Add /op, /deop commands

This commit is contained in:
Drew DeVault 2021-05-27 13:48:49 -04:00 committed by Simon Ser
parent f0a532dbd6
commit f5debac388

View file

@ -46,6 +46,23 @@ export default {
app.close(activeBuffer.id);
},
},
"deop": {
usage: "<nick>",
description: "Removes operator status for a user on this channel",
execute: (app, args) => {
var nick = args[0];
if (!nick) {
throw new Error("Missing nick");
}
var activeBuffer = app.state.buffers.get(app.state.activeBuffer);
if (!activeBuffer || !app.isChannel(activeBuffer.name)) {
throw new Error("Not in a channel");
}
getActiveClient(app).send({ command: "MODE", params: [
activeBuffer.name, "-o", user,
]});
},
},
"disconnect": {
description: "Disconnect from the server",
execute: (app, args) => {
@ -130,6 +147,23 @@ export default {
getActiveClient(app).send({ command: "NOTICE", params: [target, text] });
},
},
"op": {
usage: "<nick>",
description: "Gives a user operator status on this channel",
execute: (app, args) => {
var nick = args[0];
if (!nick) {
throw new Error("Missing nick");
}
var activeBuffer = app.state.buffers.get(app.state.activeBuffer);
if (!activeBuffer || !app.isChannel(activeBuffer.name)) {
throw new Error("Not in a channel");
}
getActiveClient(app).send({ command: "MODE", params: [
activeBuffer.name, "+o", nick,
]});
},
},
"part": {
usage: "[reason]",
description: "Leave a channel",