28 lines
920 B
Forth
28 lines
920 B
Forth
|
namespace Bot
|
||
|
|
||
|
module BotCommands =
|
||
|
|
||
|
open System.Threading.Tasks
|
||
|
open DSharpPlus.CommandsNext
|
||
|
open DSharpPlus.CommandsNext.Attributes
|
||
|
|
||
|
open Channels
|
||
|
|
||
|
type BotCommands() =
|
||
|
[<Command("hi")>]
|
||
|
member public self.hi(ctx:CommandContext) =
|
||
|
async { ctx.RespondAsync "Hi there" |> ignore } |> Async.StartAsTask :> Task
|
||
|
|
||
|
[<Command("echo")>]
|
||
|
member public self.echo(ctx:CommandContext) (message:string) =
|
||
|
async { ctx.RespondAsync message |> ignore } |> Async.StartAsTask :> Task
|
||
|
|
||
|
[<Command("toggle")>]
|
||
|
member public self.toggle(ctx:CommandContext) =
|
||
|
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
|
||
|
} |> Async.StartAsTask :> Task
|