From a3e5d472120db18fe03f044ad28d4eb0be0a47ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nguy=E1=BB=85n=20Ti=E1=BA=BFn=20=C4=90=E1=BA=A1t?= Date: Wed, 23 Oct 2024 06:38:53 +0700 Subject: [PATCH] fix: finding invite data --- src/events/guild/member/GuildMemberAdd.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/events/guild/member/GuildMemberAdd.ts b/src/events/guild/member/GuildMemberAdd.ts index 0846900..6dff54e 100644 --- a/src/events/guild/member/GuildMemberAdd.ts +++ b/src/events/guild/member/GuildMemberAdd.ts @@ -47,7 +47,10 @@ class GuildMemberAdd extends Listener { .filter((_, key) => key !== member.guild.id) .find((previousInvite, key) => { code = key; - return currentGuildInvites.get(key)!.uses! > previousInvite.uses!; + const uses = currentGuildInvites.get(key)?.uses; + if (uses && previousInvite.uses) { + return uses > previousInvite.uses; + } }); if (!usedInvite && member.guild.vanityURLCode) {