aboutsummaryrefslogtreecommitdiffstats
path: root/src/Lib.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Lib.hs')
-rw-r--r--src/Lib.hs41
1 files changed, 29 insertions, 12 deletions
diff --git a/src/Lib.hs b/src/Lib.hs
index a6ea8c0..38fc283 100644
--- a/src/Lib.hs
+++ b/src/Lib.hs
@@ -1,23 +1,40 @@
+{-# LANGUAGE OverloadedStrings #-}
+
module Lib
( someFunc
) where
+import qualified Data.ByteString as B
+import qualified Data.Text as T
+
import Database.SQLite.Simple
+import Network.IRC.Client
import Message
import Plugin
someFunc :: IO ()
someFunc = do
- let message = Message
- { text = "75ac7b18a009ffe7a77a17a61d95c01395f36b44"
- , channel = "#a-channel"
- , nick = "anon"
- }
- Just plugin = matchPlugin message
- dbConn <- open "db/sorbot_development.sqlite3"
- response <- performPlugin plugin message dbConn
- putStrLn $ case response of
- Left e -> e
- Right r -> r
- close dbConn
+ connectIRC "irc.freenode.net" 6697 "test-bot-7890asdf"
+ -- let message = Message
+ -- { text = "75ac7b18a009ffe7a77a17a61d95c01395f36b44"
+ -- , channel = "#a-channel"
+ -- , nick = "anon"
+ -- }
+ -- Just plugin = matchPlugin message
+ -- dbConn <- open "db/sorbot_development.sqlite3"
+ -- response <- performPlugin plugin message dbConn
+ -- putStrLn $ case response of
+ -- Left e -> e
+ -- Right r -> r
+ -- close dbConn
+
+connectIRC :: B.ByteString -> Int -> T.Text -> IO ()
+connectIRC host port nick = do
+ conn <- connectWithTLS host port 1
+ let cfg = defaultIRCConf nick
+ -- let cfg' = cfg { _eventHandlers = yourCustomEventHandlers : _eventHandlers cfg }
+ let cfg' = cfg {
+ _channels = ["#test-chan-13513"]
+ }
+ start conn cfg'