forked from tkjaergaard/Pinkman
-
Notifications
You must be signed in to change notification settings - Fork 1
/
pinkman.js
142 lines (128 loc) · 5.13 KB
/
pinkman.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
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
var config = {
channels: [""], // Channels to connect to on launch
server: "irc.freenode.net", // Server to connect to
botName: "pinkman", // The nick of the bot
password: "", // Password to interact with the bot
identifyPass: "" // Identify password for nickserv
},
irc = require("irc");
var bot = new irc.Client(config.server, config.botName, {
channels: config.channels
});
bot.addListener('registered', function (message) {
bot.say('NickServ', "identify " + config.botName + " " + config.identifyPass)
});
bot.addListener('error', function (message) {
console.error('ERROR: %s: %s', message.command, message.args.join(' '));
console.log(message);
});
bot.addListener("pm", function (nick, message) {
var segments = message.split(" "),
password = segments[segments.length - 1];
if (password !== config.password) {
bot.say(nick, "Invalid password!");
return false;
}
switch (segments[0]) {
case "voice":
bot.send("MODE", segments[2], "+v", segments[1]);
break;
case "devoice":
bot.send("MODE", segments[2], "-v", segments[1]);
break;
case "op":
bot.send("MODE", segments[2], "+o", segments[1]);
break;
case "deop":
bot.send("MODE", segments[2], "-o", segments[1]);
break;
case "say":
var toSay = message.match(/\[(.+)\]/);
bot.say(segments[1], toSay[1]);
break;
case "notice":
var notice = message.match(/\[(.+)\]/);
bot.send('NOTICE', segments[1], notice[1]);
break;
case "kick":
var kickMsg = message.match(/\[(.+)\]/),
say = (kickMsg[1] ? kickMsg[1] : "");
bot.send("KICK", segments[1], segments[2], say);
break;
case "invite":
bot.send("INVITE", segments[1], segments[2]);
break;
case "ban":
bot.send("MODE", segments[1], "+b", segments[2]);
break;
case "deban":
bot.send("MODE", segments[1], "-b", segments[2]);
break;
case "join":
bot.send("JOIN", segments[1]);
break;
case "topic":
var topicRaw = message.match(/\[(.+)\]/),
topic = (topicRaw[1] ? topicRaw[1] : "");
bot.send("TOPIC", segments[1], topic);
break;
case "nick":
bot.send("NICK", segments[1]);
break;
case "identify":
bot.say('NickServ', "identify " + config.botName + " " + config.identifyPass);
break;
case "help":
bot.say(nick, "voice.......: voice <user> <channel> <password>");
bot.say(nick, "devoice.....: devoice <user> <channel> <password>");
bot.say(nick, "op..........: op <user> <channel> <password>");
bot.say(nick, "deop........: deop <user> <channel> <password>");
bot.say(nick, "say.........: say <channel|user> [<text>] <password>");
bot.say(nick, "notice......: notice <channel> [<text>] <password>");
bot.say(nick, "kick........: kick <channel> <user> [<text>] <password>");
bot.say(nick, "invite......: invite <user> <channel> <password>");
bot.say(nick, "ban.........: ban <channel> <user> <password>");
bot.say(nick, "deban.......: deban <channel> <user> [<text>] <password>");
bot.say(nick, "join........: join <channel> <password>");
bot.say(nick, "topic.......: topic <channel> [<topic>] <password>");
bot.say(nick, "nick........: nick <nick> <password>");
bot.say(nick, "identify....: identify <password>");
break;
}
});
bot.addListener('raw', function (message) {
// console.log(message);
});
// Public commands
bot.addListener('message', function (from, to, message) {
if (message === '!tableflip') {
bot.say(to, '(╯°□°)╯︵ ┻━┻');
}
else if(message === '!puttableback')
{
bot.say(to, '┬─┬ ノ( ゜-゜ノ)');
}
else if(message === '!dice')
{
var number = Math.floor(Math.random() * 6) + 1;
bot.send('NOTICE', to, 'is rolling dice..');
bot.send('NOTICE', to, 'looking at the dice and '+from+' rolled a '+number);
}
else if( message === '!quote' )
{
var says = [
'Like I came to you, begging to cook meth. \'Oh, hey, nerdiest old dude I know, you wanna come cook crystal?\' Please. I\'d ask my diaper-wearing granny, but her wheelchair wouldn\'t fit in the RV.',
'You know what? Why I\'m here in the first place? Is to sell you meth. You\'re nothing to me but customers! I made you my bitch. You okay with that?',
'Are we in the meth business, or the money business?',
'What if this is like math, or algebra? And you add a plus douchebag to a minus douchebag, and you get, like, zero douchebags?',
'Hey, you girls want to meet my fat stack?',
'I got two dudes that turned into raspberry slushie then flushed down my toilet. I can\'t even take a proper dump in there. I mean, the whole damn house has got to be haunted by now.',
'What good is being an outlaw when you have responsibilities?',
'I\'M A BLOWFISH! BLOWFISH! YEEEAAAH! BLOWFISHIN\' THIS UP!',
'Yeah, bitch! Magnets!',
'Yo 148, 3-to-the-3-to-the-6-to-the-9. Representin\' the ABQ. What up, biatch? Leave it at the tone!'
];
var msg = says[ Math.floor( Math.random() * says.length) + 0];
bot.send('NOTICE', to, msg);
}
});