diff --git a/Octobot.csproj b/Octobot.csproj index ab76400..bdfb46a 100644 --- a/Octobot.csproj +++ b/Octobot.csproj @@ -17,10 +17,12 @@ en A general-purpose Discord bot for moderation written in C# docs/octobot.ico + false + diff --git a/locale/Messages.resx b/locale/Messages.resx index c2b9abb..c2be4cd 100644 --- a/locale/Messages.resx +++ b/locale/Messages.resx @@ -657,6 +657,9 @@ Example of a valid input: `1h30m` + + Version: {0} + Welcome messages channel diff --git a/locale/Messages.ru.resx b/locale/Messages.ru.resx index 814106a..d38509c 100644 --- a/locale/Messages.ru.resx +++ b/locale/Messages.ru.resx @@ -657,6 +657,9 @@ Пример правильного ввода: `1ч30м` + + Версия: {0} + Канал для приветствий diff --git a/locale/Messages.tt-ru.resx b/locale/Messages.tt-ru.resx index 71357ad..dfb1ee6 100644 --- a/locale/Messages.tt-ru.resx +++ b/locale/Messages.tt-ru.resx @@ -657,6 +657,9 @@ правильно пишут так: `1h30m` + + {0} + канал куда говорить здравствуйте diff --git a/src/BuildInfo.cs b/src/BuildInfo.cs new file mode 100644 index 0000000..50f86a2 --- /dev/null +++ b/src/BuildInfo.cs @@ -0,0 +1,52 @@ +namespace Octobot; + +public static class BuildInfo +{ + public static string RepositoryUrl + { + get + { + return ThisAssembly.Git.RepositoryUrl; + } + } + + public static string IssuesUrl + { + get + { + return $"{RepositoryUrl}/issues"; + } + } + + private static string Commit + { + get + { + return ThisAssembly.Git.Commit; + } + } + + private static string Branch + { + get + { + return ThisAssembly.Git.Branch; + } + } + + private static bool IsDirty + { + get + { + return ThisAssembly.Git.IsDirty; + } + } + + public static string Version + { + get + { + return IsDirty ? $"{Branch}-{Commit}-dirty" : $"{Branch}-{Commit}"; + } + } +} diff --git a/src/Commands/AboutCommandGroup.cs b/src/Commands/AboutCommandGroup.cs index e978ec9..05b1855 100644 --- a/src/Commands/AboutCommandGroup.cs +++ b/src/Commands/AboutCommandGroup.cs @@ -101,20 +101,21 @@ public class AboutCommandGroup : CommandGroup .WithDescription(builder.ToString()) .WithColour(ColorsList.Cyan) .WithImageUrl("https://i.ibb.co/fS6wZhh/octobot-banner.png") + .WithFooter(string.Format(Messages.Version, BuildInfo.Version)) .Build(); var repositoryButton = new ButtonComponent( ButtonComponentStyle.Link, Messages.ButtonOpenRepository, new PartialEmoji(Name: "🌐"), - URL: Octobot.RepositoryUrl + URL: BuildInfo.RepositoryUrl ); var issuesButton = new ButtonComponent( ButtonComponentStyle.Link, Messages.ButtonReportIssue, new PartialEmoji(Name: "⚠️"), - URL: Octobot.IssuesUrl + URL: BuildInfo.IssuesUrl ); return await _feedback.SendContextualEmbedResultAsync(embed, diff --git a/src/Commands/Events/ErrorLoggingPostExecutionEvent.cs b/src/Commands/Events/ErrorLoggingPostExecutionEvent.cs index 87cfc84..5d7830b 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: BuildInfo.IssuesUrl ); return await _feedback.SendContextualEmbedResultAsync(embed, diff --git a/src/Messages.Designer.cs b/src/Messages.Designer.cs index 4694254..707c814 100644 --- a/src/Messages.Designer.cs +++ b/src/Messages.Designer.cs @@ -1185,8 +1185,13 @@ namespace Octobot { } } - internal static string SettingsWelcomeMessagesChannel - { + internal static string Version { + get { + return ResourceManager.GetString("Version", resourceCulture); + } + } + + internal static string SettingsWelcomeMessagesChannel { get { return ResourceManager.GetString("SettingsWelcomeMessagesChannel", resourceCulture); } 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 fd289fc..c493910 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: BuildInfo.IssuesUrl ); return await _channelApi.CreateMessageWithEmbedResultAsync(channel, embedResult: errorEmbed,