From a9509deb1cd3dc9b02127d8d27520010c0c97d2d Mon Sep 17 00:00:00 2001 From: Macintxsh <95250141+mctaylors@users.noreply.github.com> Date: Sun, 24 Mar 2024 13:11:00 +0300 Subject: [PATCH 1/3] Don't use BannedUntil in MemberData. (#286) Signed-off-by: mctaylors --- src/Data/MemberData.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Data/MemberData.cs b/src/Data/MemberData.cs index 8e23e54..1b3d0d9 100644 --- a/src/Data/MemberData.cs +++ b/src/Data/MemberData.cs @@ -5,10 +5,9 @@ namespace Octobot.Data; /// public sealed class MemberData { - public MemberData(ulong id, DateTimeOffset? bannedUntil = null, List? reminders = null) + public MemberData(ulong id, List? reminders = null) { Id = id; - BannedUntil = bannedUntil; if (reminders is not null) { Reminders = reminders; From 844615e8bfac768e1b7bdf3165eb0db045ed5d8c Mon Sep 17 00:00:00 2001 From: Octol1ttle Date: Sun, 24 Mar 2024 17:39:26 +0500 Subject: [PATCH 2/3] fix: do not use RepositoryUrl from GitInfo (#287) GitInfo's `RepositoryUrl` string depends on origin URL, which is unvalidated user input that isn't even guaranteed to exist. This can cause issues that are almost impossible to debug Closes #281 --- src/BuildInfo.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/BuildInfo.cs b/src/BuildInfo.cs index fc3a089..2eb6059 100644 --- a/src/BuildInfo.cs +++ b/src/BuildInfo.cs @@ -2,15 +2,15 @@ public static class BuildInfo { - public static string RepositoryUrl => ThisAssembly.Git.RepositoryUrl; + public const string RepositoryUrl = "https://github.com/TeamOctolings/Octobot"; - public static string IssuesUrl => $"{RepositoryUrl}/issues"; + public const string IssuesUrl = $"{RepositoryUrl}/issues"; - public static string WikiUrl => $"{RepositoryUrl}/wiki"; + public const string WikiUrl = $"{RepositoryUrl}/wiki"; - private static string Commit => ThisAssembly.Git.Commit; + private const string Commit = ThisAssembly.Git.Commit; - private static string Branch => ThisAssembly.Git.Branch; + private const string Branch = ThisAssembly.Git.Branch; public static bool IsDirty => ThisAssembly.Git.IsDirty; From c2f7aadaeacdd1f0e88b6bc441f7783cac00ab07 Mon Sep 17 00:00:00 2001 From: Octol1ttle Date: Sun, 24 Mar 2024 20:38:51 +0500 Subject: [PATCH 3/3] Do not use ResultError#IsUserOrEnvironmentError (#289) In LoggerExtensions#LogResult we skip logging the result if the error is "user or environment error". What matches that criteria is defined by Remora's implementation. However, none of errors defined by the implementation should *ever* happen or be ignored: * CommandNotFoundError: The client shouldn't send us non-existing commands. This *can* happen because the client's command list can get out of sync with the server's, but this happens rarely. * AmbiguousCommandInvocationError: We don't have commands that would trigger this error * RequiredParameterValueMissingError: The client shouldn't send us commands without required paremeters * ParameterParsingError: See #220 * ConditionNotSatisfiedError: The client shouldn't send us commands that don't satisfy our conditions Closes #220 --- src/Extensions/LoggerExtensions.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Extensions/LoggerExtensions.cs b/src/Extensions/LoggerExtensions.cs index 9df90b8..fca3702 100644 --- a/src/Extensions/LoggerExtensions.cs +++ b/src/Extensions/LoggerExtensions.cs @@ -1,5 +1,4 @@ using Microsoft.Extensions.Logging; -using Remora.Discord.Commands.Extensions; using Remora.Results; namespace Octobot.Extensions; @@ -19,7 +18,7 @@ public static class LoggerExtensions /// The message to use if this result has failed. public static void LogResult(this ILogger logger, IResult result, string? message = "") { - if (result.IsSuccess || result.Error.IsUserOrEnvironmentError()) + if (result.IsSuccess) { return; }