Added plugin loading, and the most basic hook capability.
This commit is contained in:
parent
7e89b50bfe
commit
c497b24700
6 changed files with 68 additions and 35 deletions
|
@ -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]
|
||||
|
|
Reference in a new issue