Change how the example bot handles state
This commit is contained in:
parent
15cd6724d2
commit
d2d07eb15a
2 changed files with 22 additions and 20 deletions
|
|
@ -32,10 +32,11 @@ runCommands (c:cs) msg = do
|
|||
-- 'nextEvent':
|
||||
--
|
||||
-- > event <- respondingToCommands commands nextEvent
|
||||
respondingToCommands :: [Command e] -> Client e Event -> Client e Event
|
||||
respondingToCommands cmds holdingEvent = do
|
||||
event <- holdingEvent
|
||||
respondingToCommands :: Client e Event -> Client e [Command e] -> Client e Event
|
||||
respondingToCommands getEvent getCommands = do
|
||||
event <- getEvent
|
||||
commands <- getCommands
|
||||
case event of
|
||||
EventSend e -> void $ runCommands cmds $ sendMessage e
|
||||
EventSend e -> void $ runCommands commands $ sendMessage e
|
||||
_ -> pure ()
|
||||
pure event
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue