From d30f82962ab4abc6463df060e6579c071b5ecb88 Mon Sep 17 00:00:00 2001 From: MinusGix Date: Sun, 16 Feb 2020 21:18:13 -0600 Subject: Add 'to' parameter to invite, specifies channel --- server/src/commands/core/invite.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'server') diff --git a/server/src/commands/core/invite.js b/server/src/commands/core/invite.js index 1811e8b..62c6051 100644 --- a/server/src/commands/core/invite.js +++ b/server/src/commands/core/invite.js @@ -25,8 +25,12 @@ export async function run(core, server, socket, data) { return true; } - // generate common channel - const channel = Math.random().toString(36).substr(2, 8); + let channel; + if (typeof data.to == 'string') { + channel = data.to; + } else { + channel = Math.random().toString(36).substr(2, 8); + } // build and send invite const payload = { @@ -67,7 +71,7 @@ export async function run(core, server, socket, data) { export const requiredData = ['nick']; export const info = { name: 'invite', - description: 'Generates a unique (more or less) room name and passes it to two clients', + description: 'Sends an invite to the target client with the provided channel, or a random channel.', usage: ` - API: { cmd: 'invite', nick: '' }`, + API: { cmd: 'invite', nick: '', to: '' }`, }; -- cgit v1.2.1 From a1c0015fe2b5ac253a6c57650000329d8e27d460 Mon Sep 17 00:00:00 2001 From: MinusGix Date: Tue, 18 Feb 2020 13:57:20 -0600 Subject: Fix usage of double-equals-comparison to triple-equals --- server/src/commands/core/invite.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'server') diff --git a/server/src/commands/core/invite.js b/server/src/commands/core/invite.js index 62c6051..b594586 100644 --- a/server/src/commands/core/invite.js +++ b/server/src/commands/core/invite.js @@ -26,7 +26,7 @@ export async function run(core, server, socket, data) { } let channel; - if (typeof data.to == 'string') { + if (typeof data.to === 'string') { channel = data.to; } else { channel = Math.random().toString(36).substr(2, 8); -- cgit v1.2.1