mirror of
https://github.com/barelyprofessional/KfChatDotNet.git
synced 2026-04-30 03:22:04 -04:00
20 lines
858 B
C#
20 lines
858 B
C#
using System.Text.RegularExpressions;
|
|
using KfChatDotNetBot.Models.DbModels;
|
|
using KfChatDotNetWsClient.Models.Events;
|
|
|
|
namespace KfChatDotNetBot.Commands;
|
|
|
|
public class TimeCommand : ICommand
|
|
{
|
|
public List<Regex> Patterns => [new Regex("^time")];
|
|
public string HelpText => "Get current time in BMT";
|
|
public bool HideFromHelp => false;
|
|
public UserRight RequiredRight => UserRight.Guest;
|
|
|
|
public async Task RunCommand(ChatBot botInstance, MessageModel message, GroupCollection arguments, CancellationToken ctx)
|
|
{
|
|
var bmt = new DateTimeOffset(TimeZoneInfo.ConvertTimeFromUtc(DateTime.UtcNow,
|
|
TimeZoneInfo.FindSystemTimeZoneById("Eastern Standard Time")), TimeZoneInfo.FindSystemTimeZoneById("Eastern Standard Time").BaseUtcOffset);
|
|
botInstance.SendChatMessage($"It's currently {bmt:h:mm:ss tt} BMT");
|
|
}
|
|
} |