aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/IRC.hs12
-rw-r--r--src/Lib.hs12
-rw-r--r--src/Plugin/Base.hs2
3 files changed, 0 insertions, 26 deletions
diff --git a/src/IRC.hs b/src/IRC.hs
index bb153d2..427fac7 100644
--- a/src/IRC.hs
+++ b/src/IRC.hs
@@ -31,24 +31,18 @@ handlePrivmsg = IRC.EventHandler
}
where
dispatchEvent (IRC.Event _ (IRC.User nick) (IRC.Privmsg _ (Right msg))) = do
- -- IRC.send $ IRC.Privmsg nick (Right "test")
let message = Message
{ text = T.unpack msg
, channel = T.unpack nick
, nick = T.unpack nick
}
Just plugin = matchPlugin message
- -- rsp =<< performPlugin plugin message
- -- IRC.send case performPlugin plugin message of
- -- Left err -> IRC.Privmsg nick (Right (T.pack err))
- -- Right r -> IRC.Privmsg nick (Right (T.pack r))
response <- liftIO $ performPlugin plugin message
IRC.send $ case response of
Left err -> IRC.Privmsg nick (Right (T.pack err))
Right r -> IRC.Privmsg nick (Right (T.pack r))
dispatchEvent (IRC.Event
_ (IRC.Channel chan nick) (IRC.Privmsg _ (Right msg))) = do
- -- IRC.send $ IRC.Privmsg chan (Right "test")
let message = Message
{ text = T.unpack msg
, channel = T.unpack chan
@@ -59,9 +53,3 @@ handlePrivmsg = IRC.EventHandler
IRC.send $ case response of
Left err -> IRC.Privmsg chan (Right (T.pack err))
Right r -> IRC.Privmsg chan (Right (T.pack r))
-
- -- let Just plugin = matchPlugin message
- -- response <- performPlugin plugin message
- -- putStrLn $ case response of
- -- Left e -> e
- -- Right r -> r
diff --git a/src/Lib.hs b/src/Lib.hs
index b23bf78..5ae6f9b 100644
--- a/src/Lib.hs
+++ b/src/Lib.hs
@@ -13,15 +13,3 @@ import Plugin
someFunc :: IO ()
someFunc = do
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
- -- putStrLn $ case response of
- -- Left e -> e
- -- Right r -> r
- -- close dbConn
diff --git a/src/Plugin/Base.hs b/src/Plugin/Base.hs
index 4e63fdd..6ba4ca5 100644
--- a/src/Plugin/Base.hs
+++ b/src/Plugin/Base.hs
@@ -8,8 +8,6 @@ import Database.SQLite.Simple
import Message
--- TODO: Replace Connection with a type class
--- type PluginAction = Message -> Connection -> IO (Either String String)
type PluginAction = Message -> IO (Either String String)
data Plugin = Plugin