@@ -3,7 +3,7 @@ DiscordWebhookUnity is a Unity Tool that allows you to send Discord webhook mess
3
3
4
4
![ img] ( https://i.imgur.com/SFLGpMf.png )
5
5
6
- ## Features
6
+ # Features
7
7
8
8
- Send Discord webhook messages with content, embeds, and attachments.
9
9
- Support for image and text file attachments.
@@ -15,12 +15,12 @@ DiscordWebhookUnity is a Unity Tool that allows you to send Discord webhook mess
15
15
- Example code and scenes.
16
16
17
17
18
- ## Installation
18
+ # Installation
19
19
20
20
1 . Clone or download the repository or download the latest [ release] ( https://github.com/HuntroxGames/DiscordWebhookUnity ) .
21
21
2 . Copy the ` HuntroxGames ` folder into your Unity project's ` Assets ` directory.
22
22
23
- ## Usage
23
+ # Usage
24
24
25
25
### Simple Webhook
26
26
@@ -79,15 +79,13 @@ also note when adding Attachment, you need to provide a `referencekey` to identi
79
79
80
80
``` csharp
81
81
var webhook = new Webhook ()
82
- .SetAuthor (" My Webhook name " )
83
- .SetContent (" This webhook contains an image and a text file " )
84
- .AddAttachment (Application .dataPath + " /StreamingAssets/ExampleFiles/exampleTxtFile.txt " , " myExampleFile " , " File Attachment" )
82
+ .SetAuthor (" Bug Report Bot " )
83
+ .SetContent (" USER INPUT " )
84
+ .AddAttachment (Application .persistentDataPath + " /player.log " , " playerLogFile " , " File Attachment" )
85
85
.AddImgAttachmentRes (" Files/ExampleJpegResourceFile" , " myExampleImage" , " Image Attachment" );
86
-
87
86
webhook .SendWebhook (myWebhookURl );
88
87
```
89
-
90
-
88
+ ![ Imgur] ( https://i.imgur.com/ajMJlRM.png )
91
89
92
90
### Adding Embeds
93
91
@@ -96,18 +94,20 @@ To include embeds in your webhook messages:
96
94
``` csharp
97
95
var webhook = new Webhook ()
98
96
.SetAuthor (" My Webhook name" )
99
- .SetContent (" This webhook contains an embed" )
97
+ .SetContent (" This webhook contains an embed with img attachment " )
100
98
.AddImgAttachmentRes (" Files/ExampleJpegResourceFile" , " myExampleImage" , " Image Attachment" )
101
99
.AddEmbed (Embed .CreateEmbed (" Embed Title" , " Embed Description" , Color .red )
102
100
.CreateNewField (" Field Name" , " Field Value" , true )
101
+ .CreateNewField (" Another Field Name" , " Another Field Value" , true )
103
102
.SetImage (" myExampleImage" )
104
- .SetFooter (" Footer Text" , " https://avatars.githubusercontent.com/u/34078403?v=4" ));
103
+ .SetFooter (" Footer Text" , " https://avatars.githubusercontent.com/u/34078403?v=4" )
104
+ .SetAuthor (" This is the author" ," https://github.com/Huntrox" ," myExampleImage" ));
105
105
webhook .SendWebhook (myWebhookURl );
106
106
```
107
107
as you can see in ` SetImage ` we used the ` referencekey: "myExampleImage" ` to reference the attachment previously added with the same reference key.
108
108
this makes it possible to use the same attachment in multiple embeds. also
109
109
providing an external URL to the image will work as well.
110
-
110
+ ![ Imgur ] ( https://i.imgur.com/sXOPZcZ.png )
111
111
### Discord Timestamp Utility
112
112
113
113
this tool provides a utility function to convert a ` DateTime ` object to a Discord adding more to your webhook message.
@@ -119,7 +119,7 @@ this tool provides a utility function to convert a `DateTime` object to a Discor
119
119
```
120
120
![ img] ( https://i.imgur.com/SqxmKRW.png )
121
121
122
- ## API Reference
122
+ # API Reference
123
123
124
124
### Webhook Class
125
125
0 commit comments