Reputation: 99
How can I add a local file to my Embed as image.
I don't want to upload it to imgur or anything and get the URL. That doesn't work for the project due to changing images.
My code right now:
var emb = new EmbedBuilder()
.WithColor(Color.Blue)
.WithTimestamp(DateTime.Now)
.WithTitle(rarity)
.WithDescription($"{Context.User.Username} dropped a card!")
.WithImageUrl($"attachment://{path}")
.Build();
await Context.Channel.SendFileAsync(path, null, false, emb);
Upvotes: 2
Views: 2979
Reputation: 99
var filename = Path.GetFileName(path);
var emb = new EmbedBuilder()
.WithImageUrl($"attachment://{filename}")
.Build();
await Context.Channel.SendFileAsync(path, null, false, emb);
The Path.GetFileName
made it possible for me in combination with attachment://{filename}
Upvotes: 4