UNPKG

@sapphire/framework

Version:

Discord bot framework built for advanced and amazing bots.

19 lines (17 loc) 789 B
import { __name } from '../../chunk-PAWJFY3S.mjs'; import { ChannelMentionRegex } from '@sapphire/discord.js-utilities'; import { container } from '@sapphire/pieces'; import { Result } from '@sapphire/result'; import { Identifiers } from '../errors/Identifiers.mjs'; function resolveChannel(parameter, messageOrInteraction) { const channelId = ChannelMentionRegex.exec(parameter)?.[1] ?? parameter; const channel = (messageOrInteraction.guild ? messageOrInteraction.guild.channels : container.client.channels).cache.get(channelId); if (channel) { return Result.ok(channel); } return Result.err(Identifiers.ArgumentChannelError); } __name(resolveChannel, "resolveChannel"); export { resolveChannel }; //# sourceMappingURL=channel.mjs.map //# sourceMappingURL=channel.mjs.map