2024-05-24 16:01:11 +00:00
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
|
2024-05-29 20:51:37 +00:00
|
|
|
|
public static UserKickBanEventData OfDuration(
|
2024-05-24 16:01:11 +00:00
|
|
|
|
UserDisconnectReason reason,
|
|
|
|
|
TimeSpan duration
|
2024-05-29 20:51:37 +00:00
|
|
|
|
) {
|
|
|
|
|
return new UserKickBanEventData(reason, DateTimeOffset.UtcNow.Add(duration));
|
|
|
|
|
}
|
2024-05-24 16:01:11 +00:00
|
|
|
|
}
|
|
|
|
|
}
|