Hi, currently working on a rewrite of a bot and want to include users the ability to auto schedule events relating to rocket launches.
The bot already does auto posting of reminder messages for this, and I want to offer the events as well.
I tried doing a small test of an implementation on a single server, with 8 launch events being made and immediately hit the preemtive rate limit with DSharpPlus having to reschedule it. The code I tried is simply just:
private async Task ScheduleLaunchReminderEvents() {
// Get the launches and guilds that have this enabled
List<Launch> launches = await LaunchLibData.GetLaunches(8, 0);
List<ulong> guilds = await Interstellar.Database.GetGuildsWithEnabled("launch-notifications", "enabled");
foreach(ulong guild in guilds) {
// Find the guilds - Interstellar.GetGuild just calls ShardClient.GetShard(id).GetGuildAsync(id)
DiscordGuild guildObject = await Interstellar.GetGuild(guild);
if(guildObject == null) {
Log.Warning("Guild {GuildID} was not found while running launch reminders.", guild);
continue;
}
// Post the events
foreach(Launch launch in launches) {
// The part that probably matters \/
await guildObject.CreateEventAsync(launch.Name, launch.MissionDescription, null, ScheduledGuildEventType.External, ScheduledGuildEventPrivacyLevel.GuildOnly, launch.WindowStart, launch.WindowEnd.AddSeconds(1), launch.PadName, $"Auto Generated launch {launch.ID}");
}
}
}```
https://upload.livaco.dev/u/CqnwQX37UA.png
I'm curious what I can do to make this work, as I'm aware other bots are able to do this. Is there some batch creation of events method I'm unable to find? This runs DSharpPlus stable version 4.3.0 from Nuget.
Thanks.
