Code cleanup after #1482

This commit is contained in:
JustArchi
2019-11-06 18:56:34 +01:00
parent 60f7dc6323
commit 2e83f51a9d

View File

@@ -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;