28 lines
798 B
C#
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));
|
|
}
|
|
}
|
|
}
|