Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Uses the discord javascript!
- const Discord = require('discord.js');
- //Sets up the bot client
- const client = new Discord.Client();
- //Sets up the prefix for the bot!
- const prefix = '-';
- //Creates a require, for us to be able to get into other javascript files
- const fs = require('fs');
- //This creates a collection where we can store all of our commands (if you use TONS, this is ideal)
- client.commands = new Discord.Collection();
- //Makes sure all of the files you're gonna read is, in fact, javascript! Make a "commands" folder first!
- const commandFiles = fs.readdirSync('./commands/').filter(file => file.endsWith('.js'));
- // ---------------------------------End Const's------------------------------------------- \\
- //For the joke contest
- //use 784888072328314930 for muklukLUL
- //var reactionID='784888072328314930';
- var reactionID = '🤣';
- const identifier = client.emojis.resolveIdentifier('784888072328314930');
- //Read all files to make sure they're ready to use...
- for (const file of commandFiles) {
- const command = require(`./commands/${file}`);
- client.commands.set(command.name, command);
- }
- client.once('ready', () => {
- console.log('MuklukBot is Online');
- });
- client.on('message', message => {
- //auto-react
- if (message.channel.type == "text" && message.channel.name.toLowerCase() == "joke-contest") {
- message.react('🤣');
- }
- //If the message has the prefix, read the message, and the author...
- if (!message.content.startsWith(prefix) || message.author.bot) return;
- const args = message.content.slice(prefix.length).split(/ +/);
- const command = args.shift().toLowerCase();
- if (command === 'ping') {
- client.commands.get('ping').execute(message, args);
- //console.log('MuklukBot uses ping');
- } else if (command === 'clear') {
- client.commands.get('clear').execute(message, args);
- //console.log('MuklukBot uses clear');
- } else if (command === 'counter') {
- client.commands.get('counter').execute(message, args);
- //console.log('MuklukBot uses counter');
- } else if (command === 'reactcount') {
- client.commands.get('reactCount').execute(message, args);
- }
- }) //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