#Discord rejected API Request, entry point command...

1 messages · Page 1 of 1 (latest)

deft stratus
#

I just got this very weird error:

[2024-10-14 17:12:47 +00:00] [DSharpPlus.DiscordClient] [Info]  DSharpPlus; version 5.0.0-nightly-02383+903940e75455b4e9db15e424251d8ffb41cb4387
[2024-10-14 17:12:48 +00:00] [DSharpPlus.Net.RestClient] [Error] Request to https://discord.com/api/v10/applications/1256276568343449621/commands triggered an exception
DSharpPlus.Exceptions.BadRequestException: Bad request: BadRequest
   at DSharpPlus.Net.RestClient.ExecuteRequestAsync[TRequest](TRequest request) : Bad request: BadRequest
   at DSharpPlus.Net.RestClient.ExecuteRequestAsync[TRequest](TRequest request)
[2024-10-14 17:12:48 +00:00] [DSharpPlus.IClientErrorHandler] [Error] Event handler exception for event DSharpPlus.EventArgs.ClientStartedEventArgs thrown from System.Threading.Tasks.Task lambda_method1(System.Runtime.CompilerServices.Closure, DSharpPlus.DiscordClient, DSharpPlus.EventArgs.ClientStartedEventArgs, System.IServiceProvider) (defined in (null)):
A request was rejected by the Discord API.
lilac trailBOT
#
Automated suggestion: How to diagnose `BadRequestException`s

It's true that the BadRequestException doesn't provide that much information to the console. To get more info about what you did wrong, catch the BadRequestException yourself, and check the .JsonMessage and the .Errors properties.

deft stratus
#
  Errors: (null)
  Message: You cannot remove this app's Entry Point command in a bulk update operation. Please include the Entry Point command in your update request or delete it separately.
  Stack trace:    at DSharpPlus.Net.RestClient.ExecuteRequestAsync[TRequest](TRequest request)
   at DSharpPlus.Net.DiscordApiClient.BulkOverwriteGlobalApplicationCommandsAsync(UInt64 applicationId, IEnumerable`1 commands)
   at DSharpPlus.DiscordClient.BulkOverwriteGlobalApplicationCommandsAsync(IEnumerable`1 commands)
   at DSharpPlus.Commands.Processors.SlashCommands.SlashCommandProcessor.RegisterSlashCommandsAsync(CommandsExtension extension)
   at DSharpPlus.Commands.Processors.SlashCommands.SlashCommandProcessor.ConfigureAsync(CommandsExtension extension)
   at DSharpPlus.Commands.CommandsExtension.RefreshAsync()
   at DSharpPlus.Commands.RefreshEventHandler.HandleEventAsync(DiscordClient sender, ClientStartedEventArgs eventArgs)
   at DSharpPlus.Clients.DefaultEventDispatcher.<>c__DisplayClass5_0`1.<<DispatchAsync>b__0>d.MoveNext()
#

The code for registering the commands (which I suspect is the traitor is)

 builder = DiscordClientBuilder.CreateDefault(token, DiscordIntents.All);
// Some other code for building

     builder.UseCommands((IServiceProvider serviceProvider, CommandsExtension extension) =>
     {
         extension.AddCommands(
             [typeof(Commands.ManagementCommands),
             typeof(Commands.IntercomCommands),
             typeof(Commands.MinigamesCommands),
             typeof(Commands.TicketCommands),
             typeof(Commands.ScanCommands),
             typeof(Commands.UserFunCommands),
             typeof(Commands.LevelCommands)]);


         TextCommandProcessor textCommandProcessor = new(new()
         {
             PrefixResolver = new DefaultPrefixResolver(false, "c!", "c?", "cara?", "cara!").ResolvePrefixAsync
         });

         extension.AddProcessor(textCommandProcessor);
     }
     );
#

I updated to the latest nightly today, maybe thats the problem?
I changed the code so it fits the scheme in the docs

wanton fractal
#

it almost certainly is not the traitor

deft stratus
#

maybe, I also always get

"This command is not registered, ignoring interaction"

wanton fractal
#

this isn't a documented error, so this screams Discord™️ Incident™️

deft stratus
#

Just for reference

wanton fractal
#

that would happen if registration fails, yes

deft stratus
deft stratus
wanton fractal
#

you should wait for the person who can inquire about this (velvet) to show up

deft stratus
#

waiting for velvet
play elevator music...

high veldt
#

h