mirror of
https://github.com/RPCS3/discord-bot.git
synced 2026-01-31 01:25:22 +01:00
fix wrong note about unofficial build when it wasn't yet outdated
This commit is contained in:
@@ -439,12 +439,13 @@ internal static partial class LogParserResult
|
||||
if (items["game_mod"] is string mod)
|
||||
notes.Add($"⚠️ Game files modification present: `{mod.Trim(20)}`");
|
||||
|
||||
var updateInfo = await CheckForUpdateAsync(items).ConfigureAwait(false);
|
||||
var buildBranch = items["build_branch"]?.ToLowerInvariant();
|
||||
var (updateInfo, isTooOld) = await CheckForUpdateAsync(items).ConfigureAwait(false);
|
||||
if (updateInfo is not null
|
||||
&& isTooOld
|
||||
&& (buildBranch is "master" or "head" or "spu_perf"
|
||||
|| buildBranch is not {Length: >0}
|
||||
&& (updateInfo.X64?.CurrentBuild is not null || updateInfo.Arm?.CurrentBuild is not null)))
|
||||
&& (updateInfo.X64?.CurrentBuild is not null || updateInfo.Arm?.CurrentBuild is not null)))
|
||||
{
|
||||
string prefix = "⚠️";
|
||||
string timeDeltaStr;
|
||||
|
||||
@@ -775,10 +775,10 @@ internal static partial class LogParserResult
|
||||
}
|
||||
}
|
||||
|
||||
private static async ValueTask<UpdateInfo?> CheckForUpdateAsync(NameValueCollection items)
|
||||
private static async ValueTask<(UpdateInfo? updateInfo, bool isTooOld)> CheckForUpdateAsync(NameValueCollection items)
|
||||
{
|
||||
if (string.IsNullOrEmpty(items["build_and_specs"]))
|
||||
return null;
|
||||
return default;
|
||||
|
||||
var currentBuildCommit = items["build_commit"];
|
||||
if (string.IsNullOrEmpty(currentBuildCommit))
|
||||
@@ -793,13 +793,13 @@ internal static partial class LogParserResult
|
||||
?? updateInfo.Arm?.LatestBuild.Linux?.Download
|
||||
?? updateInfo.Arm?.LatestBuild.Mac?.Download;
|
||||
if (updateInfo.ReturnCode is not StatusCode.UpdatesAvailable || link is null)
|
||||
return null;
|
||||
return default;
|
||||
|
||||
var latestBuildInfo = BuildInfoInUpdate().Match(link.ToLowerInvariant());
|
||||
if (latestBuildInfo.Success && VersionIsTooOld(items, latestBuildInfo, updateInfo))
|
||||
return updateInfo;
|
||||
return (updateInfo, true);
|
||||
|
||||
return null;
|
||||
return (updateInfo, false);
|
||||
}
|
||||
|
||||
private static bool VersionIsTooOld(NameValueCollection items, Match update, UpdateInfo updateInfo)
|
||||
|
||||
Reference in New Issue
Block a user