diff options
Diffstat (limited to 'app.js')
| -rw-r--r-- | app.js | 88 |
1 files changed, 88 insertions, 0 deletions
@@ -0,0 +1,88 @@ +const Discord = require('discord.js'); +const client = new Discord.Client(); +const config = require('./config.json'); +const emoji = require('emoji-random'); +const { MessageEmbed } = require('discord.js'); + +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('anime | uwu!h', { + type: 'WATCHING' + }); +}); + +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; } + var msgContent = msg.content.toLowerCase(); + if (prefixCheck()) { + if (msg.channel.type == 'dm') { + console.log(msg.author.tag, 'says', msgContent, 'in a DM'); + } else { + console.log(msg.member.user.tag, 'says', msgContent, 'in #' + msg.channel.name + ' in ' + msg.guild.name); + } + + var args = msg.content.slice(config.prefix.length).split(/ +/); + var cmd = args.shift().toLowerCase(); + } + + if (cmd == 'ping' || cmd == 'ms') { + const t = Date.now(); + + msg.channel.send('plz wait..').then(m => { + m.edit(`** **`); + + const n = Date.now(); + + let emb = new MessageEmbed() + .setDescription(`pong! uwufier's ping is \`${n - t}ms\`. heartbeat \`${client.ws.ping}ms\`. ` + emoji.random()) + .setColor(0xFFCC4D) + .setFooter('Bot developed and administrated by sin#1337.'); + + msg.channel.send(emb); + }); + } + + else if (cmd == 'help' || cmd == 'h') { + let embed = new MessageEmbed() + .setColor(0xFFCC4D) + .setTitle('uwufier - Help') + .addField('Normal Commands', '**uwu!ping** - Grabs the bot\'s current ping to server.\n**uwu!uwufy/uwu/owofy/owo** - uwufys anything you send\n**uwu!uptime/ut** - Grabs the bot\'s uptime.') + .addField('Additional Information', 'If you noticied any issues or have any ideas with/ for the bot, don\'t hesitiate to DM me on Discord @ <@217348698294714370>.\nIf you want to become a collaborator, you can also send me a DM via my Discord.') + .setFooter('Bot developed and administrated by sin#1337.'); + msg.channel.send(embed); + } + + else if (cmd == 'uwufy' || cmd == 'uwu' || cmd == 'owofy' || cmd == 'owo') { + var m = args.join(' '); + var u1 = m.replace('r', 'w'); + var u2 = u1.replace('l', 'w'); + msg.reply(u2); + msg.delete(); + } + + else if(cmd == 'uptime' || cmd == 'ut') { + msg.channel.send('plz wait..').then(m => { + m.edit(`** **`); + + let emb = new MessageEmbed() + .setDescription('uwufier\'s uptime is ' + duration + '. ' + emoji.random()) + .setColor(0xFFCC4D) + .setFooter('Bot developed and administrated by sin#1337.'); + + msg.channel.send(emb); + }); + } + + else if (prefixCheck()) { + msg.reply('sowwy... :point_right: :point_left: :flushed: ... but thats not actually a command...'); + msg.channel.send('if u want to see the commands that work, then do `uwu!h` ' + emoji.random()); + } +}); + +client.login(config['secret']);
\ No newline at end of file |