oysteikt/wiki-math-bot
oysteikt
/
wiki-math-bot
Archived
1
0
Fork 0

Add logger to toggle command

This commit is contained in:
Oystein Kristoffer Tveit 2021-03-28 01:11:55 +01:00
parent 30500e18d9
commit 73938e0bad
1 changed files with 8 additions and 2 deletions

View File

@ -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