2024-05-29 20:51:37 +00:00
|
|
|
|
using SharpChat.Events;
|
|
|
|
|
|
|
|
|
|
namespace SharpChat {
|
2024-05-19 02:17:51 +00:00
|
|
|
|
public class UserInfo {
|
2023-02-17 22:17:24 +00:00
|
|
|
|
public const int DEFAULT_SIZE = 30;
|
|
|
|
|
public const int DEFAULT_MINIMUM_DELAY = 10000;
|
|
|
|
|
public const int DEFAULT_RISKY_OFFSET = 5;
|
|
|
|
|
|
2023-02-22 00:28:53 +00:00
|
|
|
|
public long UserId { get; }
|
|
|
|
|
public string UserName { get; set; }
|
2024-05-19 02:17:51 +00:00
|
|
|
|
public Colour Colour { get; set; }
|
2022-08-30 15:00:58 +00:00
|
|
|
|
public int Rank { get; set; }
|
2024-05-19 02:17:51 +00:00
|
|
|
|
public UserPermissions Permissions { get; set; }
|
2023-11-07 14:49:12 +00:00
|
|
|
|
public bool IsSuper { get; set; }
|
2023-02-22 00:28:53 +00:00
|
|
|
|
public string NickName { get; set; }
|
2023-02-17 21:47:44 +00:00
|
|
|
|
|
2024-05-19 02:17:51 +00:00
|
|
|
|
public UserInfo(
|
2023-02-22 00:28:53 +00:00
|
|
|
|
long userId,
|
2024-05-19 01:53:14 +00:00
|
|
|
|
string userName,
|
2024-05-19 02:17:51 +00:00
|
|
|
|
Colour colour,
|
2023-02-22 00:28:53 +00:00
|
|
|
|
int rank,
|
2024-05-19 02:17:51 +00:00
|
|
|
|
UserPermissions perms,
|
2024-05-10 19:18:55 +00:00
|
|
|
|
string? nickName = null,
|
2023-11-07 14:49:12 +00:00
|
|
|
|
bool isSuper = false
|
2023-02-22 00:28:53 +00:00
|
|
|
|
) {
|
|
|
|
|
UserId = userId;
|
2024-05-19 01:53:14 +00:00
|
|
|
|
UserName = userName;
|
2023-02-22 00:28:53 +00:00
|
|
|
|
Colour = colour;
|
|
|
|
|
Rank = rank;
|
|
|
|
|
Permissions = perms;
|
|
|
|
|
NickName = nickName ?? string.Empty;
|
2024-05-10 17:28:52 +00:00
|
|
|
|
IsSuper = isSuper;
|
2023-02-17 21:47:44 +00:00
|
|
|
|
}
|
|
|
|
|
|
2024-05-29 20:51:37 +00:00
|
|
|
|
public UserInfo(ChatEventInfo eventInfo)
|
|
|
|
|
: this(
|
|
|
|
|
eventInfo.SenderId,
|
|
|
|
|
eventInfo.SenderName,
|
|
|
|
|
eventInfo.SenderColour,
|
|
|
|
|
eventInfo.SenderRank,
|
|
|
|
|
eventInfo.SenderPerms,
|
|
|
|
|
eventInfo.SenderNickName
|
|
|
|
|
) {}
|
|
|
|
|
|
2024-05-19 02:17:51 +00:00
|
|
|
|
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
|
|
|
|
}
|
|
|
|
|
}
|