removed global xp leaderbaord as it is no longer used

This commit is contained in:
Toastie 2025-03-21 19:47:39 +13:00
parent ae8a63eeac
commit 2f740e96b8
Signed by: toastie_t0ast
GPG key ID: 0861BE54AD481DC7
4 changed files with 0 additions and 86 deletions
src/EllieBot

View file

@ -130,59 +130,6 @@ public partial class Xp : EllieModule<XpService>
.SendAsync();
}
[Cmd]
[RequireContext(ContextType.Guild)]
public async Task XpGlobalLeaderboard(int page = 1, params string[] args)
{
if (--page < 0 || page > 99)
return;
var (opts, _) = OptionsParser.ParseFrom(new LbOpts(), args);
await ctx.Channel.TriggerTypingAsync();
if (opts.Clean)
{
await _tracker.EnsureUsersDownloadedAsync(ctx.Guild);
}
async Task<IReadOnlyCollection<DiscordUser>> GetPageItems(int curPage)
{
if (opts.Clean)
{
return await _service.GetGlobalUserXps(page, ((SocketGuild)ctx.Guild).Users.Select(x => x.Id).ToList());
}
return await _service.GetGlobalUserXps(curPage);
}
await Response()
.Paginated()
.PageItems(GetPageItems)
.PageSize(10)
.Page((users, curPage) =>
{
var embed = CreateEmbed()
.WithOkColor()
.WithTitle(GetText(strs.global_leaderboard));
if (!users.Any())
{
embed.WithDescription("-");
return embed;
}
for (var i = 0; i < users.Count; i++)
{
var user = users[i];
embed.AddField($"#{i + 1 + (curPage * 10)} {user}",
$"{GetText(strs.level_x(new LevelStats(users[i].TotalXp).Level))} - {users[i].TotalXp}xp");
}
return embed;
})
.SendAsync();
}
[Cmd]
[RequireContext(ContextType.Guild)]
[UserPerm(GuildPerm.Administrator)]

View file

@ -465,29 +465,6 @@ public class XpService : IEService, IReadyExecutor, IExecNoCommand
.ToArrayAsyncLinqToDB();
}
public async Task<IReadOnlyCollection<DiscordUser>> GetGlobalUserXps(int page)
{
await using var uow = _db.GetDbContext();
return await uow.GetTable<DiscordUser>()
.OrderByDescending(x => x.TotalXp)
.Skip(page * 10)
.Take(10)
.ToArrayAsyncLinqToDB();
}
public async Task<IReadOnlyCollection<DiscordUser>> GetGlobalUserXps(int page, List<ulong> users)
{
await using var uow = _db.GetDbContext();
return await uow.GetTable<DiscordUser>()
.Where(x => x.UserId.In(users))
.OrderByDescending(x => x.TotalXp)
.Skip(page * 10)
.Take(10)
.ToArrayAsyncLinqToDB();
}
private bool IsVoiceChannelActive(SocketVoiceChannel channel)
{
var count = 0;

View file

@ -1116,9 +1116,6 @@ xpcurrencyreward:
xpleaderboard:
- xpleaderboard
- xplb
xpgloballeaderboard:
- xpgleaderboard
- xpglb
xpadd:
- xpadd
xpshop:

View file

@ -3574,13 +3574,6 @@ xpleaderboard:
desc: "The number of pages to display in the leaderboard."
params:
desc: "The list of player names or IDs to filter the leaderboard by."
xpgloballeaderboard:
desc: Shows the global xp leaderboard.
ex:
- ''
params:
- page:
desc: "The current page number for displaying the leaderboard results."
xpadd:
desc: Adds server XP to a single user or all users role on this server. This does not affect their global ranking. You can use negative values.
ex: