UNPKG

@sapphire/framework

Version:

Discord bot framework built for advanced and amazing bots.

1 lines 1.16 kB
{"version":3,"file":"dmChannel.cjs","names":["resolveChannel","Result","Identifiers"],"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,QADeA,6CAAe,WAAW,qBAAqB,CAChD,SAAS,UAAU;AAChC,uDAAgB,MAAM,IAAI,CAAC,MAAM,QAChC,QAAOC,yBAAO,GAAG,MAAM;AAGxB,SAAOA,yBAAO,IAAwCC,2CAAY,uBAAuB;GACxF"}