1
0
mirror of https://github.com/hack-chat/main.git synced 2024-03-22 13:20:33 +08:00

Add 'to' parameter to invite, specifies channel

This commit is contained in:
MinusGix 2020-02-16 21:18:13 -06:00
parent 2e024eddc2
commit d30f82962a

View File

@ -25,8 +25,12 @@ export async function run(core, server, socket, data) {
return true; return true;
} }
// generate common channel let channel;
const channel = Math.random().toString(36).substr(2, 8); if (typeof data.to == 'string') {
channel = data.to;
} else {
channel = Math.random().toString(36).substr(2, 8);
}
// build and send invite // build and send invite
const payload = { const payload = {
@ -67,7 +71,7 @@ export async function run(core, server, socket, data) {
export const requiredData = ['nick']; export const requiredData = ['nick'];
export const info = { export const info = {
name: 'invite', 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: ` usage: `
API: { cmd: 'invite', nick: '<target nickname>' }`, API: { cmd: 'invite', nick: '<target nickname>', to: '<optional destination channel>' }`,
}; };