Handle Crash on DiscordAPIError[50001]: Missing Access

The scenario that causes this crash is the bot tries sending a message to a channel it doesn't have access to. Now I can solve this issue by checking it has permissions before hand or catching directly on the send, but my question is, is there a way to keep the bot from crashing if I miss a check at some other point? I do have an error.ts listener set up but doesn't seem to be making a difference.
/Users/x/Work/bot/node_modules/@discordjs/rest/dist/index.js:667
throw new DiscordAPIError(data, "code" in data ? data.code : data.error, status, method, url, requestData);
^

DiscordAPIError[50001]: Missing Access
/Users/x/Work/bot/node_modules/@discordjs/rest/dist/index.js:667
throw new DiscordAPIError(data, "code" in data ? data.code : data.error, status, method, url, requestData);
^

DiscordAPIError[50001]: Missing Access
error.ts
import { ApplyOptions } from '@sapphire/decorators';
import { Events, Listener } from '@sapphire/framework';

@ApplyOptions<Listener.Options>({
event: Events.Error,
name: 'Error'
})
export class UserEvent extends Listener {

public run(error: Error) {

const { logger } = this.container;
logger.error(error);

return;
}

}
import { ApplyOptions } from '@sapphire/decorators';
import { Events, Listener } from '@sapphire/framework';

@ApplyOptions<Listener.Options>({
event: Events.Error,
name: 'Error'
})
export class UserEvent extends Listener {

public run(error: Error) {

const { logger } = this.container;
logger.error(error);

return;
}

}
Solution:
I figured it out so nvm it's because I wasn't awaiting on my send calls
Jump to solution
1 Reply
Solution
Ravelt
Ravelt2y ago
I figured it out so nvm it's because I wasn't awaiting on my send calls
Want results from more Discord servers?
Add your server