Fix /me failing in user query buffers

This is a regression.
This commit is contained in:
Simon Ser 2021-06-09 10:17:32 +02:00
parent 2546d31af0
commit 0c0f0ab79e

View file

@ -9,6 +9,14 @@ function getActiveClient(app) {
return app.clients.get(buf.server); 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) { function getActiveChannel(app) {
var activeBuffer = app.state.buffers.get(app.state.activeBuffer); var activeBuffer = app.state.buffers.get(app.state.activeBuffer);
if (!activeBuffer || activeBuffer.type !== BufferType.CHANNEL) { if (!activeBuffer || activeBuffer.type !== BufferType.CHANNEL) {
@ -173,9 +181,9 @@ export default {
description: "Send an action message to the current buffer", description: "Send an action message to the current buffer",
execute: (app, args) => { execute: (app, args) => {
var action = args.join(" "); var action = args.join(" ");
var activeChannel = getActiveChannel(app); var target = getActiveTarget(app);
var text = `\x01ACTION ${action}\x01`; var text = `\x01ACTION ${action}\x01`;
app.privmsg(activeChannel, text); app.privmsg(target, text);
}, },
}, },
"mode": { "mode": {