mirror of
https://github.com/reality/dbot.git
synced 2024-11-30 16:09:27 +01:00
~last thing
This commit is contained in:
parent
44316a5de1
commit
54a0a96cbc
@ -1,5 +1,6 @@
|
||||
var _ = require('underscore')._,
|
||||
async = require('async');
|
||||
async = require('async'),
|
||||
moment = require('moment');
|
||||
|
||||
var commands = function(dbot) {
|
||||
var commands = {
|
||||
@ -154,6 +155,22 @@ var commands = function(dbot) {
|
||||
'channel': event.channel,
|
||||
'lines': event.cStats.lines
|
||||
}));
|
||||
},
|
||||
|
||||
'~last': function(event) {
|
||||
dbot.api.users.resolveUser(event.server, event.params[1], function(user) {
|
||||
if(user) {
|
||||
this.api.getUserStats(user.id, function(uStats) {
|
||||
if(uStats && uStats.last) {
|
||||
event.reply(user.primaryNick + ' was last seen ' + moment(uStats.last).fromNow() + '.');
|
||||
} else {
|
||||
event.reply('I haven\'t seen that user active yet.');
|
||||
}
|
||||
});
|
||||
} else {
|
||||
event.reply('Unknown user.');
|
||||
}
|
||||
}.bind(this));
|
||||
}
|
||||
};
|
||||
return commands;
|
||||
|
@ -91,6 +91,7 @@ var sstats = function(dbot) {
|
||||
event.uStats.words += wCount;
|
||||
event.uStats.capitals += capitals;
|
||||
event.uStats.curses += curses;
|
||||
event.uStats.last = new Date().getTime();
|
||||
|
||||
event.cStats.words += wCount;
|
||||
event.cStats.capitals += capitals;
|
||||
|
Loading…
Reference in New Issue
Block a user