@sapphire/framework
Version:
Discord bot framework built for advanced and amazing bots.
1 lines • 2.29 kB
Source Map (JSON)
{"version":3,"file":"Enabled.cjs","names":["AllFlowsPrecondition","Identifiers","container"],"sources":["../../../src/preconditions/Enabled.ts"],"sourcesContent":["import { container } from '@sapphire/pieces';\nimport type { ChatInputCommandInteraction, ContextMenuCommandInteraction, Message } from 'discord.js';\nimport { Identifiers } from '../lib/errors/Identifiers';\nimport type { Command } from '../lib/structures/Command';\nimport { AllFlowsPrecondition } from '../lib/structures/Precondition';\n\nexport class CorePrecondition extends AllFlowsPrecondition {\n\tpublic constructor(context: AllFlowsPrecondition.LoaderContext) {\n\t\tsuper(context, { position: 10 });\n\t}\n\n\tpublic messageRun(_: Message, command: Command, context: AllFlowsPrecondition.Context): AllFlowsPrecondition.Result {\n\t\treturn command.enabled\n\t\t\t? this.ok()\n\t\t\t: this.error({ identifier: Identifiers.CommandDisabled, message: 'This message command is disabled.', context });\n\t}\n\n\tpublic chatInputRun(_: ChatInputCommandInteraction, command: Command, context: AllFlowsPrecondition.Context): AllFlowsPrecondition.Result {\n\t\treturn command.enabled\n\t\t\t? this.ok()\n\t\t\t: this.error({ identifier: Identifiers.CommandDisabled, message: 'This chat input command is disabled.', context });\n\t}\n\n\tpublic contextMenuRun(_: ContextMenuCommandInteraction, command: Command, context: AllFlowsPrecondition.Context): AllFlowsPrecondition.Result {\n\t\treturn command.enabled\n\t\t\t? this.ok()\n\t\t\t: this.error({ identifier: Identifiers.CommandDisabled, message: 'This context menu command is disabled.', context });\n\t}\n}\n\nvoid container.stores.loadPiece({\n\tname: 'Enabled',\n\tpiece: CorePrecondition,\n\tstore: 'preconditions'\n});\n"],"mappings":";;;;;;AAMA,IAAa,mBAAb,cAAsCA,yDAAqB;CAC1D,AAAO,YAAY,SAA6C;AAC/D,QAAM,SAAS,EAAE,UAAU,IAAI,CAAC;;CAGjC,AAAO,WAAW,GAAY,SAAkB,SAAoE;AACnH,SAAO,QAAQ,UACZ,KAAK,IAAI,GACT,KAAK,MAAM;GAAE,YAAYC,2CAAY;GAAiB,SAAS;GAAqC;GAAS,CAAC;;CAGlH,AAAO,aAAa,GAAgC,SAAkB,SAAoE;AACzI,SAAO,QAAQ,UACZ,KAAK,IAAI,GACT,KAAK,MAAM;GAAE,YAAYA,2CAAY;GAAiB,SAAS;GAAwC;GAAS,CAAC;;CAGrH,AAAO,eAAe,GAAkC,SAAkB,SAAoE;AAC7I,SAAO,QAAQ,UACZ,KAAK,IAAI,GACT,KAAK,MAAM;GAAE,YAAYA,2CAAY;GAAiB,SAAS;GAA0C;GAAS,CAAC;;;AAInHC,4BAAU,OAAO,UAAU;CAC/B,MAAM;CACN,OAAO;CACP,OAAO;CACP,CAAC"}