UNPKG

@sapphire/framework

Version:

Discord bot framework built for advanced and amazing bots.

33 lines (31 loc) 1.41 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"); let discord_js = require("discord.js"); //#region src/preconditions/GuildPrivateThreadOnly.ts var CorePrecondition = class extends require_lib_structures_Precondition.AllFlowsPrecondition { messageRun(message) { return message.thread?.type === discord_js.ChannelType.PrivateThread ? this.ok() : this.makeSharedError(); } async chatInputRun(interaction) { return (await this.fetchChannelFromInteraction(interaction)).type === discord_js.ChannelType.PrivateThread ? this.ok() : this.makeSharedError(); } async contextMenuRun(interaction) { return (await this.fetchChannelFromInteraction(interaction)).type === discord_js.ChannelType.PrivateThread ? this.ok() : this.makeSharedError(); } makeSharedError() { return this.error({ identifier: require_lib_errors_Identifiers.Identifiers.PreconditionGuildPrivateThreadOnly, message: "You can only run this command in private server thread channels." }); } }; __sapphire_pieces.container.stores.loadPiece({ name: "GuildPrivateThreadOnly", piece: CorePrecondition, store: "preconditions" }); //#endregion exports.CorePrecondition = CorePrecondition; //# sourceMappingURL=GuildPrivateThreadOnly.cjs.map