diff --git a/DeukBot4/DeukBot4.csproj b/DeukBot4/DeukBot4.csproj index ea24063..513ee49 100644 --- a/DeukBot4/DeukBot4.csproj +++ b/DeukBot4/DeukBot4.csproj @@ -7,6 +7,7 @@ + diff --git a/DeukBot4/MessageHandlers/CommandHandler/Commands/GeneralCommands.cs b/DeukBot4/MessageHandlers/CommandHandler/Commands/GeneralCommands.cs index 1a07307..058c478 100644 --- a/DeukBot4/MessageHandlers/CommandHandler/Commands/GeneralCommands.cs +++ b/DeukBot4/MessageHandlers/CommandHandler/Commands/GeneralCommands.cs @@ -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 }, diff --git a/DeukBot4/Program.cs b/DeukBot4/Program.cs index 786655a..bfbdeaa 100644 --- a/DeukBot4/Program.cs +++ b/DeukBot4/Program.cs @@ -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() + .FirstOrDefault(x => string.Equals(x.Key, "GitHash", StringComparison.InvariantCultureIgnoreCase)); + Version = attr.Value; + Console.WriteLine(Version); Settings = Settings.FromJsonFile("settings.json"); DatabaseConnection.ConnectionString = Settings.DatabaseConnectionString;