thelounge/src/plugins/inputs/mode.js

32 lines
498 B
JavaScript
Raw Normal View History

"use strict";
exports.commands = ["mode", "op", "voice", "deop", "devoice"];
exports.input = function(network, chan, cmd, args) {
if (args.length === 0) {
2014-09-13 23:29:45 +02:00
return;
}
2015-10-01 00:39:57 +02:00
2014-09-13 23:29:45 +02:00
var mode;
var user;
2015-10-01 00:39:57 +02:00
if (cmd !== "mode") {
2014-09-13 23:29:45 +02:00
user = args[0];
mode = {
2016-10-09 10:54:44 +02:00
op: "+o",
voice: "+v",
deop: "-o",
devoice: "-v"
2014-09-13 23:29:45 +02:00
}[cmd];
} else if (args.length === 1) {
2016-03-06 10:24:56 +01:00
return true;
2014-09-13 23:29:45 +02:00
} else {
mode = args[0];
user = args[1];
}
2016-03-08 14:36:25 +01:00
2014-09-13 23:29:45 +02:00
var irc = network.irc;
2016-03-08 14:36:25 +01:00
irc.raw("MODE", chan.name, mode, user);
2016-03-06 10:24:56 +01:00
return true;
2014-09-13 23:29:45 +02:00
};