Skip to content

Localization doesn't contains a check for max. command description characters #2066

@Sella-GH

Description

@Sella-GH

Summary

When using the IInteractionLocalizer and setting a name or description which is above the max allowed number of characters, the command registering fails and a BadRequestException is triggered. This happens on the command descriptions and the parameters.

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 23H2 - Build 22635.4005

Reproduction Steps

  1. Create a SlashCommand
  2. Apply the Description Attribute
  3. Enter a text with 101 characters
  4. Do the same for an argument
  5. Run the bot

Trace Logs

No response

Exceptions or other error messages

DSharpPlus.BaseDiscordClient[112] Request to https://discord.com/api/v10/applications/xxx/guilds/xxx/commands triggered an exceptionDSharpPlus.Exceptions.BadRequestException: Bad request: BadRequest
   at DSharpPlus.Net.RestClient.ExecuteRequestAsync[TRequest](TRequest request)
DSharpPlus.BaseDiscordClient[104] Event handler exception for event GUILD_DOWNLOAD_COMPLETED thrown from System.Threading.Tasks.Task <ConfigureAsync>b__0(DSharpPlus.DiscordClient, DSharpPlus.EventArgs.GuildDownloadCompletedEventArgs) (defined in DSharpPlus.Commands.Processors.SlashCommands.SlashCommandProcessor+<>c__DisplayClass12_0)DSharpPlus.Exceptions.BadRequestException: Bad request: BadRequest
   at DSharpPlus.Net.RestClient.ExecuteRequestAsync[TRequest](TRequest request)
   at DSharpPlus.Net.DiscordApiClient.BulkOverwriteGuildApplicationCommandsAsync(UInt64 applicationId, UInt64 guildId, IEnumerable`1 commands)
   at DSharpPlus.DiscordClient.BulkOverwriteGuildApplicationCommandsAsync(UInt64 guildId, IEnumerable`1 commands)
   at DSharpPlus.Commands.Processors.SlashCommands.SlashCommandProcessor.RegisterSlashCommandsAsync(CommandsExtension extension)
   at DSharpPlus.Commands.Processors.SlashCommands.SlashCommandProcessor.<>c__DisplayClass12_0.<<ConfigureAsync>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at DSharpPlus.AsyncEvents.AsyncEvent`2.<>c__DisplayClass7_0.<<InvokeAsync>b__0>d.MoveNext()

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