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;
|
export const name = Events.MessageCreate;
|
||||||
/** @param {Message} message */
|
/** @param {Message} message */
|
||||||
export async function execute(message) {
|
export async function execute(message) {
|
||||||
// Ignore direct messages and own messages
|
// Ignore direct messages
|
||||||
if (!message.inGuild() || message.author.id === process.env.CLIENT) return;
|
if (!message.inGuild()) return;
|
||||||
|
|
||||||
// Split message content into words
|
// Split message content into words
|
||||||
const words = message.content
|
const words = message.content.split(/\s+/);
|
||||||
.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);
|
|
||||||
|
|
||||||
// Get guild keywords
|
// Get guild keywords
|
||||||
/** @type {import('../../models/keywords.js').Keyword[]} */
|
/** @type {import('../../models/keywords.js').Keyword[]} */
|
||||||
|
Loading…
Reference in New Issue
Block a user