Fixed shop role name. Fixed .xpglb (it will now show usernames and discriminators)
This commit is contained in:
parent
0a52676042
commit
37412e4e73
@ -331,7 +331,7 @@ namespace NadekoBot.Modules.Gambling
|
||||
var embed = new EmbedBuilder().WithOkColor();
|
||||
|
||||
if (entry.Type == ShopEntryType.Role)
|
||||
return embed.AddField(efb => efb.WithName(GetText("name")).WithValue(GetText("shop_role", Format.Bold(entry.RoleName))).WithIsInline(true))
|
||||
return embed.AddField(efb => efb.WithName(GetText("name")).WithValue(GetText("shop_role", Format.Bold(Context.Guild.GetRole(entry.RoleId)?.Name ?? "MISSING_ROLE"))).WithIsInline(true))
|
||||
.AddField(efb => efb.WithName(GetText("price")).WithValue(entry.Price.ToString()).WithIsInline(true))
|
||||
.AddField(efb => efb.WithName(GetText("type")).WithValue(entry.Type.ToString()).WithIsInline(true));
|
||||
else if (entry.Type == ShopEntryType.List)
|
||||
@ -349,7 +349,7 @@ namespace NadekoBot.Modules.Gambling
|
||||
{
|
||||
if (entry.Type == ShopEntryType.Role)
|
||||
{
|
||||
return GetText("shop_role", Format.Bold(entry.RoleName));
|
||||
return GetText("shop_role", Format.Bold(Context.Guild.GetRole(entry.RoleId)?.Name ?? "MISSING_ROLE"));
|
||||
}
|
||||
else if (entry.Type == ShopEntryType.List)
|
||||
{
|
||||
|
@ -308,7 +308,7 @@ namespace NadekoBot.Modules.Xp.Services
|
||||
}
|
||||
}
|
||||
|
||||
public (ulong UserId, int TotalXp)[] GetUserXps(int page)
|
||||
public DiscordUser[] GetUserXps(int page)
|
||||
{
|
||||
using (var uow = _db.UnitOfWork)
|
||||
{
|
||||
|
@ -258,9 +258,9 @@ namespace NadekoBot.Modules.Xp
|
||||
{
|
||||
for (int i = 0; i < users.Length; i++)
|
||||
{
|
||||
var user = await Context.Guild.GetUserAsync(users[i].UserId).ConfigureAwait(false);
|
||||
var user = users[i];
|
||||
embed.AddField(
|
||||
$"#{(i + 1 + page * 9)} {(user?.ToString() ?? users[i].UserId.ToString())}",
|
||||
$"#{(i + 1 + page * 9)} {(user.ToString())}",
|
||||
$"{GetText("level_x", LevelStats.FromXp(users[i].TotalXp).Level)} - {users[i].TotalXp}xp");
|
||||
}
|
||||
}
|
||||
|
@ -7,6 +7,6 @@ namespace NadekoBot.Services.Database.Repositories
|
||||
{
|
||||
DiscordUser GetOrCreate(IUser original);
|
||||
int GetUserGlobalRanking(ulong id);
|
||||
(ulong UserId, int TotalXp)[] GetUsersXpLeaderboardFor(int page);
|
||||
DiscordUser[] GetUsersXpLeaderboardFor(int page);
|
||||
}
|
||||
}
|
||||
|
@ -46,14 +46,13 @@ namespace NadekoBot.Services.Database.Repositories.Impl
|
||||
.Sum(y => y.TotalXp));
|
||||
}
|
||||
|
||||
public (ulong UserId, int TotalXp)[] GetUsersXpLeaderboardFor(int page)
|
||||
public DiscordUser[] GetUsersXpLeaderboardFor(int page)
|
||||
{
|
||||
return _set
|
||||
.OrderByDescending(x => x.TotalXp)
|
||||
.Skip(page * 9)
|
||||
.Take(9)
|
||||
.AsEnumerable()
|
||||
.Select(y => (y.UserId, y.TotalXp))
|
||||
.ToArray();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user