-
Notifications
You must be signed in to change notification settings - Fork 85
Expand file tree
/
Copy pathOldmsg.js
More file actions
36 lines (31 loc) · 1.22 KB
/
Oldmsg.js
File metadata and controls
36 lines (31 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
const { commandHandler, automodHandler, statsHandler } = require("@src/handlers");
const { PREFIX_COMMANDS } = require("@root/config");
const { getSettings } = require("@schemas/Guild");
/**
* @param {import('@src/structures').BotClient} client
* @param {import('discord.js').Message} message
*/
module.exports = async (client, message) => {
if (!message.guild || message.author.bot) return;
const settings = await getSettings(message.guild);
// command handler
let isCommand = false;
if (PREFIX_COMMANDS.ENABLED) {
// check for bot mentions
if (message.content.includes(`${client.user.id}`)) {
message.channel.safeSend(`> My prefix is \`${settings.prefix}\``);
}
if (message.content && message.content.startsWith(settings.prefix)) {
const invoke = message.content.replace(`${settings.prefix}`, "").split(/\s+/)[0];
const cmd = client.getCommand(invoke);
if (cmd) {
isCommand = true;
commandHandler.handlePrefixCommand(message, cmd, settings);
}
}
}
// stats handler
if (settings.stats.enabled) await statsHandler.trackMessageStats(message, isCommand, settings);
// if not a command
if (!isCommand) await automod Handler.performAutomod(message, settings);
};