aboutsummaryrefslogtreecommitdiffstats
path: root/src/Lib.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Lib.hs')
-rw-r--r--src/Lib.hs12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/Lib.hs b/src/Lib.hs
index 63b6367..06745ba 100644
--- a/src/Lib.hs
+++ b/src/Lib.hs
@@ -33,8 +33,16 @@ connectIRC :: B.ByteString -> Int -> T.Text -> IO ()
connectIRC host port nick = do
conn <- IRC.connectWithTLS host port 1
let cfg = IRC.defaultIRCConf nick
- -- let cfg' = cfg { _eventHandlers = yourCustomEventHandlers : _eventHandlers cfg }
let cfg' = cfg {
- IRC._channels = ["#test-chan-13513"]
+ IRC._eventHandlers = handlePrivmsg : IRC._eventHandlers cfg
+ , IRC._channels = ["#test-chan-13513"]
}
IRC.start conn cfg'
+
+handlePrivmsg :: IRC.EventHandler s
+handlePrivmsg = IRC.EventHandler
+ { IRC._description = ""
+ , IRC._matchType = IRC.EPrivmsg
+ , IRC._eventFunc = \evt ->
+ IRC.send $ IRC.Privmsg "#test-chan-13513" (Right "test")
+ }