Advertisement
Guest User

Untitled

a guest
Sep 15th, 2019
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.32 KB | None | 0 0
  1. const Discord = require('discord.js');
  2.  
  3.  
  4.  
  5. const PREFIX = 'e?';
  6.  
  7.  
  8. const fs = require("fs");
  9.  
  10.  
  11. const botconfig = require("./botconfig.json");
  12.  
  13.  
  14. const bot = new Discord.Client({disableEveryone: true});
  15.  
  16.  
  17. bot.commands = new Discord.Collection();
  18.  
  19.  
  20. const token = 'NjIyMzU4OTY1NzU3NjczNDcy.XX4UZg.cj8uJezQIUmdg7LksPEUOHRDLD4';
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28. bot.on('ready', () => {
  29. console.log('Ionel e pe zona!');
  30. bot.user.setActivity("e?help | with DublinBOT", { type: "WATCHING" });
  31. bot.user.setStatus('Do Not Disturb')
  32. })
  33.  
  34.  
  35. fs.readdir("./commands/", (err, files) => {
  36. if(err) console.log(err);
  37.  
  38. let jsfile = files.filter(f => f.split(".").pop() === "js")
  39. if(jsfile <= 0){
  40. console.log("Commands not found");
  41. return;
  42. };
  43.  
  44. jsfile.forEach((f, i) =>{
  45. let props = require(`./commands/${f}`);
  46. console.log(`${f} loaded!`);
  47. bot.commands.set(props.help.name, props);
  48. })
  49. })
  50.  
  51. bot.on('message', async message =>{
  52.  
  53. if(message.author.bot) return;
  54. if(message.channel.type === "dm") return;
  55.  
  56. let prefix = botconfig.prefix;
  57. let messageArray = message.content.split(" ");
  58. let cmd = messageArray[0];
  59. let args = messageArray.slice(1);
  60. let commandfile = bot.commands.get(cmd.slice(prefix.length));
  61. if(commandfile) commandfile.run(bot,message,args);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement