UNPKG

@sapphire/framework

Version:

Discord bot framework built for advanced and amazing bots.

1 lines 1.71 kB
{"version":3,"sources":["../../../../../../src/lib/utils/preconditions/containers/UserPermissionsPrecondition.ts"],"names":["PermissionsBitField"],"mappings":";;;;;;AAwBO,IAAM,4BAAA,GAAN,MAAM,4BAA8F,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQnG,YAAY,WAAmC,EAAA;AACrD,IAAA,IAAA,CAAK,IAAO,GAAA,iBAAA;AACZ,IAAA,IAAA,CAAK,OAAU,GAAA;AAAA,MACd,WAAA,EAAa,IAAIA,8BAAA,CAAoB,WAAW;AAAA,KACjD;AAAA;AAEF,CAAA;AAd2G,MAAA,CAAA,4BAAA,EAAA,6BAAA,CAAA;AAApG,IAAM,2BAAN,GAAA","file":"UserPermissionsPrecondition.cjs","sourcesContent":["import { PermissionsBitField, type PermissionResolvable } from 'discord.js';\nimport type { PreconditionSingleResolvableDetails } from '../PreconditionContainerSingle';\n\n/**\n * Constructs a contextful permissions precondition requirement.\n * @since 1.0.0\n * @example\n * ```typescript\n * export class CoreCommand extends Command {\n * public constructor(context: Command.Context) {\n * super(context, {\n * preconditions: [\n * 'GuildOnly',\n * new UserPermissionsPrecondition('ADD_REACTIONS')\n * ]\n * });\n * }\n *\n * public messageRun(message: Message, args: Args) {\n * // ...\n * }\n * }\n * ```\n */\nexport class UserPermissionsPrecondition implements PreconditionSingleResolvableDetails<'UserPermissions'> {\n\tpublic name: 'UserPermissions';\n\tpublic context: { permissions: PermissionsBitField };\n\n\t/**\n\t * Constructs a precondition container entry.\n\t * @param permissions The permissions that will be required by this command.\n\t */\n\tpublic constructor(permissions: PermissionResolvable) {\n\t\tthis.name = 'UserPermissions';\n\t\tthis.context = {\n\t\t\tpermissions: new PermissionsBitField(permissions)\n\t\t};\n\t}\n}\n"]}