alihsaas

Untitled

May 1st, 2020
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. require('dotenv').config()
  2.  
  3. //modules
  4.  
  5. const {Client} = require("discord.js");
  6. const Commands = require("./Modules/commands.js");
  7.  
  8. //variables
  9.  
  10. const bot = new Client();
  11. const prefix = process.env.PREFIX;
  12. const commandsIns = new Commands()
  13.  
  14. //events
  15.  
  16. bot.on("ready", async () => {
  17.   console.log(bot.user.tag, "is up and running! ✔😀🎉");
  18. });
  19.  
  20. bot.on("message", (message) => {
  21.   let content = message.content
  22.   if (content.startsWith(prefix)) {
  23.     args = content.toLowerCase().trim().split(" ");
  24.     let command = args.shift().slice(prefix.length);
  25.     console.log(commandsIns[command])
  26.     if (commandsIns[command]) {
  27.       let {content,possibleAttachment} = commandsIns[command](args,message);
  28.       message.reply(content,possibleAttachment);
  29.     }
  30.   }
  31. });
  32.  
  33. bot.login(process.env.TOKEN);
Add Comment
Please, Sign In to add comment