Added '--version' which outputs the bot's version

using '--version' during bot execution outputs the bot's version
modify how app version is retrieved
modify casing of 'unknown' version
This commit is contained in:
Toastie 2025-02-24 13:30:26 +13:00
parent 0ead1290e9
commit 81677ee761
Signed by: toastie_t0ast
GPG key ID: 0861BE54AD481DC7

View file

@ -1,4 +1,17 @@
var shardId = 0;
using System.Reflection;
static string GetAppVersion()
{
return Assembly.GetExecutingAssembly().GetName().Version?.ToString() ?? "unknown";
}
if (args.Length > 0 && args[0] == "--version")
{
Console.WriteLine(GetAppVersion());
return;
}
var shardId = 0;
int? totalShards = null; // 0 to read from creds.yml
if (args.Length > 0 && args[0] != "run")
{
@ -20,5 +33,4 @@ if (args.Length > 0 && args[0] != "run")
}
}
await new Bot(shardId, totalShards).RunAndBlockAsync();