@sapphire/framework
Version:
Discord bot framework built for advanced and amazing bots.
1 lines • 1.26 kB
Source Map (JSON)
{"version":3,"sources":["../../../../src/lib/resolvers/partialDMChannel.ts"],"names":[],"mappings":";;;;;;AAMO,SAAS,uBAAA,CACf,WACA,OAC8G,EAAA;AAC9G,EAAM,MAAA,MAAA,GAAS,cAAe,CAAA,SAAA,EAAW,OAAO,CAAA;AAChD,EAAO,OAAA,MAAA,CAAO,OAAQ,CAAA,CAAC,OAAY,KAAA;AAClC,IAAI,IAAA,WAAA,CAAY,OAAO,CAAG,EAAA;AACzB,MAAO,OAAA,MAAA,CAAO,GAAG,OAAO,CAAA;AAAA;AAGzB,IAAO,OAAA,MAAA,CAAO,GAAwC,CAAA,WAAA,CAAY,sBAAsB,CAAA;AAAA,GACxF,CAAA;AACF;AAZgB,MAAA,CAAA,uBAAA,EAAA,yBAAA,CAAA","file":"partialDMChannel.mjs","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"]}