Skip to content

Commit

Permalink
fix: webhook reply
Browse files Browse the repository at this point in the history
  • Loading branch information
louiszn committed Oct 16, 2024
1 parent a964a5f commit 007ad7f
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions src/events/modules/Goji.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,13 @@ export default class extends Listener {
return;
}

let webhook = (await (channel as TextChannel).fetchWebhooks()).find(
(w) => w.owner?.id === client.user.id && w.name === "GojiHook"
);

if (!webhook) {
webhook = await (channel as TextChannel).createWebhook({
name: "GojiHook",
avatar: client.user.displayAvatarURL(),
});
}

await message.delete().catch(() => void 0);

const webhook = await (channel as TextChannel).createWebhook({
name: "GojiHook",
avatar: client.user.displayAvatarURL(),
});

let content = "";

if (message.reference?.messageId) {
Expand Down Expand Up @@ -71,5 +65,7 @@ export default class extends Listener {
avatarURL: goji.avatarURL || void 0,
content,
});

await webhook.delete().catch(() => null);
}
}

0 comments on commit 007ad7f

Please sign in to comment.