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

some ufixes

This commit is contained in:
Luke Slater 2014-11-09 13:59:00 +00:00
parent bdbd5ee8e4
commit 27c150f877
3 changed files with 31 additions and 21 deletions

View File

@ -214,7 +214,10 @@ var commands = function(dbot) {
async.eachSeries(pCounts, function(pCount, next) { async.eachSeries(pCounts, function(pCount, next) {
dbot.api.users.getUser(pCount[0], function(err, user) { dbot.api.users.getUser(pCount[0], function(err, user) {
pCount[0] = user.primaryNick; next(); if(user) {
pCount[0] = user.primaryNick;
}
next();
}); });
}, function() { }, function() {
event.reply(this.internalAPI.formatHighscore('Top ' + word + ' users: ', pCounts)); event.reply(this.internalAPI.formatHighscore('Top ' + word + ' users: ', pCounts));

View File

@ -48,7 +48,10 @@ var sstats = function(dbot) {
async.eachSeries(pCounts, function(pCount, next) { async.eachSeries(pCounts, function(pCount, next) {
dbot.api.users.getUser(pCount[0], function(err, user) { dbot.api.users.getUser(pCount[0], function(err, user) {
pCount[0] = user.primaryNick; next(); if(user) {
pCount[0] = user.primaryNick;
}
next();
}); });
}, function() { }, function() {
callback(pCounts); callback(pCounts);

View File

@ -76,25 +76,29 @@ var warning = function(dbot) {
server = event.server; server = event.server;
dbot.api.users.resolveUser(server, warnee, function(err, warnee) { dbot.api.users.resolveUser(server, warnee, function(err, warnee) {
var warnings = 0; if(warnee) {
this.db.search('warnings', { var warnings = 0;
'server': server, this.db.search('warnings', {
'warnee': warnee.id 'server': server,
}, function(warning) { 'warnee': warnee.id
warnings++; }, function(warning) {
}, function(err) { warnings++;
if(warnings > 0) { }, function(err) {
event.reply(dbot.t('warning_info', { if(warnings > 0) {
'user': warnee.primaryNick, event.reply(dbot.t('warning_info', {
'num': warnings, 'user': warnee.primaryNick,
'url': dbot.api.web.getUrl('warning/' + server + '/' 'num': warnings,
+ warnee.primaryNick) 'url': dbot.api.web.getUrl('warning/' + server + '/'
})); + warnee.primaryNick)
} else { }));
event.reply(dbot.t('no_warnings', { 'user': } else {
warnee.primaryNick })); event.reply(dbot.t('no_warnings', { 'user':
} warnee.primaryNick }));
}); }
});
} else {
event.reply(event.params[1] + ' not found.');
}
}.bind(this)); }.bind(this));
} }
}; };