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 14:29:45 -07:00
return;
}
2015-10-01 00:39:57 +02:00
2014-09-13 14:29:45 -07:00
var mode;
var user;
2015-10-01 00:39:57 +02:00
if (cmd !== "mode") {
2014-09-13 14:29:45 -07:00
user = args[0];
mode = {
2016-10-09 11:54:44 +03:00
op: "+o",
voice: "+v",
deop: "-o",
devoice: "-v"
2014-09-13 14:29:45 -07:00
}[cmd];
} else if (args.length === 1) {
2016-03-06 11:24:56 +02:00
return true;
2014-09-13 14:29:45 -07:00
} else {
mode = args[0];
user = args[1];
}
2016-03-08 15:36:25 +02:00
2014-09-13 14:29:45 -07:00
var irc = network.irc;
2016-03-08 15:36:25 +02:00
irc.raw("MODE", chan.name, mode, user);
2016-03-06 11:24:56 +02:00
return true;
2014-09-13 14:29:45 -07:00
};