@@ -3,7 +3,7 @@ DiscordWebhookUnity is a Unity Tool that allows you to send Discord webhook mess
33
44![ img] ( https://i.imgur.com/SFLGpMf.png )
55
6- ## Features
6+ # Features
77
88- Send Discord webhook messages with content, embeds, and attachments.
99- Support for image and text file attachments.
@@ -15,12 +15,12 @@ DiscordWebhookUnity is a Unity Tool that allows you to send Discord webhook mess
1515- Example code and scenes.
1616
1717
18- ## Installation
18+ # Installation
1919
20201 . Clone or download the repository or download the latest [ release] ( https://github.com/HuntroxGames/DiscordWebhookUnity ) .
21212 . Copy the ` HuntroxGames ` folder into your Unity project's ` Assets ` directory.
2222
23- ## Usage
23+ # Usage
2424
2525### Simple Webhook
2626
@@ -79,15 +79,13 @@ also note when adding Attachment, you need to provide a `referencekey` to identi
7979
8080``` csharp
8181 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" )
8585 .AddImgAttachmentRes (" Files/ExampleJpegResourceFile" , " myExampleImage" , " Image Attachment" );
86-
8786 webhook .SendWebhook (myWebhookURl );
8887```
89-
90-
88+ ![ Imgur] ( https://i.imgur.com/ajMJlRM.png )
9189
9290### Adding Embeds
9391
@@ -96,18 +94,20 @@ To include embeds in your webhook messages:
9694``` csharp
9795 var webhook = new Webhook ()
9896 .SetAuthor (" My Webhook name" )
99- .SetContent (" This webhook contains an embed" )
97+ .SetContent (" This webhook contains an embed with img attachment " )
10098 .AddImgAttachmentRes (" Files/ExampleJpegResourceFile" , " myExampleImage" , " Image Attachment" )
10199 .AddEmbed (Embed .CreateEmbed (" Embed Title" , " Embed Description" , Color .red )
102100 .CreateNewField (" Field Name" , " Field Value" , true )
101+ .CreateNewField (" Another Field Name" , " Another Field Value" , true )
103102 .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" ));
105105 webhook .SendWebhook (myWebhookURl );
106106```
107107as you can see in ` SetImage ` we used the ` referencekey: "myExampleImage" ` to reference the attachment previously added with the same reference key.
108108this makes it possible to use the same attachment in multiple embeds. also
109109providing an external URL to the image will work as well.
110-
110+ ![ Imgur ] ( https://i.imgur.com/sXOPZcZ.png )
111111### Discord Timestamp Utility
112112
113113this 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
119119```
120120![ img] ( https://i.imgur.com/SqxmKRW.png )
121121
122- ## API Reference
122+ # API Reference
123123
124124### Webhook Class
125125
0 commit comments