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 DSharpPlus.CommandsNext.Attributes
open Channels open Channels
open Logging
type BotCommands() = type BotCommands() =
[<Command("hi")>] [<Command("hi")>]
@ -19,10 +20,15 @@ module BotCommands =
[<Command("toggle")>] [<Command("toggle")>]
member public self.toggle(ctx:CommandContext) = member public self.toggle(ctx:CommandContext) =
log <| sprintf "!toggle from %A" ctx.Channel.Id
async { async {
toggleChannel ctx.Channel.Id toggleChannel ctx.Channel.Id
|> fun channelGotAdded -> |> fun channelGotAdded ->
match channelGotAdded with match channelGotAdded with
| true -> ctx.RespondAsync "This is now my channel :)" |> ignore | true ->
| false -> ctx.RespondAsync "This is now your channel (:" |> ignore 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 } |> Async.StartAsTask :> Task