forked from GitHub/dbot
Merge quotes and reality
This commit is contained in:
parent
fd4c2e8148
commit
617ce3ca12
@ -105,7 +105,25 @@ var quotes = function(dbot) {
|
|||||||
rmAllowed = true;
|
rmAllowed = true;
|
||||||
});
|
});
|
||||||
return commands;
|
return commands;
|
||||||
}
|
},
|
||||||
|
|
||||||
|
// For automatic quote retrieval
|
||||||
|
'listener': function(data, params) {
|
||||||
|
if(data.user == 'reality') {
|
||||||
|
var once = data.message.valMatch(/^I ([\d\w\s,'-]* once)/, 2);
|
||||||
|
} else {
|
||||||
|
var once = data.message.valMatch(/^reality ([\d\w\s,'-]* once)/, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(once) {
|
||||||
|
dbot.db.quoteArrs['realityonce'].push('reality ' + once[1] + '.');
|
||||||
|
dbot.instance.say(data.channel, '\'reality ' + once[1] + '.\' saved.');
|
||||||
|
dbot.save();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
'on': 'PRIVMSG'
|
||||||
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,26 +0,0 @@
|
|||||||
var reality = function(dbot) {
|
|
||||||
var dbot = dbot;
|
|
||||||
|
|
||||||
return {
|
|
||||||
'listener': function(data, params) {
|
|
||||||
// Ternary for I/reality doesn't seem to work with the regex. Investigate.
|
|
||||||
if(data.user == 'reality') {
|
|
||||||
var once = data.message.valMatch(/^I ([\d\w\s,'-]* once)/, 2);
|
|
||||||
} else {
|
|
||||||
var once = data.message.valMatch(/^reality ([\d\w\s,'-]* once)/, 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(once) {
|
|
||||||
dbot.db.quoteArrs['realityonce'].push('reality ' + once[1] + '.');
|
|
||||||
dbot.instance.say(data.channel, '\'reality ' + once[1] + '.\' saved.');
|
|
||||||
dbot.save();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
'on': 'PRIVMSG'
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
exports.fetch = function(dbot) {
|
|
||||||
return reality(dbot);
|
|
||||||
}
|
|
2
run.js
2
run.js
@ -3,7 +3,7 @@ var timers = require('./timer');
|
|||||||
var jsbot = require('./jsbot');
|
var jsbot = require('./jsbot');
|
||||||
require('./snippets');
|
require('./snippets');
|
||||||
|
|
||||||
var modules = ['user', 'web', 'admin', 'puns', 'kick', 'reality', 'karma', 'youare', 'quotes'];
|
var modules = ['user', 'web', 'admin', 'puns', 'kick', 'karma', 'youare', 'quotes'];
|
||||||
|
|
||||||
var DBot = function(dModules, timers) {
|
var DBot = function(dModules, timers) {
|
||||||
this.admin = 'reality';
|
this.admin = 'reality';
|
||||||
|
Loading…
Reference in New Issue
Block a user