Skip to content

Commands not being registered #1986

@ecrocombe

Description

@ecrocombe

Summary

Running #1908, mixed with some other updates: https://github.com/VereTech-Gaming/DSharpPlus/actions/runs/9507103601)
For some reason commands never get registered.

2024-06-14 00:32:17.548 +00:00 [ERR] Event handler exception for event INTERACTION_CREATED thrown from System.Threading.Tasks.Task ExecuteInteractionAsync(DSharpPlus.DiscordClient, DSharpPlus.EventArgs.InteractionCreateEventArgs) (defined in DSharpPlus.Commands.Processors.SlashCommands.SlashCommandProcessor)
System.NullReferenceException: Object reference not set to an instance of an object.
   at DSharpPlus.Commands.Processors.SlashCommands.SlashCommandProcessor.TryFindCommand(DiscordInteraction interaction, Command& command, IEnumerable`1& options)
   at DSharpPlus.Commands.Processors.SlashCommands.SlashCommandProcessor.ExecuteInteractionAsync(DiscordClient client, InteractionCreateEventArgs eventArgs)
   at DSharpPlus.AsyncEvents.AsyncEvent`2.<>c__DisplayClass7_0.<<InvokeAsync>b__0>d.MoveNext()

With this, the slashy never responds and user is display with "application command failed within 3 seconds".
This was thought to have been fixed by #1972


Running a backport based off #1908 with #1972 (https://github.com/VereTech-Gaming/DSharpPlus/actions/runs/9750534303)
Again, commands do not register,

2024-07-07 05:47:58.487 +00:00 [ERR] Request to {ULID}: {"message": "Invalid Form Body", "code": 50025, "errors": {"type": {"_errors: [{"code": "BASE_TYPE_CHOICES", "message": "Value must be one of {8}."}]}}}

This time however, the CommandErrored handler is invoked, and the discord user receives a reply, albeit only an error.

What version of the library are you using?

v5.0.0-nightly (make sure you are using the latest nightly!)

What .NET version are you using? Make sure to use the latest patch release for your major version.

.NET 8.0

Operating System

Ubuntu

Reproduction Steps

It was originally thought that the cause was receiving an intereaction between GDC event invocation and commands registering. Now, idk.

Trace Logs

No response

Exceptions or other error messages

No response

Anything else you'd like to share

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions