UNPKG

@sapphire/framework

Version:

Discord bot framework built for advanced and amazing bots.

42 lines (40 loc) 1.36 kB
import { __name } from '../chunk-PAWJFY3S.mjs'; import { container } from '@sapphire/pieces'; import { Identifiers } from '../lib/errors/Identifiers.mjs'; import { resolveGuildThreadChannel } from '../lib/resolvers/guildThreadChannel.mjs'; import { Argument } from '../lib/structures/Argument.mjs'; var _CoreArgument = class _CoreArgument extends Argument { constructor(context) { super(context, { name: "guildThreadChannel" }); } run(parameter, context) { const { guild } = context.message; if (!guild) { return this.error({ parameter, identifier: Identifiers.ArgumentGuildChannelMissingGuildError, message: "This command can only be used in a server.", context }); } const resolved = resolveGuildThreadChannel(parameter, guild); return resolved.mapErrInto( (identifier) => this.error({ parameter, identifier, message: "The given argument did not resolve to a valid thread.", context: { ...context, guild } }) ); } }; __name(_CoreArgument, "CoreArgument"); var CoreArgument = _CoreArgument; void container.stores.loadPiece({ name: "guildThreadChannel", piece: CoreArgument, store: "arguments" }); export { CoreArgument }; //# sourceMappingURL=CoreGuildThreadChannel.mjs.map //# sourceMappingURL=CoreGuildThreadChannel.mjs.map