-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbot.js
More file actions
42 lines (34 loc) · 1.39 KB
/
bot.js
File metadata and controls
42 lines (34 loc) · 1.39 KB
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
const status = [],
config = require("./config.json"),
auth = {
token: config.token
},
Discord = require('discord.js'),
client = new Discord.Client(),
webshot = require('webshot');
client.on('ready', () => {
console.log("Connected as: " + client.user.username + "\nBot ID: " + client.user.id);
//client.user.setPresence({ status: 'online', });
});
client.on('message', async function(message) {
var send = (content, options) => {
return message.channel.send(content, options);
};
if (message.content.startsWith(config.prefix)) {
var args = message.content.split(" ");
var command = args.splice(0,1).join(" ");
args = args.filter(l => l.length).join(" ");
switch (command.replace(config.prefix, '')) {
case 'webshot':
case 'ws':
webshot(args, "webshot.png", err => {
if (err)
send('There was an error, <@!'+message.author.id+'>. Please try `'+message.content+'` again later.', err);
else
send('<@!'+message.author.id+'> took a webshot of `'+args+'`:', {files: ['webshot.png']});
});
break;
}
}
});
client.login(auth.token);