@sapphire/framework
Version:
Discord bot framework built for advanced and amazing bots.
1 lines • 1.21 kB
Source Map (JSON)
{"version":3,"file":"resolveGuildChannelPredicate.cjs","names":["resolveGuildChannel","Result"],"sources":["../../../../../src/lib/utils/resolvers/resolveGuildChannelPredicate.ts"],"sourcesContent":["import type { ChannelTypes, GuildBasedChannelTypes } from '@sapphire/discord.js-utilities';\nimport { Result } from '@sapphire/result';\nimport type { Nullish } from '@sapphire/utilities';\nimport type { Guild } from 'discord.js';\nimport type { Identifiers } from '../../errors/Identifiers';\nimport { resolveGuildChannel } from '../../resolvers/guildChannel';\n\nexport function resolveGuildChannelPredicate<TChannel extends GuildBasedChannelTypes, TError extends Identifiers>(\n\tparameter: string,\n\tguild: Guild,\n\tpredicate: (channel: ChannelTypes | Nullish) => channel is TChannel,\n\terror: TError\n): Result<TChannel, TError | Identifiers.ArgumentGuildChannelError> {\n\tconst result = resolveGuildChannel(parameter, guild);\n\treturn result.mapInto((channel) => (predicate(channel) ? Result.ok(channel) : Result.err(error)));\n}\n"],"mappings":";;;;;AAOA,SAAgB,6BACf,WACA,OACA,WACA,OACmE;AAEnE,QADeA,uDAAoB,WAAW,MAAM,CACtC,SAAS,YAAa,UAAU,QAAQ,GAAGC,yBAAO,GAAG,QAAQ,GAAGA,yBAAO,IAAI,MAAM,CAAE"}