sharp-chat/SharpChatCommon/Events/UserKickBanEventData.cs
2024-05-29 20:51:41 +00:00

28 lines
798 B
C#

using System;
using System.Text.Json.Serialization;
namespace SharpChat.Events {
[ChatEventDataFor("user:kickban")]
public class UserKickBanEventData : ChatEventData {
[JsonPropertyName("reason")]
public UserDisconnectReason Reason { get; }
[JsonPropertyName("expires")]
public DateTimeOffset Expires { get; }
public UserKickBanEventData(
UserDisconnectReason reason,
DateTimeOffset expires
) {
Reason = reason;
Expires = expires;
}
public static UserKickBanEventData OfDuration(
UserDisconnectReason reason,
TimeSpan duration
) {
return new UserKickBanEventData(reason, DateTimeOffset.UtcNow.Add(duration));
}
}
}