@sapphire/framework
Version:
Discord bot framework built for advanced and amazing bots.
39 lines (36 loc) • 1.62 kB
JavaScript
;
var pieces = require('@sapphire/pieces');
var discord_js = require('discord.js');
var Identifiers_cjs = require('../lib/errors/Identifiers.cjs');
var Precondition_cjs = require('../lib/structures/Precondition.cjs');
var __defProp = Object.defineProperty;
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
var _CorePrecondition = class _CorePrecondition extends Precondition_cjs.AllFlowsPrecondition {
messageRun(message) {
return message.thread?.type === discord_js.ChannelType.PublicThread ? this.ok() : this.makeSharedError();
}
async chatInputRun(interaction) {
const channel = await this.fetchChannelFromInteraction(interaction);
return channel.type === discord_js.ChannelType.PublicThread ? this.ok() : this.makeSharedError();
}
async contextMenuRun(interaction) {
const channel = await this.fetchChannelFromInteraction(interaction);
return channel.type === discord_js.ChannelType.PublicThread ? this.ok() : this.makeSharedError();
}
makeSharedError() {
return this.error({
identifier: Identifiers_cjs.Identifiers.PreconditionGuildPublicThreadOnly,
message: "You can only run this command in public server thread channels."
});
}
};
__name(_CorePrecondition, "CorePrecondition");
var CorePrecondition = _CorePrecondition;
void pieces.container.stores.loadPiece({
name: "GuildPublicThreadOnly",
piece: CorePrecondition,
store: "preconditions"
});
exports.CorePrecondition = CorePrecondition;
//# sourceMappingURL=GuildPublicThreadOnly.cjs.map
//# sourceMappingURL=GuildPublicThreadOnly.cjs.map