AnsonBot/AnsonBot.Bot/DiscordService.cs

34 lines
1 KiB
C#
Raw Permalink Normal View History

2026-07-30 19:47:39 +00:00
using Discord;
using Discord.WebSocket;
using System;
using System.Collections.Generic;
using System.Text;
namespace AnsonBot.Bot;
internal class DiscordService
{
private readonly DiscordSocketClient _client;
public DiscordService(DiscordSocketClient client)
{
_client = client;
}
public async Task ClientReady()
{
await _client.SetActivityAsync(new Game("Awaiting commands"));
SlashCommandBuilder globalCommand = new();
globalCommand.WithName("palworld-status").WithDescription("Check the status of the Palworld server");
globalCommand.WithName("palworld-players").WithDescription("Check who is on the Palworld server");
await _client.CreateGlobalApplicationCommandAsync(globalCommand.Build());
}
public async Task SlashHandler(SocketSlashCommand command)
{
switch (command.Data.Name)
{
case "palworld-status":
await command.RespondAsync("Palworld status command received");
break;
}
}
}