fix(arabot): catch conditions for fetching guild and user

This commit is contained in:
Anthony 2024-01-27 19:41:22 +01:00
parent cf8142b86a
commit 5793bbb461

View File

@ -32,7 +32,7 @@ export class VerifyUnblock extends ScheduledTask {
// Get the guild where the user is in // Get the guild where the user is in
let guild = this.container.client.guilds.cache.get(payload.guildId); let guild = this.container.client.guilds.cache.get(payload.guildId);
if (guild === undefined) { if (guild === undefined) {
guild = await this.container.client.guilds.fetch(payload.guildId); guild = await this.container.client.guilds.fetch(payload.guildId).catch(() => undefined);
if (guild === undefined) { if (guild === undefined) {
this.container.logger.error('verifyUnblock: Guild not found!'); this.container.logger.error('verifyUnblock: Guild not found!');
return; return;
@ -42,7 +42,7 @@ export class VerifyUnblock extends ScheduledTask {
// Find GuildMember for the user // Find GuildMember for the user
let user = guild.members.cache.get(payload.userId); let user = guild.members.cache.get(payload.userId);
if (user === undefined) { if (user === undefined) {
user = await guild.members.fetch(payload.userId).catch(undefined); user = await guild.members.fetch(payload.userId).catch(() => undefined);
if (user === undefined) { if (user === undefined) {
this.container.logger.error('verifyUnblock: GuildMember not found!'); this.container.logger.error('verifyUnblock: GuildMember not found!');
return; return;