Skip to content
This repository was archived by the owner on Oct 9, 2025. It is now read-only.

Commit 2dadfaa

Browse files
authored
fix(goal): Fixed undefined leave messages
1 parent d5f02a8 commit 2dadfaa

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

src/Events/guildCreate.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,15 +71,15 @@ export default {
7171
await sendInFirst(guild, { embeds: [embed], components: [buttons] }).catch(() => null);
7272
}
7373

74-
const goalChannel = guild.client.channels.cache.get(constants.channel.goal) as TextChannel;
74+
const goalChannel = guild.client.channels.cache.get(constants.channel.goal) as TextChannel | undefined;
7575
const guildOwner = await guild.fetchOwner();
7676

77-
goalChannel.send({
77+
goalChannel?.send({
7878
embeds: [
7979
new EmbedBuilder()
8080
.setTitle('I have joined a new server! 🙌')
8181
.setDescription(stripIndents`
82-
**${800 - guild.client.guilds.cache.size}** servers more to go! ${tada}
82+
**${900 - guild.client.guilds.cache.size}** servers more to go! ${tada}
8383
8484
**Server Name:** ${guild.name} (${guild.id})
8585
**Owner:** ${guildOwner.user.tag} (${guildOwner?.id})

src/Events/guildDelete.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,19 @@ import { captureException } from '@sentry/node';
88
export default {
99
name: 'guildDelete',
1010
async execute(guild: Guild) {
11+
if (!guild.available) return;
1112
const database = getDb();
1213
await database.setup.deleteMany({ where: { guildId: guild.id } });
1314
disconnect({ serverId: guild.id });
1415

15-
const goalChannel = guild.client.channels.cache.get(constants.channel.goal) as TextChannel;
16+
const goalChannel = guild.client.channels.cache.get(constants.channel.goal) as TextChannel | undefined;
1617

17-
goalChannel.send({
18+
goalChannel?.send({
1819
embeds: [
1920
new EmbedBuilder()
2021
.setTitle('I have been kicked from a server 😢')
2122
.setDescription(stripIndents`
22-
**${800 - guild.client.guilds.cache.size}** servers more to go! 💪
23+
**${900 - guild.client.guilds.cache.size}** servers more to go! 💪
2324
2425
**Server Name:** ${guild.name} (${guild.id})
2526
**Member Count:** ${guild.memberCount}

0 commit comments

Comments
 (0)