Make ping command customizable
This commit is contained in:
parent
c12d278ee1
commit
02487f0d60
2 changed files with 11 additions and 10 deletions
|
|
@ -20,13 +20,13 @@ import qualified EuphApi.Bot as B
|
||||||
import qualified EuphApi.Types as E
|
import qualified EuphApi.Types as E
|
||||||
import qualified EuphApi.Utils as E
|
import qualified EuphApi.Utils as E
|
||||||
|
|
||||||
pingCommand :: E.Command b c
|
pingCommand :: T.Text -> E.Command b c
|
||||||
pingCommand = E.specificCommand "ping" $ \msg ->
|
pingCommand pingText = E.specificCommand "ping" $ \msg ->
|
||||||
void $ B.reply (E.msgID msg) "Pong!"
|
void $ B.reply (E.msgID msg) pingText
|
||||||
|
|
||||||
generalPingCommand :: E.Command b c
|
generalPingCommand :: T.Text -> E.Command b c
|
||||||
generalPingCommand = E.command "ping" $ \msg ->
|
generalPingCommand pingText = E.command "ping" $ \msg ->
|
||||||
void $ B.reply (E.msgID msg) "Pong!"
|
void $ B.reply (E.msgID msg) pingText
|
||||||
|
|
||||||
helpCommand :: T.Text -> E.Command b c
|
helpCommand :: T.Text -> E.Command b c
|
||||||
helpCommand helpText = E.specificCommand "help" $ \msg ->
|
helpCommand helpText = E.specificCommand "help" $ \msg ->
|
||||||
|
|
|
||||||
|
|
@ -17,15 +17,16 @@ import qualified EuphApi.Utils.Botrulez as E
|
||||||
|
|
||||||
myCommands :: [E.Command b c]
|
myCommands :: [E.Command b c]
|
||||||
myCommands =
|
myCommands =
|
||||||
[ E.pingCommand
|
[ E.pingCommand "Pong!"
|
||||||
, E.generalPingCommand
|
, E.generalPingCommand "Pong!"
|
||||||
, E.helpCommand "Some specific placeholder help"
|
, E.helpCommand "Some specific placeholder help"
|
||||||
, E.generalHelpCommand "I help test @Garmy's EuphApi"
|
, E.generalHelpCommand "I help test @Garmy's EuphApi"
|
||||||
, E.uptimeCommand
|
, E.uptimeCommand
|
||||||
, E.generalUptimeCommand
|
, E.generalUptimeCommand -- most bots don't do this
|
||||||
, E.command "whatsmynick" (\msg -> do
|
, E.command "whatsmynick" (\msg -> do
|
||||||
nick <- E.sessName <$> B.getOwnView
|
nick <- E.sessName <$> B.getOwnView
|
||||||
let content = nick <> "\n" <> E.mention nick <> "\n" <> E.atMention nick <> "\n" <> E.mentionReduce nick
|
let content = nick <> "\n" <> E.mention nick <> "\n" <> E.atMention nick
|
||||||
|
<> "\n" <> E.mentionReduce nick
|
||||||
void $ B.reply (E.msgID msg) content
|
void $ B.reply (E.msgID msg) content
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue