Add EuphApi.Utils.Listing module
This commit is contained in:
parent
b72d662566
commit
7e0c5f82da
6 changed files with 127 additions and 12 deletions
|
|
@ -11,6 +11,7 @@ module EuphApi.Utils.Commands
|
|||
( Command
|
||||
, CommandName
|
||||
, runCommands
|
||||
, autorunCommands
|
||||
-- * Creating commands
|
||||
, command
|
||||
, specificCommand
|
||||
|
|
@ -50,6 +51,11 @@ runCommands :: [Command b c] -> E.Message -> E.Bot b c ()
|
|||
-- runCommands cs = mapM_ E.fork . sequence cs
|
||||
runCommands cs m = mapM_ (E.fork . ($m)) cs
|
||||
|
||||
-- | Atomatically run commands as necessary, according to the 'E.Event' given.
|
||||
autorunCommands :: [Command b c] -> E.Event -> E.Bot b c ()
|
||||
autorunCommands cs (E.SendEvent msg) = runCommands cs msg
|
||||
autorunCommands _ _ = return ()
|
||||
|
||||
withNick :: (T.Text -> a) -> E.Bot b c a
|
||||
withNick f = (f . E.sessName) <$> E.getOwnView
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue