@sapphire/framework
Version:
Discord bot framework built for advanced and amazing bots.
1 lines • 1.11 kB
Source Map (JSON)
{"version":3,"file":"dmChannel.mjs","names":[],"sources":["../../../../src/lib/resolvers/dmChannel.ts"],"sourcesContent":["import { isDMChannel } from '@sapphire/discord.js-utilities';\nimport { Result } from '@sapphire/result';\nimport type { CommandInteraction, DMChannel, Message } from 'discord.js';\nimport { Identifiers } from '../errors/Identifiers';\nimport { resolveChannel } from './channel';\n\nexport function resolveDMChannel(\n\tparameter: string,\n\tmessageOrInteraction: Message | CommandInteraction\n): Result<DMChannel, Identifiers.ArgumentChannelError | Identifiers.ArgumentDMChannelError> {\n\tconst result = resolveChannel(parameter, messageOrInteraction);\n\treturn result.mapInto((value) => {\n\t\tif (isDMChannel(value) && !value.partial) {\n\t\t\treturn Result.ok(value);\n\t\t}\n\n\t\treturn Result.err<Identifiers.ArgumentDMChannelError>(Identifiers.ArgumentDMChannelError);\n\t});\n}\n"],"mappings":";;;;;;AAMA,SAAgB,iBACf,WACA,sBAC2F;AAE3F,QADe,eAAe,WAAW,qBAAqB,CAChD,SAAS,UAAU;AAChC,MAAI,YAAY,MAAM,IAAI,CAAC,MAAM,QAChC,QAAO,OAAO,GAAG,MAAM;AAGxB,SAAO,OAAO,IAAwC,YAAY,uBAAuB;GACxF"}