3
0
mirror of https://github.com/reality/dbot.git synced 2024-11-23 20:39:25 +01:00

run ncount on other users

This commit is contained in:
reality 2015-08-13 20:59:56 +00:00
parent 25d26b5586
commit c6d352038c

View File

@ -9,15 +9,18 @@ var commands = function(dbot) {
typeCounts = {},
total = 0,
offString = event.params[1] || null;
offset = moment().subtract(offString, 1).valueOf() || null;
offset = moment().subtract(offString, 1).valueOf() || null,
nick = event.params[2] || event.user;
/*if(!offset || !offset.isValid()) {
event.reply('Invalid timescale. Try \'week\'');
return;
}*/
dbot.api.users.resolveUser(event.server, nick, function(err, user) {
if(user) {
this.db.scan('notifies', function(notify) {
if(notify.user == event.rUser.id) {
if(notify.user == user.id) {
if(!offString) {
if(!_.has(chanCounts, notify.channel)) chanCounts[notify.channel] = 0;
if(!_.has(typeCounts, notify.type)) typeCounts[notify.type] = 0;
@ -63,7 +66,7 @@ var commands = function(dbot) {
if(offString) {
event.reply(dbot.t('timed_notifies', {
'user': event.user,
'user': user.priamryNick,
'count': total,
'offString': offString,
'cString': cString,
@ -71,13 +74,17 @@ var commands = function(dbot) {
}));
} else {
event.reply(dbot.t('total_notifies', {
'user': event.user,
'user': user.primaryNick,
'count': total,
'cString': cString,
'tString': tString
}));
}
});
} else {
event.reply('No idea who that is mate.');
}
});
},
'~sustatus': function(event) {
@ -363,7 +370,7 @@ var commands = function(dbot) {
commands['~sustatus'].regex = [/^sustatus ([^ ]+)$/, 2];
commands['~ustatus'].access = 'power_user';
commands['~sustatus'].access = 'power_user';
commands['~sustatus'].access = 'concerning';
commands['~ncount'].access = 'power_user';
return commands;
};