2020-12-18 13:37:56 +00:00
// SupportBot 6.0, Created by Emerald Services
2020-06-15 23:58:37 +01:00
// Message Event
const Discord = require ( "discord.js" );
const fs = require ( "fs" );
const yaml = require ( 'js-yaml' );
const supportbot = yaml . load ( fs . readFileSync ( './supportbot-config.yml' , 'utf8' ));
module . exports = async ( bot , message ) => {
if ( message . author . bot ) return ;
if ( message . channel . type === "dm" ) return ;
if ( message . content . indexOf ( supportbot . Prefix ) !== 0 ) return ;
let messageArray = message . content . split ( " " );
const args = message . content . slice ( supportbot . Prefix . length ). trim (). split ( / +/g );
const command = args . shift (). toLowerCase ();
2021-06-15 18:09:06 +01:00
console . log ( `\u001b[32m` , `[ ${ supportbot . Bot_Name } ]` , `\u001b[36m` , ` ${ message . author . tag } ` , `\u001b[33m` , `has executed the command` , `\u001b[36m` , ` ${ supportbot . Prefix }${ command } ` )
2020-06-15 23:58:37 +01:00
const cmd = bot . commands . get ( command );
if ( ! cmd ) return ;
cmd . execute ( message , args );
2020-07-27 10:39:25 -04:00
};