discord-jda / JDA

Java wrapper for the popular chat & VOIP service: Discord https://discord.com
Apache License 2.0
4.26k stars 730 forks source link

Add method to retrieve a list of scheduled events #2700

Open senseiwells opened 1 month ago

senseiwells commented 1 month ago

General Troubleshooting

Feature Request

Provide a method that gets a list of scheduled events in a guild.

Currently it's possible to only fetch scheduled events by their id.

The Route for this api call does exist, but is seemingly never actually used: https://github.com/discord-jda/JDA/blob/6ae83e3b6c4ac4b01fb80e1b1d8c5d982edeca48/src/main/java/net/dv8tion/jda/api/requests/Route.java#L139

The discord api documentation for this can be found here: https://github.com/discord/discord-api-docs/blob/main/docs/resources/Guild_Scheduled_Event.md#list-scheduled-events-for-guild--get-guildsguildiddocs_resources_guildguild-objectscheduled-events

Example Use-Case

public void foobar() {
    Guild guild = // ...
    List<ScheduledEvent> events = guild.retrieveScheduledEvents().complete();
    if (events.isEmpty()) {
        // Do something
        return;
    }
    for (ScheduledEvent event : events) {
        // Do something else
    }
}