@sapphire/framework
Version:
Discord bot framework built for advanced and amazing bots.
1 lines • 1.78 kB
Source Map (JSON)
{"version":3,"file":"GuildOnly.cjs","names":["AllFlowsPrecondition","Identifiers","container"],"sources":["../../../src/preconditions/GuildOnly.ts"],"sourcesContent":["import { container } from '@sapphire/pieces';\nimport type { ChatInputCommandInteraction, ContextMenuCommandInteraction, Message } from 'discord.js';\nimport { Identifiers } from '../lib/errors/Identifiers';\nimport { AllFlowsPrecondition } from '../lib/structures/Precondition';\n\nexport class CorePrecondition extends AllFlowsPrecondition {\n\tpublic messageRun(message: Message): AllFlowsPrecondition.Result {\n\t\treturn message.guildId === null ? this.makeSharedError() : this.ok();\n\t}\n\n\tpublic chatInputRun(interaction: ChatInputCommandInteraction): AllFlowsPrecondition.Result {\n\t\treturn interaction.guildId === null ? this.makeSharedError() : this.ok();\n\t}\n\n\tpublic contextMenuRun(interaction: ContextMenuCommandInteraction): AllFlowsPrecondition.Result {\n\t\treturn interaction.guildId === null ? this.makeSharedError() : this.ok();\n\t}\n\n\tprivate makeSharedError(): AllFlowsPrecondition.Result {\n\t\treturn this.error({\n\t\t\tidentifier: Identifiers.PreconditionGuildOnly,\n\t\t\tmessage: 'You cannot run this command in DMs.'\n\t\t});\n\t}\n}\n\nvoid container.stores.loadPiece({\n\tname: 'GuildOnly',\n\tpiece: CorePrecondition,\n\tstore: 'preconditions'\n});\n"],"mappings":";;;;;;AAKA,IAAa,mBAAb,cAAsCA,yDAAqB;CAC1D,AAAO,WAAW,SAA+C;AAChE,SAAO,QAAQ,YAAY,OAAO,KAAK,iBAAiB,GAAG,KAAK,IAAI;;CAGrE,AAAO,aAAa,aAAuE;AAC1F,SAAO,YAAY,YAAY,OAAO,KAAK,iBAAiB,GAAG,KAAK,IAAI;;CAGzE,AAAO,eAAe,aAAyE;AAC9F,SAAO,YAAY,YAAY,OAAO,KAAK,iBAAiB,GAAG,KAAK,IAAI;;CAGzE,AAAQ,kBAA+C;AACtD,SAAO,KAAK,MAAM;GACjB,YAAYC,2CAAY;GACxB,SAAS;GACT,CAAC;;;AAICC,4BAAU,OAAO,UAAU;CAC/B,MAAM;CACN,OAAO;CACP,OAAO;CACP,CAAC"}