sharp-chat/SharpChatCommon/Events/UserKickBanEventData.cs

29 lines
798 B
C#
Raw Normal View History

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));
}
}
}