diff options
Diffstat (limited to 'src/Lib.hs')
-rw-r--r-- | src/Lib.hs | 12 |
1 files changed, 10 insertions, 2 deletions
@@ -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") + } |