diff --git a/src/NadekoBot/Modules/Gambling/Gambling.cs b/src/NadekoBot/Modules/Gambling/Gambling.cs index 12071254..1edf0f9e 100644 --- a/src/NadekoBot/Modules/Gambling/Gambling.cs +++ b/src/NadekoBot/Modules/Gambling/Gambling.cs @@ -248,22 +248,33 @@ namespace NadekoBot.Modules.Gambling [NadekoCommand, Usage, Description, Aliases] public async Task Leaderboard() { - IEnumerable richest = new List(); + var richest = new List(); using (var uow = DbHandler.UnitOfWork()) { - richest = uow.Currency.GetTopRichest(10); + richest = uow.Currency.GetTopRichest(9).ToList(); } if (!richest.Any()) return; - await Context.Channel.SendMessageAsync( - richest.Aggregate(new StringBuilder( -$@"```xl -┏━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━┓ -┃ Id ┃ $$$ ┃ -"), - (cur, cs) => cur.AppendLine($@"┣━━━━━━━━━━━━━━━━━━━━━╋━━━━━━━━┫ -┃{(Context.Guild.GetUserAsync(cs.UserId).GetAwaiter().GetResult()?.Username?.TrimTo(18, true) ?? cs.UserId.ToString()),-20} ┃ {cs.Amount,6} ┃") - ).ToString() + "┗━━━━━━━━━━━━━━━━━━━━━┻━━━━━━━━┛```").ConfigureAwait(false); + + + var embed = new EmbedBuilder() + .WithOkColor() + .WithTitle(NadekoBot.BotConfig.CurrencySign + " Leaderboard"); + + for (var i = 0; i < richest.Count; i++) + { + var x = richest[i]; + var usr = await Context.Guild.GetUserAsync(x.UserId).ConfigureAwait(false); + var usrStr = ""; + if (usr == null) + usrStr = x.UserId.ToString(); + else + usrStr = usr.Username?.TrimTo(20, true); + + embed.AddField(efb => efb.WithName("#" + (i + 1) + " " + usrStr).WithValue(x.Amount.ToString() + " " + NadekoBot.BotConfig.CurrencySign).WithIsInline(true)); + } + + await Context.Channel.EmbedAsync(embed).ConfigureAwait(false); } } } diff --git a/src/NadekoBot/Resources/CommandStrings.Designer.cs b/src/NadekoBot/Resources/CommandStrings.Designer.cs index 0f25ceb5..f8097764 100644 --- a/src/NadekoBot/Resources/CommandStrings.Designer.cs +++ b/src/NadekoBot/Resources/CommandStrings.Designer.cs @@ -879,7 +879,7 @@ namespace NadekoBot.Resources { } /// - /// Looks up a localized string similar to Bet to guess will the result be heads or tails. Guessing awards you 1.8x the currency you've bet.. + /// Looks up a localized string similar to Bet to guess will the result be heads or tails. Guessing awards you 1.95x the currency you've bet (rounded up). Multiplier can be changed by the bot owner.. /// public static string betflip_desc { get { diff --git a/src/NadekoBot/Resources/CommandStrings.resx b/src/NadekoBot/Resources/CommandStrings.resx index 2b742f4a..c9fcc6a8 100644 --- a/src/NadekoBot/Resources/CommandStrings.resx +++ b/src/NadekoBot/Resources/CommandStrings.resx @@ -1183,7 +1183,7 @@ betflip bf - Bet to guess will the result be heads or tails. Guessing awards you 1.8x the currency you've bet. + Bet to guess will the result be heads or tails. Guessing awards you 1.95x the currency you've bet (rounded up). Multiplier can be changed by the bot owner. `{0}bf 5 heads` or `{0}bf 3 t`