Skip to content

Commit

Permalink
🐛 Fix webhook author errors
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcusOtter committed Mar 29, 2023
1 parent 2566cb1 commit 4a44980
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/models/MessageVariables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,14 @@ export default class MessageVariables {
public async replace(input: string): Promise<string> {
if (input.length === 0) return "";

const threadUser = this.thread && (await getThreadAuthor(this.thread));
const threadMember = this.thread && threadUser && (await this.thread.members.fetch(threadUser.id));
let threadUser = undefined;
let threadMember = undefined;
try {
threadUser = this.thread && (await getThreadAuthor(this.thread));
threadMember = this.thread && threadUser && (await this.thread.members.fetch(threadUser.id));
} catch {
/* we don't care, undefined is handled below */
}

const user = this.user instanceof GuildMember ? this.user.user : this.user;
const userName = user?.username ?? "";
Expand Down

0 comments on commit 4a44980

Please sign in to comment.