From e2e2f7a8fcb1d74908832c9a4392b77ae942ea11 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Thu, 27 May 2021 09:37:09 -0400 Subject: [PATCH] /mode: use active buffer if omitted --- commands.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/commands.js b/commands.js index 0cf7cf7..7927e9c 100644 --- a/commands.js +++ b/commands.js @@ -93,6 +93,14 @@ export default { usage: " [mode args...]", description: "Change channel or user mode", execute: (app, args) => { + var target = args[0]; + if (target.startsWith("+") || target.startsWith("-")) { + var activeBuffer = app.state.buffers.get(app.state.activeBuffer); + if (!activeBuffer || !app.isChannel(activeBuffer.name)) { + throw new Error("Not in a channel"); + } + args = [activeBuffer.name, ...args]; + } getActiveClient(app).send({ command: "MODE", params: args }); }, },