From 63e0080a08fe37e600a9a6ed5695aeed1e652ddd Mon Sep 17 00:00:00 2001 From: HuhRyan <59122836+zimzika@users.noreply.github.com> Date: Thu, 26 Oct 2023 17:40:07 -0300 Subject: [PATCH] fix host member undefined on start new giveaway --- src/Giveaways.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/Giveaways.ts b/src/Giveaways.ts index 0b08ff6..e2fea11 100644 --- a/src/Giveaways.ts +++ b/src/Giveaways.ts @@ -741,9 +741,17 @@ export class Giveaways< isEnded: false } + const hostMember = await this.client.users.fetch(hostMemberID).catch(console.error) as User; + if (!hostMember) { + throw new GiveawaysError( + errorMessages.USER_NOT_FOUND(hostMemberID), + GiveawaysErrorCodes.USER_NOT_FOUND + ); + } + const definedEmbedStrings = defineEmbedStrings ? defineEmbedStrings( - giveawayTemplate as any, - this.client.users.cache.get(hostMemberID) as User + giveawayTemplate as any, + hostMember ) : {} const startEmbedStrings = definedEmbedStrings?.start || {}