Skip to content

Commit

Permalink
Don't update events whose match time has passed.
Browse files Browse the repository at this point in the history
  • Loading branch information
roncli committed Sep 30, 2022
1 parent 97a6c3f commit 17499ad
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/models/challenge.js
Expand Up @@ -2771,14 +2771,14 @@ class Challenge {
try {
if (this.details.discordEvent) {
// Set Discord event.
if (this.details.discordEvent.isCompleted()) {
if (this.details.discordEvent.isCompleted() || this.details.matchTime.getTime() + 60 * 60 * 1000 >= Date.now()) {
this.details.discordEvent = void 0;
} else if (!this.details.matchTime) {
await this.details.discordEvent.delete();

this.details.discordEvent = void 0;
} else if (matchTimeUpdate) {
if (this.details.confirmed || this.details.matchTime < new Date()) {
if (this.details.confirmed || this.details.matchTime.getTime() < Date.now()) {
await this.details.discordEvent.edit({
name: `${this.details.title ? `${this.details.title} - ` : ""}${this.challengingTeam.name} vs ${this.challengedTeam.name}`,
description: eventParameters.join("\n"),
Expand Down

0 comments on commit 17499ad

Please sign in to comment.