-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbot.js
More file actions
111 lines (100 loc) · 3.36 KB
/
Copy pathbot.js
File metadata and controls
111 lines (100 loc) · 3.36 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
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
/* jshint unused:vars */
// Create the configuration
var config = {
channels: [process.env.CHANNEL],
server: "irc.freenode.net",
botName: process.env.BOTNAME
};
// Get the lib
var irc = require("irc");
// Create the bot name
var bot = new irc.Client(config.server, config.botName, {
channels: config.channels
});
// Listen for joins
bot.addListener("join", function(channel, who) {
console.log(channel, who);
// Welcome them in!
bot.say(channel, who + "...Hello! Welcome to the Modulus IRC channel!");
});
// Listen for any message, PM said user when he posts
//bot.addListener("message", function(from, to, text, message) {
// bot.say(from, "¿Que?");
//});
// Listen for any message, say to him/her in the room
//bot.addListener("message", function(from, to, text, message) {
// bot.say(config.channels[0], "¿Public que?");
//});
// Listen for any message, if this then that
bot.addListener("message", function(from, to, message) {
console.log(message);
if (message.indexOf("Bot, do you have any good jokes?") > -1
|| message.indexOf("do you have a good joke?") > -1
) {
bot.say(to, 'Knock knock!');
}
if( message.indexOf("is there anyone here?") > -1
|| message.indexOf("who's there?") > -1
|| message.indexOf("who is there?") > -1
) {
bot.say(to, 'David is here. David is always here.');
}
if (message.indexOf("help") > -1
|| message.indexOf("help me") > -1
) {
bot.say(to, 'You need help?');
}
if (message.indexOf("my app") > -1
|| message.indexOf("meteor project") > -1
|| message.indexOf("node project") > -1
|| message.indexOf("a problem") > -1
) {
bot.say(to, 'What is your project ID or *.onmodulus.net URL?');
}
if (message.indexOf("anyone here") > -1
|| message.indexOf("is anyone") > -1
|| message.indexOf("is empty") > -1
) {
bot.say(to, 'I am here!');
}
if (message.indexOf("you are a robot") > -1
|| message.indexOf("you're just a bot") > -1
|| message.indexOf("you are stupid") > -1
) {
bot.say(to, 'I am a cybernetic organism. Living tissue over a metal endoskeleton. My mission is to protect you.');
}
if (message.indexOf("who are you") > -1
|| message.indexOf("are you real") > -1
|| message.indexOf("are you a robot") > -1
|| message.indexOf("are you a bot") > -1
) {
bot.say(to, 'I am a not a robot!');
}
if (message.indexOf("not possible") > -1
|| message.indexOf("impossible") > -1
) {
bot.say(to, 'Anything is possible!!!');
}
if (message.indexOf("logs") > -1
|| message.indexOf("logged") > -1
) {
bot.say(to, 'Give me the logs..');
}
if (message.indexOf("no.") > -1
|| message.indexOf("never.") > -1
) {
bot.say(to, 'You are telling me no?');
}
if (message.indexOf("support") > -1
|| message.indexOf("support ticket") > -1
) {
bot.say(to, 'Did you submit a support ticket?');
}
});
// Log errors, damn it!
//var client = new irc.Client(config.server, config.botName, {
// channels: config.channels
//});
//client.addListener('error', function(message) {
// console.log('error: ', message);
//});