56 lines
1.8 KiB
Forth
56 lines
1.8 KiB
Forth
open System.Threading.Tasks
|
|
open DSharpPlus
|
|
open DSharpPlus.Entities
|
|
open DSharpPlus.SlashCommands
|
|
open Emzi0767.Utilities
|
|
open DegenzGame
|
|
open DegenzGame.Commands
|
|
|
|
type EmptyGlobalCommandToAvoidFamousDuplicateSlashCommandsBug() = inherit ApplicationCommandModule ()
|
|
|
|
type HackerGame() =
|
|
inherit ApplicationCommandModule ()
|
|
|
|
[<SlashCommand("hack", "Send a hack attack to another player")>]
|
|
member this.AttackCommand (ctx : InteractionContext, [<Option("target", "The player you want to hack")>] target : DiscordUser) =
|
|
Commands.attack ctx target
|
|
|
|
[<SlashCommand("defend", "Create a passive defense that will last a certain amount of time")>]
|
|
member this.DefendCommand (ctx : InteractionContext) = Commands.defend ctx
|
|
|
|
[<SlashCommand("status", "Get your current status like bank account, and active hacks and defenses")>]
|
|
member this.Status (ctx : InteractionContext) = Commands.status ctx
|
|
|
|
[<SlashCommand("leaderboard", "View the current list of players ranked by highest earnings")>]
|
|
member this.Leaderboard (ctx : InteractionContext) = Commands.leaderboard ctx
|
|
|
|
let config = DiscordConfiguration()
|
|
config.Token <- "OTIyNDIyMDIyMTI1MDEwOTU1.YcBOcw.JxfW1CSIwEO7j6RbRFCnPZ-HoTk"
|
|
config.TokenType <- TokenType.Bot
|
|
config.Intents <- DiscordIntents.All
|
|
//config.MinimumLogLevel <- Microsoft.Extensions.Logging.LogLevel.Trace
|
|
|
|
let client = new DiscordClient(config)
|
|
|
|
client.add_ComponentInteractionCreated(AsyncEventHandler(handleButtonEvent))
|
|
|
|
let slash = client.UseSlashCommands()
|
|
|
|
// My server
|
|
slash.RegisterCommands<HackerGame>(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
|
|
|