RavenBot/events/message.js

16 lines
568 B
JavaScript
Raw Normal View History

2021-04-23 15:20:48 -04:00
const Discord = require("discord.js");
require('dotenv').config()
const functions = require("../functions/functions.js");
module.exports = async (bot, message) => {
let prefix = process.env.PREFIX;
const args = message.content.split(/ +/g);
const command = args.shift().slice(prefix.length).toLowerCase();
const cmd = bot.commands.get(command) || bot.aliases.get(command);
if(!message.content.toLowerCase().startsWith(prefix) || !message.guild || message.author.bot || !cmd) return;
cmd.run(bot, message, args, functions)
}