From 0ffe70b7fc4bae5d2e8298bb928dd27d54f00904 Mon Sep 17 00:00:00 2001 From: Still Hsu <341464@gmail.com> Date: Thu, 26 Apr 2018 03:34:17 +0800 Subject: [PATCH] Add local image embed instruction --- .../Common/EmbedBuilder.Overwrites.md | 28 ++++++++++++++++--- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/docs/_overwrites/Common/EmbedBuilder.Overwrites.md b/docs/_overwrites/Common/EmbedBuilder.Overwrites.md index de7da8f5d..2dcb1e004 100644 --- a/docs/_overwrites/Common/EmbedBuilder.Overwrites.md +++ b/docs/_overwrites/Common/EmbedBuilder.Overwrites.md @@ -16,6 +16,8 @@ uid: Discord.EmbedBuilder example: [*content] --- +#### Basic Usage + The example below builds an embed and sends it to the chat using the command system. @@ -27,9 +29,10 @@ public async Task SendRichEmbedAsync() { // Embed property can be set within object initializer Title = "Hello world!" - } + Description = "I am a description set by initializer." + }; // Or with methods - .AddField("Field title", + embed.AddField("Field title", "Field value. I also support [hyperlink markdown](https://example.com)!") .WithAuthor(Context.Client.CurrentUser) .WithFooter(footer => footer.Text = "I am a footer.") @@ -43,6 +46,23 @@ public async Task SendRichEmbedAsync() } ``` -#### Result +![Embed Example](images/embed-example.png) + +#### Usage with Local Images -![Embed Example](images/embed-example.png) \ No newline at end of file +The example below sends an image and has the image embedded in the rich +embed. See @Discord.IMessageChannel.SendFileAsync* for more information +about uploading a file or image. + +```cs +[Command("embedimage")] +public async Task SendEmbedWithImageAsync() +{ + var fileName = "image.png"; + var embed = new EmbedBuilder() + { + ImageUrl = $"attachment://{fileName}" + }.Build(); + await Context.Channel.SendFileAsync(fileName, embed: embed); +} +``` \ No newline at end of file