@sapphire/framework
Version:
Discord bot framework built for advanced and amazing bots.
35 lines (33 loc) • 1.28 kB
JavaScript
import { __name } from '../chunk-PAWJFY3S.mjs';
import { container } from '@sapphire/pieces';
import { Identifiers } from '../lib/errors/Identifiers.mjs';
import { AllFlowsPrecondition } from '../lib/structures/Precondition.mjs';
var _CorePrecondition = class _CorePrecondition extends AllFlowsPrecondition {
messageRun(message) {
return message.thread ? this.ok() : this.makeSharedError();
}
async chatInputRun(interaction) {
const channel = await this.fetchChannelFromInteraction(interaction);
return channel.isThread() ? this.ok() : this.makeSharedError();
}
async contextMenuRun(interaction) {
const channel = await this.fetchChannelFromInteraction(interaction);
return channel.isThread() ? this.ok() : this.makeSharedError();
}
makeSharedError() {
return this.error({
identifier: Identifiers.PreconditionThreadOnly,
message: "You can only run this command in server thread channels."
});
}
};
__name(_CorePrecondition, "CorePrecondition");
var CorePrecondition = _CorePrecondition;
void container.stores.loadPiece({
name: "GuildThreadOnly",
piece: CorePrecondition,
store: "preconditions"
});
export { CorePrecondition };
//# sourceMappingURL=GuildThreadOnly.mjs.map
//# sourceMappingURL=GuildThreadOnly.mjs.map