Files
thelounge/server/plugins/inputs/action.ts
Max Leiter f77e4d1e6f ircv3: add +reply support (#5062)
Relies on https://github.com/kiwiirc/irc-framework/pull/411

https://ircv3.net/specs/client-tags/reply.html

Design feedback very welcome

<img width="1718" height="278" alt="Screenshot 2026-04-11 at 21-00-22
#thelounge — The Lounge"
src="https://github.com/user-attachments/assets/ba6e7c69-2477-4a7b-b196-901d19ca9cba"
/>

1. we lack a 'thread' view (irccloud, slack, etc). can be a followup if
we do want it
2. need to test scrolling to messages outside of the current buffer
3. due to lack of client support, i opted to auto prefill the input with
\`<targetNick>: \` so people can follow along even without reply support
4. CSS can definitely be improved (once a design is settled on)

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
2026-07-15 20:18:09 -07:00

64 lines
1.3 KiB
TypeScript

import {PluginInputHandler} from "./index";
import Msg from "../../models/msg";
import {MessageType} from "../../../shared/types/msg";
import {ChanType} from "../../../shared/types/chan";
const commands = ["slap", "me"];
const input: PluginInputHandler = function (network, chan, cmd, args, extras) {
if (chan.type !== ChanType.CHANNEL && chan.type !== ChanType.QUERY) {
chan.pushMessage(
this,
new Msg({
type: MessageType.ERROR,
text: `${cmd} command can only be used in channels and queries.`,
})
);
return;
}
const irc = network.irc;
let text;
switch (cmd) {
case "slap":
text = "slaps " + args[0] + " around a bit with a large trout";
/* fall through */
case "me": {
if (args.length === 0) {
break;
}
text = text || args.join(" ");
const replyTo = extras?.replyTo;
const replyTags =
replyTo && network.serverOptions.supportsReply ? {"+reply": replyTo} : undefined;
irc.action(chan.name, text, replyTags);
// If the IRCd does not support echo-message, simulate the message
// being sent back to us.
if (!irc.network.cap.isEnabled("echo-message")) {
irc.emit("action", {
nick: irc.user.nick,
target: chan.name,
message: text,
tags: replyTo ? {"+reply": replyTo} : undefined,
});
}
break;
}
}
return true;
};
export default {
commands,
input,
};