Skip to content

Commit

Permalink
fix: mention?
Browse files Browse the repository at this point in the history
  • Loading branch information
louiszn committed Oct 16, 2024
1 parent 007ad7f commit b965393
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions src/events/modules/Goji.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "";

Expand Down Expand Up @@ -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`;
}
}

Expand All @@ -65,7 +71,5 @@ export default class extends Listener {
avatarURL: goji.avatarURL || void 0,
content,
});

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

0 comments on commit b965393

Please sign in to comment.