summaryrefslogtreecommitdiff
path: root/app.js
blob: 0fd6c8a596eddc5c2c75671ee614cbe3604e5520 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
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']);