UNPKG

@sapphire/framework

Version:

Discord bot framework built for advanced and amazing bots.

1 lines 1.3 kB
{"version":3,"file":"CoreChannel.mjs","names":[],"sources":["../../../src/arguments/CoreChannel.ts"],"sourcesContent":["import type { ChannelTypes } from '@sapphire/discord.js-utilities';\nimport { container } from '@sapphire/pieces';\nimport { resolveChannel } from '../lib/resolvers/channel';\nimport { Argument } from '../lib/structures/Argument';\n\nexport class CoreArgument extends Argument<ChannelTypes> {\n\tpublic constructor(context: Argument.LoaderContext) {\n\t\tsuper(context, { name: 'channel' });\n\t}\n\n\tpublic run(parameter: string, context: Argument.Context): Argument.Result<ChannelTypes> {\n\t\tconst resolved = resolveChannel(parameter, context.message);\n\t\treturn resolved.mapErrInto((identifier) =>\n\t\t\tthis.error({\n\t\t\t\tparameter,\n\t\t\t\tidentifier,\n\t\t\t\tmessage: 'The argument did not resolve to a channel.',\n\t\t\t\tcontext\n\t\t\t})\n\t\t);\n\t}\n}\n\nvoid container.stores.loadPiece({\n\tname: 'channel',\n\tpiece: CoreArgument,\n\tstore: 'arguments'\n});\n"],"mappings":";;;;;AAKA,IAAa,eAAb,cAAkC,SAAuB;CACxD,AAAO,YAAY,SAAiC;AACnD,QAAM,SAAS,EAAE,MAAM,WAAW,CAAC;;CAGpC,AAAO,IAAI,WAAmB,SAA0D;AAEvF,SADiB,eAAe,WAAW,QAAQ,QAAQ,CAC3C,YAAY,eAC3B,KAAK,MAAM;GACV;GACA;GACA,SAAS;GACT;GACA,CAAC,CACF;;;AAIE,UAAU,OAAO,UAAU;CAC/B,MAAM;CACN,OAAO;CACP,OAAO;CACP,CAAC"}