Compare commits
3 Commits
3ed56b7927
...
00c3fa8219
| Author | SHA1 | Date | |
|---|---|---|---|
| 00c3fa8219 | |||
| 610ca41195 | |||
| 827dafbb99 |
@@ -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
8
dist/discord.js
vendored
@@ -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
4
dist/queue.js
vendored
@@ -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')
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -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());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user