3
0
mirror of https://github.com/reality/dbot.git synced 2024-11-27 14:29:29 +01:00

Fix ~quote syntax. It's a little messy.

This commit is contained in:
Luke Slater 2011-08-28 17:16:28 +01:00
parent 6b0e2de264
commit 21ff3e002b
2 changed files with 8 additions and 3 deletions

View File

@ -3,7 +3,7 @@ var quotes = function(dbot) {
var commands = {
'~q': function(data, params) {
var q = data.message.valMatch(/^~q ([\d\w\s]*)/, 2)
var q = data.message.valMatch(/^~q ([\d\w\s]*)/, 2);
if(q) {
key = q[1].trim().toLowerCase();
if(quotes.hasOwnProperty(key)) {

9
run.js
View File

@ -76,9 +76,14 @@ DBot.prototype.reloadModules = function() {
this.commands[params[0]](data, params);
this.save();
} else {
var q = data.message.valMatch(/^~([\d\w\s]*)/, 2)
var q = data.message.valMatch(/^~([\d\w\s]*)/, 2);
if(q) {
this.say(data.channel, this.quotes.get(q[1].trim()));
key = q[1].trim().toLowerCase();
if(this.db.quoteArrs.hasOwnProperty(key)) {
this.say(data.channel, key + ': ' + this.db.quoteArrs[key].random());
} else {
this.say(data.channel, 'No quotes under ' + key);
}
}
}
}.bind(this));