generated from Baipyrus/DiscordJS-Template
Compare commits
No commits in common. "034beca51c3f102be28cc07ab60ef0744d2fe3c5" and "cbefb18dcdb3d7b511d8bbad88fcf289694b53fe" have entirely different histories.
034beca51c
...
cbefb18dcd
@ -5,18 +5,11 @@ import { Op } from 'sequelize';
|
||||
export const name = Events.MessageCreate;
|
||||
/** @param {Message} message */
|
||||
export async function execute(message) {
|
||||
// Ignore direct messages and own messages
|
||||
if (!message.inGuild() || message.author.id === process.env.CLIENT) return;
|
||||
// Ignore direct messages
|
||||
if (!message.inGuild()) return;
|
||||
|
||||
// Split message content into words
|
||||
const words = message.content
|
||||
.toLowerCase()
|
||||
.split(/\s+/)
|
||||
.flatMap((word) => {
|
||||
const without = word.replace(/[^\w\s]/g, '');
|
||||
return without !== word ? [word, without] : word;
|
||||
})
|
||||
.filter((w, i, a) => a.indexOf(w) === i);
|
||||
const words = message.content.split(/\s+/);
|
||||
|
||||
// Get guild keywords
|
||||
/** @type {import('../../models/keywords.js').Keyword[]} */
|
||||
|
Loading…
Reference in New Issue
Block a user