mirror of
https://github.com/barelyprofessional/KfChatDotNet.git
synced 2026-04-30 03:22:04 -04:00
22 lines
1.0 KiB
C#
22 lines
1.0 KiB
C#
using System.Text.RegularExpressions;
|
|
using KfChatDotNetBot.Models;
|
|
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 UserRight RequiredRight => UserRight.Guest;
|
|
public TimeSpan Timeout => TimeSpan.FromSeconds(10);
|
|
public RateLimitOptionsModel? RateLimitOptions => null;
|
|
public bool WhisperCanInvoke => true;
|
|
public async Task RunCommand(ChatBot botInstance, BotCommandMessageModel message, UserDbModel user, GroupCollection arguments, CancellationToken ctx)
|
|
{
|
|
var bmt = new DateTimeOffset(TimeZoneInfo.ConvertTimeFromUtc(DateTime.UtcNow,
|
|
TimeZoneInfo.FindSystemTimeZoneById("Eastern Standard Time")), TimeZoneInfo.FindSystemTimeZoneById("Eastern Standard Time").BaseUtcOffset);
|
|
await botInstance.ReplyToUser(message, $"It's currently {bmt:dddd h:mm:ss tt} BMT");
|
|
}
|
|
} |