Skip to content

Commit

Permalink
fix(giveaway): host member is undefined on giveaway start (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
shadowplay1 authored Oct 28, 2023
2 parents 5264f03 + 63e0080 commit ace68d3
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/Giveaways.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<true>(
giveawayTemplate as any,
this.client.users.cache.get(hostMemberID) as User
giveawayTemplate as any,
hostMember
) : {}

const startEmbedStrings = definedEmbedStrings?.start || {}
Expand Down

0 comments on commit ace68d3

Please sign in to comment.