I've written this super simple command:```cs
using DSharpPlus.Commands;
public class TestCommand
{
[Command("test")]
public static async Task ExecuteAsync(CommandContext context)
{
Console.WriteLine("Test command ran");
// Flick back a message
await context.RespondAsync("Hello, world!");
}
}
but when I start my bot and reload my Discord client the command won't show up in the command list. I've added my server as a debug guild so it should be updating pretty quick. Here is all of the code that actually gets the bot up and running:cs
// Make the Discord client (bot)
DiscordClientBuilder clientBuilder = DiscordClientBuilder.CreateDefault(config.Token, DiscordIntents.All);
DiscordClient client = clientBuilder.Build();
// Say that we're using commands or something
CommandsExtension commandsExtension = client.UseCommands(new CommandsConfiguration()
{
DebugGuildId = config.DebugGuildId
});
// Register all the commands automatically
commandsExtension.AddCommands(typeof(Program).Assembly);
// Start the bot, then make the current thread run forever
// so that the bot doesn't kill itself immediately
await client.ConnectAsync();
await Task.Delay(-1);
When I run the bot then I get this output:
[2024-06-17 10:26:36 +00:00] [DSharpPlus.DiscordClient] [Info] DSharpPlus, version 5.0.0-nightly-02287+c23b6d2211786ec8c6b830adf8e1956eddb4fa5e
[2024-06-17 10:26:39 +00:00] [DSharpPlus.Commands.Processors.BaseCommandProcessor] [Info] Registered 1 top-level slash commands, 1 total slash commands.