sharp-chat/SharpChatCommon/UserInfo.cs

45 lines
1.5 KiB
C#

namespace SharpChat {
public class UserInfo {
public const int DEFAULT_SIZE = 30;
public const int DEFAULT_MINIMUM_DELAY = 10000;
public const int DEFAULT_RISKY_OFFSET = 5;
public long UserId { get; }
public string UserName { get; set; }
public Colour Colour { get; set; }
public int Rank { get; set; }
public UserPermissions Permissions { get; set; }
public bool IsSuper { get; set; }
public string NickName { get; set; }
public UserStatus Status { get; set; }
public string StatusText { get; set; }
public UserInfo(
long userId,
string userName,
Colour colour,
int rank,
UserPermissions perms,
string? nickName = null,
UserStatus status = UserStatus.Online,
string? statusText = null,
bool isSuper = false
) {
UserId = userId;
UserName = userName;
Colour = colour;
Rank = rank;
Permissions = perms;
NickName = nickName ?? string.Empty;
Status = status;
StatusText = statusText ?? string.Empty;
IsSuper = isSuper;
}
public static string GetDMChannelName(UserInfo user1, UserInfo user2) {
return user1.UserId < user2.UserId
? $"@{user1.UserId}-{user2.UserId}"
: $"@{user2.UserId}-{user1.UserId}";
}
}
}