Browse Source

Add local image embed instruction

pull/988/head
Still Hsu 7 years ago
parent
commit
0ffe70b7fc
No known key found for this signature in database GPG Key ID: 8601A145FDA95209
1 changed files with 24 additions and 4 deletions
  1. +24
    -4
      docs/_overwrites/Common/EmbedBuilder.Overwrites.md

+ 24
- 4
docs/_overwrites/Common/EmbedBuilder.Overwrites.md View File

@@ -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)
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);
}
```

Loading…
Cancel
Save