From f5debac3882190a9106d4e0bec46c7a3fcd0036a Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Thu, 27 May 2021 13:48:49 -0400 Subject: [PATCH] Add /op, /deop commands --- commands.js | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/commands.js b/commands.js index cf75d7c..3dd2645 100644 --- a/commands.js +++ b/commands.js @@ -46,6 +46,23 @@ export default { app.close(activeBuffer.id); }, }, + "deop": { + usage: "", + 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: "", + 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",