From 646f08ae4a8ec9f4264fe361f3b671324ff20581 Mon Sep 17 00:00:00 2001 From: Anri Date: Fri, 20 Jan 2023 03:43:54 +0100 Subject: [PATCH] fix: quotes not working (#60) - add intent - fix regex edited by prettier Co-authored-by: Mylloon Reviewed-on: https://git.kennel.ml/ConfrerieDuKassoulait/Botanique/pulls/60 --- src/events/message/messageCreate.ts | 2 +- src/utils/client.ts | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/events/message/messageCreate.ts b/src/events/message/messageCreate.ts index 4e0b97a..5322979 100644 --- a/src/events/message/messageCreate.ts +++ b/src/events/message/messageCreate.ts @@ -23,7 +23,7 @@ export default async (message: Message, client: Client) => { /* Citation */ const regex = - "https://(?:canary\\.|ptb\\.)?discord(?:app)?\\.com/channels/(\\d{17,19})/(\\d{17,19})/(\\d{17,19})"; + /https:\/\/(?:canary\.|ptb\.)?discord(?:app)?\.com\/channels\/(\d{17,19})\/(\d{17,19})\/(\d{17,19})/g; const urls = message.content.match(new RegExp(regex, "g")); // Ignore message if there is no URLs diff --git a/src/utils/client.ts b/src/utils/client.ts index 448b882..870bd3d 100644 --- a/src/utils/client.ts +++ b/src/utils/client.ts @@ -7,7 +7,11 @@ import { Database } from "sqlite3"; /** Creation of the client and definition of its properties. */ export default async () => { const client: Client = new Client({ - intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages], + intents: [ + GatewayIntentBits.Guilds, + GatewayIntentBits.GuildMessages, + GatewayIntentBits.MessageContent, + ], }); client.config = {