@sapphire/framework
Version:
Discord bot framework built for advanced and amazing bots.
33 lines (31 loc) • 1.42 kB
JavaScript
;
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/GuildNewsThreadOnly.ts
var CorePrecondition = class extends require_lib_structures_Precondition.AllFlowsPrecondition {
messageRun(message) {
return message.thread?.type === discord_js.ChannelType.AnnouncementThread ? this.ok() : this.makeSharedError();
}
async chatInputRun(interaction) {
return (await this.fetchChannelFromInteraction(interaction)).type === discord_js.ChannelType.AnnouncementThread ? this.ok() : this.makeSharedError();
}
async contextMenuRun(interaction) {
return (await this.fetchChannelFromInteraction(interaction)).type === discord_js.ChannelType.AnnouncementThread ? this.ok() : this.makeSharedError();
}
makeSharedError() {
return this.error({
identifier: require_lib_errors_Identifiers.Identifiers.PreconditionGuildNewsThreadOnly,
message: "You can only run this command in server announcement thread channels."
});
}
};
__sapphire_pieces.container.stores.loadPiece({
name: "GuildNewsThreadOnly",
piece: CorePrecondition,
store: "preconditions"
});
//#endregion
exports.CorePrecondition = CorePrecondition;
//# sourceMappingURL=GuildNewsThreadOnly.cjs.map