Skip to content

Commit 9217ffe

Browse files
committed
Updating README
1 parent ce2547a commit 9217ffe

2 files changed

Lines changed: 23 additions & 9 deletions

File tree

HuntroxGames/DiscordWebhookUnity/Runtime/Disocrd/Embed.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,16 @@ public Embed SetFooter(string text, string icon_url = "")
7979
};
8080
return this;
8181
}
82-
82+
public Embed SetAuthor(string name, string url = "", string icon_url = "")
83+
{
84+
author = new Author
85+
{
86+
name = name,
87+
url = url,
88+
icon_url = icon_url
89+
};
90+
return this;
91+
}
8392

8493
public Embed CreateEmbedAuthor(string name, string url = "", string icon_url = "")
8594
{

README.md

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
11
# DiscordWebhookUnity
22
DiscordWebhookUnity is a Unity Tool that allows you to send Discord webhook messages directly from your Unity projects. This package supports sending messages with content, embeds, and attachments such as images and text files.
33

4+
![img](https://i.imgur.com/SFLGpMf.png)
5+
46
## Features
57

68
- Send Discord webhook messages with content, embeds, and attachments.
79
- Support for image and text file attachments.
810
- Support for sending multiple embeds and attachments in a single message.
911
- Easy-to-use API for creating and sending webhook messages.
10-
- Callback support for handling webhook responses.
12+
- Callback support for handling webhook responses.
13+
- Progress callback when processing requests.
14+
- Discord timestamp conversion utility function.
15+
- Example code and scenes.
1116

1217

1318
## Installation
@@ -19,7 +24,7 @@ DiscordWebhookUnity is a Unity Tool that allows you to send Discord webhook mess
1924

2025
### Simple Webhook
2126

22-
Easy way to send a webhook message using method chaining:
27+
Easy way to send a webhook message using helpful methods:
2328
```csharp
2429
var webhook = new Webhook()
2530
.SetAuthor("My Webhook name", "https://avatars.githubusercontent.com/u/34078403?v=4")
@@ -67,9 +72,10 @@ Construct a `Webhook` instance and have more control over its properties:
6772
webhook.SendWebhook(myWebhookURl);
6873
```
6974

70-
### Sending Attachments
75+
### Adding Attachments
7176

72-
You can also send attachments with your webhook messages:
77+
To include attachments in your webhook simply use the `AddAttachment` or `AddImgAttachmentRes` or `AddTextAttachmentRes` methods.
78+
also note when adding Attachment, you need to provide a `referencekey` to identify the attachment and helps with referencing the attachment in the embed Thumbnail or Image fields.
7379

7480
```csharp
7581
var webhook = new Webhook()
@@ -81,10 +87,9 @@ You can also send attachments with your webhook messages:
8187
webhook.SendWebhook(myWebhookURl);
8288
```
8389

84-
when adding Attachment, you need to provide a `referencekey` to identify the attachment and helps with referencing the attachment in the embed Thumbnail or Image fields.
8590

8691

87-
### Sending Embeds
92+
### Adding Embeds
8893

8994
To include embeds in your webhook messages:
9095

@@ -121,9 +126,9 @@ providing an external URL to the image will work as well.
121126

122127
- `CreateEmbed(string title, string description, Color color)`: Creates a new embed.
123128
- `CreateNewField(string name, string value, bool inline)`: Adds a new field to the embed.
124-
- `SetImage(string url)`: Sets the image of the embed.
129+
- `SetImage(string url)`: Sets the image of the embed. use the `referencekey` to reference the attachment previously added with the same reference key or Direct URL.
125130
- `SetFooter(string text, string icon_url)`: Sets the footer of the embed.
126-
- `SetThumbnail(string url)`: Sets the thumbnail of the embed.
131+
- `SetThumbnail(string url)`: Sets the thumbnail of the embed. use the `referencekey` to reference the attachment previously added with the same reference key or Direct URL.
127132

128133
### Attachment Types
129134
- `Attachment`: Used to load file attachment directly from a file path. e.g. `"c:/path/to/file.txt"`.

0 commit comments

Comments
 (0)