UNPKG

@sapphire/framework

Version:

Discord bot framework built for advanced and amazing bots.

1 lines 2.18 kB
{"version":3,"file":"registriesErrors.cjs","names":["container","Events"],"sources":["../../../../../src/lib/utils/application-commands/registriesErrors.ts"],"sourcesContent":["import { container } from '@sapphire/pieces';\nimport type { Command } from '../../structures/Command';\nimport { Events } from '../../types/Events';\nimport { bulkOverwriteError } from './registriesLog';\n\n/**\n * Opinionatedly logs the encountered registry error.\n * @param error The emitted error\n * @param command The command which had the error\n */\nexport function emitPerRegistryError(error: unknown, command: Command<any, any>) {\n\tconst { name, location } = command;\n\tconst { client, logger } = container;\n\n\tif (client.listenerCount(Events.CommandApplicationCommandRegistryError)) {\n\t\tclient.emit(Events.CommandApplicationCommandRegistryError, error, command);\n\t} else {\n\t\tlogger.error(\n\t\t\t`Encountered error while handling the command application command registry for command \"${name}\" at path \"${location.full}\"`,\n\t\t\terror\n\t\t);\n\t}\n}\n\n/**\n * Opinionatedly logs any bulk overwrite registries error.\n * @param error The emitted error\n * @param guildId The guild id in which the error was caused\n */\nexport function emitBulkOverwriteError(error: unknown, guildId: string | null) {\n\tconst { client } = container;\n\n\tif (client.listenerCount(Events.ApplicationCommandRegistriesBulkOverwriteError)) {\n\t\tclient.emit(Events.ApplicationCommandRegistriesBulkOverwriteError, error, guildId);\n\t} else if (guildId) {\n\t\tbulkOverwriteError(`Failed to overwrite guild application commands for guild ${guildId}`, error);\n\t} else {\n\t\tbulkOverwriteError(`Failed to overwrite global application commands`, error);\n\t}\n}\n"],"mappings":";;;;;;;;;;;AAUA,SAAgB,qBAAqB,OAAgB,SAA4B;CAChF,MAAM,EAAE,MAAM,aAAa;CAC3B,MAAM,EAAE,QAAQ,WAAWA;AAE3B,KAAI,OAAO,cAAcC,gCAAO,uCAAuC,CACtE,QAAO,KAAKA,gCAAO,wCAAwC,OAAO,QAAQ;KAE1E,QAAO,MACN,0FAA0F,KAAK,aAAa,SAAS,KAAK,IAC1H,MACA;;;;;;;AASH,SAAgB,uBAAuB,OAAgB,SAAwB;CAC9E,MAAM,EAAE,WAAWD;AAEnB,KAAI,OAAO,cAAcC,gCAAO,+CAA+C,CAC9E,QAAO,KAAKA,gCAAO,gDAAgD,OAAO,QAAQ;UACxE,QACV,yEAAmB,4DAA4D,WAAW,MAAM;KAEhG,yEAAmB,mDAAmD,MAAM"}