mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-15 02:00:09 +00:00
Message info embed improvements (#374)
- Fetch the user if there's no member object, so users who left the server don't show up as deleted - Order roles by position (so potential staff roles show up first and aren't cut off)
This commit is contained in:
parent
9d344a4ef9
commit
74140b5994
1 changed files with 7 additions and 2 deletions
|
|
@ -303,7 +303,9 @@ namespace PluralKit.Bot {
|
||||||
userInfo = member.User;
|
userInfo = member.User;
|
||||||
memberInfo = member;
|
memberInfo = member;
|
||||||
}
|
}
|
||||||
else userInfo = await _cache.GetOrFetchUser(_rest, msg.Message.Sender);
|
|
||||||
|
if (userInfo == null)
|
||||||
|
userInfo = await _cache.GetOrFetchUser(_rest, msg.Message.Sender);
|
||||||
|
|
||||||
// Calculate string displayed under "Sent by"
|
// Calculate string displayed under "Sent by"
|
||||||
string userStr;
|
string userStr;
|
||||||
|
|
@ -327,7 +329,10 @@ namespace PluralKit.Bot {
|
||||||
if (roles != null && roles.Count > 0)
|
if (roles != null && roles.Count > 0)
|
||||||
{
|
{
|
||||||
// TODO: what if role isn't in cache? figure out a fallback
|
// TODO: what if role isn't in cache? figure out a fallback
|
||||||
var rolesString = string.Join(", ", roles.Select(id => _cache.GetRole(id).Name));
|
var rolesString = string.Join(", ", roles
|
||||||
|
.Select(id => _cache.GetRole(id))
|
||||||
|
.OrderByDescending(role => role.Position)
|
||||||
|
.Select(role => role.Name));
|
||||||
eb.Field(new($"Account roles ({roles.Count})", rolesString.Truncate(1024)));
|
eb.Field(new($"Account roles ({roles.Count})", rolesString.Truncate(1024)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue