This repository has been archived on 2026-03-28. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
legacy-musicbot/events/message.js
2020-08-11 22:47:38 +02:00

28 lines
772 B
JavaScript

const config = require(`../config/bot.json`)
module.exports = (client, message) => {
//Ignore all bots
if (message.author.bot) return;
//Prefix
let prefix = config.prefix
//Ignore messages not starting with the prefix (in config.json)
if (message.content.indexOf(prefix) !== 0) return;
//Our standard argument/command name definition.
const args = message.content.slice(prefix.length).trim().split(/ +/g);
const command = args.shift().toLowerCase();
//Grab the command data from the client.commands (Discord collection)
const cmd = client.commands.get(command);
//If that command doesn't exist, silently exit and do nothing
if (!cmd) return;
//Run the command
cmd.run(client, message, args);
};