scan each word with and without symbols

This commit is contained in:
Baipyrus 2024-04-10 07:57:25 +02:00
parent 194a3d89ab
commit 6ec1892a80

View File

@ -9,7 +9,13 @@ export async function execute(message) {
if (!message.inGuild() || message.author.id === process.env.CLIENT) return;
// Split message content into words
const words = message.content.toLowerCase().split(/\s+/);
const words = message.content
.toLowerCase()
.split(/\s+/)
.flatMap((word) => {
const without = word.replace(/[^\w\s]/g, '');
return without !== word ? [word, without] : word;
});
// Get guild keywords
/** @type {import('../../models/keywords.js').Keyword[]} */