From 2a9a46e781c9296735978dffd42a0e18cec67e30 Mon Sep 17 00:00:00 2001 From: Matthias Guillitte Date: Wed, 31 Jul 2024 17:04:11 +0200 Subject: [PATCH] Stop thinking markdown link are commands --- events/guild/messageCreate.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/events/guild/messageCreate.js b/events/guild/messageCreate.js index 45c6f88..5aea9d4 100755 --- a/events/guild/messageCreate.js +++ b/events/guild/messageCreate.js @@ -27,6 +27,11 @@ module.exports = async (client, message) => { if (prefixRegex.test(message.content)) { //now define the right prefix either ping or not ping const [, matchedPrefix] = message.content.match(prefixRegex); + // If the used prefix is "[" we check if it is not juste a use of "[some text]" + if (matchedPrefix == prefix) { + const closingBrace = new RegExp(/^(?:\[[^\[\]]*\])/); + if (closingBrace.test(message.content)) return; + } //create the arguments with slicing of of the right prefix length const args = message.content.slice(matchedPrefix.length).trim().split(/ +/); //creating the cmd argument by shifting the args by 1