Simplify command system
This commit is contained in:
parent
1313d22056
commit
46dc9242cf
2 changed files with 31 additions and 21 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue