diff --git a/ArchiSteamFarm/Bot.cs b/ArchiSteamFarm/Bot.cs index 8ba4c5f5c..49cb78613 100755 --- a/ArchiSteamFarm/Bot.cs +++ b/ArchiSteamFarm/Bot.cs @@ -36,7 +36,6 @@ using ArchiSteamFarm.Localization; using ArchiSteamFarm.NLog; using ArchiSteamFarm.Plugins; using JetBrains.Annotations; -using Microsoft.OpenApi.Models; using Newtonsoft.Json; using SteamKit2; using SteamKit2.Unified.Internal; @@ -2195,32 +2194,6 @@ namespace ArchiSteamFarm { await Actions.AcceptGuestPasses(guestPassIDs).ConfigureAwait(false); } - private bool ShouldAckGroupChatMessage(ulong steamID) { - if (BotConfig.BotBehaviour.HasFlag(BotConfig.EBotBehaviour.MarkReceivedMessagesAsRead)) { - return true; - } - - if (BotConfig.BotBehaviour.HasFlag(BotConfig.EBotBehaviour.MarkBotMessagesAsRead) && - Bots.Values.Any(bot => bot.SteamID == steamID)) { - return true; - } - - return false; - } - - private bool ShouldAckPrivateChatMessage(ulong steamID, string message) { - if (ShouldAckGroupChatMessage(steamID)) { - return true; - } - - if (BotConfig.BotBehaviour.HasFlag(BotConfig.EBotBehaviour.MarkTradeMessagesAsRead) && - message.StartsWith("[tradeoffer", StringComparison.Ordinal)) { - return true; - } - - return false; - } - private async Task OnIncomingChatMessage(CChatRoom_IncomingChatMessage_Notification notification) { if (notification == null) { ArchiLogger.LogNullError(nameof(notification)); @@ -2955,6 +2928,34 @@ namespace ArchiSteamFarm { StopPlayingWasBlockedTimer(); } + private bool ShouldAckGroupChatMessage(ulong steamID) { + if ((steamID == 0) || !new SteamID(steamID).IsIndividualAccount) { + ArchiLogger.LogNullError(nameof(steamID)); + + return false; + } + + if (BotConfig.BotBehaviour.HasFlag(BotConfig.EBotBehaviour.MarkReceivedMessagesAsRead)) { + return true; + } + + return BotConfig.BotBehaviour.HasFlag(BotConfig.EBotBehaviour.MarkBotMessagesAsRead) && Bots.Values.Any(bot => bot.SteamID == steamID); + } + + private bool ShouldAckPrivateChatMessage(ulong steamID, string message) { + if ((steamID == 0) || !new SteamID(steamID).IsIndividualAccount || string.IsNullOrEmpty(message)) { + ArchiLogger.LogNullError(nameof(steamID) + " || " + nameof(message)); + + return false; + } + + if (ShouldAckGroupChatMessage(steamID)) { + return true; + } + + return BotConfig.BotBehaviour.HasFlag(BotConfig.EBotBehaviour.MarkTradeMessagesAsRead) && message.StartsWith("[tradeoffer", StringComparison.Ordinal); + } + private void StopConnectionFailureTimer() { if (ConnectionFailureTimer == null) { return;