Skip to content

Commit 1710309

Browse files
author
code-raisan
committed
first
1 parent 9e8a853 commit 1710309

File tree

6 files changed

+68
-7
lines changed

6 files changed

+68
-7
lines changed

README.en.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# php-discord-webhook
2+
3+
<table>
4+
<thead>
5+
<tr>
6+
<th style="text-align:center">
7+
<a href="README.md">日本語</a>
8+
</th>
9+
<th style="text-align:center">
10+
<a>English</a>
11+
</th>
12+
</tr>
13+
</thead>
14+
</table>
15+
16+
Easily send Discord Webhooks.
17+
18+
![sample](./docs/result.png)
19+
20+
## Install
21+
22+
```bash
23+
composer require ablaze/php-discord-webhook
24+
```
25+
26+
## Use
27+
28+
Use the sample code as a reference.
29+
30+
[sample/README.md](./sample/)

README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# php-discord-webhook
2+
3+
<table>
4+
<thead>
5+
<tr>
6+
<th style="text-align:center">
7+
<a>日本語</a>
8+
</th>
9+
<th style="text-align:center">
10+
<a href="README.en.md">English</a>
11+
</th>
12+
</tr>
13+
</thead>
14+
</table>
15+
16+
Discord Webhookを簡単に送信することができます。
17+
18+
![sample](./docs/result.png)
19+
20+
## Install
21+
22+
```bash
23+
composer require ablaze/php-discord-webhook
24+
```
25+
26+
## Use
27+
28+
サンプルコードを参考に使用してください。
29+
30+
[sample/README.md](./sample/)

docs/result.png

29.4 KB
Loading

sample/embed_send_sample.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,16 @@
77

88
$embed = new Embed("Title", "Description");
99
$embed->setColor("#FFFFFF");
10-
$embed->setAuthor("Author Name", "https://example.com", "https://example.img");
11-
$embed->setFooter("Footer", "https://example.img");
12-
$embed->setImage("https://example.img");
13-
$embed->setThumbnail("https://example.img");
10+
$embed->setAuthor("Author Name", "https://example.com", "https://raw.githubusercontent.com/Ablaze-MIRAI/php-discord-webhook/main/sample/image/icon.png");
11+
$embed->setFooter("Footer", "https://raw.githubusercontent.com/Ablaze-MIRAI/php-discord-webhook/main/sample/image/icon.png");
12+
$embed->setTimestamp(new DateTime("0:00"));
13+
$embed->setImage("https://raw.githubusercontent.com/Ablaze-MIRAI/php-discord-webhook/main/sample/image/image.png");
14+
$embed->setThumbnail("https://raw.githubusercontent.com/Ablaze-MIRAI/php-discord-webhook/main/sample/image/thumbnail.png");
1415
$embed->addField("Field 1", "value");
1516
$embed->addField("Field 2", "value(inline)", true);
1617
$embed->addField("Field 3", "value(inline)", true);
1718

18-
$message = new Webhook("User Name", "https://github.com/qiita.png", "Message Content");
19+
$message = new Webhook("User Name", "https://raw.githubusercontent.com/Ablaze-MIRAI/php-discord-webhook/main/sample/image/icon.png", "Message Content");
1920
$message->addEmbed($embed);
2021
$response = $message->send("https://discord.com/api/webhooks/****/****");
2122

sample/message_send_sample.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
use Ablaze\PhpDiscordWebhook\Webhook;
66

7-
$message = new Webhook("User Name", "https://github.com/qiita.png", "Message Content");
7+
$message = new Webhook("User Name", "https://raw.githubusercontent.com/Ablaze-MIRAI/php-discord-webhook/main/sample/image/icon.png", "Message Content");
88
$response = $message->send("https://discord.com/api/webhooks/****/****");
99

1010
if($message->ok()){

src/Webhook.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public function __construct(string $name=null, string $avater_url=null, string $
2222
$this->webhook_body = [];
2323
$this->webhook_body["embeds"] = [];
2424
if($name) $this->webhook_body["username"] = $name;
25-
if($avater_url) $this->webhook_body["avater_url"] = $avater_url;
25+
if($avater_url) $this->webhook_body["avatar_url"] = $avater_url;
2626
if($content) $this->webhook_body["content"] = $content;
2727
}
2828

0 commit comments

Comments
 (0)