forked from planetenamek/SteemStem-Upvote-Bot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
59 lines (51 loc) · 1.74 KB
/
app.js
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
const Discord = require("discord.js");
const steem = require("steem");
const config = require("./config.json");
var bot = new Discord.Client({
autoReconnect: true
});
var cmd = require("./cmd-bot.js");
bot.on("ready", () => {
console.log("--------------- SteemStem Bot Ready !");
bot.user.setActivity('Sending votes ...!');
});
bot.on("message", async message => {
const args = message.content.slice(config.prefix.length).trim().split(/ +/g);
const command = args.shift().toLowerCase();
if (message.content.indexOf(config.prefix) !== 0) {
return;
}
if (message.channel.type === "dm") {
return
}
switch (command) {
case "vote":
return cmd.Vote(message);
case "add_community_curator":
return cmd.community_init(message);
case "add_general_curator":
return cmd.general_init(message);
case "delete_curator":
return cmd.delete_curator(message);
case "update_role":
return cmd.update_role(message);
case "display_role":
return cmd.display_role(message);
case "blacklist":
return cmd.blacklist_member(message);
case "unblacklist":
return cmd.unblacklist_member(message);
case "add_team_member":
return cmd.add_team_member(message);
case "delete_team_member":
return cmd.delete_team_member(message);
default:
console.log('--------------- Unknown command');
}
});
bot.on("disconnect", function() {
console.log("--------------- Bot disconnected");
bot.login(config.token);
console.log("--------------- Curabot Ready ! (disconnect action event)");
});
bot.login(config.token);