Add /quote command

Closes: https://todo.sr.ht/~emersion/gamja/22
This commit is contained in:
Simon Ser 2021-05-27 11:22:34 +02:00
parent d34bff9ed6
commit d5e21097f8

View file

@ -1,3 +1,4 @@
import * as irc from "../lib/irc.js";
import { SERVER_BUFFER, BufferType } from "./state.js"; import { SERVER_BUFFER, BufferType } from "./state.js";
function getActiveClient(app) { function getActiveClient(app) {
@ -151,6 +152,19 @@ export default {
app.close({ name: SERVER_BUFFER }); app.close({ name: SERVER_BUFFER });
}, },
}, },
"quote": {
usage: "<command>",
description: "Send a raw IRC command to the server",
execute: (app, args) => {
var msg;
try {
msg = irc.parseMessage(args.join(" "));
} catch (err) {
throw new Error("failed to parse IRC command: " + err.message);
}
getActiveClient(app).send(msg);
},
},
"reconnect": { "reconnect": {
description: "Reconnect to the server", description: "Reconnect to the server",
execute: (app, args) => { execute: (app, args) => {