Support for getting git hash at runtime
This commit is contained in:
parent
ff76878e31
commit
3b9c7808d5
|
@ -7,6 +7,7 @@
|
|||
<ItemGroup>
|
||||
<PackageReference Include="Discord.Net" Version="2.1.1" />
|
||||
<PackageReference Include="JetBrains.Annotations" Version="2018.3.0" />
|
||||
<PackageReference Include="MSBuildGitHash" Version="0.4.1" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" />
|
||||
<PackageReference Include="Npgsql" Version="4.0.3" />
|
||||
<PackageReference Include="StackExchange.Redis" Version="2.0.601" />
|
||||
|
|
|
@ -29,6 +29,10 @@ namespace DeukBot4.MessageHandlers.CommandHandler
|
|||
Name = "Software", Value = "Deukbot 4.0", IsInline = true
|
||||
},
|
||||
new EmbedFieldBuilder()
|
||||
{
|
||||
Name = "Version", Value = Program.Version, IsInline = true
|
||||
},
|
||||
new EmbedFieldBuilder()
|
||||
{
|
||||
Name = "Creator", Value = "<@84372569012043776>", IsInline = true
|
||||
},
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Threading.Tasks;
|
||||
using DeukBot4.Database;
|
||||
using DeukBot4.Database.ServerSettings;
|
||||
|
@ -17,6 +20,8 @@ namespace DeukBot4
|
|||
public static Settings Settings { get; private set; }
|
||||
public static ulong BotId { get; private set; }
|
||||
public static bool IsConnected { get; private set; }
|
||||
|
||||
public static string Version { get; private set; }
|
||||
|
||||
private static void Main(string[] args)
|
||||
{
|
||||
|
@ -32,6 +37,11 @@ namespace DeukBot4
|
|||
|
||||
private static async Task MainAsync()
|
||||
{
|
||||
var assembly = Assembly.GetExecutingAssembly();
|
||||
var attr = assembly.GetCustomAttributes<AssemblyMetadataAttribute>()
|
||||
.FirstOrDefault(x => string.Equals(x.Key, "GitHash", StringComparison.InvariantCultureIgnoreCase));
|
||||
Version = attr.Value;
|
||||
Console.WriteLine(Version);
|
||||
|
||||
Settings = Settings.FromJsonFile("settings.json");
|
||||
DatabaseConnection.ConnectionString = Settings.DatabaseConnectionString;
|
||||
|
|
Loading…
Reference in New Issue