sharp-chat/SharpChat.Common/Events/UserBanCreatedEvent.cs

30 lines
898 B
C#
Raw Normal View History

2022-08-30 15:05:29 +00:00
using SharpChat.Users.Remote;
using System;
namespace SharpChat.Events {
[Event(TYPE)]
public class UserBanCreatedEvent : Event {
public const string TYPE = @"ban:create";
public long ModeratorUserId { get; }
public bool IsPermanent { get; }
public long Duration { get; }
public string Reason { get; }
public UserBanCreatedEvent(
IRemoteUser subject,
IRemoteUser moderator,
bool permanent,
TimeSpan duration,
string reason
) : base(
(subject ?? throw new ArgumentNullException(nameof(subject))).UserId
) {
ModeratorUserId = moderator?.UserId ?? -1;
IsPermanent = permanent;
Duration = (long)duration.TotalSeconds;
Reason = reason ?? throw new ArgumentNullException(nameof(reason));
}
}
}