.clubinfo will now show member's levels and order them by it, feathub#212

This commit is contained in:
Master Kwoth 2017-11-20 03:49:05 +01:00
parent a0c5b469b8
commit acf411c336
2 changed files with 13 additions and 9 deletions

View File

@ -129,23 +129,27 @@ namespace NadekoBot.Modules.Xp
.AddField("Owner", club.Owner.ToString(), true) .AddField("Owner", club.Owner.ToString(), true)
.AddField("Level Req.", club.MinimumLevelReq.ToString(), true) .AddField("Level Req.", club.MinimumLevelReq.ToString(), true)
.AddField("Members", string.Join("\n", club.Users .AddField("Members", string.Join("\n", club.Users
.OrderByDescending(x => { .OrderByDescending(x =>
{
var l = new LevelStats(x.TotalXp).Level;
if (club.OwnerId == x.Id) if (club.OwnerId == x.Id)
return 2; return int.MaxValue;
else if (x.IsClubAdmin) else if (x.IsClubAdmin)
return 1; return int.MaxValue / 2 + l;
else else
return 0; return l;
}) })
.Skip(page * 10) .Skip(page * 10)
.Take(10) .Take(10)
.Select(x => .Select(x =>
{ {
var l = new LevelStats(x.TotalXp);
var lvlStr = Format.Bold($" 『{l.Level}』");
if (club.OwnerId == x.Id) if (club.OwnerId == x.Id)
return x.ToString() + "🌟"; return x.ToString() + "🌟" + lvlStr;
else if (x.IsClubAdmin) else if (x.IsClubAdmin)
return x.ToString() + "⭐"; return x.ToString() + "⭐" + lvlStr;
return x.ToString(); return x.ToString() + lvlStr;
})), false); })), false);
if (Uri.IsWellFormedUriString(club.ImageUrl, UriKind.Absolute)) if (Uri.IsWellFormedUriString(club.ImageUrl, UriKind.Absolute))

View File

@ -21,7 +21,7 @@ namespace NadekoBot.Core.Services.Impl
private readonly IBotCredentials _creds; private readonly IBotCredentials _creds;
private readonly DateTime _started; private readonly DateTime _started;
public const string BotVersion = "2.5.6"; public const string BotVersion = "2.5.7";
public string Author => "Kwoth#2560"; public string Author => "Kwoth#2560";
public string Library => "Discord.Net"; public string Library => "Discord.Net";