Skip to content
Snippets Groups Projects
Commit 161c4e73 authored by Levatax's avatar Levatax
Browse files

Added message event

parent 66c192d7
No related branches found
No related tags found
No related merge requests found
Pipeline #67 canceled
module.exports = {
message: (bot, settings, discord) => {
bot.on('message', async message => {
if (message.author.bot) return;
if (message.channel.type === "dm") return;
let prefix = settings.prefix;
let args = message.content.slice(prefix.length).trim().split(' ');
let cmd = args.shift().toLowerCase();
let command;
if (!message.content.startsWith(settings.prefix)) return;
if (bot.commands.has(cmd)) {
command = bot.commands.get(cmd);
} else if (bot.aliases.has(cmd)) {
command = bot.commands.get(bot.aliases.get(cmd));
}
try {
command.run(bot, message, args);
} catch (err) {
if (err) return undefined;
}
});
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment