Wrote the list plugin command.
This commit is contained in:
parent
50b21c21ee
commit
d922240e9a
6 changed files with 40 additions and 15 deletions
|
@ -1,5 +1,6 @@
|
|||
module Hsbot.Plugin
|
||||
( loadPlugin
|
||||
( listPlugins
|
||||
, loadPlugin
|
||||
, sendToPlugin
|
||||
, unloadPlugin
|
||||
) where
|
||||
|
@ -31,6 +32,15 @@ effectivelyLoadPlugin name entryPoint serverChan = do
|
|||
threadId <- forkIO $ entryPoint serverChan chan
|
||||
return $ Plugin name threadId chan
|
||||
|
||||
-- | Sends a list of loaded plugins
|
||||
listPlugins :: Maybe IrcMsg -> String -> IrcBot ()
|
||||
listPlugins originalRequest dest = do
|
||||
plugins <- gets botPlugins
|
||||
let listing = unwords $ M.keys plugins
|
||||
case M.lookup dest plugins of
|
||||
Just plugin -> sendToPlugin (InternalCmd $ IntCmd "ANSWER" "CORE" dest listing originalRequest) plugin
|
||||
Nothing -> return ()
|
||||
|
||||
-- | Unloads a plugin
|
||||
unloadPlugin :: String -> IrcBot ()
|
||||
unloadPlugin name = do
|
||||
|
|
Reference in a new issue