forked from po-devs/po-server-goodies
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bot.js
41 lines (38 loc) · 1.03 KB
/
bot.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
function Bot(name) {
this.name = name;
}
Bot.prototype.formatMsg = function(message)
{
return "±" + this.name + ": " + message;
}
/* Shortcuts to sys functions */
Bot.prototype.sendAll = function(message, channel)
{
if (channel === undefined || channel == -1)
sendChanAll(this.formatMsg(message),-1);
else
sendChanAll(this.formatMsg(message), channel);
}
Bot.prototype.sendMessage = function(tar, message, channel)
{
if (channel === undefined)
sys.sendMessage(tar, this.formatMsg(message));
else
sys.sendMessage(tar, this.formatMsg(message), channel);
}
Bot.prototype.sendMainTour = function(message)
{
this.sendAll(message, 0);
// Relies on Tournaments channel
this.sendAll(message, sys.channelId("Tournaments"));
}
/* Following two rely on global channel parameter */
Bot.prototype.sendChanMessage = function(tar, message)
{
this.sendMessage(tar, message, channel);
}
Bot.prototype.sendChanAll = function(message)
{
this.sendAll(message, channel);
}
exports.Bot = Bot;