33 lines
1.2 KiB
C#
33 lines
1.2 KiB
C#
|
namespace SharpChat.Users;
|
||
|
|
||
|
public class User(
|
||
|
string userId,
|
||
|
string userName,
|
||
|
ColourInheritable colour,
|
||
|
int rank,
|
||
|
UserPermissions perms,
|
||
|
string nickName = "",
|
||
|
UserStatus status = UserStatus.Online,
|
||
|
string statusText = ""
|
||
|
) {
|
||
|
public string UserId { get; } = userId;
|
||
|
public string UserName { get; internal set; } = userName;
|
||
|
public ColourInheritable Colour { get; internal set; } = colour;
|
||
|
public int Rank { get; internal set; } = rank;
|
||
|
public UserPermissions Permissions { get; internal set; } = perms;
|
||
|
public string NickName { get; internal set; } = nickName;
|
||
|
public UserStatus Status { get; internal set; } = status;
|
||
|
public string StatusText { get; internal set; } = statusText;
|
||
|
|
||
|
public bool NameEquals(string name) {
|
||
|
return string.Equals(name, UserName, StringComparison.OrdinalIgnoreCase)
|
||
|
|| string.Equals(name, NickName, StringComparison.OrdinalIgnoreCase);
|
||
|
}
|
||
|
|
||
|
public string GetDMChannelNameWith(User other) {
|
||
|
return string.Compare(UserId, other.UserId, StringComparison.Ordinal) > 0
|
||
|
? $"@{other.UserId}-{UserId}"
|
||
|
: $"@{UserId}-{other.UserId}";
|
||
|
}
|
||
|
}
|