private async Task MultiCoinReply(IList <Currency> coins, Color color, string title, string description) { EmbedBuilder builder = new EmbedBuilder(); builder.WithTitle(title); builder.WithDescription(description); builder.Color = color; AddAuthor(builder); AddFooter(builder, coins.Max(c => c.Getdetails <CoinMarketCapCoin>().LastUpdated)); foreach (Currency coin in coins) { CoinMarketCapCoin details = coin.Getdetails <CoinMarketCapCoin>(); builder.Fields.Add(new EmbedFieldBuilder { Name = $"{coin.Name} ({coin.Symbol}) | {details.DayChange.AsPercentage()} | {details.GetPriceSummary()}", Value = $"[{details.GetChangeSummary()}{Environment.NewLine}Cap {details.MarketCap.AsUsdPrice()} | Vol {details.Volume.AsUsdPrice()} | Rank {details.Rank}]({details.Url})" }); } await this.ReplyAsync(string.Empty, false, builder.Build()); }
public async Task Price([Remainder, Summary("The symbol for the coin")] string symbol) { using (this.Context.Channel.EnterTypingState()) { try { Currency currency = this._currencyManager.Get(symbol); if (currency != null) { CoinMarketCapCoin details = currency.Getdetails <CoinMarketCapCoin>(); await this.ReplyAsync($"{currency.Symbol} - ${details.GetPriceSummary()} ({details.GetChangeSummary()})"); } else { await this.ReplyAsync($"sorry, {symbol} was not found"); } } catch (Exception e) { this._logger.LogError(new EventId(e.HResult), e, e.Message); await this.ReplyAsync($"oops, something went wrong, sorry!"); return; } } }