diff --git a/KfChatDotNetBot/Commands/UtilityCommands.cs b/KfChatDotNetBot/Commands/UtilityCommands.cs index fa7b37e..798d49a 100644 --- a/KfChatDotNetBot/Commands/UtilityCommands.cs +++ b/KfChatDotNetBot/Commands/UtilityCommands.cs @@ -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 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().InformationalVersion; + await botInstance.SendChatMessageAsync($"Bot compiled against {version.Split('+')[1]}", true); + } } \ No newline at end of file diff --git a/KfChatDotNetBot/KfChatDotNetBot.csproj b/KfChatDotNetBot/KfChatDotNetBot.csproj index e22431a..0e42bc2 100644 --- a/KfChatDotNetBot/KfChatDotNetBot.csproj +++ b/KfChatDotNetBot/KfChatDotNetBot.csproj @@ -17,6 +17,10 @@ runtime; build; native; contentfiles; analyzers; buildtransitive + + all + runtime; build; native; contentfiles; analyzers; buildtransitive +