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