thelounge/src/plugins/inputs/mode.js

33 lines
492 B
JavaScript
Raw Normal View History

exports.commands = ["mode", "op", "voice", "deop", "devoice"];
exports.input = function(network, chan, cmd, args) {
if (args.length === 0) {
2014-09-13 21:29:45 +00:00
return;
}
2015-09-30 22:39:57 +00:00
2014-09-13 21:29:45 +00:00
var mode;
var user;
2015-09-30 22:39:57 +00:00
if (cmd !== "mode") {
2014-09-13 21:29:45 +00:00
user = args[0];
mode = {
2015-09-30 22:39:57 +00:00
"op": "+o",
"voice": "+v",
"deop": "-o",
"devoice": "-v"
2014-09-13 21:29:45 +00:00
}[cmd];
} else if (args.length === 1) {
2016-03-06 09:24:56 +00:00
return true;
2014-09-13 21:29:45 +00:00
} else {
mode = args[0];
user = args[1];
}
var irc = network.irc;
irc.mode(
chan.name,
mode,
user
);
2016-03-06 09:24:56 +00:00
return true;
2014-09-13 21:29:45 +00:00
};