mirror of
https://github.com/TeamOctolings/Octobot.git
synced 2025-05-04 04:56:30 +03:00
Add GitInfo NuGet package (#268)
In this PR, I added a NuGet package called GitInfo. It can replace Octobot.RepositoryUrl and display the bot version as the current branch and commit. --------- Signed-off-by: mctaylors <cantsendmails@mctaylors.ru> Signed-off-by: Macintxsh <95250141+mctaylors@users.noreply.github.com>
This commit is contained in:
parent
771750c922
commit
2342116e87
10 changed files with 75 additions and 9 deletions
52
src/BuildInfo.cs
Normal file
52
src/BuildInfo.cs
Normal file
|
@ -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}";
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
9
src/Messages.Designer.cs
generated
9
src/Messages.Designer.cs
generated
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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<MentionType>(), Array.Empty<Snowflake>(), Array.Empty<Snowflake>());
|
||||
|
||||
|
|
|
@ -117,7 +117,7 @@ public class GuildLoadedResponder : IResponder<IGuildCreate>
|
|||
ButtonComponentStyle.Link,
|
||||
Messages.ButtonReportIssue,
|
||||
new PartialEmoji(Name: "⚠️"),
|
||||
URL: Octobot.IssuesUrl
|
||||
URL: BuildInfo.IssuesUrl
|
||||
);
|
||||
|
||||
return await _channelApi.CreateMessageWithEmbedResultAsync(channel, embedResult: errorEmbed,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue