Skip to content

Commit

Permalink
Updated documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
scrummer committed Jan 5, 2020
1 parent dd13ee5 commit 2393171
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 4 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

### 1.0.0
* FEATURE: Final embed support
* HTTP client implementation
* Production-ready

### 0.2.0
* FEATURE: Embed support
* `DiscordWebhook\Webhook::addEmbed(Embed $embed)`
Expand Down
23 changes: 20 additions & 3 deletions docs/01_Basics.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ After creating an instance of the webhook you're able to configure the following
```php
use DiscordWebhook\Webhook;

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

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

$wh = new Webhook('https://my.webhook/url');
$wh = new Webhook(['https://my.webhook/url']);
$wh->setTts(true);
```

### Multiple destinations
The constructor accepts an array. There you can pass multiple webhooks which are all executed.
This is useful when you want to send the same information to multiple Discord servers.
```php
use DiscordWebhook\Webhook;

$wh = new Webhook([
'https://my.webhook/url',
'https://another.webhook/url/v2',
'...'
]);

$wh
->setMessage('Test-message')
->send();
```
39 changes: 38 additions & 1 deletion docs/03_Embeds.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,40 @@
# Embeds

coming soon...
`DiscordWebhook\Embed::class` is the base class for creating an embed.
A message can contain [up to 10 embeds](https://discordapp.com/developers/docs/resources/webhook#execute-webhook).

Every embed can contain different components.
For every component there is a class which can be used to construct the embed according to your thoughts.

## Elements
All properties are `private`. Use their getters and setters to access them.

* `DiscordWebhook\Embed::class` (base class)
* `DiscordWebhook\Embed\Author::class`
* `DiscordWebhook\Embed\Field::class`
* `DiscordWebhook\Embed\Footer::class`
* `DiscordWebhook\Embed\Image::class`
* `DiscordWebhook\Embed\Provider::class`
* `DiscordWebhook\Embed\Thumbnail::class`
* `DiscordWebhook\Embed\Video::class`

## Simple example
```php
<?php
declare(strict_types=1);

$wh = new \DiscordWebhook\Webhook(['https://webhook.url']);
$embed = new \DiscordWebhook\Embed();

$embed
->setTitle('My embed')
->setTimestamp(new DateTime('now'));

$wh
->setUsername('My bot')
->addEmbed($embed)
->send();
```

Result:<br>
![Webhook image](http://img.scrummer.de/210801050120-43792.png)

0 comments on commit 2393171

Please sign in to comment.