use of me.shadorc.shadbot.data.lotto.LottoHistoric in project Shadbot by Shadorc.
the class LottoCmd method show.
private void show(Context context) {
List<LottoPlayer> players = LottoManager.getPlayers();
EmbedBuilder embed = EmbedUtils.getDefaultEmbed().withAuthorName("Lotto").withThumbnail("https://cdn.onlineunitedstatescasinos.com/wp-content/uploads/2016/04/Lottery-icon.png").withDescription(String.format("The next draw will take place in **%s**%nTo participate, type: `%s%s %d-%d`", FormatUtils.formatCustomDate(LottoCmd.getDelay()), context.getPrefix(), this.getName(), MIN_NUM, MAX_NUM)).appendField("Number of participants", Integer.toString(players.size()), false).appendField("Prize pool", FormatUtils.formatCoins(LottoManager.getPool()), false);
LottoPlayer player = players.stream().filter(lottoPlayer -> lottoPlayer.getUserID() == context.getAuthor().getLongID()).findAny().orElse(null);
if (player != null) {
embed.withFooterIcon("https://images.emojiterra.com/twitter/512px/1f39f.png");
embed.withFooterText(String.format("%s, you bet on number %d.", context.getAuthorName(), player.getNum()));
}
LottoHistoric historic = LottoManager.getHistoric();
if (historic != null) {
String people;
switch(historic.getWinnersCount()) {
case 0:
people = "nobody";
break;
case 1:
people = "one person";
break;
default:
people = historic.getWinnersCount() + " people";
break;
}
embed.appendField("Historic", String.format("Last week, the prize pool contained **%s**, the winning number was **%d** and **%s won**.", FormatUtils.formatCoins(historic.getPool()), historic.getNum(), people), false);
}
BotUtils.sendMessage(embed.build(), context.getChannel());
}
Aggregations