UNPKG

@sapphire/framework

Version:

Discord bot framework built for advanced and amazing bots.

1 lines 4.48 kB
{"version":3,"sources":["../../../../../../src/lib/utils/application-commands/compute-differences/_shared.ts"],"names":[],"mappings":";;;AAYa,IAAA,sBAAA,uBAA6B,GAA0C,CAAA;AAAA,EACnF,CAAC,4BAA6B,CAAA,UAAA,EAAY,YAAY,CAAA;AAAA,EACtD,CAAC,4BAA6B,CAAA,eAAA,EAAiB,kBAAkB,CAAA;AAAA,EACjE,CAAC,4BAA6B,CAAA,MAAA,EAAQ,eAAe,CAAA;AAAA,EACrD,CAAC,4BAA6B,CAAA,OAAA,EAAS,gBAAgB,CAAA;AAAA,EACvD,CAAC,4BAA6B,CAAA,OAAA,EAAS,gBAAgB,CAAA;AAAA,EACvD,CAAC,4BAA6B,CAAA,IAAA,EAAM,aAAa,CAAA;AAAA,EACjD,CAAC,4BAA6B,CAAA,OAAA,EAAS,gBAAgB,CAAA;AAAA,EACvD,CAAC,4BAA6B,CAAA,IAAA,EAAM,aAAa,CAAA;AAAA,EACjD,CAAC,4BAA6B,CAAA,WAAA,EAAa,oBAAoB,CAAA;AAAA,EAC/D,CAAC,4BAA6B,CAAA,MAAA,EAAQ,eAAe,CAAA;AAAA,EACrD,CAAC,4BAA6B,CAAA,UAAA,EAAY,mBAAmB;AAC9D,CAAC;AAEM,IAAM,gBAAmB,GAAA,CAAC,sBAAuB,CAAA,OAAA,EAAS,uBAAuB,IAAI;AACrF,IAAM,eAAkB,GAAA,CAAC,4BAA6B,CAAA,eAAA,EAAiB,6BAA6B,UAAU;AAO9G,SAAS,sBAAsB,MAAyF,EAAA;AAC9H,EAAO,OAAA,CAAC,6BAA6B,OAAS,EAAA,4BAAA,CAA6B,MAAM,CAAE,CAAA,QAAA,CAAS,OAAO,IAAI,CAAA;AACxG;AAFgB,MAAA,CAAA,qBAAA,EAAA,uBAAA,CAAA;AAIT,SAAS,iCACf,MACkE,EAAA;AAClE,EAAO,OAAA;AAAA,IACN,4BAA6B,CAAA,OAAA;AAAA;AAAA,IAC7B,4BAA6B,CAAA,MAAA;AAAA,IAC7B,4BAA6B,CAAA;AAAA,GAC9B,CAAE,QAAS,CAAA,MAAA,CAAO,IAAI,CAAA;AACvB;AARgB,MAAA,CAAA,gCAAA,EAAA,kCAAA,CAAA;AAUT,SAAS,uBAAuB,MAAuF,EAAA;AAC7H,EAAO,OAAA,MAAA,CAAO,SAAS,4BAA6B,CAAA,MAAA;AACrD;AAFgB,MAAA,CAAA,sBAAA,EAAA,wBAAA,CAAA;AAIT,SAAS,uBAAuB,MAAmF,EAAA;AACzH,EAAO,OAAA,MAAA,CAAO,SAAS,4BAA6B,CAAA,OAAA;AACrD;AAFgB,MAAA,CAAA,sBAAA,EAAA,wBAAA,CAAA","file":"_shared.mjs","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"]}