Skip to content

Command failed to register properly when using InteractionLocalizer #2056

@Lounek09

Description

@Lounek09

Summary

When we register a locale for DiscordLocale.en_US that difer from the default name set in the CommandAttribute the command will fail to register internally. On the Discord side, it's seems good.

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

Windows 11

Reproduction Steps

public sealed class TestCommandModule
{
    [Command("test"), Description("[Owner] Command to test random stuff")]
    [InteractionLocalizer<TestInteractionLocalizer>]
    [SlashCommandTypes(DiscordApplicationCommandType.SlashCommand)]
    [InteractionInstallType(DiscordApplicationIntegrationType.GuildInstall)]
    [InteractionAllowedContexts(DiscordInteractionContextType.Guild)]
    [RequireApplicationOwner]
    public static async Task ExecuteAsync(SlashCommandContext ctx)
    {
        await ctx.RespondAsync(ctx.Interaction.Locale);
    }
}

public sealed class TestInteractionLocalizer : IInteractionLocalizer
{
    public async ValueTask<IReadOnlyDictionary<DiscordLocale, string>> TranslateAsync(string fullSymbolName)
    {
        return new Dictionary<DiscordLocale, string>()
        {
            { DiscordLocale.en_US, "test_en" },
            { DiscordLocale.fr, "test_fr" }
        };
    }
}

Trace Logs

No response

Exceptions or other error messages

image

Anything else you'd like to share

No response

Metadata

Metadata

Assignees

Labels

bugfixcommandsFor issues related to DSharpPlus.Commands

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions