UNPKG

@sapphire/framework

Version:

Discord bot framework built for advanced and amazing bots.

1 lines 1.25 kB
{"version":3,"file":"CoreGuild.mjs","names":[],"sources":["../../../src/arguments/CoreGuild.ts"],"sourcesContent":["import { container } from '@sapphire/pieces';\nimport type { Guild } from 'discord.js';\nimport { resolveGuild } from '../lib/resolvers/guild';\nimport { Argument } from '../lib/structures/Argument';\n\nexport class CoreArgument extends Argument<Guild> {\n\tpublic constructor(context: Argument.LoaderContext) {\n\t\tsuper(context, { name: 'guild' });\n\t}\n\n\tpublic async run(parameter: string, context: Argument.Context): Argument.AsyncResult<Guild> {\n\t\tconst resolved = await resolveGuild(parameter);\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 given argument did not resolve to a Discord guild.',\n\t\t\t\tcontext\n\t\t\t})\n\t\t);\n\t}\n}\n\nvoid container.stores.loadPiece({\n\tname: 'guild',\n\tpiece: CoreArgument,\n\tstore: 'arguments'\n});\n"],"mappings":";;;;;AAKA,IAAa,eAAb,cAAkC,SAAgB;CACjD,AAAO,YAAY,SAAiC;AACnD,QAAM,SAAS,EAAE,MAAM,SAAS,CAAC;;CAGlC,MAAa,IAAI,WAAmB,SAAwD;AAE3F,UADiB,MAAM,aAAa,UAAU,EAC9B,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"}