Use bot nick in help commands
This commit is contained in:
parent
f6f4bfac35
commit
f7b012259c
2 changed files with 15 additions and 9 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -23,12 +23,12 @@ myCommands :: [Command]
|
|||
myCommands =
|
||||
[ E.pingCommand "Pong!"
|
||||
, E.generalPingCommand "Pong!"
|
||||
, E.helpCommand "Some specific placeholder help"
|
||||
, E.generalHelpCommand "I help test @Garmy's EuphApi"
|
||||
, E.helpCommand (\n -> "Some specific placeholder help for " <> E.atMention n <> ".")
|
||||
, E.generalHelpCommand (const "I help test @Garmy's EuphApi.")
|
||||
, E.uptimeCommand
|
||||
, E.generalUptimeCommand -- most bots don't do this
|
||||
, E.killCommand "Bye!"
|
||||
, E.restartCommand "brb"
|
||||
, E.restartCommand "brb."
|
||||
]
|
||||
|
||||
myBotHandler :: E.EventType -> Bot ()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue