diff --git a/src/main/java/net/dv8tion/jda/api/entities/Guild.java b/src/main/java/net/dv8tion/jda/api/entities/Guild.java index 8c07ec5325..2a1712e482 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/Guild.java +++ b/src/main/java/net/dv8tion/jda/api/entities/Guild.java @@ -1440,6 +1440,15 @@ default List getMembersWithRoles(@Nonnull Collection roles) */ @Nonnull SortedSnowflakeCacheView getScheduledEventCache(); + + /** + * Retrieves all {@link ScheduledEvent ScheduledEvents} for this guild. + * + * @return {@link RestAction} - Type: {@link List} of {@link ScheduledEvent} + */ + @Nonnull + @CheckReturnValue + RestAction> retrieveScheduledEvents(); /** * Gets a list of all {@link ScheduledEvent ScheduledEvents} in this Guild that have the same diff --git a/src/main/java/net/dv8tion/jda/internal/entities/GuildImpl.java b/src/main/java/net/dv8tion/jda/internal/entities/GuildImpl.java index 2ab78beceb..491c291725 100644 --- a/src/main/java/net/dv8tion/jda/internal/entities/GuildImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/entities/GuildImpl.java @@ -588,6 +588,20 @@ public TextChannel getRulesChannel() return rulesChannel; } + @Nonnull + @Override + public RestAction> retrieveScheduledEvents() + { + Route.CompiledRoute route = Route.Guilds.GET_SCHEDULED_EVENTS.compile(getId()); + + return new RestActionImpl<>(getJDA(), route, + (response, request) -> + response.getArray() + .stream(DataArray::getObject) + .map(json -> api.getEntityBuilder().createScheduledEvent(this, json)) + .collect(Collectors.toList())); + } + @Nonnull @Override public CacheRestAction retrieveScheduledEventById(@Nonnull String id)