limit piracy checks in log until I can fix it properly

This commit is contained in:
13xforever
2019-03-18 01:34:06 +05:00
parent ebb09bcbc5
commit 27676c6be8
4 changed files with 28 additions and 17 deletions

View File

@@ -161,7 +161,7 @@ namespace CompatBot.EventHandlers.LogParsing
["PS3 firmware is not installed"] = new Regex(@"(?<fw_missing_msg>PS3 firmware is not installed.+)\r?$", DefaultOptions),
["do you have the PS3 firmware installed"] = new Regex(@"(?<fw_missing_something>do you have the PS3 firmware installed.*)\r?$", DefaultOptions),
},
OnNewLineAsync = PiracyCheckAsync,
OnNewLineAsync = LimitedPiracyCheckAsync,
OnSectionEnd = MarkAsCompleteAndReset,
EndTrigger = "All threads stopped...",
}
@@ -192,6 +192,16 @@ namespace CompatBot.EventHandlers.LogParsing
}
}
private static Task LimitedPiracyCheckAsync(string line, LogParseState state)
{
if (state.LinesAfterConfig > 10)
return Task.CompletedTask;
state.LinesAfterConfig++;
return PiracyCheckAsync(line, state);
}
private static void ClearResults(LogParseState state)
{
void Copy(params string[] keys)

View File

@@ -14,6 +14,7 @@ namespace CompatBot.EventHandlers.LogParsing.POCOs
public string PiracyContext;
public long ReadBytes;
public long TotalBytes;
public int LinesAfterConfig;
public TimeSpan ParsingTime;
#if DEBUG
public Dictionary<string, int> ExtractorHitStats = new Dictionary<string, int>();

View File

@@ -1,10 +1,8 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.IO.Pipelines;
using System.Linq;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using CompatApiClient.Utils;

View File

@@ -35,13 +35,14 @@ namespace CompatBot.EventHandlers
public static async Task OnMemberUpdated(GuildMemberUpdateEventArgs args)
{
try {
var name = args.Member.DisplayName;
if (NeedsRename(name))
await args.Client.ReportAsync("Potential display name issue",
$"Member {args.Member.GetMentionWithNickname()} has changed their __display name__ and is now shown as **{name.Sanitize()}**\nSuggestion to rename: **{StripZalgo(name).Sanitize()}**",
null,
ReportSeverity.Medium);
try
{
var name = args.Member.DisplayName;
if (NeedsRename(name))
await args.Client.ReportAsync("Potential display name issue",
$"Member {args.Member.GetMentionWithNickname()} has changed their __display name__ and is now shown as **{name.Sanitize()}**\nSuggestion to rename: **{StripZalgo(name).Sanitize()}**",
null,
ReportSeverity.Medium);
}
catch (Exception e)
{
@@ -51,13 +52,14 @@ namespace CompatBot.EventHandlers
public static async Task OnMemberAdded(GuildMemberAddEventArgs args)
{
try {
var name = args.Member.DisplayName;
if (NeedsRename(name))
await args.Client.ReportAsync("Potential display name issue",
$"New member joined the server: {args.Member.GetMentionWithNickname()} and is shown as **{name.Sanitize()}**\nSuggestion to rename: **{StripZalgo(name).Sanitize()}**",
null,
ReportSeverity.Medium);
try
{
var name = args.Member.DisplayName;
if (NeedsRename(name))
await args.Client.ReportAsync("Potential display name issue",
$"New member joined the server: {args.Member.GetMentionWithNickname()} and is shown as **{name.Sanitize()}**\nSuggestion to rename: **{StripZalgo(name).Sanitize()}**",
null,
ReportSeverity.Medium);
}
catch (Exception e)
{