I've tried every solution on adding an embed on a web hook but none work on my case or am I missing something?
I'm using Discord.Net v2.2.0
here's part of my code
var DCW = new DiscordWebhookClient(DCWebhook)
using (var client = DCW)
{
var eb = new EmbedBuilder();
eb.WithDescription("some text")
.Build();
await client.SendFileAsync(filePath: "file.txt", text: null, embeds: eb);
}
this code shows an error
cannot convert from 'Discord.Embed' to System.Collections.Generic.IEnumerable<Discord.Embed>
I tried this code and had the error fixed
await client.SendFileAsync(filePath: "file.txt", text: null, embeds: (IEnumerable<Embed>)eb);
I built and ran the .exe file and an error occured on console
Unhandled Exception: System.InvalidCastException: Unable to cast object of type 'Discord.EmbedBuilder' to type System.Collections.Generic.IEnumerable 1[Discord.Embed].
references: Send a Discord Embed via Webhook C#
https://discord.foxbot.me/docs/api/Discord.EmbedBuilder.html
I know most solutions above work but not in my case. I would really appreciate examples on how to solve this. thanks!