Archived
1
0
Fork 0

Added plugin loading, and the most basic hook capability.

This commit is contained in:
Julien Dessaux 2011-05-01 03:11:32 +02:00
parent 7e89b50bfe
commit c497b24700
6 changed files with 68 additions and 35 deletions

View file

@ -11,13 +11,13 @@ import qualified Network.IRC as IRC
import Hsbot.Types
-- Plugin Utils
readMsg :: Plugin IO (Message)
readMsg :: Plugin (Env IO) (Message)
readMsg = gets pluginChan >>= liftIO . readChan >>= return
writeMsg :: Message -> Plugin IO ()
writeMsg :: Message -> Plugin (Env IO) ()
writeMsg msg = gets pluginMaster >>= liftIO . flip writeChan msg
answerMsg :: IRC.Message -> String -> Plugin IO ()
answerMsg :: IRC.Message -> String -> Plugin (Env IO) ()
answerMsg request msg =
case IRC.msg_params request of
sender:_ -> writeMsg . OutgoingMsg $ IRC.Message Nothing "PRIVMSG" [sender, msg]