forked from LibreGaming/matchbot
Add support for sending multi-line IRC messages
Signed-off-by: Sebastian Crane <seabass-labrax@gmx.com>
This commit is contained in:
parent
2f27cb8a86
commit
55379e1e81
|
@ -2,15 +2,16 @@
|
||||||
;; SPDX-FileCopyrightText: 2022 Sebastian Crane <seabass-labrax@gmx.com>
|
;; SPDX-FileCopyrightText: 2022 Sebastian Crane <seabass-labrax@gmx.com>
|
||||||
|
|
||||||
(ns irc
|
(ns irc
|
||||||
(:require [bot :refer :all]
|
(:require [clojure.string :as str]
|
||||||
|
[bot :refer :all]
|
||||||
[irclj.core]))
|
[irclj.core]))
|
||||||
|
|
||||||
(defn irc-callback [state config connection type & m]
|
(defn irc-callback [state config connection type & m]
|
||||||
(let [{:keys [channel]} (:irc config)
|
(let [{:keys [channel]} (:irc config)
|
||||||
{:keys [nick text target]} type]
|
{:keys [nick text target]} type]
|
||||||
(irclj.core/message connection channel
|
(when (= target channel)
|
||||||
(when (= target channel)
|
(doseq [line (str/split-lines (dispatch-command state nick text))]
|
||||||
(dispatch-command state nick text)))))
|
(irclj.core/message connection channel line)))))
|
||||||
|
|
||||||
(defn new-irc-connection [state config]
|
(defn new-irc-connection [state config]
|
||||||
(let [{:keys [server port name nick channel]} (:irc config)]
|
(let [{:keys [server port name nick channel]} (:irc config)]
|
||||||
|
|
Loading…
Reference in New Issue