aboutsummaryrefslogtreecommitdiff
path: root/commands.js
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2021-05-27 11:22:34 +0200
committerSimon Ser <contact@emersion.fr>2021-05-27 11:22:34 +0200
commitd5e21097f8781bdc1f8e57b943265a752a5db7ef (patch)
treee5a2b71f103deb4a1741193d43a40d58c890da64 /commands.js
parentd34bff9ed6fb8258dbc1caf8b738581ee50c4729 (diff)
downloadgamja-d5e21097f8781bdc1f8e57b943265a752a5db7ef.tar.gz
gamja-d5e21097f8781bdc1f8e57b943265a752a5db7ef.zip
Add /quote command
Closes: https://todo.sr.ht/~emersion/gamja/22
Diffstat (limited to 'commands.js')
-rw-r--r--commands.js14
1 files changed, 14 insertions, 0 deletions
diff --git a/commands.js b/commands.js
index 5359f69..ba6b4c6 100644
--- a/commands.js
+++ b/commands.js
@@ -1,3 +1,4 @@
+import * as irc from "../lib/irc.js";
import { SERVER_BUFFER, BufferType } from "./state.js";
function getActiveClient(app) {
@@ -151,6 +152,19 @@ export default {
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": {
description: "Reconnect to the server",
execute: (app, args) => {