51 lines
1.6 KiB
C#
51 lines
1.6 KiB
C#
using SharpChat.Events;
|
|
|
|
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 UserInfo(
|
|
long userId,
|
|
string userName,
|
|
Colour colour,
|
|
int rank,
|
|
UserPermissions perms,
|
|
string? nickName = null,
|
|
bool isSuper = false
|
|
) {
|
|
UserId = userId;
|
|
UserName = userName;
|
|
Colour = colour;
|
|
Rank = rank;
|
|
Permissions = perms;
|
|
NickName = nickName ?? string.Empty;
|
|
IsSuper = isSuper;
|
|
}
|
|
|
|
public UserInfo(ChatEventInfo eventInfo)
|
|
: this(
|
|
eventInfo.SenderId,
|
|
eventInfo.SenderName,
|
|
eventInfo.SenderColour,
|
|
eventInfo.SenderRank,
|
|
eventInfo.SenderPerms,
|
|
eventInfo.SenderNickName
|
|
) {}
|
|
|
|
public static string GetDMChannelName(UserInfo user1, UserInfo user2) {
|
|
return user1.UserId < user2.UserId
|
|
? $"@{user1.UserId}-{user2.UserId}"
|
|
: $"@{user2.UserId}-{user1.UserId}";
|
|
}
|
|
}
|
|
}
|