UNPKG

@sapphire/framework

Version:

Discord bot framework built for advanced and amazing bots.

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