Skip to content

Commit

Permalink
/join and /pug now join queue when available.
Browse files Browse the repository at this point in the history
  • Loading branch information
GleammerRay committed Jul 14, 2024
1 parent 7ee7246 commit 47005fa
Showing 1 changed file with 37 additions and 20 deletions.
57 changes: 37 additions & 20 deletions lib/compretty.js
Original file line number Diff line number Diff line change
Expand Up @@ -1834,23 +1834,7 @@ export class CompRettyTeams {
}
}
}
switch (interaction.data.name) {
case 'kick':
if (!isAdmin) return await this.sendPermissionDenied(interaction);
switch (_arg1) {
case 'all':
var _msg = `<@${interaction.member.user.id}> kicked all players from all teams. :cloud_tornado:`;
this.dmPlayers(`{"content":"> ${this.#competitionName}: ${_msg}\\n\\nhttps://discord.com/channels/${interaction.guild_id}/${interaction.channel_id}"}`);
this.clearPlayers();
await this._onSave();
this.logEvent(interaction.channel_id, new CompRettyEvent(null, null, CompRettyEventType.Left, _msg));
return await this.#rest.createInteractionResponse(interaction, getEphemeralResponse(`Kicked all players from all teams. :cloud_tornado:`));
case 'player':
var _playerID = _option.options[0].value;
return await this._onKickPlayer(interaction, _playerID);
}
return;
case 'join':
async function _onJoin() {
switch (_arg1) {
case 'random': return await this._onJoinRandom(interaction);
case 'team':
Expand All @@ -1870,7 +1854,36 @@ export class CompRettyTeams {
case 'queue':
if (await this._onJoinQueue(interaction) != null) return;
return await this.#rest.createInteractionResponse(interaction, getEphemeralResponse(`You have joined player queue. :hourglass:`));
default:
var _team = this.#queue;
if (_team == null) return;
var response = await this._onJoinQueue(interaction);
if (response != null) return response;
return await this.#rest.createInteractionResponse(interaction, getEphemeralResponse(`You have joined player queue. :hourglass:`));
}
}
switch (interaction.data.name) {
case 'kick':
if (!isAdmin) return await this.sendPermissionDenied(interaction);
switch (_arg1) {
case 'all':
var _msg = `<@${interaction.member.user.id}> kicked all players from all teams. :cloud_tornado:`;
this.dmPlayers(`{"content":"> ${this.#competitionName}: ${_msg}\\n\\nhttps://discord.com/channels/${interaction.guild_id}/${interaction.channel_id}"}`);
this.clearPlayers();
await this._onSave();
this.logEvent(interaction.channel_id, new CompRettyEvent(null, null, CompRettyEventType.Left, _msg));
return await this.#rest.createInteractionResponse(interaction, getEphemeralResponse(`Kicked all players from all teams. :cloud_tornado:`));
case 'player':
var _playerID = _option.options[0].value;
return await this._onKickPlayer(interaction, _playerID);
}
return;
case 'join':
var response = await _onJoin.apply(this, []);
if (response != null) return response;
case 'pug':
var response = await _onJoin.apply(this, []);
if (response != null) return response;
case 'leave': return await this.onPlayerLeave(interaction);
case 'unpug': return await this.onPlayerLeave(interaction);
case 'ready':
Expand Down Expand Up @@ -2801,10 +2814,14 @@ export class CompRettyCompetition {
}
var _playerID = interaction.member.user.id;
switch (interaction.data.name) {
case 'join': {
case 'join':
var response = this.#teams.execute(interaction, isAdmin || !this.#moderatorRoleCheck);
if (interaction.data.options == null) return await this.sendCompetition(interaction, isAdmin || !this.#moderatorRoleCheck);
return this.#teams.execute(interaction, isAdmin || !this.#moderatorRoleCheck);
}
return response;
case 'pug':
var response = this.#teams.execute(interaction, isAdmin || !this.#moderatorRoleCheck);
if (interaction.data.options == null) return await this.sendCompetition(interaction, isAdmin || !this.#moderatorRoleCheck);
return response;
case 'leave': return this.#teams.execute(interaction, isAdmin || !this.#moderatorRoleCheck);
case 'unpug': return this.#teams.execute(interaction, isAdmin || !this.#moderatorRoleCheck);
case 'ready': return this.#teams.execute(interaction, isAdmin || !this.#moderatorRoleCheck);
Expand Down

0 comments on commit 47005fa

Please sign in to comment.