Merge branch 'vnext'

This commit is contained in:
13xforever
2025-07-26 20:23:28 +05:00
5 changed files with 13 additions and 16 deletions

View File

@@ -176,11 +176,9 @@ public static class LogParsingHandler
if (await message.Author.IsWhitelistedAsync(client, channel.Guild).ConfigureAwait(false))
{
var piracyWarning = await result.AsEmbedAsync(client, message, source).ConfigureAwait(false);
piracyWarning = piracyWarning.WithDescription(
"Please remove the log and issue warning to the original author of the log");
piracyWarning = piracyWarning.WithDescription("Please remove the log and issue warning to the original author of the log");
botMsg = await botMsg.UpdateOrCreateMessageAsync(channel, embed: piracyWarning).ConfigureAwait(false);
var matchedOn = ContentFilter.GetMatchedScope(result.SelectedFilter,
result.SelectedFilterContext);
var matchedOn = ContentFilter.GetMatchedScope(result.SelectedFilter, result.SelectedFilterContext);
await client.ReportAsync(yarr + " Pirated Release (whitelisted by role)", message,
result.SelectedFilter.String, matchedOn, result.SelectedFilter.Id,
result.SelectedFilterContext, ReportSeverity.Low).ConfigureAwait(false);
@@ -190,8 +188,7 @@ public static class LogParsingHandler
var severity = ReportSeverity.Low;
try
{
DeletedMessagesMonitor.RemovedByBotCache.Set(message.Id, true,
DeletedMessagesMonitor.CacheRetainTime);
DeletedMessagesMonitor.RemovedByBotCache.Set(message.Id, true, DeletedMessagesMonitor.CacheRetainTime);
await message.DeleteAsync("Piracy detected in log").ConfigureAwait(false);
}
catch (Exception e)
@@ -218,8 +215,7 @@ public static class LogParsingHandler
}
try
{
var matchedOn = ContentFilter.GetMatchedScope(result.SelectedFilter,
result.SelectedFilterContext);
var matchedOn = ContentFilter.GetMatchedScope(result.SelectedFilter, result.SelectedFilterContext);
await client.ReportAsync(yarr + " Pirated Release", message,
result.SelectedFilter.String, matchedOn, result.SelectedFilter.Id,
result.SelectedFilterContext, severity).ConfigureAwait(false);
@@ -228,7 +224,7 @@ public static class LogParsingHandler
{
Config.Log.Error(e, "Failed to send piracy report");
}
if (!(message.Channel!.IsPrivate || message.Channel.Name.Contains("spam")))
//if (!(message.Channel!.IsPrivate || message.Channel.Name.Contains("spam")))
{
var reason = "Logs showing use of pirated content";
var (saved, suppress, recent, total) = await Warnings.AddAsync(
@@ -246,7 +242,7 @@ public static class LogParsingHandler
Warned for: {reason} by {client.CurrentUser.Mention}
"""
).AddMention(new UserMention(message.Author));
await message.Channel.SendMessageAsync(msg).ConfigureAwait(false);
await message.Channel!.SendMessageAsync(msg).ConfigureAwait(false);
}
}
}

View File

@@ -26,6 +26,7 @@ public static class OcrProvider
backendName = "tesseract";
result = GetBackend(backendName)!;
}
Config.Log.Info($"Initializing OCR backend {BackendName}…");
if (await result.InitializeAsync(cancellationToken).ConfigureAwait(false))
{
backend = result;

View File

@@ -273,13 +273,13 @@ internal static partial class LogParserResult
if (items["os_type"] is "Windows"
&& Version.TryParse(items["os_version"], out var winVersion)
&& (winVersion is { Major: < 10 } or { Build: < 19045 or (> 20000 and < 22621) }))
&& (winVersion is { Major: < 10 } or { Build: <19045 or (>20000 and <22621) }))
notes.Add("⚠️ Please [upgrade your Windows](https://www.microsoft.com/en-us/software-download/windows11) to currently supported version");
if (items["os_type"] is "MacOS" && Version.TryParse(items["os_version"], out var macVersion))
{
if (macVersion is {Major: < 12})
if (macVersion is {Major: <14})
notes.Add("⚠️ Please [upgrade your macOS](https://support.apple.com/en-us/109033#latest) to currently supported version");
else if (macVersion is { Major: 14, Minor: >= 0 and <= 2 })
else if (macVersion is { Major: 14, Minor: >=0 and <=2 })
notes.Add("❌️ Please update your OS to version 14.3 or newer");
}

View File

@@ -1075,7 +1075,7 @@ internal static partial class LogParserResult
return $"{osType} {kernelVersion}";
}
private static string? GetMacOsVersion(Version macVer)
private static string GetMacOsVersion(Version macVer)
=> macVer.Major switch
{
10 => macVer.Minor switch

View File

@@ -75,11 +75,11 @@ public class CpuTierListGenerator: IIncrementalGenerator
);
*/
result.AppendLine($"""
private static readonly Regex Model{idx++} = new(@"{line}", DefaultOptions);
private static readonly Regex Model{idx++} = new(@"\b{line}", DefaultOptions);
"""
);
}
result.AppendLine($"""
result.AppendLine("""
public static readonly List<(string model, string tier, Regex regex)> List = [
"""