summaryrefslogtreecommitdiff
path: root/bot.js
blob: a688191e8c982951e10a8a1cb8c60cc3cca08874 (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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
const Discord = require("discord.js");
const client = new Discord.Client();
const config = require('./config.json');
const readline = require('readline');
const vtVersion = "1.0.0";
const prefix = "vt!";

function setGame() {
    var games = [
        "For help: vt!help",
		"Qt Creator",
		"theShell",
		"VS Code"
    ]

    client.user.setPresence({
        status: 'online',
        afk: false,
        game: {
            type: 0,
            name: games[Math.floor(Math.random() * games.length)]
        }
    })
}

client.on('ready', () => {
  console.log(`Welcome to VTBot Terminal!`)
  console.log(`[STATUS] Bot is now ready!`);
  console.log(`[STATUS] Logged in as ${client.user.tag}!`);
  console.log(`[STATUS] Prefix: ` + prefix)
  console.log(`[STATUS] Token: ` + config.token)
  setGame();
  client.setInterval(setGame, 200000);

  const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout,
    prompt: 'VTBot> '
  });
  
  rl.prompt();
  
  rl.on('line', (line) => {
    switch (line.trim()) {
      case 'help':
        console.log('VTBot Terminal Help:\nhelp\nexit');
        break;
      case 'exit':
        console.log("[STATUS] Exiting VTBot...")
        process.exit(0);
      default:
        console.log(`[ERROR] Unknown command: ${line.trim()}`);
        break;
    }
    rl.prompt();
  }).on('close', () => {
    console.log('Have a great day!');
    process.exit(0);
  });
  
});

client.on('message', msg => {

    if (msg.mentions != null && msg.mentions.users != null) {
        if (msg.mentions.users.has("401491921865801728")){
                if (msg.content.toLowerCase().includes("hello") || (msg.content.toLowerCase().includes("hi"))) {
                    msg.reply("Hi there.");
            } else {
                if (msg.content.toLowerCase().includes("shut") && msg.content.toLowerCase().includes("up")) {
                msg.reply("Excuse me?")
            } else if (msg.content.toLowerCase().includes("kden")) {
                msg.reply("live")
            } else if (msg.content.toLowerCase().includes("sausages")) {
                msg.reply("Sausages.")
            }
            }
        }
    }

    if (msg.content == 'kden') {
        msg.channel.send('live');
    }
      
    if (msg.content == prefix + 'help') {
        const embed = new Discord.RichEmbed();
        embed.setTitle('VTBot Help')
        embed.setDescription('Every command you put in this bot must start with `' + prefix + '`')
        embed.addField('- General Commands', 'ping', true)
        embed.setFooter("VTBot Copyright 2018. The version that VTBot's running is " + vtVersion + "!")
        embed.setColor("00C8FF")
        msg.channel.send({embed});
    }    

    if (msg.content == prefix + 'ping') {
        msg.reply(':warning: Pong!')
    }


});

client.login(config.token);