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@
|
-- | 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 reply with a detailed help message.
|
||||||
--
|
--
|
||||||
-- Bots __should implement__ this command.
|
-- Bots __should implement__ this command.
|
||||||
helpCommand :: T.Text -> E.Command b c
|
helpCommand :: (T.Text -> T.Text) -> E.Command b c
|
||||||
helpCommand helpText = E.specificCommand "help" $ \msg ->
|
helpCommand f = E.specificCommand "help" $ \msg -> do
|
||||||
void $ E.reply (E.msgID msg) helpText
|
s <- E.sessName <$> E.getOwnView
|
||||||
|
void $ E.reply (E.msgID msg) (f s)
|
||||||
|
|
||||||
-- | General version of 'helpCommand': @!help@
|
-- | 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 should reply with a short description of their function.
|
||||||
--
|
--
|
||||||
-- Bots __may implement__ this command.
|
-- Bots __may implement__ this command.
|
||||||
generalHelpCommand :: T.Text -> E.Command b c
|
generalHelpCommand :: (T.Text -> T.Text) -> E.Command b c
|
||||||
generalHelpCommand helpText = E.command "help" $ \msg ->
|
generalHelpCommand f = E.command "help" $ \msg -> do
|
||||||
void $ E.reply (E.msgID msg) helpText
|
s <- E.sessName <$> E.getOwnView
|
||||||
|
void $ E.reply (E.msgID msg) (f s)
|
||||||
|
|
||||||
uptime :: E.Message -> E.Bot b c ()
|
uptime :: E.Message -> E.Bot b c ()
|
||||||
uptime msg = do
|
uptime msg = do
|
||||||
|
|
|
||||||
|
|
@ -23,12 +23,12 @@ myCommands :: [Command]
|
||||||
myCommands =
|
myCommands =
|
||||||
[ E.pingCommand "Pong!"
|
[ E.pingCommand "Pong!"
|
||||||
, E.generalPingCommand "Pong!"
|
, E.generalPingCommand "Pong!"
|
||||||
, E.helpCommand "Some specific placeholder help"
|
, E.helpCommand (\n -> "Some specific placeholder help for " <> E.atMention n <> ".")
|
||||||
, E.generalHelpCommand "I help test @Garmy's EuphApi"
|
, E.generalHelpCommand (const "I help test @Garmy's EuphApi.")
|
||||||
, E.uptimeCommand
|
, E.uptimeCommand
|
||||||
, E.generalUptimeCommand -- most bots don't do this
|
, E.generalUptimeCommand -- most bots don't do this
|
||||||
, E.killCommand "Bye!"
|
, E.killCommand "Bye!"
|
||||||
, E.restartCommand "brb"
|
, E.restartCommand "brb."
|
||||||
]
|
]
|
||||||
|
|
||||||
myBotHandler :: E.EventType -> Bot ()
|
myBotHandler :: E.EventType -> Bot ()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue