L:Merge branch 'betterusers' of github.com:reality/dbot into betterusers

This commit is contained in:
reality 2014-10-01 00:28:40 +00:00
commit d0aab89435

View File

@ -14,11 +14,18 @@ var commands = function(dbot) {
this.api.addQuote(key, quote, event.user, function(newCount) { this.api.addQuote(key, quote, event.user, function(newCount) {
if(newCount) { if(newCount) {
dbot.api.event.emit('~qadd', [ key, quote ]); dbot.api.event.emit('~qadd', [ key, quote ]);
if(_.has(dbot.modules, 'web')) {
event.reply(dbot.t('quote_saved', { event.reply(dbot.t('quote_saved', {
'category': key, 'category': key,
'count': newCount, 'count': newCount,
'link': dbot.api.web.getUrl('quotes/' + encodeURIComponent(key)) 'link': dbot.api.web.getUrl('quotes/' + encodeURIComponent(key))
})); }));
} else {
event.reply(dbot.t('quote_saved', {
'category': key,
'count': newCount
}));
}
} else { } else {
event.reply(dbot.t('quote_exists')); event.reply(dbot.t('quote_exists'));
} }
@ -103,11 +110,18 @@ var commands = function(dbot) {
removedQuote; removedQuote;
var quoteRemoved = function(err) { var quoteRemoved = function(err) {
this.internalAPI.resetRemoveTimer(event, key, removedQuote); this.internalAPI.resetRemoveTimer(event, key, removedQuote);
if(_.has(dbot.modules, 'web')) {
event.reply(dbot.t('removed_from', { event.reply(dbot.t('removed_from', {
'quote': removedQuote, 'quote': removedQuote,
'category': key, 'category': key,
'link': dbot.api.web.getUrl('quotes/' + encodeURIComponent(key)) 'link': dbot.api.web.getUrl('quotes/' + encodeURIComponent(key))
})); }));
} else {
event.reply(dbot.t('removed_from', {
'quote': removedQuote,
'category': key
}));
}
}.bind(this); }.bind(this);
this.db.search('quote_category', { 'name': key }, function(result) { this.db.search('quote_category', { 'name': key }, function(result) {
@ -137,11 +151,18 @@ var commands = function(dbot) {
category = false; category = false;
var quoteRemoved = function(err) { var quoteRemoved = function(err) {
this.internalAPI.resetRemoveTimer(event, key, quote); this.internalAPI.resetRemoveTimer(event, key, quote);
if(_.has(dbot.modules, 'web')) {
event.reply(dbot.t('removed_from', { event.reply(dbot.t('removed_from', {
'category': key, 'category': key,
'quote': quote, 'quote': quote,
'link': dbot.api.web.getUrl('quotes/' + encodeURIComponent(key)) 'link': dbot.api.web.getUrl('quotes/' + encodeURIComponent(key))
})); }));
} else {
event.reply(dbot.t('removed_from', {
'category': key,
'quote': quote
}));
}
}.bind(this); }.bind(this);
this.db.search('quote_category', { 'name': key }, function(result) { this.db.search('quote_category', { 'name': key }, function(result) {