const Discord = require('discord.js'); const client = new Discord.Client(); const config = require('./config.json'); const emoji = require('emoji-random'); client.once('ready', () => { console.log(`Started bot: ${client.user.tag} (ID: ${client.user.id})\nCurrently running on ${client.guilds.cache.size} server(s).`); client.user.setActivity('with my squeaky toy :D', { type: 'PLAYING' }); }); client.on('error', console.error); client.on('message', async msg => { const upTime = require('moment'); require('moment-duration-format'); const duration = upTime.duration(client.uptime).format(" D [days], H [hrs], m [mins], s [secs]"); function prefixCheck() { if (msg.content.startsWith(config.prefix)) return true; } if (prefixCheck()) { console.log(msg.member.user.tag, 'says', msg.content.toLowerCase(), 'in #' + msg.channel.name); var args = msg.content.slice(config.prefix.length).split(/ +/); var cmd = args.shift().toLowerCase(); } if (cmd == 'ping' || cmd == 'ms' || cmd == 'p') { const t = Date.now(); msg.channel.send('plz wait..').then(m => { m.edit(`** **`); const n = Date.now(); let emb = new Discord.MessageEmbed() .setDescription(`bork! chesters's is \`${n - t}ms\`. heartbeat \`${client.ws.ping}ms\`. ` + emoji.random()) .setColor(0xFFE4BA); msg.channel.send(emb); }); } if (cmd == 'say' || cmd == 's') { if (msg.member.hasPermission('KICK_MEMBERS')) { m = args.join(' '); msg.channel.send(m); msg.delete(); } } if (cmd == 'leave' || cmd == 'l') { if (msg.guild.voice) { msg.guild.voice.disconnect(); msg.reply('succesfully left voice channel ' + emoji.random()); } else { msg.reply('i\'m not in a voice channel ' + emoji.random()); } } if (cmd == 'join' || cmd == 'j') { if (!msg.guild.voice && msg.member.voice.channel) { msg.member.voice.channel.join(); msg.reply('succesfully joined voice channel ' + emoji.random()); } else if (msg.guild.voice) { msg.reply('i\'m already in voice channel ' + emoji.random()); } else if (!msg.member.voice.channel) { msg.reply('you\'re not in a voice channel ' + emoji.random()); } } if (msg.mentions.everyone) { msg.react(':ArisaPing:695887537390223402'); } if (msg.content == 'dog' || msg.content == 'dogs' || msg.content == 'bark' || msg.content == 'bork' || msg.content == 'woof' || msg.content == 'mutt') { var borkNum = Math.floor((Math.random() * 3) + 1); var specialBork = Math.floor((Math.random() * 10) + 1); var specialBorkCheck = Math.floor((Math.random() * 10) + 1); if (specialBork == specialBorkCheck) { msg.reply('you got the special bork, this was a 1 in 100 chance of getting ' + emoji.random()); } else { if (borkNum == 1) { msg.reply('bork ' + emoji.random()); } else if (borkNum == 2) { msg.reply('bark ' + emoji.random()); } else if (borkNum == 3) { msg.reply('woof ' + emoji.random()); } } } if (cmd == 'uptime' || cmd == 'ut') { msg.reply(duration + ' ' + emoji.random()); } }); client.login(config['secret']);