Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions src/events/guildDelete.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,16 @@ class GuildDelete extends Event {
}
}

await this.client.shard.broadcastEval(sendLoggedMessage, { context: { guild, emojis, iconURL: guild.iconURL(), ownerUsername: owner?.tag } });
// Fired on a ready shard during the spawn window, broadcastEval/setActivity
// throw ShardingInProcess; swallow it so a leave event can't crash the shard.
try {
await this.client.shard.broadcastEval(sendLoggedMessage, { context: { guild, emojis, iconURL: guild.iconURL(), ownerUsername: owner?.tag } });

log.info(`[GuildCreate] uwu bot LEFT a server: ${guild.name}`);
await this.client.setActivity();
log.info(`[GuildDelete] uwu bot LEFT a server: ${guild.name}`);
await this.client.setActivity();
} catch (error) {
log.error(`[GuildDelete] Error broadcasting leave event: ${error}`);
}

// Save to analytics.
try {
Expand Down