UNPKG

@sapphire/framework

Version:

Discord bot framework built for advanced and amazing bots.

1 lines 1.07 kB
{"version":3,"file":"partialDMChannel.mjs","names":[],"sources":["../../../../src/lib/resolvers/partialDMChannel.ts"],"sourcesContent":["import { isDMChannel } from '@sapphire/discord.js-utilities';\nimport { Result } from '@sapphire/result';\nimport type { DMChannel, Message, PartialDMChannel } from 'discord.js';\nimport { Identifiers } from '../errors/Identifiers';\nimport { resolveChannel } from './channel';\n\nexport function resolvePartialDMChannel(\n\tparameter: string,\n\tmessage: Message\n): Result<DMChannel | PartialDMChannel, Identifiers.ArgumentChannelError | Identifiers.ArgumentDMChannelError> {\n\tconst result = resolveChannel(parameter, message);\n\treturn result.mapInto((channel) => {\n\t\tif (isDMChannel(channel)) {\n\t\t\treturn Result.ok(channel);\n\t\t}\n\n\t\treturn Result.err<Identifiers.ArgumentDMChannelError>(Identifiers.ArgumentDMChannelError);\n\t});\n}\n"],"mappings":";;;;;;AAMA,SAAgB,wBACf,WACA,SAC8G;AAE9G,QADe,eAAe,WAAW,QAAQ,CACnC,SAAS,YAAY;AAClC,MAAI,YAAY,QAAQ,CACvB,QAAO,OAAO,GAAG,QAAQ;AAG1B,SAAO,OAAO,IAAwC,YAAY,uBAAuB;GACxF"}