mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-03 01:10:07 +00:00
Merge pull request #1112 from discordeno/cool-stuff
Slash Command Autocomplete
This commit is contained in:
@@ -23,6 +23,8 @@ interface ApplicationCommandInteractionDataOptionBase<T extends DiscordApplicati
|
||||
type: T;
|
||||
/** The value of the pair */
|
||||
value: V;
|
||||
/** Whether the user has focused this option for autocompletion. */
|
||||
focused?: true;
|
||||
}
|
||||
|
||||
export interface ApplicationCommandInteractionDataOptionSubCommand
|
||||
|
||||
@@ -16,6 +16,8 @@ export interface ApplicationCommandOption {
|
||||
choices?: ApplicationCommandOptionChoice[];
|
||||
/** If the option is a subcommand or subcommand group type, this nested options will be the parameters */
|
||||
options?: ApplicationCommandOption[];
|
||||
/** Whether this option should make autocomplete interactions. */
|
||||
autocomplete?: boolean;
|
||||
/** If the option is a channel type, the channels shown will be restricted to these types */
|
||||
channelTypes?: ChannelTypes[];
|
||||
}
|
||||
|
||||
@@ -10,6 +10,8 @@ export enum DiscordInteractionResponseTypes {
|
||||
DeferredUpdateMessage,
|
||||
/** For components, edit the message the component was attached to */
|
||||
UpdateMessage,
|
||||
/** For Application Command Options, send an autocomplete result */
|
||||
ApplicationCommandAutocompleteResult,
|
||||
}
|
||||
|
||||
export type InteractionResponseTypes = DiscordInteractionResponseTypes;
|
||||
|
||||
@@ -3,6 +3,7 @@ export enum DiscordInteractionTypes {
|
||||
Ping = 1,
|
||||
ApplicationCommand,
|
||||
MessageComponent,
|
||||
ApplicationCommandAutocomplete,
|
||||
}
|
||||
|
||||
export type InteractionTypes = DiscordInteractionTypes;
|
||||
|
||||
@@ -52,6 +52,7 @@ export function validateSlashOptionChoices(
|
||||
});
|
||||
}
|
||||
|
||||
// TODO: add checks for autocomplete options when discord provides more info about them.
|
||||
export function validateSlashOptions(bot: Bot, options: ApplicationCommandOption[]) {
|
||||
const requiredOptions: ApplicationCommandOption[] = [];
|
||||
const optionalOptions: ApplicationCommandOption[] = [];
|
||||
|
||||
Reference in New Issue
Block a user