Skip to content

[Bug]: AutocompleteResult Value has no length limit #3182

@HEJOK254

Description

@HEJOK254

Check The Docs

  • I double checked the docs and couldn't find any useful information.

Verify Issue Source

  • I verified the issue was caused by Discord.Net.

Check your intents

  • I double checked that I have the required intents.

Description

According to the Discord API Docs (and my manual testing), the Value of an AutocompleteResult has a limit of max. 100 characters. While in the library, this is true for the Name property, Value doesn't have any limit set, resulting in autocompletes failing on Discord, if an AutocompleteResult with a Value longer than 100 characters is sent

Version

3.18.0

Working Version

No response

Logs

Nothing relevant is logged because of the bug
There are no exceptions thrown because of the bug

Sample

public class ExampleInvalidValueAutocompleteHandler : AutocompleteHandler
{
	public override Task<AutocompletionResult> GenerateSuggestionsAsync(IInteractionContext context, IAutocompleteInteraction autocompleteInteraction, IParameterInfo parameter, IServiceProvider services)
	{
		IEnumerable<AutocompleteResult> results =
		[
			// If name is longer than 100 characters, an exception is thrown
			// Value does not get checked for character length
			new("Name", "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas ut molestie urna. Phasellus laoreet lacus.")
		];

		return Task.FromResult(AutocompletionResult.FromSuccess(results));
	}
}

Packages

not relevant

Environment

not relevant

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions