57 lines
1.5 KiB
Forth
57 lines
1.5 KiB
Forth
open System
|
|
open System.Threading.Tasks
|
|
open DSharpPlus
|
|
open DSharpPlus.Entities
|
|
open DSharpPlus.SlashCommands
|
|
open DegenzGame
|
|
open DegenzGame.Shared
|
|
|
|
type EmptyGlobalCommandToAvoidFamousDuplicateSlashCommandsBug() = inherit ApplicationCommandModule ()
|
|
|
|
type Trainer() =
|
|
inherit ApplicationCommandModule ()
|
|
|
|
[<SlashCommand("hack", "Send a hack attack to another player")>]
|
|
member this.Attack (ctx : InteractionContext) =
|
|
async {
|
|
let! playerResult = DbService.tryFindPlayer ctx.Member.Id
|
|
return ()
|
|
} |> Async.StartAsTask
|
|
:> Task
|
|
|
|
[<SlashCommand("defend", "Create a passive defense that will last 24 hours")>]
|
|
member this.DefendCommand (ctx : InteractionContext) =
|
|
async {
|
|
let! playerResult = DbService.tryFindPlayer ctx.Member.Id
|
|
return ()
|
|
} |> Async.StartAsTask
|
|
:> Task
|
|
|
|
let config = DiscordConfiguration()
|
|
config.Token <- "OTMzMDg4MTQyNDM5ODk5MTg4.YeccDQ.AbysjlHICgbNQVyduG6aGIHNpdE"
|
|
config.TokenType <- TokenType.Bot
|
|
config.Intents <- DiscordIntents.All
|
|
//config.MinimumLogLevel <- Microsoft.Extensions.Logging.LogLevel.Trace
|
|
|
|
let client = new DiscordClient(config)
|
|
|
|
let slash = client.UseSlashCommands()
|
|
|
|
// My server
|
|
slash.RegisterCommands<Trainer>(922419263275425832uL);
|
|
// Degenz
|
|
//slash.RegisterCommands<HackerGame>(922414052708327494uL);
|
|
|
|
client.ConnectAsync ()
|
|
|> Async.AwaitTask
|
|
|> Async.RunSynchronously
|
|
|
|
Task.Delay(-1)
|
|
|> Async.AwaitTask
|
|
|> Async.RunSynchronously
|
|
|
|
client.DisconnectAsync ()
|
|
|> Async.AwaitTask
|
|
|> Async.RunSynchronously
|
|
|