cleaned up queue file
This commit is contained in:
12
dist/index.js
vendored
12
dist/index.js
vendored
@@ -48,6 +48,7 @@ CLIENT.on('ready', client => {
|
|||||||
CLIENT.on('interactionCreate', (interaction) => __awaiter(void 0, void 0, void 0, function* () {
|
CLIENT.on('interactionCreate', (interaction) => __awaiter(void 0, void 0, void 0, function* () {
|
||||||
if (!interaction.isCommand())
|
if (!interaction.isCommand())
|
||||||
return;
|
return;
|
||||||
|
try {
|
||||||
if (interaction.commandName === 'queue')
|
if (interaction.commandName === 'queue')
|
||||||
yield (0, queue_1.createQueue)(interaction);
|
yield (0, queue_1.createQueue)(interaction);
|
||||||
else if (interaction.commandName === 'join')
|
else if (interaction.commandName === 'join')
|
||||||
@@ -60,5 +61,16 @@ CLIENT.on('interactionCreate', (interaction) => __awaiter(void 0, void 0, void 0
|
|||||||
yield (0, queue_1.queueInfo)(interaction);
|
yield (0, queue_1.queueInfo)(interaction);
|
||||||
else if (interaction.commandName === 'elo')
|
else if (interaction.commandName === 'elo')
|
||||||
yield (0, api_1.getPlayerInteraction)(interaction);
|
yield (0, api_1.getPlayerInteraction)(interaction);
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
if (typeof e === 'string') {
|
||||||
|
if (interaction.deferred || interaction.replied)
|
||||||
|
interaction.editReply(e);
|
||||||
|
else
|
||||||
|
interaction.reply(e);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
console.error(e);
|
||||||
|
}
|
||||||
}));
|
}));
|
||||||
CLIENT.login(TOKEN);
|
CLIENT.login(TOKEN);
|
||||||
|
|||||||
147
dist/queue.js
vendored
147
dist/queue.js
vendored
@@ -14,20 +14,40 @@ const discord_js_1 = require("discord.js");
|
|||||||
const util_1 = require("./util");
|
const util_1 = require("./util");
|
||||||
//maps ChannelID to QueueInfo
|
//maps ChannelID to QueueInfo
|
||||||
const QUEUE = new Map();
|
const QUEUE = new Map();
|
||||||
|
/**
|
||||||
|
* get the GuildMember of an interaction
|
||||||
|
* @param interaction
|
||||||
|
* @throws string message if it cannot be read
|
||||||
|
* @returns member
|
||||||
|
*/
|
||||||
|
function getMember(interaction) {
|
||||||
|
let member = interaction.member;
|
||||||
|
if (!(member instanceof discord_js_1.GuildMember))
|
||||||
|
throw 'Unable to retrieve guild member information, please try again';
|
||||||
|
return member;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* get the queueInfo of an interaction
|
||||||
|
* @param interaction
|
||||||
|
* @throws string message if it does not exist
|
||||||
|
* @returns queue info
|
||||||
|
*/
|
||||||
|
function getInfo(interaction) {
|
||||||
|
let info = QUEUE.get(interaction.channelId);
|
||||||
|
if (!info)
|
||||||
|
throw 'There is not an active queue in this channel, type `/queue` to create one';
|
||||||
|
return info;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* creates a queue from an interaction
|
||||||
|
* @param interaction
|
||||||
|
* @throws string message if it cannot be created
|
||||||
|
*/
|
||||||
function createQueue(interaction) {
|
function createQueue(interaction) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
console.log('COMMAND createQueue');
|
let { channelId } = interaction, member = getMember(interaction), teamsize = interaction.options.getInteger('teamsize', true);
|
||||||
let member = interaction.member;
|
if (QUEUE.has(channelId))
|
||||||
if (!(member instanceof discord_js_1.GuildMember)) {
|
throw 'There is already an active queue in this channel, type `/join` to join'; //and you are already in it
|
||||||
yield interaction.reply('Unable to retrieve guild member information, please try again');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
let channelId = interaction.channelId;
|
|
||||||
if (QUEUE.has(channelId)) {
|
|
||||||
yield interaction.reply('There is already an active queue in this channel, type `/join` to join'); //and you are already in it
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
let teamsize = interaction.options.getInteger('teamsize', true);
|
|
||||||
QUEUE.set(channelId, {
|
QUEUE.set(channelId, {
|
||||||
players: [
|
players: [
|
||||||
member
|
member
|
||||||
@@ -39,83 +59,58 @@ function createQueue(interaction) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
exports.createQueue = createQueue;
|
exports.createQueue = createQueue;
|
||||||
|
/**
|
||||||
|
* joins a queue from an interaction
|
||||||
|
* @param interaction
|
||||||
|
* @throws string message if it cannot be joined
|
||||||
|
*/
|
||||||
function joinQueue(interaction) {
|
function joinQueue(interaction) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
console.log('COMMAND joinQueue');
|
let member = getMember(interaction), info = getInfo(interaction);
|
||||||
let member = interaction.member;
|
if (info.players.map(m => m.id).includes(member.id))
|
||||||
if (!(member instanceof discord_js_1.GuildMember)) {
|
throw 'You are already in the active queue';
|
||||||
yield interaction.reply('Unable to retrieve guild member information, please try again');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
let channelId = interaction.channelId;
|
|
||||||
let info = QUEUE.get(channelId);
|
|
||||||
if (!info) {
|
|
||||||
yield interaction.reply('There is not an active queue in this channel, type `/queue` to create one');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (info.players.map(m => m.id).includes(member.id)) {
|
|
||||||
yield interaction.reply('You are already in the active queue');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
console.log(JSON.stringify(member.id));
|
|
||||||
console.log(JSON.stringify(info.players.map(m => m.id)));
|
|
||||||
info.players.push(member);
|
info.players.push(member);
|
||||||
QUEUE.set(channelId, info);
|
QUEUE.set(interaction.channelId, info);
|
||||||
yield interaction.reply('Joined the queue');
|
yield interaction.reply('Joined the queue');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
exports.joinQueue = joinQueue;
|
exports.joinQueue = joinQueue;
|
||||||
|
/**
|
||||||
|
* leaves a queue from an interaction
|
||||||
|
* @param interaction
|
||||||
|
* @throws string message if it cannot be left
|
||||||
|
*/
|
||||||
function leaveQueue(interaction) {
|
function leaveQueue(interaction) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
console.log('COMMAND leaveQueue');
|
let member = getMember(interaction), info = getInfo(interaction);
|
||||||
let member = interaction.member;
|
if (!info.players.map(m => m.id).includes(member.id))
|
||||||
if (!(member instanceof discord_js_1.GuildMember)) {
|
throw 'You aren\'t in the active queue';
|
||||||
yield interaction.reply('Unable to retrieve guild member information, please try again');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
let channelId = interaction.channelId;
|
|
||||||
let info = QUEUE.get(channelId);
|
|
||||||
if (!info) {
|
|
||||||
yield interaction.reply('There is not an active queue in this channel, type `/queue` to create one');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!info.players.map(m => m.id).includes(member.id)) {
|
|
||||||
yield interaction.reply('You aren\'t in the active queue');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
info.players.splice(info.players.indexOf(member), 1);
|
info.players.splice(info.players.indexOf(member), 1);
|
||||||
QUEUE.set(channelId, info);
|
QUEUE.set(interaction.channelId, info);
|
||||||
yield interaction.reply('Left the queue');
|
yield interaction.reply('Left the queue');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
exports.leaveQueue = leaveQueue;
|
exports.leaveQueue = leaveQueue;
|
||||||
|
/**
|
||||||
|
* readys a queue from an interaction
|
||||||
|
* @param interaction
|
||||||
|
* @throws string message if it cannot be readied
|
||||||
|
*/
|
||||||
function readyQueue(interaction) {
|
function readyQueue(interaction) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
console.log('COMMAND readyQueue');
|
let member = getMember(interaction), info = getInfo(interaction), { initiator } = info;
|
||||||
let member = interaction.member;
|
if (member.id !== initiator.id)
|
||||||
if (!(member instanceof discord_js_1.GuildMember)) {
|
throw 'Only the queue initiator can ready the queue';
|
||||||
yield interaction.reply('Unable to retrieve guild member information, please try again');
|
//reset queue
|
||||||
return;
|
QUEUE.delete(interaction.channelId);
|
||||||
}
|
if (info.players.filter(m => m.id !== initiator.id).length === 0)
|
||||||
let channelId = interaction.channelId;
|
throw 'Nobody signed up for the queue, the queue has been reset';
|
||||||
let info = QUEUE.get(channelId);
|
//team data
|
||||||
if (!info) {
|
|
||||||
yield interaction.reply('There is no active queue in this channel, type `/queue` to create one'); //and you are already in it
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
let { initiator } = info;
|
|
||||||
if (member.id !== initiator.id) {
|
|
||||||
yield interaction.reply('Only the queue initiator can ready the queue');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
QUEUE.delete(channelId);
|
|
||||||
if (info.players.filter(m => m.id !== initiator.id).length === 0) {
|
|
||||||
yield interaction.reply('Nobody signed up for the queue, the queue has been reset');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
let playerlist = (0, util_1.shuffle)(info.players), teams = [];
|
let playerlist = (0, util_1.shuffle)(info.players), teams = [];
|
||||||
|
//fill team data
|
||||||
for (let i = 0; i < playerlist.length; i += info.teamsize)
|
for (let i = 0; i < playerlist.length; i += info.teamsize)
|
||||||
teams.push(playerlist.slice(i, i + info.teamsize));
|
teams.push(playerlist.slice(i, i + info.teamsize));
|
||||||
|
//convert teams to strings
|
||||||
let teamsStr = [];
|
let teamsStr = [];
|
||||||
teams.forEach((team, i) => {
|
teams.forEach((team, i) => {
|
||||||
let str = [`Team ${i + 1}`];
|
let str = [`Team ${i + 1}`];
|
||||||
@@ -126,14 +121,14 @@ function readyQueue(interaction) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
exports.readyQueue = readyQueue;
|
exports.readyQueue = readyQueue;
|
||||||
|
/**
|
||||||
|
* sends the queue information from an interaction
|
||||||
|
* @param interaction
|
||||||
|
* @throws string message if it cannot be read
|
||||||
|
*/
|
||||||
function queueInfo(interaction) {
|
function queueInfo(interaction) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
console.log('COMMAND queueInfo');
|
let info = getInfo(interaction);
|
||||||
let channelId = interaction.channelId, info = QUEUE.get(channelId);
|
|
||||||
if (!info) {
|
|
||||||
yield interaction.reply('There is not an active queue in this channel, type `/queue` to create one');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
yield interaction.reply('```' + `
|
yield interaction.reply('```' + `
|
||||||
players: ${info.players.map(p => p.user.tag).join('\n ')}
|
players: ${info.players.map(p => p.user.tag).join('\n ')}
|
||||||
initiator: ${info.initiator.user.tag}
|
initiator: ${info.initiator.user.tag}
|
||||||
|
|||||||
13
src/index.ts
13
src/index.ts
@@ -24,6 +24,8 @@ CLIENT.on('ready', client => {
|
|||||||
CLIENT.on('interactionCreate', async interaction => {
|
CLIENT.on('interactionCreate', async interaction => {
|
||||||
if (!interaction.isCommand()) return;
|
if (!interaction.isCommand()) return;
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
if (interaction.commandName === 'queue')
|
if (interaction.commandName === 'queue')
|
||||||
await createQueue(interaction);
|
await createQueue(interaction);
|
||||||
else if (interaction.commandName === 'join')
|
else if (interaction.commandName === 'join')
|
||||||
@@ -36,6 +38,17 @@ CLIENT.on('interactionCreate', async interaction => {
|
|||||||
await queueInfo(interaction);
|
await queueInfo(interaction);
|
||||||
else if (interaction.commandName === 'elo')
|
else if (interaction.commandName === 'elo')
|
||||||
await getPlayerInteraction(interaction);
|
await getPlayerInteraction(interaction);
|
||||||
|
|
||||||
|
} catch (e) {
|
||||||
|
|
||||||
|
if (typeof e === 'string') {
|
||||||
|
if (interaction.deferred || interaction.replied)
|
||||||
|
interaction.editReply(e);
|
||||||
|
else
|
||||||
|
interaction.reply(e);
|
||||||
|
} else console.error(e);
|
||||||
|
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
CLIENT.login(TOKEN);
|
CLIENT.login(TOKEN);
|
||||||
|
|||||||
181
src/queue.ts
181
src/queue.ts
@@ -1,3 +1,4 @@
|
|||||||
|
import { info } from "console";
|
||||||
import { CommandInteraction, GuildMember } from "discord.js";
|
import { CommandInteraction, GuildMember } from "discord.js";
|
||||||
import { shuffle } from "./util";
|
import { shuffle } from "./util";
|
||||||
|
|
||||||
@@ -10,25 +11,49 @@ type queueInfo = {
|
|||||||
//maps ChannelID to QueueInfo
|
//maps ChannelID to QueueInfo
|
||||||
const QUEUE = new Map<string, queueInfo>();
|
const QUEUE = new Map<string, queueInfo>();
|
||||||
|
|
||||||
export async function createQueue(interaction: CommandInteraction) {
|
/**
|
||||||
|
* get the GuildMember of an interaction
|
||||||
console.log('COMMAND createQueue')
|
* @param interaction
|
||||||
|
* @throws string message if it cannot be read
|
||||||
|
* @returns member
|
||||||
|
*/
|
||||||
|
function getMember(interaction: CommandInteraction): GuildMember {
|
||||||
let member = interaction.member;
|
let member = interaction.member;
|
||||||
|
|
||||||
if (!(member instanceof GuildMember)) {
|
if (!(member instanceof GuildMember))
|
||||||
await interaction.reply('Unable to retrieve guild member information, please try again');
|
throw 'Unable to retrieve guild member information, please try again';
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
let channelId = interaction.channelId;
|
return member;
|
||||||
|
}
|
||||||
|
|
||||||
if (QUEUE.has(channelId)) {
|
/**
|
||||||
await interaction.reply('There is already an active queue in this channel, type `/join` to join'); //and you are already in it
|
* get the queueInfo of an interaction
|
||||||
return;
|
* @param interaction
|
||||||
}
|
* @throws string message if it does not exist
|
||||||
|
* @returns queue info
|
||||||
|
*/
|
||||||
|
function getInfo(interaction: CommandInteraction): queueInfo {
|
||||||
|
let info = QUEUE.get(interaction.channelId);
|
||||||
|
|
||||||
let teamsize = interaction.options.getInteger('teamsize', true);
|
if (!info)
|
||||||
|
throw 'There is not an active queue in this channel, type `/queue` to create one';
|
||||||
|
|
||||||
|
return info;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* creates a queue from an interaction
|
||||||
|
* @param interaction
|
||||||
|
* @throws string message if it cannot be created
|
||||||
|
*/
|
||||||
|
export async function createQueue(interaction: CommandInteraction) {
|
||||||
|
|
||||||
|
let {channelId} = interaction,
|
||||||
|
member = getMember(interaction),
|
||||||
|
teamsize = interaction.options.getInteger('teamsize', true);
|
||||||
|
|
||||||
|
if (QUEUE.has(channelId))
|
||||||
|
throw 'There is already an active queue in this channel, type `/join` to join'; //and you are already in it
|
||||||
|
|
||||||
QUEUE.set(channelId, {
|
QUEUE.set(channelId, {
|
||||||
players: [
|
players: [
|
||||||
@@ -42,117 +67,78 @@ export async function createQueue(interaction: CommandInteraction) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* joins a queue from an interaction
|
||||||
|
* @param interaction
|
||||||
|
* @throws string message if it cannot be joined
|
||||||
|
*/
|
||||||
export async function joinQueue(interaction: CommandInteraction) {
|
export async function joinQueue(interaction: CommandInteraction) {
|
||||||
|
|
||||||
console.log('COMMAND joinQueue')
|
let member = getMember(interaction),
|
||||||
|
info = getInfo(interaction);
|
||||||
|
|
||||||
let member = interaction.member;
|
if (info.players.map(m=>m.id).includes(member.id))
|
||||||
|
throw 'You are already in the active queue';
|
||||||
if (!(member instanceof GuildMember)) {
|
|
||||||
await interaction.reply('Unable to retrieve guild member information, please try again');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
let channelId = interaction.channelId;
|
|
||||||
|
|
||||||
let info = QUEUE.get(channelId);
|
|
||||||
|
|
||||||
if (!info) {
|
|
||||||
await interaction.reply('There is not an active queue in this channel, type `/queue` to create one');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (info.players.map(m=>m.id).includes(member.id)) {
|
|
||||||
await interaction.reply('You are already in the active queue');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log(JSON.stringify(member.id))
|
|
||||||
console.log(JSON.stringify(info.players.map(m=>m.id)))
|
|
||||||
|
|
||||||
info.players.push(member);
|
info.players.push(member);
|
||||||
|
|
||||||
QUEUE.set(channelId, info);
|
QUEUE.set(interaction.channelId, info);
|
||||||
|
|
||||||
await interaction.reply('Joined the queue');
|
await interaction.reply('Joined the queue');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* leaves a queue from an interaction
|
||||||
|
* @param interaction
|
||||||
|
* @throws string message if it cannot be left
|
||||||
|
*/
|
||||||
export async function leaveQueue(interaction: CommandInteraction) {
|
export async function leaveQueue(interaction: CommandInteraction) {
|
||||||
|
|
||||||
console.log('COMMAND leaveQueue')
|
let member = getMember(interaction),
|
||||||
|
info = getInfo(interaction);
|
||||||
|
|
||||||
let member = interaction.member;
|
if (!info.players.map(m=>m.id).includes(member.id))
|
||||||
|
throw 'You aren\'t in the active queue';
|
||||||
if (!(member instanceof GuildMember)) {
|
|
||||||
await interaction.reply('Unable to retrieve guild member information, please try again');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
let channelId = interaction.channelId;
|
|
||||||
|
|
||||||
let info = QUEUE.get(channelId);
|
|
||||||
|
|
||||||
if (!info) {
|
|
||||||
await interaction.reply('There is not an active queue in this channel, type `/queue` to create one');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!info.players.map(m=>m.id).includes(member.id)) {
|
|
||||||
await interaction.reply('You aren\'t in the active queue');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
info.players.splice(info.players.indexOf(member), 1);
|
info.players.splice(info.players.indexOf(member), 1);
|
||||||
|
|
||||||
QUEUE.set(channelId, info);
|
QUEUE.set(interaction.channelId, info);
|
||||||
|
|
||||||
await interaction.reply('Left the queue');
|
await interaction.reply('Left the queue');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* readys a queue from an interaction
|
||||||
|
* @param interaction
|
||||||
|
* @throws string message if it cannot be readied
|
||||||
|
*/
|
||||||
export async function readyQueue(interaction: CommandInteraction) {
|
export async function readyQueue(interaction: CommandInteraction) {
|
||||||
|
|
||||||
console.log('COMMAND readyQueue');
|
let member = getMember(interaction),
|
||||||
|
info = getInfo(interaction),
|
||||||
|
{initiator} = info;
|
||||||
|
|
||||||
let member = interaction.member;
|
if (member.id !== initiator.id)
|
||||||
|
throw 'Only the queue initiator can ready the queue';
|
||||||
|
|
||||||
if (!(member instanceof GuildMember)) {
|
//reset queue
|
||||||
await interaction.reply('Unable to retrieve guild member information, please try again');
|
QUEUE.delete(interaction.channelId);
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
let channelId = interaction.channelId;
|
if (info.players.filter(m => m.id !== initiator.id).length === 0)
|
||||||
|
throw 'Nobody signed up for the queue, the queue has been reset';
|
||||||
let info = QUEUE.get(channelId);
|
|
||||||
|
|
||||||
if (!info) {
|
|
||||||
await interaction.reply('There is no active queue in this channel, type `/queue` to create one'); //and you are already in it
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
let {initiator} = info;
|
|
||||||
|
|
||||||
if (member.id !== initiator.id) {
|
|
||||||
await interaction.reply('Only the queue initiator can ready the queue');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
QUEUE.delete(channelId);
|
|
||||||
|
|
||||||
if (info.players.filter(m => m.id !== initiator.id).length === 0) {
|
|
||||||
await interaction.reply('Nobody signed up for the queue, the queue has been reset');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
//team data
|
||||||
let playerlist: GuildMember[] = shuffle(info.players),
|
let playerlist: GuildMember[] = shuffle(info.players),
|
||||||
teams: GuildMember[][] = [];
|
teams: GuildMember[][] = [];
|
||||||
|
|
||||||
|
//fill team data
|
||||||
for (let i = 0; i < playerlist.length; i+= info.teamsize)
|
for (let i = 0; i < playerlist.length; i+= info.teamsize)
|
||||||
teams.push(playerlist.slice(i, i+info.teamsize));
|
teams.push(playerlist.slice(i, i+info.teamsize));
|
||||||
|
|
||||||
|
//convert teams to strings
|
||||||
let teamsStr: string[] = [];
|
let teamsStr: string[] = [];
|
||||||
|
|
||||||
teams.forEach((team, i) => {
|
teams.forEach((team, i) => {
|
||||||
let str = [`Team ${i+1}`];
|
let str = [`Team ${i+1}`];
|
||||||
|
|
||||||
@@ -165,17 +151,14 @@ export async function readyQueue(interaction: CommandInteraction) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* sends the queue information from an interaction
|
||||||
|
* @param interaction
|
||||||
|
* @throws string message if it cannot be read
|
||||||
|
*/
|
||||||
export async function queueInfo(interaction: CommandInteraction) {
|
export async function queueInfo(interaction: CommandInteraction) {
|
||||||
|
|
||||||
console.log('COMMAND queueInfo')
|
let info = getInfo(interaction);
|
||||||
|
|
||||||
let channelId = interaction.channelId,
|
|
||||||
info = QUEUE.get(channelId);
|
|
||||||
|
|
||||||
if (!info) {
|
|
||||||
await interaction.reply('There is not an active queue in this channel, type `/queue` to create one');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
await interaction.reply('```'+`
|
await interaction.reply('```'+`
|
||||||
players: ${info.players.map(p => p.user.tag).join('\n ')}
|
players: ${info.players.map(p => p.user.tag).join('\n ')}
|
||||||
|
|||||||
Reference in New Issue
Block a user