import { Channel , Internal , snowflake } from '.' ; /** https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-structure */ export interface ApplicationCommand { /** unique id of the command */ id : snowflake ; /** the type of command, defaults 1 if not set */ type ? : ApplicationCommand . Type ; /** unique id of the parent application */ application_id : snowflake ; /** guild id of the command, if not global */ guild_id ? : snowflake ; /** 1-32 character name */ name : string ; /** 1-100 character description for CHAT_INPUT commands, empty string for USER and MESSAGE commands */ description : string ; /** the parameters for the command, max 25 */ options ? : ApplicationCommand . Option [ ] ; /** whether the command is enabled by default when the app is added to a guild */ default_permission ? : boolean ; /** autoincrementing version identifier updated during substantial record changes */ version : snowflake ; } export namespace ApplicationCommand { /** https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-types */ export enum Type { /** Slash commands; a text-based command that shows up when a user types / */ CHAT_INPUT = 1 , /** A UI-based command that shows up when you right click or tap on a user */ USER = 2 , /** A UI-based command that shows up when you right click or tap on a message */ MESSAGE = 3 } /** https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-structure */ export interface Option { /** the type of option */ type : OptionType ; /** 1-32 character name */ name : string ; /** 1-100 character description */ description : string ; /** if the parameter is required or optional--default false */ required ? : boolean ; /** choices for STRING, INTEGER, and NUMBER types for the user to pick from, max 25 */ choices ? : OptionChoice [ ] ; /** if the option is a subcommand or subcommand group type, this nested options will be the parameters */ options ? : Option [ ] ; /** if the option is a channel type, the channels shown will be restricted to these types */ channel_types ? : Channel . Type [ ] ; } /** https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-type */ export enum OptionType { SUB_COMMAND = 1 , SUB_COMMAND_GROUP = 2 , STRING = 3 , /** Any integer between -2^53 and 2^53 */ INTEGER = 4 , BOOLEAN = 5 , USER = 6 , /** Includes all channel types + categories */ CHANNEL = 7 , ROLE = 8 , /** Includes users and roles */ MENTIONABLE = 9 , /** Any double between -2^53 and 2^53 */ NUMBER = 10 } /** https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-choice-structure */ export interface OptionChoice { /** 1-100 character choice name */ name : string ; /** value of the choice, up to 100 characters if string */ value : string | number ; } /** https://discord.com/developers/docs/interactions/application-commands#application-command-permissions-object-guild-application-command-permissions-structure */ export interface GuildPermissions { /** the id of the command */ id : snowflake ; /** the id of the application the command belongs to */ application_id : snowflake ; /** the id of the guild */ guild_id : snowflake ; /** the permissions for the command in the guild */ permissions : Permissions [ ] ; } /** https://discord.com/developers/docs/interactions/application-commands#application-command-permissions-object-application-command-permissions-structure */ export interface Permissions { /** the id of the role or user */ id : snowflake ; /** role or user */ type : PermissionType ; /** true to allow, false, to disallow */ permission : boolean ; } /** https://discord.com/developers/docs/interactions/application-commands#application-command-permissions-object-application-command-permission-type */ export enum PermissionType { ROLE = 1 , USER = 2 } export namespace Params { /** https://discord.com/developers/docs/interactions/application-commands#create-global-application-command-json-params */ export interface Create { /** 1-32 character name */ name : string ; /** 1-100 character description */ description : string ; /** the parameters for the command */ options ? : Option [ ] ; /** whether the command is enabled by default when the app is added to a guild */ default_permission ? : boolean ; /** the type of command, defaults 1 if not set */ type ? : Type ; } /** https://discord.com/developers/docs/interactions/application-commands#edit-global-application-command-json-params */ export interface Edit { /** 1-32 character name */ name ? : string ; /** 1-100 character description */ description ? : string ; /** the parameters for the command */ options ? : Option [ ] ; /** whether the command is enabled by default when the app is added to a guild */ default_permission ? : boolean ; } /** https://discord.com/developers/docs/interactions/application-commands#edit-application-command-permissions-json-params */ export interface EditPermissions { /** the permissions for the command in the guild */ permissions : Permissions [ ] ; } } } declare module './internal' { interface Internal { see https getGlobalApplicationCommands ( application_id ) : Promise < ApplicationCommand [ ] > ; see https createGlobalApplicationCommand ( application_id , param ) : Promise < ApplicationCommand > ; see https bulkOverwriteGlobalApplicationCommands ( application_id ) : Promise < ApplicationCommand [ ] > ; see https getGlobalApplicationCommand ( application_id , command_id ) : Promise < ApplicationCommand > ; see https editGlobalApplicationCommand ( application_id , command_id , param ) : Promise < ApplicationCommand > ; see https deleteGlobalApplicationCommand ( application_id , command_id ) : Promise < void > ; see https getGuildApplicationCommands ( application_id , guild_id ) : Promise < ApplicationCommand [ ] > ; see https createGuildApplicationCommand ( application_id , guild_id , param ) : Promise < ApplicationCommand > ; see https bulkOverwriteGuildApplicationCommands ( application_id , guild_id ) : Promise < void > ; see https getGuildApplicationCommandPermissions ( application_id , guild_id ) : Promise < ApplicationCommand . GuildPermissions [ ] > ; see https batchEditApplicationCommandPermissions ( application_id , guild_id , permissions ) : Promise < void > ; see https getGuildApplicationCommand ( application_id , guild_id , command_id ) : Promise < ApplicationCommand > ; see https editGuildApplicationCommand ( application_id , guild_id , command_id , param ) : Promise < ApplicationCommand > ; see https deleteGuildApplicationCommand ( application_id , guild_id , command_id ) : Promise < void > ; see https getApplicationCommandPermissions ( application_id , guild_id , command_id ) : Promise < ApplicationCommand . GuildPermissions > ; see https editApplicationCommandPermissions ( application_id , guild_id , command_id , param ) : Promise < ApplicationCommand . GuildPermissions > ; } } Internal . define ( { '/applications/{application.id}/commands' : { GET : 'getGlobalApplicationCommands' , POST : 'createGlobalApplicationCommand' , PUT : 'bulkOverwriteGlobalApplicationCommands' , } , '/applications/{application.id}/commands/{command.id}' : { GET : 'getGlobalApplicationCommand' , PATCH : 'editGlobalApplicationCommand' , DELETE : 'deleteGlobalApplicationCommand' , } , '/applications/{application.id}/guilds/{guild.id}/commands' : { GET : 'getGuildApplicationCommands' , POST : 'createGuildApplicationCommand' , PUT : 'bulkOverwriteGuildApplicationCommands' , } , '/applications/{application.id}/guilds/{guild.id}/commands/{command.id}' : { GET : 'getGuildApplicationCommand' , PATCH : 'editGuildApplicationCommand' , DELETE : 'deleteGuildApplicationCommand' , } , '/applications/{application.id}/guilds/{guild.id}/commands/permissions' : { GET : 'getGuildApplicationCommandPermissions' , PUT : 'batchEditApplicationCommandPermissions' , } , '/applications/{application.id}/guilds/{guild.id}/commands/{command.id}/permissions' : { GET : 'getApplicationCommandPermissions' , PUT : 'editApplicationCommandPermissions' , } , } ) ;