-
Notifications
You must be signed in to change notification settings - Fork 3
/
pinkman.js
163 lines (149 loc) · 6.36 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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
var fs = require('fs'),
irc = require('irc'),
config;
/**
* Load config file
* from the file system.
*/
try {
var configData = fs.readFileSync(__dirname + '/config.json', {encoding: 'utf8'});
config = JSON.parse(configData);
}
catch (err)
{
console.error('Error: Can not read config file "' + __dirname + '/config.json"\n\n' + err);
process.exit(1);
}
/**
* Create bot instance
* @type 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 'leave':
bot.send('PART', 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, 'leave.......: leave <channel> <password>');
bot.say(nick, 'topic.......: topic <channel> [<topic>] <password>');
bot.say(nick, 'nick........: nick <nick> <password>');
bot.say(nick, 'identify....: identify <password>');
break;
}
});
// Not used at the moment
bot.addListener('raw', function (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!',
'Bitch!',
'Nah, come on man. Some straight like you, giant stick up his ass at like what, sixty, he\'s just gonna break bad?',
'Look, I like making cherry product, but let\'s keep it real, alright? We make poison for people who don\'t care. We probably have the most unpicky customers in the world.',
'You don’t need a criminal lawyer. You need a criminal lawyer',
'Possum. Big, freaky, lookin\' bitch. Since when did they change it to opossum? When I was comin\' up it was just possum. Opossum makes it sound like he\'s irish or something. Why do they gotta go changing everything?',
'I uh… I eat a lot of frozen stuff… It\'s usually pretty bad, I mean the pictures are always so awesome, you know? It\'s like “hell yeah, I\'m starved for this lasagna!” and then you nuke it and the cheese gets all scabby on top and it\'s like… it\'s like you\'re eating a scab… I mean, seriously, what\'s that about? It\'s like “Yo! What ever happened to truth in advertising?” You know?'
];
var msg = says[ Math.floor( Math.random() * says.length) + 0];
bot.send('NOTICE', to, msg);
}
});