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

Merge pull request #85 from MinusGix/add_channel_invite

Add ability to specify the channel that the invite command invites the user to
This commit is contained in:
marzavec 2020-02-19 11:30:51 -06:00 committed by GitHub
commit 133740a250
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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>' }`,
}; };