1
0
Fork 1
mirror of https://github.com/TeamOctolings/Octobot.git synced 2025-04-19 16:33:36 +03:00

uhhh ehhh

Signed-off-by: mctaylors <cantsendmails@mctaylors.ru>
This commit is contained in:
Macintxsh 2024-03-19 19:37:59 +03:00
parent d10bf3377c
commit a5a3eb86dd
Signed by: mctaylors
GPG key ID: 7181BEBE676903C1
5 changed files with 61 additions and 14 deletions

View file

@ -17,14 +17,12 @@
<NeutralLanguage>en</NeutralLanguage>
<Description>A general-purpose Discord bot for moderation written in C#</Description>
<ApplicationIcon>docs/octobot.ico</ApplicationIcon>
<GitVersion>false</GitVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="DiffPlex" Version="1.7.2" />
<PackageReference Include="GitInfo" Version="3.3.4">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="GitInfo" Version="3.3.4" />
<PackageReference Include="Humanizer.Core.ru" Version="2.14.1" />
<PackageReference Include="JetBrains.Annotations" Version="2023.3.0" />
<PackageReference Include="Microsoft.CodeAnalysis.BannedApiAnalyzers" Version="3.3.4" />

54
src/BuildInfo.cs Normal file
View file

@ -0,0 +1,54 @@
using JetBrains.Annotations;
namespace Octobot;
public static class BuildInfo
{
public static string RepositoryUrl
{
get
{
return ThisAssembly.Git.RepositoryUrl;
}
}
public static string Issues
{
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}";
}
}
}

View file

@ -101,26 +101,21 @@ public class AboutCommandGroup : CommandGroup
.WithDescription(builder.ToString())
.WithColour(ColorsList.Cyan)
.WithImageUrl("https://i.ibb.co/fS6wZhh/octobot-banner.png")
// ThisAssembly.Git.IsDirty already returns true or false.
// ReSharper disable HeuristicUnreachableCode
.WithFooter(string.Format(Messages.Version, ThisAssembly.Git.IsDirty
? $"{ThisAssembly.Git.Branch}-{ThisAssembly.Git.Commit}-dirty"
: $"{ThisAssembly.Git.Branch}-{ThisAssembly.Git.Commit}"))
// ReSharper restore HeuristicUnreachableCode
.WithFooter(string.Format(Messages.Version, BuildInfo.Version))
.Build();
var repositoryButton = new ButtonComponent(
ButtonComponentStyle.Link,
Messages.ButtonOpenRepository,
new PartialEmoji(Name: "🌐"),
URL: ThisAssembly.Git.RepositoryUrl
URL: BuildInfo.RepositoryUrl
);
var issuesButton = new ButtonComponent(
ButtonComponentStyle.Link,
Messages.ButtonReportIssue,
new PartialEmoji(Name: "⚠️"),
URL: $"{ThisAssembly.Git.RepositoryUrl}/issues"
URL: BuildInfo.Issues
);
return await _feedback.SendContextualEmbedResultAsync(embed,

View file

@ -72,7 +72,7 @@ public class ErrorLoggingPostExecutionEvent : IPostExecutionEvent
ButtonComponentStyle.Link,
Messages.ButtonReportIssue,
new PartialEmoji(Name: "⚠️"),
URL: $"{ThisAssembly.Git.RepositoryUrl}/issues"
URL: BuildInfo.Issues
);
return await _feedback.SendContextualEmbedResultAsync(embed,

View file

@ -117,7 +117,7 @@ public class GuildLoadedResponder : IResponder<IGuildCreate>
ButtonComponentStyle.Link,
Messages.ButtonReportIssue,
new PartialEmoji(Name: "⚠️"),
URL: $"{ThisAssembly.Git.RepositoryUrl}/issues"
URL: BuildInfo.Issues
);
return await _channelApi.CreateMessageWithEmbedResultAsync(channel, embedResult: errorEmbed,