#Slash commands aren't updating

1 messages · Page 1 of 1 (latest)

graceful sapphire
#

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.

onyx zinc
#

Set debug guild ID to 0. For some reason guild specific commands don't register and you need to have them globally.

#

I sense it's a discord issue...

zealous lynx
onyx zinc
#

Well considering the commands don't show up on desktop app, freshly opened web version, PTB, canary or even on mobile, pretty sure a reload wont fix this

#

meanwhile if you don't set a debug guild or set it to 0, the commands show up properly

zealous lynx
#

interesting

#

does it work when you specify a guild id in AddCommands?

#

Oh and also global commands should be as quick as guild specific ones

onyx zinc
#

pretty sure guild specific command intention is to have a test bot that has them only on a test server not somewhere else

zealous lynx
#

then its our issue

onyx zinc
#

ah but at least TIL that can pass guild id's through add commands, so sort of a solution i guess

zealous lynx
#

yeah its also possible to have cmds for server x only and some other for server y only

zealous lynx
onyx zinc
#

sure

#

let me just remember how tf to do that 😄
Every time i forget

gritty wingBOT
#

🏷 use pr artifacts:

To run the library off a pull request, you will need a GitHub account. Navigate to the pull request you want to use and click on the green check mark next to the latest commit: https://cdn.discordapp.com/attachments/379379415475552276/1075485948281888788/image.png

Then, go to "Details" and scroll all the way down to "Artifacts". Download the zip file and extract it into a folder of your choice.

Now, you need to add the packages to your project.

Using CLI:

Run dotnet add package <package-name> --source "path/to/your/package/folder"

Using Visual Studio:

Add your local folder as a package source in this dialog, reached through the little gear icon in your NuGet dialogue, see https://cdn.discordapp.com/attachments/959804202744422453/962070642432311366/unknown.png and https://cdn.discordapp.com/attachments/959804202744422453/962070737148051536/unknown.png. You'll want to click the plus icon to create a new package source, then enter your folder name at "Source".

Using your .csproj file:

(do not.)
Add <RestoreAdditionalPackageSources>path/to/your/package/folder</RestoreAdditionalPackageSources> to your head PropertyGroup.

In the latter two cases, you should then be able to update D#+ to the pull request build through your NuGet dialogue.

zealous lynx
#

give me a sec to open the pr

#

##1965

smoky heartBOT
onyx zinc
#

i think that fixed it

zealous lynx
#

merged and present in newest nightly

graceful sapphire
onyx zinc
zealous lynx
#

if you update to newest nightly it should work again

graceful sapphire
#

ok I'll do that now

potent prism
#

I have that same problem. The command appears in the integration section, but it does not appear in the message writing section. It does not update. The deleted command still continues to appear. When I set the guild ID to 0, I get an error like this. Can you help me?

#

@onyx zinc

onyx zinc
#

doesn't look like the same issue at all.

#

need more context to understand whats going wrong

potent prism
#

main problem is "slash command update". When i create a new command Discord is not updated.

potent prism
#

like this

onyx zinc
#

why do you blukoverwrite?

potent prism
onyx zinc
#

oh is this old extension?

#

DSharpPlus.SlashCommands or DSharpPlus.Commands?

potent prism
#

DSharpPlus.SlashCommands

#

is that old

onyx zinc
#

sort of yeah. Should use DSharpPlus.Commands

potent prism
#

i'll use 4.4.9 the version is this last version

onyx zinc
#

Oh i use nightly versions so idk about "stable"