Simplify command system

This commit is contained in:
Joscha 2020-04-09 19:15:39 +00:00
parent 1313d22056
commit 46dc9242cf
2 changed files with 31 additions and 21 deletions

View file

@ -50,15 +50,15 @@ exampleBot mPasswd = do
botMain :: MVar BotState -> Client T.Text ()
botMain stateVar = forever $ do
event <- respondingToCommands (getCommands stateVar) $
event <- respondingToCommand (getCommand stateVar) $
respondingToPing nextEvent
updateFromEventVia botListing stateVar event
getCommands :: MVar BotState -> Client e [Command T.Text]
getCommands stateVar = do
getCommand :: MVar BotState -> Client e (Command T.Text)
getCommand stateVar = do
state <- liftIO $ readMVar stateVar
let name = state ^. botListing . lsSelfL . svNickL
pure
pure $ cmdSequential
[ botrulezPingGeneral
, botrulezPingSpecific name
, botrulezHelpSpecific name