@sapphire/framework
Version:
Discord bot framework built for advanced and amazing bots.
1 lines • 3.91 kB
Source Map (JSON)
{"version":3,"file":"_shared.mjs","names":[],"sources":["../../../../../../src/lib/utils/application-commands/compute-differences/_shared.ts"],"sourcesContent":["import {\n\tApplicationCommandOptionType,\n\tApplicationCommandType,\n\ttype APIApplicationCommandChannelOption,\n\ttype APIApplicationCommandIntegerOption,\n\ttype APIApplicationCommandNumberOption,\n\ttype APIApplicationCommandOption,\n\ttype APIApplicationCommandStringOption,\n\ttype APIApplicationCommandSubcommandGroupOption,\n\ttype APIApplicationCommandSubcommandOption\n} from 'discord-api-types/v10';\n\nexport const optionTypeToPrettyName = new Map<ApplicationCommandOptionType, string>([\n\t[ApplicationCommandOptionType.Subcommand, 'subcommand'],\n\t[ApplicationCommandOptionType.SubcommandGroup, 'subcommand group'],\n\t[ApplicationCommandOptionType.String, 'string option'],\n\t[ApplicationCommandOptionType.Integer, 'integer option'],\n\t[ApplicationCommandOptionType.Boolean, 'boolean option'],\n\t[ApplicationCommandOptionType.User, 'user option'],\n\t[ApplicationCommandOptionType.Channel, 'channel option'],\n\t[ApplicationCommandOptionType.Role, 'role option'],\n\t[ApplicationCommandOptionType.Mentionable, 'mentionable option'],\n\t[ApplicationCommandOptionType.Number, 'number option'],\n\t[ApplicationCommandOptionType.Attachment, 'attachment option']\n]);\n\nexport const contextMenuTypes = [ApplicationCommandType.Message, ApplicationCommandType.User];\nexport const subcommandTypes = [ApplicationCommandOptionType.SubcommandGroup, ApplicationCommandOptionType.Subcommand];\n\nexport type APIApplicationCommandSubcommandTypes = APIApplicationCommandSubcommandOption | APIApplicationCommandSubcommandGroupOption;\nexport type APIApplicationCommandMinAndMaxValueTypes = APIApplicationCommandIntegerOption | APIApplicationCommandNumberOption;\nexport type APIApplicationCommandChoosableAndAutocompletableTypes = APIApplicationCommandMinAndMaxValueTypes | APIApplicationCommandStringOption;\nexport type APIApplicationCommandMinMaxLengthTypes = APIApplicationCommandStringOption;\n\nexport function hasMinMaxValueSupport(option: APIApplicationCommandOption): option is APIApplicationCommandMinAndMaxValueTypes {\n\treturn [ApplicationCommandOptionType.Integer, ApplicationCommandOptionType.Number].includes(option.type);\n}\n\nexport function hasChoicesAndAutocompleteSupport(\n\toption: APIApplicationCommandOption\n): option is APIApplicationCommandChoosableAndAutocompletableTypes {\n\treturn [\n\t\tApplicationCommandOptionType.Integer, //\n\t\tApplicationCommandOptionType.Number,\n\t\tApplicationCommandOptionType.String\n\t].includes(option.type);\n}\n\nexport function hasMinMaxLengthSupport(option: APIApplicationCommandOption): option is APIApplicationCommandMinMaxLengthTypes {\n\treturn option.type === ApplicationCommandOptionType.String;\n}\n\nexport function hasChannelTypesSupport(option: APIApplicationCommandOption): option is APIApplicationCommandChannelOption {\n\treturn option.type === ApplicationCommandOptionType.Channel;\n}\n\nexport interface CommandDifference {\n\tkey: string;\n\texpected: string;\n\toriginal: string;\n}\n"],"mappings":";;;AAYA,MAAa,yBAAyB,IAAI,IAA0C;CACnF,CAAC,6BAA6B,YAAY,aAAa;CACvD,CAAC,6BAA6B,iBAAiB,mBAAmB;CAClE,CAAC,6BAA6B,QAAQ,gBAAgB;CACtD,CAAC,6BAA6B,SAAS,iBAAiB;CACxD,CAAC,6BAA6B,SAAS,iBAAiB;CACxD,CAAC,6BAA6B,MAAM,cAAc;CAClD,CAAC,6BAA6B,SAAS,iBAAiB;CACxD,CAAC,6BAA6B,MAAM,cAAc;CAClD,CAAC,6BAA6B,aAAa,qBAAqB;CAChE,CAAC,6BAA6B,QAAQ,gBAAgB;CACtD,CAAC,6BAA6B,YAAY,oBAAoB;CAC9D,CAAC;AAEF,MAAa,mBAAmB,CAAC,uBAAuB,SAAS,uBAAuB,KAAK;AAC7F,MAAa,kBAAkB,CAAC,6BAA6B,iBAAiB,6BAA6B,WAAW;AAOtH,SAAgB,sBAAsB,QAAyF;AAC9H,QAAO,CAAC,6BAA6B,SAAS,6BAA6B,OAAO,CAAC,SAAS,OAAO,KAAK;;AAGzG,SAAgB,iCACf,QACkE;AAClE,QAAO;EACN,6BAA6B;EAC7B,6BAA6B;EAC7B,6BAA6B;EAC7B,CAAC,SAAS,OAAO,KAAK;;AAGxB,SAAgB,uBAAuB,QAAuF;AAC7H,QAAO,OAAO,SAAS,6BAA6B;;AAGrD,SAAgB,uBAAuB,QAAmF;AACzH,QAAO,OAAO,SAAS,6BAA6B"}