private async Task <string> DisplayGameStatus(string channelId, BlackjackGame game) { var messageBuilder = new EbmedMessageBuilder() .AddCustomAuthor("Blackjack"); messageBuilder.AddMessageField(new EmbedField("Prize pool", string.Format("{0:0.##}", game.MoneyToWin))); foreach (var member in game.Members) { var userCards = string.Empty; foreach (var card in member.UserCards) { userCards += $"``{card.Symbol} {GetCardEmoji(card.Color)}`` "; } userCards += $"({string.Format(TextFormat.BoldText, member.CurrentScore)})"; messageBuilder.AddMessageField(new EmbedField( string.Format(TextFormat.BoldText, member.UserNickname), userCards)); } var response = await _discordRestClient.PostMessage(channelId, new Message { Embed = messageBuilder.Build() }); return(response.Data.Id); }
public async Task HandleAsync(Command command) { var users = await _userPointsRepository.GetUsersAsync(); var embedMessage = new EbmedMessageBuilder() .AddAuthor(); foreach (var user in users.OrderByDescending(x => x.Balance).Take(15)) { embedMessage.AddMessageField(new EmbedField($"{user.Nickname}", string.Format("{0:0.##}", user.Balance))); } embedMessage.AddMessageFooter(DateTime.Now.ToShortDateString()); await _discordRestClient.PostMessage(command.CalledFromChannel, new Message { Embed = embedMessage.Build() }); }