mirror of
https://github.com/reality/dbot.git
synced 2024-11-27 22:39:26 +01:00
~ckick command to channelKick on behalf of dbot. Add countSilently kick option. [#261]
This commit is contained in:
parent
d8267316ef
commit
732a1e3d3b
@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"dbKeys": [ "kicks", "kickers" ],
|
"dbKeys": [ "kicks", "kickers" ],
|
||||||
"dependencies": [ "command" ],
|
"dependencies": [ "command", "report", "users" ],
|
||||||
"help": "http://github.com/reality/depressionbot/blob/master/modules/kick/README.md",
|
"help": "http://github.com/reality/depressionbot/blob/master/modules/kick/README.md",
|
||||||
"ignorable": true
|
"ignorable": true,
|
||||||
|
"countSilently": true
|
||||||
}
|
}
|
||||||
|
@ -1,55 +1,6 @@
|
|||||||
var _ = require('underscore')._;
|
var _ = require('underscore')._;
|
||||||
|
|
||||||
var kick = function(dbot) {
|
var kick = function(dbot) {
|
||||||
var commands = {
|
|
||||||
// Give the number of times a given user has been kicked and has kicked
|
|
||||||
// other people.
|
|
||||||
'~kickcount': function(event) {
|
|
||||||
var username = event.params[1];
|
|
||||||
|
|
||||||
if(!_.has(dbot.db.kicks, username)) {
|
|
||||||
var kicks = '0';
|
|
||||||
} else {
|
|
||||||
var kicks = dbot.db.kicks[username];
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!_.has(dbot.db.kickers, username)) {
|
|
||||||
var kicked = '0';
|
|
||||||
} else {
|
|
||||||
var kicked = dbot.db.kickers[username];
|
|
||||||
}
|
|
||||||
|
|
||||||
event.reply(dbot.t('user_kicks', {
|
|
||||||
'user': username,
|
|
||||||
'kicks': kicks,
|
|
||||||
'kicked': kicked
|
|
||||||
}));
|
|
||||||
},
|
|
||||||
|
|
||||||
// Output a list of the people who have been kicked the most and those
|
|
||||||
// who have kicked other people the most.
|
|
||||||
'~kickstats': function(event) {
|
|
||||||
var orderedKickLeague = function(list, topWhat) {
|
|
||||||
var kickArr = _.chain(list)
|
|
||||||
.pairs()
|
|
||||||
.sortBy(function(kick) { return kick[1] })
|
|
||||||
.reverse()
|
|
||||||
.first(10)
|
|
||||||
.value();
|
|
||||||
|
|
||||||
var kickString = "Top " + topWhat + ": ";
|
|
||||||
for(var i=0;i<kickArr.length;i++) {
|
|
||||||
kickString += kickArr[i][0] + " (" + kickArr[i][1] + "), ";
|
|
||||||
}
|
|
||||||
|
|
||||||
return kickString.slice(0, -2);
|
|
||||||
};
|
|
||||||
|
|
||||||
event.reply(orderedKickLeague(dbot.db.kicks, 'Kicked'));
|
|
||||||
event.reply(orderedKickLeague(dbot.db.kickers, 'Kickers'));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
this.commands = commands;
|
|
||||||
|
|
||||||
this.api = {
|
this.api = {
|
||||||
'ban': function(server, user, channel) {
|
'ban': function(server, user, channel) {
|
||||||
@ -79,11 +30,13 @@ var kick = function(dbot) {
|
|||||||
dbot.db.kickers[event.user] += 1;
|
dbot.db.kickers[event.user] += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
event.reply(event.kickee + '-- (' + dbot.t('user_kicks', {
|
if(!this.config.countSilently) {
|
||||||
'user': event.kickee,
|
event.reply(event.kickee + '-- (' + dbot.t('user_kicks', {
|
||||||
'kicks': dbot.db.kicks[event.kickee],
|
'user': event.kickee,
|
||||||
'kicked': dbot.db.kickers[event.kickee]
|
'kicks': dbot.db.kicks[event.kickee],
|
||||||
}) + ')');
|
'kicked': dbot.db.kickers[event.kickee]
|
||||||
|
}) + ')');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
this.on = 'KICK';
|
this.on = 'KICK';
|
||||||
|
@ -10,5 +10,8 @@
|
|||||||
"es": "No expulsás {botname}",
|
"es": "No expulsás {botname}",
|
||||||
"na'vi": "Ngal {botname}it ke tsun tsrive'i",
|
"na'vi": "Ngal {botname}it ke tsun tsrive'i",
|
||||||
"cy": "Ni ddylech cicio {botname}"
|
"cy": "Ni ddylech cicio {botname}"
|
||||||
|
},
|
||||||
|
"ckicked": {
|
||||||
|
"en": "Attention: {kicker} has kicked {kickee} from {channel}. The reason given was: \"{reason}.\""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"webHost": "localhost",
|
"webHost": "nourishedcloud.com",
|
||||||
"webPort": 8080,
|
"webPort": 9001,
|
||||||
"externalPath": false,
|
"externalPath": false,
|
||||||
"help": "https://github.com/reality/depressionbot/blob/master/modules/web/README.md"
|
"help": "https://github.com/reality/depressionbot/blob/master/modules/web/README.md"
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user