Skip to content

Commit

Permalink
Fix bug when updating a scheduled events location (#2349)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mitmocc authored Dec 7, 2022
1 parent 106ccfc commit 27df292
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ protected RequestBody finalizeData()
{
case STAGE_INSTANCE:
case VOICE:
object.putNull("entity_metadata");
object.put("channel_id", channelId);
break;
case EXTERNAL:
Expand All @@ -214,11 +215,11 @@ private void preChecks()
{
if (shouldUpdate(LOCATION))
{
if (entityType == ScheduledEvent.Type.EXTERNAL)
Checks.check((endTime).isAfter(startTime), "Cannot schedule event to end before starting!");
Checks.check(getScheduledEvent().getStatus() == ScheduledEvent.Status.SCHEDULED, "Cannot update location of non-scheduled event.");
if (entityType == ScheduledEvent.Type.EXTERNAL && endTime == null && getScheduledEvent().getEndTime() == null)
throw new IllegalStateException("Missing required parameter: End Time");
if (entityType == ScheduledEvent.Type.EXTERNAL)
Checks.check((endTime != null ? endTime : getScheduledEvent().getEndTime()).isAfter(startTime), "Cannot schedule event to end before starting!");
}

if (shouldUpdate(START_TIME))
Expand Down

0 comments on commit 27df292

Please sign in to comment.