diff --git a/src/events/modules/Goji.ts b/src/events/modules/Goji.ts index 2b90c6b..7e498ed 100644 --- a/src/events/modules/Goji.ts +++ b/src/events/modules/Goji.ts @@ -23,10 +23,16 @@ export default class extends Listener { await message.delete().catch(() => void 0); - const webhook = await (channel as TextChannel).createWebhook({ - name: "GojiHook", - avatar: client.user.displayAvatarURL(), - }); + 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(), + }); + } let content = ""; @@ -54,7 +60,7 @@ export default class extends Listener { displayContent += "..."; } - content += `${submark} <@${repliedMessage.author.id}> - ${displayContent} [Nhảy tới tin nhắn](${repliedMessage.url})\n`; + content += `${submark} **${repliedMessage.author.username}** - ${displayContent} [Nhảy tới tin nhắn](${repliedMessage.url})\n`; } } @@ -65,7 +71,5 @@ export default class extends Listener { avatarURL: goji.avatarURL || void 0, content, }); - - await webhook.delete().catch(() => null); } }