4-indent to 2-indent

This commit is contained in:
Scritches 2018-05-05 13:35:49 -04:00
parent a5f9998872
commit ed69582c7a
3 changed files with 747 additions and 696 deletions

View File

@ -39,7 +39,8 @@ var commands = function(dbot) {
if (this.recentTimeouts[user.id] == 0) {
delete this.recentTimeouts[user.id];
}
}.bind(this), 3600000);
}
.bind(this), 3600000);
if (this.recentTimeouts[user.id] == 3) {
duration = null;
@ -51,7 +52,8 @@ var commands = function(dbot) {
event.reply(response);
});
}
}.bind(this));
}
.bind(this));
},
'~unquiet': function (event) {
@ -66,7 +68,9 @@ var commands = function(dbot) {
} else {
this.api.unquiet(server, this.hosts[server][quietee], channel);
}
event.reply(dbot.t('unquieted', { 'quietee': quietee }));
event.reply(dbot.t('unquieted', {
'quietee': quietee
}));
dbot.api.report.notify('unquiet', server, event.rUser, channel,
dbot.t('unquiet_notify', {
'unquieter': quieter,
@ -98,7 +102,8 @@ var commands = function(dbot) {
// Kick and ban from all channels on the network.
'~nban': function (event) {
if(!event.input) return;
if (!event.input)
return;
var server = event.server,
banner = event.user,
@ -138,13 +143,16 @@ var commands = function(dbot) {
// Ban the user from all channels
var i = 0;
var banChannel = function (channels) {
if(i >= channels.length) return;
if (i >= channels.length)
return;
var channel = channels[i];
this.api.ban(server, host, channel);
this.api.kick(server, banee, channel, reason +
' (network-wide ban)');
i++; banChannel(channels);
}.bind(this);
i++;
banChannel(channels);
}
.bind(this);
banChannel(channels);
this.hosts[event.server][banee] = host;
@ -164,7 +172,8 @@ var commands = function(dbot) {
timeout += ' hours';
}
if(!_.has(this.tempBans, event.server)) this.tempBans[event.server] = {};
if (!_.has(this.tempBans, event.server))
this.tempBans[event.server] = {};
this.tempBans[event.server][banee] = msTimeout;
this.internalAPI.addTempBan(event.server, banee, msTimeout);
@ -232,9 +241,12 @@ var commands = function(dbot) {
// err
dbot.say(event.server, 'NickServ', 'FREEZE ' + banee + ' ON ' + reason);
} else {
event.reply(dbot.t('no_user', { 'user': banee }));
event.reply(dbot.t('no_user', {
'user': banee
}));
}
}.bind(this));
}
.bind(this));
},
'~nunban': function (event) {
@ -244,7 +256,9 @@ var commands = function(dbot) {
this.api.networkUnban(event.server, unbanee, unbanner, host, function (err) {
if (err) {
event.reply(dbot.t('nunban_error', { 'unbanee': unbanee }));
event.reply(dbot.t('nunban_error', {
'unbanee': unbanee
}));
}
});
},
@ -281,7 +295,9 @@ var commands = function(dbot) {
var orderedKickLeague = function (list, topWhat) {
var kickArr = _.chain(list)
.pairs()
.sortBy(function(kick) { return kick[1] })
.sortBy(function (kick) {
return kick[1]
})
.reverse()
.first(10)
.value();
@ -310,7 +326,13 @@ var commands = function(dbot) {
}
if (!_.has(this.voteQuiets, user.id)) {
this.voteQuiets[user.id] = { 'user': user.id, 'reason': reason, 'channel': event.channel, 'yes': [event.rUser.primaryNick], 'no': [] };
this.voteQuiets[user.id] = {
'user': user.id,
'reason': reason,
'channel': event.channel,
'yes': [event.rUser.primaryNick],
'no': []
};
event.reply(event.user + ' has started a vote to quiet ' + target + ' for "' + reason + '." Type either "~voteyes ' + target + '" or "~voteno ' + target + '" in the next 90 seconds.');
this.voteQuiets[user.id].timer = setTimeout(function () {
@ -337,8 +359,10 @@ var commands = function(dbot) {
setTimeout(function () {
delete this.voteQuiets[user.id];
}.bind(this), 600000);
}.bind(this), 90000);
}
.bind(this), 600000);
}
.bind(this), 90000);
} else {
if (this.voteQuiets[user.id].spent) {
event.reply('A votequiet attempt has already been made on this user in the last 10 minutes.');
@ -357,7 +381,8 @@ var commands = function(dbot) {
vq.spent = true;
setTimeout(function () {
delete this.voteQuiets[user.id];
}.bind(this), 600000);
}
.bind(this), 600000);
event.reply(response);
});
}
@ -369,7 +394,8 @@ var commands = function(dbot) {
} else {
event.reply('Target does not seem to be in the channel.');
}
}.bind(this));
}
.bind(this));
} else {
event.reply('Target does not seem to be in the channel.');
}
@ -399,7 +425,8 @@ var commands = function(dbot) {
vq.spent = true;
setTimeout(function () {
delete this.voteQuiets[user.id];
}.bind(this), 600000);
}
.bind(this), 600000);
event.reply(response);
});
}
@ -412,7 +439,8 @@ var commands = function(dbot) {
} else {
event.reply('No idea who that is m8');
}
}.bind(this));
}
.bind(this));
},
'~voteno': function (event) {
@ -440,7 +468,8 @@ var commands = function(dbot) {
} else {
event.reply('No idea who that is m8');
}
}.bind(this));
}
.bind(this));
}
};

View File

@ -78,7 +78,8 @@ var kick = function(dbot) {
}), false, quietee);
});
}
}.bind(this));
}
.bind(this));
callback(dbot.t('tquieted', {
'quietee': quietee,
'minutes': duration
@ -89,10 +90,11 @@ var kick = function(dbot) {
'quieter': quieter.primaryNick,
'quietee': quietee,
'reason': reason
}), false, quietee
);
}), false, quietee);
} else {
callback(dbot.t('quieted', { 'quietee': quietee }));
callback(dbot.t('quieted', {
'quietee': quietee
}));
dbot.api.report.notify('quiet', server, quieter.primaryNick, channel,
dbot.t('quiet_notify', {
'quieter': quieter.primaryNick,
@ -115,9 +117,12 @@ var kick = function(dbot) {
function () {});
}
} else {
event.reply(dbot.t('no_user', { 'user': quietee }));
event.reply(dbot.t('no_user', {
'user': quietee
}));
}
}.bind(this));
}
.bind(this));
},
'networkUnban': function (server, unbanee, unbanner, manualHost, callback) {
@ -156,13 +161,16 @@ var kick = function(dbot) {
// Unban
var i = 0;
var unbanChannel = function (channels) {
if(i >= channels.length) return;
if (i >= channels.length)
return;
var channel = channels[i];
this.api.unban(server, host, channel);
setTimeout(function () {
i++; unbanChannel(channels);
i++;
unbanChannel(channels);
}, 1000);
}.bind(this);
}
.bind(this);
unbanChannel(channels);
dbot.say(server, 'NickServ', 'FREEZE ' + unbanee + ' OFF');
@ -171,13 +179,15 @@ var kick = function(dbot) {
// Attempt to look up the host on-the-fly
dbot.api.nickserv.getUserHost(server, unbanee, unbanner, function (host) {
if (host) {
if(!_.has(this.hosts, server)) this.hosts[server] = {};
if (!_.has(this.hosts, server))
this.hosts[server] = {};
this.hosts[server][unbanee] = host;
this.api.networkUnban(server, unbanee, unbanner);
} else {
callback(true); // No host could be found
}
}.bind(this));
}
.bind(this));
}
}
};
@ -188,15 +198,20 @@ var kick = function(dbot) {
dbot.api.timers.addTimeout(timeout, function () {
this.api.networkUnban(server, banee, bot, undefined, function (err) {});
delete this.tempBans[server][banee];
}.bind(this));
}.bind(this));
}.bind(this)
}
.bind(this));
}
.bind(this));
}
.bind(this)
};
this.listener = function (event) {
if (event.kickee == dbot.config.name) {
dbot.instance.join(event, event.channel.name);
event.reply(dbot.t('kicked_dbot', { 'botname': dbot.config.name }));
event.reply(dbot.t('kicked_dbot', {
'botname': dbot.config.name
}));
dbot.db.kicks[dbot.config.name] += 1;
} else {
if (!_.has(dbot.db.kicks, event.kickee)) {
@ -219,7 +234,8 @@ var kick = function(dbot) {
}) + ')');
}
}
}.bind(this);
}
.bind(this);
this.on = 'KICK';
this.onLoad = function () {
@ -229,7 +245,8 @@ var kick = function(dbot) {
dbot.db.hosts[k] = {};
}, this);
}
if(!_.has(dbot.db, 'tempBans')) dbot.db.tempBans = {};
if (!_.has(dbot.db, 'tempBans'))
dbot.db.tempBans = {};
this.hosts = dbot.db.hosts;
this.tempBans = dbot.db.tempBans;
this.voteQuiets = {};
@ -244,7 +261,8 @@ var kick = function(dbot) {
if (_.has(dbot.modules, 'web')) {
dbot.api.web.addIndexLink('/bans', 'Ban List');
}
}.bind(this);
}
.bind(this);
};
exports.fetch = function (dbot) {

View File

@ -9,7 +9,9 @@ var pages = function(dbot) {
},
'/underbans': function (req, res) {
this.db.search('nbans', { 'server': server }, function(ban) {
this.db.search('nbans', {
'server': server
}, function (ban) {
if (ban.reason.match('#underban')) {
bans.push(ban);
}
@ -25,7 +27,9 @@ var pages = function(dbot) {
var server = req.params.server,
bans = [];
this.db.search('nbans', { 'server': server }, function(ban) {
this.db.search('nbans', {
'server': server
}, function (ban) {
bans.push(ban);
}, function () {
res.render('bans', {