mirror of
https://github.com/RPCS3/discord-bot.git
synced 2026-01-31 01:25:22 +01:00
limit piracy checks in log until I can fix it properly
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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>();
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user