mirror of
https://github.com/reality/dbot.git
synced 2024-11-27 14:29:29 +01:00
Modified missing report system as per [#545]
This commit is contained in:
parent
e06c1647c4
commit
154a0b30fe
@ -35,6 +35,21 @@ var pages = function(dbot) {
|
|||||||
'notifies': notifies
|
'notifies': notifies
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
'/report/:server/missing/:user': function(req, res) {
|
||||||
|
var server = req.params.server,
|
||||||
|
nick = req.params.user;
|
||||||
|
|
||||||
|
dbot.api.users.resolveUser(server, nick, function(user) {
|
||||||
|
var notifies = this.pending[user.id];
|
||||||
|
console.log(notifies);
|
||||||
|
res.render('missing_notifies', {
|
||||||
|
'name': dbot.config.name,
|
||||||
|
'user': nick,
|
||||||
|
'notifies': notifies
|
||||||
|
});
|
||||||
|
}.bind(this));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -28,9 +28,13 @@ var report = function(dbot) {
|
|||||||
});
|
});
|
||||||
}, function() {
|
}, function() {
|
||||||
offlineUsers = perOps;
|
offlineUsers = perOps;
|
||||||
|
console.log(offlineUsers);
|
||||||
_.each(offlineUsers, function(id) {
|
_.each(offlineUsers, function(id) {
|
||||||
if(!this.pending[id]) this.pending[id] = [];
|
if(!this.pending[id]) this.pending[id] = [];
|
||||||
this.pending[id].push(message);
|
this.pending[id].push({
|
||||||
|
'time': new Date().getTime(),
|
||||||
|
'message': message
|
||||||
|
});
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
}
|
}
|
||||||
@ -50,26 +54,26 @@ var report = function(dbot) {
|
|||||||
|
|
||||||
this.listener = function(event) {
|
this.listener = function(event) {
|
||||||
if(_.has(this.pending, event.rUser.id)) {
|
if(_.has(this.pending, event.rUser.id)) {
|
||||||
var i=0,
|
dbot.say(event.server, event.user, dbot.t('missed_notifies', {
|
||||||
pending = this.pending[event.rUser.id];
|
'user': event.rUser.primaryNick,
|
||||||
|
'link': dbot.api.web.getUrl('report/' + event.server +
|
||||||
var notifyUser = function(pending) {
|
'/missing/' + event.rUser.primaryNick)
|
||||||
if(i >= pending.length) {
|
}));
|
||||||
delete this.pending[event.rUser.id];
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
dbot.say(event.server, event.user, pending[i]);
|
|
||||||
setTimeout(function() {
|
|
||||||
i++; notifyUser(pending);
|
|
||||||
}, 5000);
|
|
||||||
}.bind(this);
|
|
||||||
|
|
||||||
notifyUser(pending);
|
|
||||||
}
|
}
|
||||||
}.bind(this);
|
}.bind(this);
|
||||||
this.on = 'JOIN';
|
this.on = 'JOIN';
|
||||||
|
|
||||||
var commands = {
|
var commands = {
|
||||||
|
'~clearmissing': function(event) {
|
||||||
|
if(_.has(this.pending, event.rUser.id)) {
|
||||||
|
var count = this.pending[event.rUser.id].length;
|
||||||
|
delete this.pending[event.rUser.id];
|
||||||
|
event.reply(dbot.t('cleared_notifies', { 'count': count }));
|
||||||
|
} else {
|
||||||
|
event.reply(dbot.t('no_missed_notifies'));
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
'~report': function(event) {
|
'~report': function(event) {
|
||||||
var channelName = event.input[1],
|
var channelName = event.input[1],
|
||||||
nick = event.input[2],
|
nick = event.input[2],
|
||||||
|
@ -8,6 +8,15 @@
|
|||||||
"fr": "Attention : {reporter} a reporté {reported} dans {channel}. Raison donnée : \"{reason}\"",
|
"fr": "Attention : {reporter} a reporté {reported} dans {channel}. Raison donnée : \"{reason}\"",
|
||||||
"it": "Attentzone : {reporter} ha segnalato {reported} in {channel}. Motivo : \"{reason}\""
|
"it": "Attentzone : {reporter} ha segnalato {reported} in {channel}. Motivo : \"{reason}\""
|
||||||
},
|
},
|
||||||
|
"missed_notifies": {
|
||||||
|
"en": "{user}, you have some missed notifications (clear these once you have read them using ~clearmissing) - {link}"
|
||||||
|
},
|
||||||
|
"cleared_notifies": {
|
||||||
|
"en": "{count} pending notifications cleared."
|
||||||
|
},
|
||||||
|
"no_missed_notifies": {
|
||||||
|
"en": "No missing notifications were available to clear."
|
||||||
|
},
|
||||||
"reported": {
|
"reported": {
|
||||||
"en": "Thank you, {reported} has been reported to the channel administrators.",
|
"en": "Thank you, {reported} has been reported to the channel administrators.",
|
||||||
"na'vi": "Irayo si ngari, fìtsengìri ayeyktan omum teri {reported}it set.",
|
"na'vi": "Irayo si ngari, fìtsengìri ayeyktan omum teri {reported}it set.",
|
||||||
|
Loading…
Reference in New Issue
Block a user