From 55379e1e8149a7ba392e1e0da08c326823eec2f3 Mon Sep 17 00:00:00 2001 From: Sebastian Crane Date: Sun, 27 Feb 2022 21:52:07 +0000 Subject: [PATCH] Add support for sending multi-line IRC messages Signed-off-by: Sebastian Crane --- src/irc.clj | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/irc.clj b/src/irc.clj index 5275ab2..0036ca9 100644 --- a/src/irc.clj +++ b/src/irc.clj @@ -2,15 +2,16 @@ ;; SPDX-FileCopyrightText: 2022 Sebastian Crane (ns irc - (:require [bot :refer :all] + (:require [clojure.string :as str] + [bot :refer :all] [irclj.core])) (defn irc-callback [state config connection type & m] (let [{:keys [channel]} (:irc config) {:keys [nick text target]} type] - (irclj.core/message connection channel - (when (= target channel) - (dispatch-command state nick text))))) + (when (= target channel) + (doseq [line (str/split-lines (dispatch-command state nick text))] + (irclj.core/message connection channel line))))) (defn new-irc-connection [state config] (let [{:keys [server port name nick channel]} (:irc config)]