@sapphire/framework
Version:
Discord bot framework built for advanced and amazing bots.
37 lines (34 loc) • 1.65 kB
JavaScript
;
var pieces = require('@sapphire/pieces');
var Events_cjs = require('../../types/Events.cjs');
var registriesLog_cjs = require('./registriesLog.cjs');
var __defProp = Object.defineProperty;
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
function emitPerRegistryError(error, command) {
const { name, location } = command;
const { client, logger } = pieces.container;
if (client.listenerCount(Events_cjs.Events.CommandApplicationCommandRegistryError)) {
client.emit(Events_cjs.Events.CommandApplicationCommandRegistryError, error, command);
} else {
logger.error(
`Encountered error while handling the command application command registry for command "${name}" at path "${location.full}"`,
error
);
}
}
__name(emitPerRegistryError, "emitPerRegistryError");
function emitBulkOverwriteError(error, guildId) {
const { client } = pieces.container;
if (client.listenerCount(Events_cjs.Events.ApplicationCommandRegistriesBulkOverwriteError)) {
client.emit(Events_cjs.Events.ApplicationCommandRegistriesBulkOverwriteError, error, guildId);
} else if (guildId) {
registriesLog_cjs.bulkOverwriteError(`Failed to overwrite guild application commands for guild ${guildId}`, error);
} else {
registriesLog_cjs.bulkOverwriteError(`Failed to overwrite global application commands`, error);
}
}
__name(emitBulkOverwriteError, "emitBulkOverwriteError");
exports.emitBulkOverwriteError = emitBulkOverwriteError;
exports.emitPerRegistryError = emitPerRegistryError;
//# sourceMappingURL=registriesErrors.cjs.map
//# sourceMappingURL=registriesErrors.cjs.map