$lb redesign

This commit is contained in:
Kwoth 2017-01-23 01:33:07 +01:00
parent 53b0b7d3a5
commit b6f44de8b5
3 changed files with 24 additions and 13 deletions

View File

@ -248,22 +248,33 @@ namespace NadekoBot.Modules.Gambling
[NadekoCommand, Usage, Description, Aliases]
public async Task Leaderboard()
{
IEnumerable<Currency> richest = new List<Currency>();
var richest = new List<Currency>();
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);
}
}
}

View File

@ -879,7 +879,7 @@ namespace NadekoBot.Resources {
}
/// <summary>
/// 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&apos;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&apos;ve bet (rounded up). Multiplier can be changed by the bot owner..
/// </summary>
public static string betflip_desc {
get {

View File

@ -1183,7 +1183,7 @@
<value>betflip bf</value>
</data>
<data name="betflip_desc" xml:space="preserve">
<value>Bet to guess will the result be heads or tails. Guessing awards you 1.8x the currency you've bet.</value>
<value>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.</value>
</data>
<data name="betflip_usage" xml:space="preserve">
<value>`{0}bf 5 heads` or `{0}bf 3 t`</value>