UNPKG

@sapphire/framework

Version:

Discord bot framework built for advanced and amazing bots.

42 lines (40 loc) 1.41 kB
import { __name } from '../chunk-PAWJFY3S.mjs'; import { container } from '@sapphire/pieces'; import { Identifiers } from '../lib/errors/Identifiers.mjs'; import { resolveGuildPublicThreadChannel } from '../lib/resolvers/guildPublicThreadChannel.mjs'; import { Argument } from '../lib/structures/Argument.mjs'; var _CoreArgument = class _CoreArgument extends Argument { constructor(context) { super(context, { name: "guildPublicThreadChannel" }); } 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 = resolveGuildPublicThreadChannel(parameter, guild); return resolved.mapErrInto( (identifier) => this.error({ parameter, identifier, message: "The given argument did not resolve to a valid public thread.", context: { ...context, guild } }) ); } }; __name(_CoreArgument, "CoreArgument"); var CoreArgument = _CoreArgument; void container.stores.loadPiece({ name: "guildPublicThreadChannel", piece: CoreArgument, store: "arguments" }); export { CoreArgument }; //# sourceMappingURL=CoreGuildPublicThreadChannel.mjs.map //# sourceMappingURL=CoreGuildPublicThreadChannel.mjs.map