Advertisement
AmeliaLotus

main.js

Jan 21st, 2021
1,780
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //Uses the discord javascript!
  2. const Discord = require('discord.js');
  3.  
  4. //Sets up the bot client
  5. const client = new Discord.Client();
  6.  
  7. //Sets up the prefix for the bot!
  8. const prefix = '-';
  9.  
  10. //Creates a require, for us to be able to get into other javascript files
  11. const fs = require('fs');
  12.  
  13. //This creates a collection where we can store all of our commands (if you use TONS, this is ideal)
  14. client.commands = new Discord.Collection();
  15.  
  16. //Makes sure all of the files you're gonna read is, in fact, javascript! Make a "commands" folder first!
  17. const commandFiles = fs.readdirSync('./commands/').filter(file => file.endsWith('.js'));
  18.  
  19. // ---------------------------------End Const's------------------------------------------- \\
  20.  
  21. //For the joke contest
  22. //use 784888072328314930 for muklukLUL
  23. //var reactionID='784888072328314930';
  24. var reactionID = '🤣';
  25. const identifier = client.emojis.resolveIdentifier('784888072328314930');
  26.  
  27. //Read all files to make sure they're ready to use...
  28. for (const file of commandFiles) {
  29.     const command = require(`./commands/${file}`);
  30.     client.commands.set(command.name, command);
  31. }
  32.  
  33. client.once('ready', () => {
  34.     console.log('MuklukBot is Online');
  35. });
  36.  
  37. client.on('message', message => {
  38.     //auto-react
  39.     if (message.channel.type == "text" && message.channel.name.toLowerCase() == "joke-contest") {
  40.         message.react('🤣');
  41.     }
  42.  
  43.     //If the message has the prefix, read the message, and the author...
  44.     if (!message.content.startsWith(prefix) || message.author.bot) return;
  45.  
  46.     const args = message.content.slice(prefix.length).split(/ +/);
  47.     const command = args.shift().toLowerCase();
  48.  
  49.     if (command === 'ping') {
  50.         client.commands.get('ping').execute(message, args);
  51.         //console.log('MuklukBot uses ping');
  52.     } else if (command === 'clear') {
  53.         client.commands.get('clear').execute(message, args);
  54.         //console.log('MuklukBot uses clear');
  55.     } else if (command === 'counter') {
  56.         client.commands.get('counter').execute(message, args);
  57.         //console.log('MuklukBot uses counter');
  58.     } else if (command === 'reactcount') {
  59.         client.commands.get('reactCount').execute(message, args);
  60.     }
  61. }) //end of client ON. Keep client.login OUTSIDE of this code (preferably below this line)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement