Skip to content

Commit 2393171

Browse files
committed
Updated documentation
1 parent dd13ee5 commit 2393171

File tree

3 files changed

+63
-4
lines changed

3 files changed

+63
-4
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Changelog
22

3+
### 1.0.0
4+
* FEATURE: Final embed support
5+
* HTTP client implementation
6+
* Production-ready
7+
38
### 0.2.0
49
* FEATURE: Embed support
510
* `DiscordWebhook\Webhook::addEmbed(Embed $embed)`

docs/01_Basics.md

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ After creating an instance of the webhook you're able to configure the following
1313
```php
1414
use DiscordWebhook\Webhook;
1515

16-
$wh = new Webhook('https://my.webhook/url');
16+
$wh = new Webhook(['https://my.webhook/url']);
1717
$wh
1818
->setUsername('My awesome BOT 💥')
1919
->setAvatar('https://url.to/the_avatar.jpg');
@@ -24,7 +24,7 @@ It's no rocket sience, just that simple:
2424
```php
2525
use DiscordWebhook\Webhook;
2626

27-
$wh = new Webhook('https://my.webhook/url');
27+
$wh = new Webhook(['https://my.webhook/url']);
2828
$wh
2929
->setMessage('Test-message')
3030
->send();
@@ -35,6 +35,23 @@ If you want to send Text-To-Speech (TTS) messages just set the TTS to `true`
3535
```php
3636
use DiscordWebhook\Webhook;
3737

38-
$wh = new Webhook('https://my.webhook/url');
38+
$wh = new Webhook(['https://my.webhook/url']);
3939
$wh->setTts(true);
4040
```
41+
42+
### Multiple destinations
43+
The constructor accepts an array. There you can pass multiple webhooks which are all executed.
44+
This is useful when you want to send the same information to multiple Discord servers.
45+
```php
46+
use DiscordWebhook\Webhook;
47+
48+
$wh = new Webhook([
49+
'https://my.webhook/url',
50+
'https://another.webhook/url/v2',
51+
'...'
52+
]);
53+
54+
$wh
55+
->setMessage('Test-message')
56+
->send();
57+
```

docs/03_Embeds.md

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,40 @@
11
# Embeds
22

3-
coming soon...
3+
`DiscordWebhook\Embed::class` is the base class for creating an embed.
4+
A message can contain [up to 10 embeds](https://discordapp.com/developers/docs/resources/webhook#execute-webhook).
5+
6+
Every embed can contain different components.
7+
For every component there is a class which can be used to construct the embed according to your thoughts.
8+
9+
## Elements
10+
All properties are `private`. Use their getters and setters to access them.
11+
12+
* `DiscordWebhook\Embed::class` (base class)
13+
* `DiscordWebhook\Embed\Author::class`
14+
* `DiscordWebhook\Embed\Field::class`
15+
* `DiscordWebhook\Embed\Footer::class`
16+
* `DiscordWebhook\Embed\Image::class`
17+
* `DiscordWebhook\Embed\Provider::class`
18+
* `DiscordWebhook\Embed\Thumbnail::class`
19+
* `DiscordWebhook\Embed\Video::class`
20+
21+
## Simple example
22+
```php
23+
<?php
24+
declare(strict_types=1);
25+
26+
$wh = new \DiscordWebhook\Webhook(['https://webhook.url']);
27+
$embed = new \DiscordWebhook\Embed();
28+
29+
$embed
30+
->setTitle('My embed')
31+
->setTimestamp(new DateTime('now'));
32+
33+
$wh
34+
->setUsername('My bot')
35+
->addEmbed($embed)
36+
->send();
37+
```
38+
39+
Result:<br>
40+
![Webhook image](http://img.scrummer.de/210801050120-43792.png)

0 commit comments

Comments
 (0)