removed global xp leaderbaord as it is no longer used
This commit is contained in:
parent
ae8a63eeac
commit
2f740e96b8
4 changed files with 0 additions and 86 deletions
src/EllieBot
|
@ -130,59 +130,6 @@ public partial class Xp : EllieModule<XpService>
|
||||||
.SendAsync();
|
.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]
|
[Cmd]
|
||||||
[RequireContext(ContextType.Guild)]
|
[RequireContext(ContextType.Guild)]
|
||||||
[UserPerm(GuildPerm.Administrator)]
|
[UserPerm(GuildPerm.Administrator)]
|
||||||
|
|
|
@ -465,29 +465,6 @@ public class XpService : IEService, IReadyExecutor, IExecNoCommand
|
||||||
.ToArrayAsyncLinqToDB();
|
.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)
|
private bool IsVoiceChannelActive(SocketVoiceChannel channel)
|
||||||
{
|
{
|
||||||
var count = 0;
|
var count = 0;
|
||||||
|
|
|
@ -1116,9 +1116,6 @@ xpcurrencyreward:
|
||||||
xpleaderboard:
|
xpleaderboard:
|
||||||
- xpleaderboard
|
- xpleaderboard
|
||||||
- xplb
|
- xplb
|
||||||
xpgloballeaderboard:
|
|
||||||
- xpgleaderboard
|
|
||||||
- xpglb
|
|
||||||
xpadd:
|
xpadd:
|
||||||
- xpadd
|
- xpadd
|
||||||
xpshop:
|
xpshop:
|
||||||
|
|
|
@ -3574,13 +3574,6 @@ xpleaderboard:
|
||||||
desc: "The number of pages to display in the leaderboard."
|
desc: "The number of pages to display in the leaderboard."
|
||||||
params:
|
params:
|
||||||
desc: "The list of player names or IDs to filter the leaderboard by."
|
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:
|
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.
|
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:
|
ex:
|
||||||
|
|
Loading…
Add table
Reference in a new issue