generated from Baipyrus/DiscordJS-Template
scan each word with and without symbols
This commit is contained in:
parent
194a3d89ab
commit
6ec1892a80
@ -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[]} */
|
||||
|
Loading…
Reference in New Issue
Block a user