From 8cbcd845360846c6ad6905f500109c6f9e655bed Mon Sep 17 00:00:00 2001 From: mctaylors Date: Sun, 17 Mar 2024 23:49:17 +0300 Subject: [PATCH] Use ThisAssembly.Git.RepositoryUrl Signed-off-by: mctaylors --- src/Commands/AboutCommandGroup.cs | 14 +++++++------- .../Events/ErrorLoggingPostExecutionEvent.cs | 2 +- src/Octobot.cs | 3 --- src/Responders/GuildLoadedResponder.cs | 2 +- 4 files changed, 9 insertions(+), 12 deletions(-) diff --git a/src/Commands/AboutCommandGroup.cs b/src/Commands/AboutCommandGroup.cs index 19ed1e9..6c4fa00 100644 --- a/src/Commands/AboutCommandGroup.cs +++ b/src/Commands/AboutCommandGroup.cs @@ -96,30 +96,30 @@ public class AboutCommandGroup : CommandGroup builder.AppendBulletPointLine($"{tag} — {$"AboutDeveloper@{dev.Username}".Localized()}"); } - var footer = ThisAssembly.Git.IsDirty - ? $"{ThisAssembly.Git.Branch}-{ThisAssembly.Git.Commit}-dirty" - : $"{ThisAssembly.Git.Branch}-{ThisAssembly.Git.Commit}"; - var embed = new EmbedBuilder() .WithSmallTitle(string.Format(Messages.AboutBot, bot.Username), bot) .WithDescription(builder.ToString()) .WithColour(ColorsList.Cyan) .WithImageUrl("https://i.ibb.co/fS6wZhh/octobot-banner.png") - .WithFooter(string.Format(Messages.Version, footer)) + .WithFooter(string.Format(Messages.Version, ThisAssembly.Git.IsDirty + ? $"{ThisAssembly.Git.Branch}-{ThisAssembly.Git.Commit}-dirty" + // ReSharper disable once HeuristicUnreachableCode + // ^^^ while being reachable, however + : $"{ThisAssembly.Git.Branch}-{ThisAssembly.Git.Commit}")) .Build(); var repositoryButton = new ButtonComponent( ButtonComponentStyle.Link, Messages.ButtonOpenRepository, new PartialEmoji(Name: "🌐"), - URL: Octobot.RepositoryUrl + URL: ThisAssembly.Git.RepositoryUrl ); var issuesButton = new ButtonComponent( ButtonComponentStyle.Link, Messages.ButtonReportIssue, new PartialEmoji(Name: "⚠️"), - URL: Octobot.IssuesUrl + URL: $"{ThisAssembly.Git.RepositoryUrl}/issues" ); return await _feedback.SendContextualEmbedResultAsync(embed, diff --git a/src/Commands/Events/ErrorLoggingPostExecutionEvent.cs b/src/Commands/Events/ErrorLoggingPostExecutionEvent.cs index 87cfc84..d4cdb8d 100644 --- a/src/Commands/Events/ErrorLoggingPostExecutionEvent.cs +++ b/src/Commands/Events/ErrorLoggingPostExecutionEvent.cs @@ -72,7 +72,7 @@ public class ErrorLoggingPostExecutionEvent : IPostExecutionEvent ButtonComponentStyle.Link, Messages.ButtonReportIssue, new PartialEmoji(Name: "⚠️"), - URL: Octobot.IssuesUrl + URL: $"{ThisAssembly.Git.RepositoryUrl}/issues" ); return await _feedback.SendContextualEmbedResultAsync(embed, diff --git a/src/Octobot.cs b/src/Octobot.cs index 1ebf7c3..e0d9b07 100644 --- a/src/Octobot.cs +++ b/src/Octobot.cs @@ -22,9 +22,6 @@ namespace Octobot; public sealed class Octobot { - public const string RepositoryUrl = "https://github.com/TeamOctolings/Octobot"; - public const string IssuesUrl = $"{RepositoryUrl}/issues"; - public static readonly AllowedMentions NoMentions = new( Array.Empty(), Array.Empty(), Array.Empty()); diff --git a/src/Responders/GuildLoadedResponder.cs b/src/Responders/GuildLoadedResponder.cs index a1e7d16..caa4696 100644 --- a/src/Responders/GuildLoadedResponder.cs +++ b/src/Responders/GuildLoadedResponder.cs @@ -117,7 +117,7 @@ public class GuildLoadedResponder : IResponder ButtonComponentStyle.Link, Messages.ButtonReportIssue, new PartialEmoji(Name: "⚠️"), - URL: Octobot.IssuesUrl + URL: $"{ThisAssembly.Git.RepositoryUrl}/issues" ); return await _channelApi.CreateMessageWithEmbedResultAsync(channel, embedResult: errorEmbed,