~emersion/public-inbox

gamja: Add /invite command v1 APPLIED

Drew DeVault: 1
 Add /invite command

 1 files changed, 17 insertions(+), 0 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~emersion/public-inbox/patches/23051/mbox | git am -3
Learn more about email & git
View this thread in the archives

[PATCH gamja] Add /invite command Export this patch

---
 commands.js | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/commands.js b/commands.js
index 40260c3..f8df0a1 100644
--- a/commands.js
+++ b/commands.js
@@ -134,6 +134,23 @@ export default {
			app.openHelp();
		},
	},
	"invite": {
		usage: "<nick>",
		description: "Invites a user to the channel",
		execute: (app, args) => {
			var nick = args[0];
			if (!nick) {
				throw new Error("Missing nick");
			}
			var activeBuffer = app.state.buffers.get(app.state.activeBuffer);
			if (!activeBuffer || !app.isChannel(activeBuffer.name)) {
				throw new Error("Not in a channel");
			}
			getActiveClient(app).send({ command: "INVITE", params: [
				nick, activeBuffer.name,
			]});
		},
	},
	"j": join,
	"join": join,
	"kick": kick,
-- 
2.31.1
LGTM, pushed. Thanks!
Side note, we should probably pretty-print incoming INVITE messages in
the buffer.