This repository has been archived by the owner on Mar 24, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
218 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# Message Builder with Embed Example | ||
|
||
```php | ||
<?php | ||
use EnterV\DiscordWebhooks\Builder\TextFormattingCombine; | ||
use EnterV\DiscordWebhooks\Builder\TextMessageBuilder; | ||
use EnterV\DiscordWebhooks\Payload; | ||
use EnterV\DiscordWebhooks\WebhookClient; | ||
|
||
$url = 'DISCORD_WEBHOOK_URL'; // Put your discord webhook url | ||
|
||
// Builder with on auto-newline mode (to disable auto-newline use new TextMessageBuilder(false)) | ||
$messageBuilder = new TextMessageBuilder(); | ||
$text = $messageBuilder->addText('How are you?') // some text without format | ||
->addBold("It's time for new webhook tool!") // **Text with bold** | ||
/** | ||
* Text with multiline codeblock: | ||
* ```php | ||
* // It's can using codeblock | ||
* ``` | ||
*/ | ||
->addMultilineCodeBlock("// It's can using codeblock", 'php') | ||
->addQuoteBlock('And some quote!') // > Text with quote block | ||
->addCombineTextFormatting( | ||
"It's awesome!!!111oneone", | ||
(new TextFormattingCombine()) | ||
->withBold() | ||
->withItalic() | ||
->withUnderline() | ||
) // ***__Text with: Bold, Italic and Underline__*** | ||
->addText('Are you reade for this??') | ||
->build() // build message (it was returned string) | ||
; | ||
|
||
// Create embed | ||
$embed = new Embed(); | ||
$embed->addField('Field title', $text); // add field | ||
|
||
// Create Payload | ||
$payload = new Payload(); | ||
$payload->addEmbed($embed) // Add embed | ||
|
||
// Send message | ||
$webhook = new WebhookClient(); | ||
$webhook->send($url, $payload); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Simple example | ||
|
||
```php | ||
<?php | ||
use EnterV\DiscordWebhooks\Payload; | ||
use EnterV\DiscordWebhooks\WebhookClient; | ||
|
||
$url = 'DISCORD_WEBHOOK_URL'; // Put your discord webhook url | ||
|
||
// Create Payload | ||
$payload = new Payload(); | ||
$payload->setMessage('This is a message'); // Some text. If You need use the Message Builder | ||
|
||
// New discord webhook client | ||
$webhook = new WebhookClient(); | ||
// Send message | ||
$webhook->send($url, $payload); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters