Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Øystein Kristoffer Tveit
WikiMathBot
Commits
73938e0b
Commit
73938e0b
authored
Mar 28, 2021
by
Øystein Kristoffer Tveit
💻
Browse files
Add logger to toggle command
parent
30500e18
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/Bot/BotCommands.fs
View file @
73938e0b
...
...
@@ -7,6 +7,7 @@ module BotCommands =
open
DSharpPlus
.
CommandsNext
.
Attributes
open
Channels
open
Logging
type
BotCommands
()
=
[<
Command
(
"hi"
)>]
...
...
@@ -19,10 +20,15 @@ module BotCommands =
[<
Command
(
"toggle"
)>]
member
public
self
.
toggle
(
ctx
:
CommandContext
)
=
log
<|
sprintf
"!toggle from %A"
ctx
.
Channel
.
Id
async
{
toggleChannel
ctx
.
Channel
.
Id
|>
fun
channelGotAdded
->
match
channelGotAdded
with
|
true
->
ctx
.
RespondAsync
"This is now my channel :)"
|>
ignore
|
false
->
ctx
.
RespondAsync
"This is now your channel (:"
|>
ignore
|
true
->
log
<|
sprintf
"Added %A to list of channels "
ctx
.
Channel
.
Id
ctx
.
RespondAsync
"This is now my channel :)"
|>
ignore
|
false
->
log
<|
sprintf
"Removed %A from list of channels "
ctx
.
Channel
.
Id
ctx
.
RespondAsync
"This is now your channel (:"
|>
ignore
}
|>
Async
.
StartAsTask
:>
Task
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment