sharp-chat/SharpChatCommon/UserInfo.cs

46 lines
1.5 KiB
C#
Raw Normal View History

2024-05-19 21:02:17 +00:00
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; }
2022-08-30 15:00:58 +00:00
public int Rank { get; set; }
public UserPermissions Permissions { get; set; }
2023-11-07 14:49:12 +00:00
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,
2024-05-10 19:18:55 +00:00
string? nickName = null,
UserStatus status = UserStatus.Online,
2024-05-10 19:18:55 +00:00
string? statusText = null,
2023-11-07 14:49:12 +00:00
bool isSuper = false
) {
UserId = userId;
UserName = userName;
Colour = colour;
Rank = rank;
Permissions = perms;
NickName = nickName ?? string.Empty;
Status = status;
StatusText = statusText ?? string.Empty;
2024-05-10 17:28:52 +00:00
IsSuper = isSuper;
}
public static string GetDMChannelName(UserInfo user1, UserInfo user2) {
2023-02-16 22:56:50 +00:00
return user1.UserId < user2.UserId
? $"@{user1.UserId}-{user2.UserId}"
: $"@{user2.UserId}-{user1.UserId}";
}
2022-08-30 15:00:58 +00:00
}
}