Handling BulkOverwrite Registry Errors

When I encounter this error
[ERROR] ApplicationCommandRegistries(BulkOverwrite) Failed to overwrite guild application commands for guild 1********* DiscordAPIError[50001]: Missing Access
[ERROR] ApplicationCommandRegistries(BulkOverwrite) Failed to overwrite guild application commands for guild 1********* DiscordAPIError[50001]: Missing Access
I want to be able to capture this error and take an action. In this case update my record of guilds to remove the inaccessible guild. I've tried to capture the errors using the error event listener as well as one on commandApplicationCommandRegistryError however neither seems to be called when this error occurs. What is the recommended way to listen for these BulkOverwrite error events? Example listeners which are never called:
import { ApplyOptions } from '@sapphire/decorators';
import { Listener, Events, Command } from '@sapphire/framework';

@ApplyOptions<Listener.Options>({
event: Events.CommandApplicationCommandRegistryError,
})
export class ApplicationRegistryError extends Listener<
typeof Events.CommandApplicationCommandRegistryError
> {
public run(error: unknown, command: Command) {
console.error('caught registry error');
console.error(error);
}
}
import { ApplyOptions } from '@sapphire/decorators';
import { Listener, Events, Command } from '@sapphire/framework';

@ApplyOptions<Listener.Options>({
event: Events.CommandApplicationCommandRegistryError,
})
export class ApplicationRegistryError extends Listener<
typeof Events.CommandApplicationCommandRegistryError
> {
public run(error: unknown, command: Command) {
console.error('caught registry error');
console.error(error);
}
}
import { Events, Listener } from '@sapphire/framework';
import { ApplyOptions } from '@sapphire/decorators';


@ApplyOptions<Listener.Options>({
event: Events.Error,
})
export class ErrorListener extends Listener {
public run(error: Error) {
console.error('captured error');
console.error(error);
}
}
import { Events, Listener } from '@sapphire/framework';
import { ApplyOptions } from '@sapphire/decorators';


@ApplyOptions<Listener.Options>({
event: Events.Error,
})
export class ErrorListener extends Listener {
public run(error: Error) {
console.error('captured error');
console.error(error);
}
}
F
Favna403d ago
@A Vladdy
V
vladdy403d ago
Did I do a dumb and forgot to handle this? Yes, yes i did I made it just log Thx for the report, I'll have a pr to add this to an event hopefully this week
K
kyle13403d ago
Thanks @Vladdy appreciate the response and fast turnaround!
V
vladdy401d ago
@kyle13 I've opened https://github.com/sapphiredev/framework/pull/622, should work, you can install the packed version and test it out sometime Prayge
K
kyle13396d ago
@A Vladdy the code fix looks like it will solve the issue. I'm just not sure how to "install the packed version" to test it out. I tried checking out the branch, building it and using npm link, but it seems like it can't resolve the types for my project when used that way. Any advice on how to install and test out your fix? Also is there a timeline on when this would be added to a release? Thanks so much for your help!
V
vladdy396d ago
we packed the release for you oh shit @Favna this is badd Im gonna try a rerun
F
Favna396d ago
sup? what happened?
V
vladdy396d ago
sapphire pack never finished wait it did it never responded tho
F
Favna396d ago
you have to run npm run prepack when you want to link otherwise it doesnt build a proper bundle
V
vladdy396d ago
@sapphire/framework@4.2.3-pr-622.23bda1a.0
F
Favna396d ago
npm i @sapphire/framework@pr-622
npm i @sapphire/framework@pr-622
anyway yeah I noticed that before as well I need to look into it I guess @A Vladdy can you create a GH issue on the repo and assign me so I dont forget? sapphiredev/sapphiredev
V
vladdy396d ago
on it
F
Favna396d ago
tyvm
V
vladdy396d ago
mf disabled issues 🤡
F
Favna396d ago
what 🤡
K
kyle13396d ago
Thank you @Vladdy and @Favna for your outstanding support! I was able to download the test version and verify adding a listener lets me capture the bulk overwrite errors perfectly. I'll go ahead and mark this request as solved.
@ApplyOptions<Listener.Options>({
event: Events.ApplicationCommandRegistriesBulkOverwriteError,
})
export class ApplicationRegistryError extends Listener<
typeof Events.ApplicationCommandRegistriesBulkOverwriteError
> {
public run(error: unknown, guildId: string) {
logger.error('caught bulk registry error', { guildId, error });
}
}
@ApplyOptions<Listener.Options>({
event: Events.ApplicationCommandRegistriesBulkOverwriteError,
})
export class ApplicationRegistryError extends Listener<
typeof Events.ApplicationCommandRegistriesBulkOverwriteError
> {
public run(error: unknown, guildId: string) {
logger.error('caught bulk registry error', { guildId, error });
}
}
Want results from more Discord servers?
Add your server
More Posts
Events for VoiceHow can I do something like the following but for voice? ``` import { Listener } from '@sapphire/frHow do I use autocompleteRun on subcommands?^ As the title says. I can't seem to figure out how subcommands can have autocompleteRun implementedMessage editing fails even though message can be fetchedWhenever I want to edit an ephemeral message I get the following error: ```js [ERROR] Encountered erProblem with ephemeral messagesI currently have a command which sends a button, problem is, once the button is pressed, I can't remIs recommend have split autocomplete handlersI want know is recommend have split handler such as characterAutocomplete & itemsAutocomplete.Error serverHow can I solve this error ? ``` Error [ERR_SERVER_ALREADY_LISTEN]: Listen method has been called mQuick question regarding application descriptionsHow does one link an application command in the description of an app? Looks like a mention syntax, What typescript version to use?Since the most recent announcement in #Announcements recommends that I should not use typescript verHow to get subcommand name from interaction object?I ~~am~~ will be having multiple commands which have their own sub commands (3 sub command per parenHow do I listen for reactions on all messages in a channel?doing discord bot dev after a long time. i wanted to listen for message reactions on every message iMessageCreate Event isn't workingThis is the first listener Im creating I've read the documentation 50 times imo and checked out the How big is the difference between xyz.cache.get() and await xzy.fetch()?fetch returns the cached thing aswell if it exists, so except the Promise difference i see not reallNOT WORK SAPPHIREwhy not work bot commands?Throwing on unhandled interactionHey, I just wanted to quickly check this idea - If I assign a listener to interaction create and theReply During CooldownCan I make the bot reply with the remaining time of cooldown delay ?messageUpdate event not Triggering```ts import { Listener } from '@sapphire/framework'; import type { Message } from 'discord.js'; exp'"discord.js"' has no exported member named 'WebhookEditMessageOptions'. Did you mean 'WebhookFetchMError: '"discord.js"' has no exported member named 'WebhookEditMessageOptions'. Did you mean 'WebhooMonoreposDoes Sapphire work and play nice with monorepos?Question regarding slash commands / aliasesHi, is there a way for me to register command aliases as slash commands as well? For example: Commandisable commands by dashboard.I want to disable commands through dashboard so, is there any way to dynamically disable commands ?