diff --git a/KfChatDotNetBot/Commands/MemeCommands.cs b/KfChatDotNetBot/Commands/MemeCommands.cs index e95f0b0..a388739 100644 --- a/KfChatDotNetBot/Commands/MemeCommands.cs +++ b/KfChatDotNetBot/Commands/MemeCommands.cs @@ -179,4 +179,25 @@ public class CleanCommand : ICommand var timespan = DateTimeOffset.UtcNow - DateTimeOffset.Parse(start.Value); await botInstance.SendChatMessageAsync($"Bossman has been clean {timespan.Humanize(precision:5)}", true); } +} + +public class RehbCommand : ICommand +{ + public List Patterns => [ + new Regex("^rehab") + ]; + public string? HelpText => "How long until rehab is over?"; + 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 end = await Helpers.GetValue(BuiltIn.Keys.BotRehabEndTime); + if (end.Value == null) + { + await botInstance.SendChatMessageAsync("Bossman's rehab end date was null", true); + return; + } + var timespan = DateTimeOffset.Parse(end.Value) - DateTimeOffset.UtcNow; + await botInstance.SendChatMessageAsync($"Bossman's rehab will be over in roughly {timespan.Humanize(precision:3)}", true); + } } \ No newline at end of file diff --git a/KfChatDotNetBot/Settings/BuiltIn.cs b/KfChatDotNetBot/Settings/BuiltIn.cs index 3e2ecf9..66e2e46 100644 --- a/KfChatDotNetBot/Settings/BuiltIn.cs +++ b/KfChatDotNetBot/Settings/BuiltIn.cs @@ -580,6 +580,15 @@ public static class BuiltIn Default = "2024-09-19T13:33:00-04:00", IsSecret = false, CacheDuration = TimeSpan.FromHours(1) + }, + new BuiltInSettingsModel + { + Key = Keys.BotRehabEndTime, + Regex = ".+", + Description = "ISO8601 date of Bossman's rehab end", + Default = "2024-10-24T09:00:00-04:00", + IsSecret = false, + CacheDuration = TimeSpan.FromHours(1) } ]; @@ -636,5 +645,6 @@ public static class BuiltIn public static string BotPraygeImgUrl = "Bot.Prayge.ImgUrl"; public static string BotCrackpipeImgUrl = "Bot.Crackpipe.ImgUrl"; public static string BotCleanStartTime = "Bot.Clean.StartTime"; + public static string BotRehabEndTime = "Bot.Rehab.EndTime"; } } \ No newline at end of file