$lb command added. Lists top 10 richest people (without name atm)
This commit is contained in:
parent
a54f1b23fc
commit
075c3d503d
@ -176,6 +176,14 @@ Order By mp.DateAdded desc
|
|||||||
Limit 20 OFFSET ?", num * 20);
|
Limit 20 OFFSET ?", num * 20);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal IEnumerable<CurrencyState> GetTopRichest(int n = 10)
|
||||||
|
{
|
||||||
|
using (var conn = new SQLiteConnection(FilePath))
|
||||||
|
{
|
||||||
|
return conn.Table<CurrencyState>().Take(n).ToList().OrderBy(cs => -cs.Value);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,10 +2,12 @@
|
|||||||
using Discord.Commands;
|
using Discord.Commands;
|
||||||
using Discord.Modules;
|
using Discord.Modules;
|
||||||
using NadekoBot.Classes;
|
using NadekoBot.Classes;
|
||||||
|
using NadekoBot.DataModels;
|
||||||
using NadekoBot.Extensions;
|
using NadekoBot.Extensions;
|
||||||
using NadekoBot.Modules.Permissions.Classes;
|
using NadekoBot.Modules.Permissions.Classes;
|
||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace NadekoBot.Modules.Gambling
|
namespace NadekoBot.Modules.Gambling
|
||||||
@ -114,6 +116,26 @@ namespace NadekoBot.Modules.Gambling
|
|||||||
|
|
||||||
await e.Channel.SendMessage($"{e.User.Mention} successfully took {amount} {NadekoBot.Config.CurrencyName}s from {mentionedUser.Mention}!").ConfigureAwait(false);
|
await e.Channel.SendMessage($"{e.User.Mention} successfully took {amount} {NadekoBot.Config.CurrencyName}s from {mentionedUser.Mention}!").ConfigureAwait(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
cgb.CreateCommand(Prefix + "leaderboard")
|
||||||
|
.Alias(Prefix + "lb")
|
||||||
|
.Do(async e =>
|
||||||
|
{
|
||||||
|
var richestTemp = DbHandler.Instance.GetTopRichest();
|
||||||
|
var richest = richestTemp as CurrencyState[] ?? richestTemp.ToArray();
|
||||||
|
if (richest.Length == 0)
|
||||||
|
return;
|
||||||
|
await e.Channel.SendMessage(
|
||||||
|
richest.Aggregate(new StringBuilder(
|
||||||
|
$@"```xl
|
||||||
|
┏━━━━━━━━━━━━━━━━━━━┳━━━━━━━┓
|
||||||
|
┃ Id ┃ $$$ ┃
|
||||||
|
"),
|
||||||
|
(cur, cs) => cur.AppendLine(
|
||||||
|
$@"┣━━━━━━━━━━━━━━━━━━━╋━━━━━━━┫
|
||||||
|
┃{cs.UserId,-18} ┃ {cs.Value,5} ┃")
|
||||||
|
).ToString() + "┗━━━━━━━━━━━━━━━━━━━┻━━━━━━━┛```");
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user