-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathembed-message.php
More file actions
72 lines (63 loc) · 1.85 KB
/
embed-message.php
File metadata and controls
72 lines (63 loc) · 1.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<?php
// ? Your Discord Webhook URL (by default try to take from .env file if exists)
$webhook_url = getenv('DISCORD_WEBHOOK_URL') ?: 'YOUR_DISCORD_WEBHOOK_URL_HERE';
$msg = [
"avatar_url" => "", // avatar url
"username" => "", // username required
"content" => "", // default message content
"embeds" => [
[
"color" => 0xb7996d, // embed color
"author" => [
"name" => "",
"url" => "", // name url
"icon_url" => ""
],
"title" => "",
"url" => "", // url for the title
"description" => "",
"timestamp" => "",
"fields" => [
[
"name" => "",
"value" => "",
"inline" => true
],
[
"name" => "",
"value" => "",
"inline" => true
],
[
"name" => "",
"value" => "",
],
[
"name" => "",
"value" => "",
]
],
"footer" => [
"text" => "",
"icon_url" => "",
],
"image" => [
"url" => ""
],
"thumbnail" =>[
"url" => ""
],
]
],
];
$headers = array('Content-Type: application/json');
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $webhook_url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($msg));
$response = curl_exec($ch);
curl_close($ch);
echo $response;