public async Task <Stream> GetStream(BadoszEndpoint endpoint, NameValueCollection parameters = null) { var uri = new UriBuilder(HttpClient.BaseAddress + endpoint.GetEnumMemberValue()) { Query = parameters?.ToString() }; return(await HttpClient.GetStreamAsync(uri.Uri)); }
public async Task <DiscordMessage> SendEmbedImage(CommandContext ctx, BadoszEndpoint endpoint, string title = null, NameValueCollection parameters = null) { await using var stream = await GetStream(endpoint, parameters); var name = endpoint.GetEnumMemberValue(); var embed = new ModernEmbedBuilder { Title = title ?? (name ?? throw new InvalidOperationException()).First().ToString().ToUpper() + name.Substring(1), ImageUrl = "attachment://image.gif" }.AddGeneratedForFooter(ctx);