From 0c0f0ab79e7245c718f7543a232b957594949b0b Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Wed, 9 Jun 2021 10:17:32 +0200 Subject: [PATCH] Fix /me failing in user query buffers This is a regression. --- commands.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/commands.js b/commands.js index ad559d1..a17989c 100644 --- a/commands.js +++ b/commands.js @@ -9,6 +9,14 @@ function getActiveClient(app) { return app.clients.get(buf.server); } +function getActiveTarget(app) { + var activeBuffer = app.state.buffers.get(app.state.activeBuffer); + if (!activeBuffer) { + throw new Error("Not in a buffer"); + } + return activeBuffer.name; +} + function getActiveChannel(app) { var activeBuffer = app.state.buffers.get(app.state.activeBuffer); if (!activeBuffer || activeBuffer.type !== BufferType.CHANNEL) { @@ -173,9 +181,9 @@ export default { description: "Send an action message to the current buffer", execute: (app, args) => { var action = args.join(" "); - var activeChannel = getActiveChannel(app); + var target = getActiveTarget(app); var text = `\x01ACTION ${action}\x01`; - app.privmsg(activeChannel, text); + app.privmsg(target, text); }, }, "mode": {