@sapphire/framework
Version:
Discord bot framework built for advanced and amazing bots.
1 lines • 1.34 kB
Source Map (JSON)
{"version":3,"sources":["../../../../src/lib/resolvers/partialDMChannel.ts"],"names":["result","resolveChannel","isDMChannel","Result","Identifiers"],"mappings":";;;;;;;;;AAMO,SAAS,uBAAA,CACf,WACA,OAC8G,EAAA;AAC9G,EAAM,MAAAA,QAAA,GAASC,0BAAe,CAAA,SAAA,EAAW,OAAO,CAAA;AAChD,EAAO,OAAAD,QAAA,CAAO,OAAQ,CAAA,CAAC,OAAY,KAAA;AAClC,IAAI,IAAAE,+BAAA,CAAY,OAAO,CAAG,EAAA;AACzB,MAAO,OAAAC,aAAA,CAAO,GAAG,OAAO,CAAA;AAAA;AAGzB,IAAO,OAAAA,aAAA,CAAO,GAAwC,CAAAC,2BAAA,CAAY,sBAAsB,CAAA;AAAA,GACxF,CAAA;AACF;AAZgB,MAAA,CAAA,uBAAA,EAAA,yBAAA,CAAA","file":"partialDMChannel.cjs","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"]}