Added command registering and dispatching for plugins.
This commit is contained in:
parent
d2f40f6481
commit
cf68de02be
6 changed files with 79 additions and 16 deletions
Hsbot
|
@ -7,6 +7,7 @@ import Control.Concurrent.Chan
|
|||
import Control.Monad.State
|
||||
import qualified Data.Map as M
|
||||
|
||||
import Hsbot.Command
|
||||
import Hsbot.IRCParser
|
||||
import Hsbot.Plugin
|
||||
import Hsbot.Types
|
||||
|
@ -30,12 +31,13 @@ runServer = do
|
|||
let input = readChan chan
|
||||
msg <- liftIO input
|
||||
case msg of
|
||||
InputMsg inputMsg ->
|
||||
InputMsg inputMsg -> do
|
||||
dispatchCommand $ InputMsg inputMsg
|
||||
mapM_ (sendToPlugin (InputMsg inputMsg) . snd) (M.toList plugins)
|
||||
OutputMsg outputMsg ->
|
||||
sendstr (serializeIrcMsg outputMsg)
|
||||
InternalCmd internalCmd ->
|
||||
traceM "TODO"
|
||||
InternalCmd _ ->
|
||||
traceM "TODO internal command"
|
||||
runServer
|
||||
|
||||
-- | Joins a chan
|
||||
|
|
Reference in a new issue