mirror of
https://github.com/reality/dbot.git
synced 2024-12-24 03:33:07 +01:00
Reality anecdote generation!
This commit is contained in:
parent
97e5a8fc08
commit
e56f287e1c
16
run.js
16
run.js
@ -22,6 +22,8 @@ var instance = jsbot.createJSBot(name, 'elara.ivixor.net', 6667, function() {
|
||||
instance.addListener('JOIN', function(data) {
|
||||
if(data.user == 'Lamp') {
|
||||
instance.say(data.channel, db.lampPuns.random());
|
||||
} else if(data.user == 'Reality') {
|
||||
instance.say(data.channel, db.realiPuns.random());
|
||||
} else if(instance.inChannel(data.channel)) {
|
||||
instance.say('aisbot', '.karma ' + data.user);
|
||||
waitingForKarma = data.channel;
|
||||
@ -111,6 +113,9 @@ instance.addListener('PRIVMSG', function(data) {
|
||||
case '~lamp':
|
||||
instance.say(data.channel, db.lampPuns.random());
|
||||
break;
|
||||
case '~reality':
|
||||
instance.say(data.channel, db.realiPuns.random());
|
||||
break;
|
||||
case '~rq':
|
||||
var rQuote = Object.keys(db.quotes).random();
|
||||
instance.say(data.channel, rQuote + ': ' + db.quotes[rQuote]);
|
||||
@ -118,3 +123,14 @@ instance.addListener('PRIVMSG', function(data) {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
instance.addListener('PRIVMSG', function(data) {
|
||||
if(data.user == 'reality') {
|
||||
var once = data.message.match(/I ([\d\w\s]* once.)/);
|
||||
if(once != null) {
|
||||
db.realiPuns.push('reality ' + once[1]);
|
||||
instance.say(data.channel, '\'reality ' + once[1] + '\' saved.');
|
||||
fs.writeFile('db.json', JSON.stringify(db, null, ' '));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user