Use bot nick in help commands

This commit is contained in:
Joscha 2018-02-25 21:09:47 +00:00
parent f6f4bfac35
commit f7b012259c
2 changed files with 15 additions and 9 deletions

View file

@ -45,21 +45,27 @@ generalPingCommand pingText = E.command "ping" $ \msg ->
-- | Specific help command: @!help \@botname@
--
-- The function passed as the first argument receives the bot's current nick as argument.
--
-- Bots should reply with a detailed help message.
--
-- Bots __should implement__ this command.
helpCommand :: T.Text -> E.Command b c
helpCommand helpText = E.specificCommand "help" $ \msg ->
void $ E.reply (E.msgID msg) helpText
helpCommand :: (T.Text -> T.Text) -> E.Command b c
helpCommand f = E.specificCommand "help" $ \msg -> do
s <- E.sessName <$> E.getOwnView
void $ E.reply (E.msgID msg) (f s)
-- | General version of 'helpCommand': @!help@
--
-- The function passed as the first argument receives the bot's current nick as argument.
--
-- Bots should reply with a short description of their function.
--
-- Bots __may implement__ this command.
generalHelpCommand :: T.Text -> E.Command b c
generalHelpCommand helpText = E.command "help" $ \msg ->
void $ E.reply (E.msgID msg) helpText
generalHelpCommand :: (T.Text -> T.Text) -> E.Command b c
generalHelpCommand f = E.command "help" $ \msg -> do
s <- E.sessName <$> E.getOwnView
void $ E.reply (E.msgID msg) (f s)
uptime :: E.Message -> E.Bot b c ()
uptime msg = do