fix: don't expand message links for bots (#164)

Signed-off-by: PandaNinjas <admin@malwarefight.wip.la>
This commit is contained in:
PandaNinjas 2023-05-13 01:27:30 -04:00 committed by GitHub
parent 968e911ded
commit e5b85e454d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -20,6 +20,8 @@ function findFirstImage(message: Message): string | undefined {
} }
export async function expandDiscordLink(message: Message): Promise<void> { export async function expandDiscordLink(message: Message): Promise<void> {
if (message.author.bot && !message.author.webhookId) return;
const re = const re =
/(https?:\/\/)?(?:canary\.|ptb\.)?discord(?:app)?\.com\/channels\/(?<server_id>\d+)\/(?<channel_id>\d+)\/(?<message_id>\d+)/g; /(https?:\/\/)?(?:canary\.|ptb\.)?discord(?:app)?\.com\/channels\/(?<server_id>\d+)\/(?<channel_id>\d+)\/(?<message_id>\d+)/g;