Updated TZ output to AGT

This commit is contained in:
barelyprofessional
2025-02-06 00:02:25 +08:00
parent 4a5151229c
commit f7bc5b5026

View File

@@ -7,13 +7,13 @@ namespace KfChatDotNetBot.Commands;
public class TimeCommand : ICommand public class TimeCommand : ICommand
{ {
public List<Regex> Patterns => [new Regex("^time")]; public List<Regex> Patterns => [new Regex("^time")];
public string? HelpText => "Get current time in BMT"; public string? HelpText => "Get current time in AGT";
public UserRight RequiredRight => UserRight.Guest; public UserRight RequiredRight => UserRight.Guest;
public TimeSpan Timeout => TimeSpan.FromSeconds(10); public TimeSpan Timeout => TimeSpan.FromSeconds(10);
public async Task RunCommand(ChatBot botInstance, MessageModel message, UserDbModel user, GroupCollection arguments, CancellationToken ctx) public async Task RunCommand(ChatBot botInstance, MessageModel message, UserDbModel user, GroupCollection arguments, CancellationToken ctx)
{ {
var bmt = new DateTimeOffset(TimeZoneInfo.ConvertTimeFromUtc(DateTime.UtcNow, var agt = new DateTimeOffset(TimeZoneInfo.ConvertTimeFromUtc(DateTime.UtcNow,
TimeZoneInfo.FindSystemTimeZoneById("Eastern Standard Time")), TimeZoneInfo.FindSystemTimeZoneById("Eastern Standard Time").BaseUtcOffset); TimeZoneInfo.FindSystemTimeZoneById("Eastern Standard Time")), TimeZoneInfo.FindSystemTimeZoneById("Eastern Standard Time").BaseUtcOffset);
await botInstance.SendChatMessageAsync($"It's currently {bmt:h:mm:ss tt} BMT"); await botInstance.SendChatMessageAsync($"It's currently {agt:dddd h:mm:ss tt} AGT", true);
} }
} }