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

29 lines
927 B
C#
Raw Normal View History

2022-08-30 15:05:29 +00:00
using SharpChat.Users;
using System;
namespace SharpChat.Events {
[Event(TYPE)]
public class UserConnectEvent : Event {
public const string TYPE = @"user:connect";
public string Name { get; }
public Colour Colour { get; }
public int Rank { get; }
public UserPermissions Permissions { get; }
public string NickName { get; }
public UserStatus Status { get; }
public string StatusMessage { get; }
public UserConnectEvent(ILocalUser user)
: base(user ?? throw new ArgumentNullException(nameof(user))) {
Name = user.UserName;
Colour = user.Colour;
Rank = user.Rank;
Permissions = user.Permissions;
NickName = string.IsNullOrWhiteSpace(user.NickName) ? null : user.NickName;
Status = user.Status;
StatusMessage = user.StatusMessage;
}
}
}