mirror of
https://github.com/thelounge/thelounge.git
synced 2024-05-02 22:43:19 +02:00
324fb9023e
This commit adds a new command, /kickban, that is a combination of /kick and /ban: it kicks the specific user from the channel and then sets the +b mode to ban the user from the channel.
50 lines
913 B
JavaScript
50 lines
913 B
JavaScript
"use strict";
|
|
|
|
const Chan = require("../../models/chan");
|
|
const Msg = require("../../models/msg");
|
|
|
|
exports.commands = ["ban", "unban", "banlist", "kickban"];
|
|
|
|
exports.input = function ({irc}, chan, cmd, args) {
|
|
if (chan.type !== Chan.Type.CHANNEL) {
|
|
chan.pushMessage(
|
|
this,
|
|
new Msg({
|
|
type: Msg.Type.ERROR,
|
|
text: `${cmd} command can only be used in channels.`,
|
|
})
|
|
);
|
|
|
|
return;
|
|
}
|
|
|
|
if (cmd !== "banlist" && args.length === 0) {
|
|
if (args.length === 0) {
|
|
chan.pushMessage(
|
|
this,
|
|
new Msg({
|
|
type: Msg.Type.ERROR,
|
|
text: `Usage: /${cmd} <nick>`,
|
|
})
|
|
);
|
|
|
|
return;
|
|
}
|
|
}
|
|
|
|
switch (cmd) {
|
|
case "kickban":
|
|
irc.raw("KICK", chan.name, args[0], args.slice(1).join(" "));
|
|
// fall through
|
|
case "ban":
|
|
irc.ban(chan.name, args[0]);
|
|
break;
|
|
case "unban":
|
|
irc.unban(chan.name, args[0]);
|
|
break;
|
|
case "banlist":
|
|
irc.banlist(chan.name);
|
|
break;
|
|
}
|
|
};
|