UNPKG

@sapphire/framework

Version:

Discord bot framework built for advanced and amazing bots.

32 lines (30 loc) 1.21 kB
"use strict"; const require_lib_errors_Identifiers = require('../lib/errors/Identifiers.cjs'); const require_lib_structures_Precondition = require('../lib/structures/Precondition.cjs'); let __sapphire_pieces = require("@sapphire/pieces"); //#region src/preconditions/GuildThreadOnly.ts var CorePrecondition = class extends require_lib_structures_Precondition.AllFlowsPrecondition { messageRun(message) { return message.thread ? this.ok() : this.makeSharedError(); } async chatInputRun(interaction) { return (await this.fetchChannelFromInteraction(interaction)).isThread() ? this.ok() : this.makeSharedError(); } async contextMenuRun(interaction) { return (await this.fetchChannelFromInteraction(interaction)).isThread() ? this.ok() : this.makeSharedError(); } makeSharedError() { return this.error({ identifier: require_lib_errors_Identifiers.Identifiers.PreconditionThreadOnly, message: "You can only run this command in server thread channels." }); } }; __sapphire_pieces.container.stores.loadPiece({ name: "GuildThreadOnly", piece: CorePrecondition, store: "preconditions" }); //#endregion exports.CorePrecondition = CorePrecondition; //# sourceMappingURL=GuildThreadOnly.cjs.map