Add the IrcMsg as an optional parameter for an internal command.
This commit is contained in:
parent
455b18bc10
commit
8551832bd2
4 changed files with 7 additions and 7 deletions
|
@ -56,7 +56,7 @@ dispatchMessage (InputMsg inputMsg) = do
|
||||||
, (head getMsgContent) == (commandPrefix config) ]
|
, (head getMsgContent) == (commandPrefix config) ]
|
||||||
sendRunCommand :: String -> Plugin -> IrcBot ()
|
sendRunCommand :: String -> Plugin -> IrcBot ()
|
||||||
sendRunCommand cmd plugin = do
|
sendRunCommand cmd plugin = do
|
||||||
sendToPlugin (InternalCmd $ IntCmd "RUN" "CORE" (pluginName plugin) cmd) plugin
|
sendToPlugin (InternalCmd $ IntCmd "RUN" "CORE" (pluginName plugin) cmd (Just inputMsg)) plugin
|
||||||
getMsgContent :: String
|
getMsgContent :: String
|
||||||
getMsgContent = unwords . tail $ parameters inputMsg
|
getMsgContent = unwords . tail $ parameters inputMsg
|
||||||
dispatchMessage _ = return ()
|
dispatchMessage _ = return ()
|
||||||
|
|
|
@ -28,7 +28,7 @@ sendCommand :: String -> String -> String -> IrcPlugin ()
|
||||||
sendCommand cmd to params = do
|
sendCommand cmd to params = do
|
||||||
serverChan <- gets instanceServerChan
|
serverChan <- gets instanceServerChan
|
||||||
from <- gets instanceName
|
from <- gets instanceName
|
||||||
liftIO $ writeChan serverChan $ InternalCmd $ IntCmd cmd from to params
|
liftIO $ writeChan serverChan $ InternalCmd $ IntCmd cmd from to params Nothing
|
||||||
|
|
||||||
sendRegisterCommand :: String -> IrcPlugin ()
|
sendRegisterCommand :: String -> IrcPlugin ()
|
||||||
sendRegisterCommand cmd = sendCommand "REGISTER" "CORE" cmd
|
sendRegisterCommand cmd = sendCommand "REGISTER" "CORE" cmd
|
||||||
|
|
|
@ -90,10 +90,11 @@ data IrcMsg = IrcMsg
|
||||||
|
|
||||||
-- | An internal command
|
-- | An internal command
|
||||||
data IntCmd = IntCmd
|
data IntCmd = IntCmd
|
||||||
{ intCmdCmd :: String -- the internal command
|
{ intCmdCmd :: String -- the internal command
|
||||||
, intCmdFrom :: String -- who issues it
|
, intCmdFrom :: String -- who issues it
|
||||||
, intCmdTo :: String -- who it is destinated to
|
, intCmdTo :: String -- who it is destinated to
|
||||||
, intCmdMsg :: String -- the IrcMsg associated with the command
|
, intCmdMsg :: String -- the message to be transfered
|
||||||
|
, intCmdBotMsg :: Maybe IrcMsg -- An IrcMsg attached to the command
|
||||||
} deriving (Show)
|
} deriving (Show)
|
||||||
|
|
||||||
data BotMsg = InputMsg IrcMsg | OutputMsg IrcMsg | InternalCmd IntCmd deriving (Show)
|
data BotMsg = InputMsg IrcMsg | OutputMsg IrcMsg | InternalCmd IntCmd deriving (Show)
|
||||||
|
|
1
TODO
1
TODO
|
@ -1,6 +1,5 @@
|
||||||
:julien!~julien@ogu21.corp PRIVMSG #shbot :@quote graou snif
|
:julien!~julien@ogu21.corp PRIVMSG #shbot :@quote graou snif
|
||||||
|
|
||||||
* Add the IrcMsg as an optional parameter for an internal command
|
|
||||||
* Solve the catching that never happen in main
|
* Solve the catching that never happen in main
|
||||||
* throwto exception to main thread
|
* throwto exception to main thread
|
||||||
* write a safe reload : try reload before unloading
|
* write a safe reload : try reload before unloading
|
||||||
|
|
Reference in a new issue