diff --git a/SysBot.Pokemon/Helpers/NotRaidBot.cs b/SysBot.Pokemon/Helpers/NotRaidBot.cs index 204d61b..dfe4064 100644 --- a/SysBot.Pokemon/Helpers/NotRaidBot.cs +++ b/SysBot.Pokemon/Helpers/NotRaidBot.cs @@ -2,7 +2,7 @@ { public static class NotRaidBot { - public const string Version = "v8.1.7"; + public const string Version = "v8.1.8"; public const string Repo = "https://github.com/bdawg1989/NotRaidBot"; public const string ConfigPath = "config.json"; } diff --git a/SysBot.Pokemon/SV/BotRaid/RaidEnum.cs b/SysBot.Pokemon/SV/BotRaid/RaidEnum.cs index 9406539..5df9eaf 100644 --- a/SysBot.Pokemon/SV/BotRaid/RaidEnum.cs +++ b/SysBot.Pokemon/SV/BotRaid/RaidEnum.cs @@ -104,6 +104,15 @@ public enum ScreenshotTimingOptions _10000 = 10000 // Everything SS } + public enum RequestEmbedTimingOptions + { + _2500 = 2500, + _3000 = 3000, + _3500 = 3500, + _4000 = 4000, + _4500 = 4500 + } + public enum GifQuality { [Description("Default quality")] diff --git a/SysBot.Pokemon/SV/BotRaid/RotatingRaidBotSV.cs b/SysBot.Pokemon/SV/BotRaid/RotatingRaidBotSV.cs index a52c058..6c321ff 100644 --- a/SysBot.Pokemon/SV/BotRaid/RotatingRaidBotSV.cs +++ b/SysBot.Pokemon/SV/BotRaid/RotatingRaidBotSV.cs @@ -1926,25 +1926,20 @@ private async Task CheckIfTrainerBanned(RaidMyStatus trainer, ulong nid, i { if (!await IsConnectedToLobby(token)) return (false, new List<(ulong, RaidMyStatus)>()); + await EnqueueEmbed(null, "", false, false, false, false, token).ConfigureAwait(false); - Task? delayTask = null; + List<(ulong, RaidMyStatus)> lobbyTrainers = []; TimeSpan wait; - if (Settings.ActiveRaids[RotationCount].AddedByRACommand && Settings.ActiveRaids[RotationCount].Title != "Mystery Shiny Raid") { - delayTask = Task.Delay(Settings.EmbedToggles.RequestEmbedTime * 1000, token) - .ContinueWith(async _ => await EnqueueEmbed(null, "", false, false, false, false, token), token); - wait = TimeSpan.FromSeconds(160); + wait = TimeSpan.FromSeconds(160) - TimeSpan.FromMilliseconds((int)Settings.EmbedToggles.RequestEmbedTime); } else { - await EnqueueEmbed(null, "", false, false, false, false, token).ConfigureAwait(false); wait = TimeSpan.FromSeconds(160); } - List<(ulong, RaidMyStatus)> lobbyTrainers = []; - var endTime = DateTime.Now + wait; bool full = false; @@ -2016,11 +2011,7 @@ private async Task CheckIfTrainerBanned(RaidMyStatus trainer, ulong nid, i } } - - if (delayTask != null) - { - await delayTask; - } + await Task.Delay(5_000, token).ConfigureAwait(false); if (lobbyTrainers.Count == 0) { @@ -2324,7 +2315,13 @@ private async Task EnqueueEmbed(List? names, string message, bool hatTri // If it's a "Free For All", set the code as such code = "Free For All"; } - + // Apply delay only if the raid was added by RA command, not a Mystery Shiny Raid, and has a code + if (Settings.ActiveRaids[RotationCount].AddedByRACommand && + Settings.ActiveRaids[RotationCount].Title != "Mystery Shiny Raid" && + code != "Free For All") + { + await Task.Delay((int)Settings.EmbedToggles.RequestEmbedTime, token).ConfigureAwait(false); + } // Description can only be up to 4096 characters. //var description = Settings.ActiveRaids[RotationCount].Description.Length > 0 ? string.Join("\n", Settings.ActiveRaids[RotationCount].Description) : ""; var description = Settings.EmbedToggles.RaidEmbedDescription.Length > 0 ? string.Join("\n", Settings.EmbedToggles.RaidEmbedDescription) : ""; diff --git a/SysBot.Pokemon/SV/BotRaid/RotatingRaidSettingsSV.cs b/SysBot.Pokemon/SV/BotRaid/RotatingRaidSettingsSV.cs index b18d581..2a814b4 100644 --- a/SysBot.Pokemon/SV/BotRaid/RotatingRaidSettingsSV.cs +++ b/SysBot.Pokemon/SV/BotRaid/RotatingRaidSettingsSV.cs @@ -404,9 +404,30 @@ public class RotatingRaidPresetFiltersCategory "PP Up" }; - [Category(Hosting), Description("Amount of time (in seconds) to post a requested raid embed.")] + private RequestEmbedTimingOptions _requestEmbedTime = RequestEmbedTimingOptions._3500; + + [Category(Hosting)] + [Description("Amount of time (in milliseconds) to post a requested raid embed.")] [DisplayName("Post User Request Embeds in...")] - public int RequestEmbedTime { get; set; } = 30; + public RequestEmbedTimingOptions RequestEmbedTime + { + get => _requestEmbedTime; + set + { + if (value != RequestEmbedTimingOptions._2500 && + value != RequestEmbedTimingOptions._3000 && + value != RequestEmbedTimingOptions._3500 && + value != RequestEmbedTimingOptions._4000 && + value != RequestEmbedTimingOptions._4500) + { + _requestEmbedTime = RequestEmbedTimingOptions._3500; + } + else + { + _requestEmbedTime = value; + } + } + } [Category(FeatureToggle), Description("When enabled, the bot will attempt take screenshots for the Raid Embeds. If you experience crashes often about \"Size/Parameter\" try setting this to false.")] [DisplayName("Use Screenshots?")]