@sapphire/framework
Version:
Discord bot framework built for advanced and amazing bots.
33 lines (31 loc) • 1.43 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 __sapphire_discord_js_utilities = require("@sapphire/discord.js-utilities");
//#region src/preconditions/GuildVoiceOnly.ts
var CorePrecondition = class extends require_lib_structures_Precondition.AllFlowsPrecondition {
messageRun(message) {
return (0, __sapphire_discord_js_utilities.isVoiceChannel)(message.channel) ? this.ok() : this.makeSharedError();
}
async chatInputRun(interaction) {
return (0, __sapphire_discord_js_utilities.isVoiceChannel)(await this.fetchChannelFromInteraction(interaction)) ? this.ok() : this.makeSharedError();
}
async contextMenuRun(interaction) {
return (0, __sapphire_discord_js_utilities.isVoiceChannel)(await this.fetchChannelFromInteraction(interaction)) ? this.ok() : this.makeSharedError();
}
makeSharedError() {
return this.error({
identifier: require_lib_errors_Identifiers.Identifiers.PreconditionGuildVoiceOnly,
message: "You can only run this command in server voice channels."
});
}
};
__sapphire_pieces.container.stores.loadPiece({
name: "GuildVoiceOnly",
piece: CorePrecondition,
store: "preconditions"
});
//#endregion
exports.CorePrecondition = CorePrecondition;
//# sourceMappingURL=GuildVoiceOnly.cjs.map