Added git versioning to stamp assemblies with the commit and a command that might work to retrieve the commit hash

This commit is contained in:
barelyprofessional
2025-05-11 12:08:43 -05:00
parent 2a99eea470
commit 16961f12d6
2 changed files with 23 additions and 1 deletions

View File

@@ -1,4 +1,5 @@
using System.Text.RegularExpressions;
using System.Reflection;
using System.Text.RegularExpressions;
using KfChatDotNetBot.Models.DbModels;
using KfChatDotNetWsClient.Models.Events;
@@ -50,4 +51,21 @@ public class EnableGambaMessages : ICommand
botInstance.BotServices.TemporarilySuppressGambaMessages = false;
await botInstance.SendChatMessageAsync("Gamba notifs back on the menu", true);
}
}
public class GetVersionCommand : ICommand
{
public List<Regex> Patterns => [
new Regex("^version$")
];
public string? HelpText => null;
public UserRight RequiredRight => UserRight.Loser;
public TimeSpan Timeout => TimeSpan.FromSeconds(10);
public async Task RunCommand(ChatBot botInstance, MessageModel message, UserDbModel user, GroupCollection arguments, CancellationToken ctx)
{
var version = Assembly.GetEntryAssembly()
.GetCustomAttribute<AssemblyInformationalVersionAttribute>().InformationalVersion;
await botInstance.SendChatMessageAsync($"Bot compiled against {version.Split('+')[1]}", true);
}
}