Bot version retrieved via --version will now match the version in .stats

This commit is contained in:
Toastie 2025-03-01 12:45:14 +13:00
parent 3653d97c90
commit da0eff4339
Signed by: toastie_t0ast
GPG key ID: 0861BE54AD481DC7
2 changed files with 2 additions and 7 deletions
src/EllieBot
Program.cs
_common/Services/Impl

View file

@ -1,13 +1,8 @@
using System.Reflection; using System.Reflection;
static string GetAppVersion()
{
return Assembly.GetExecutingAssembly().GetName().Version?.ToString() ?? "unknown";
}
if (args.Length > 0 && args[0] == "--version") if (args.Length > 0 && args[0] == "--version")
{ {
Console.WriteLine(GetAppVersion()); Console.WriteLine(StatsService.BotVersion);
return; return;
} }

View file

@ -7,7 +7,7 @@ namespace EllieBot.Services;
public sealed class StatsService : IStatsService, IReadyExecutor, IEService public sealed class StatsService : IStatsService, IReadyExecutor, IEService
{ {
public static string BotVersion public static string BotVersion
=> typeof(Bot).Assembly.GetName().Version?.ToString(3) ?? "Custom"; => typeof(Bot).Assembly.GetName().Version?.ToString(3) ?? "custom";
public string Author public string Author
=> "toastie_t0ast"; => "toastie_t0ast";