Compare commits

...

3 Commits

Author SHA1 Message Date
00c3fa8219 info for later 2022-02-11 13:29:32 -06:00
610ca41195 more command renaming 2022-02-11 13:29:23 -06:00
827dafbb99 more dumb issues 2022-02-11 13:29:17 -06:00
5 changed files with 21 additions and 8 deletions

View File

@@ -2,6 +2,10 @@
# 1800queue
## Invite info
needs: create commands/send messages
## Prerequirements
Download and install [Node.js](https://nodejs.org/en/)

8
dist/discord.js vendored
View File

@@ -6,8 +6,8 @@ const v9_1 = require("discord-api-types/v9");
// list of commands to register with discord
const commands = [
{
name: 'queue',
description: 'initialize a queue for this channel',
name: 'open',
description: 'open a queue for this channel',
options: [
{
type: 4,
@@ -22,6 +22,10 @@ const commands = [
name: 'close',
description: 'close the queue for this channel'
},
{
name: 'queue',
description: 'view queue info'
},
{
name: 'join',
description: 'join the active queue'

4
dist/queue.js vendored
View File

@@ -33,7 +33,7 @@ if (!fs.existsSync('./queues.json'))
const _QUEUE = fs.readFileSync('./queues.json').toString(), QUEUE = new Map();
try {
let queueJson = JSON.parse(_QUEUE);
for (let channelId of queueJson) {
for (let channelId in queueJson) {
let { teamsize } = queueJson[channelId];
if (teamsize)
QUEUE.set(channelId, { teamsize, players: [] });
@@ -50,7 +50,7 @@ async function checkQueue(channel) {
let info = QUEUE.get(channel.id);
if (!info)
return;
if (info.players.length > info.teamsize) {
if (info.players.length >= info.teamsize) {
let team = info.players.splice(0, info.teamsize).map(m => m.toString());
let embed = new discord_js_1.MessageEmbed()
.setTitle('Team')

View File

@@ -4,8 +4,8 @@ import { Routes } from 'discord-api-types/v9';
// list of commands to register with discord
const commands = [
{
name: 'queue',
description: 'initialize a queue for this channel',
name: 'open',
description: 'open a queue for this channel',
options: [
{
type: 4, //INTEGER
@@ -20,6 +20,11 @@ const commands = [
name: 'close',
description: 'close the queue for this channel'
},
{
name: 'queue',
description: 'view queue info'
},
{
name: 'join',
description: 'join the active queue'

View File

@@ -18,7 +18,7 @@ try {
let queueJson = JSON.parse(_QUEUE);
for (let channelId of queueJson) {
for (let channelId in queueJson) {
let {teamsize} = queueJson[channelId] as queueInfoBase;
if (teamsize)
QUEUE.set(channelId, { teamsize, players: [] })
@@ -44,7 +44,7 @@ async function checkQueue(channel: TextChannel) {
if (!info)
return;
if (info.players.length > info.teamsize) {
if (info.players.length >= info.teamsize) {
let team = info.players.splice(0, info.teamsize).map(m => m.toString());