34 lines
1 KiB
C#
34 lines
1 KiB
C#
|
|
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;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|