diff --git a/KfChatDotNetBot/ChatBot.cs b/KfChatDotNetBot/ChatBot.cs index 8e7e5b3..92ba89e 100644 --- a/KfChatDotNetBot/ChatBot.cs +++ b/KfChatDotNetBot/ChatBot.cs @@ -83,10 +83,11 @@ public class ChatBot private void OnFailedToJoinRoom(object sender, string message) { + var failureLimit = Helpers.GetValue(BuiltIn.Keys.KiwiFarmsJoinFailLimit).Result.ToType(); _joinFailures++; _logger.Error($"Couldn't join the room, attempt {_joinFailures}. KF returned: {message}"); _logger.Error("This is likely due to the session cookie expiring. Retrieving a new one."); - if (_joinFailures > 3) + if (_joinFailures >= failureLimit) { _logger.Error("Seems we're in a rejoin loop. Wiping out cookies entirely in hopes it'll make this piece of shit work"); _kfTokenService.WipeCookies(); diff --git a/KfChatDotNetBot/Settings/BuiltIn.cs b/KfChatDotNetBot/Settings/BuiltIn.cs index ed2e263..8880659 100644 --- a/KfChatDotNetBot/Settings/BuiltIn.cs +++ b/KfChatDotNetBot/Settings/BuiltIn.cs @@ -525,6 +525,15 @@ public static class BuiltIn Default = "10", IsSecret = false, CacheDuration = TimeSpan.FromHours(1) + }, + new BuiltInSettingsModel + { + Key = Keys.KiwiFarmsJoinFailLimit, + Regex = @"\d+", + Description = "Limit of times to fail joining the room before wiping cookies", + Default = "2", + IsSecret = false, + CacheDuration = TimeSpan.FromHours(1) } ]; @@ -575,5 +584,6 @@ public static class BuiltIn public static string CrackedZalgoFuckUpPosition = "Cracked.ZalgoFuckUpPosition"; public static string WinmanjackImgUrl = "Winmanjack.ImgUrl"; public static string BotDisconnectReplayLimit = "Bot.DisconnectReplayLimit"; + public static string KiwiFarmsJoinFailLimit = "KiwiFarms.JoinFailLimit"; } } \ No newline at end of file