mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-20 11:39:43 +00:00
Fix lag while sending a message to discord
This commit is contained in:
parent
7b4d69d550
commit
42e5e09ae4
1 changed files with 8 additions and 10 deletions
|
|
@ -716,16 +716,14 @@ class PocketMinecraftServer{
|
|||
if($this->extraprops->get("discord-msg") == true and $this->extraprops->get("discord-webhook-url") !== "none"){
|
||||
$url = $this->extraprops->get("discord-webhook-url");
|
||||
$name = $this->extraprops->get("discord-bot-name");
|
||||
$headers = [ 'Content-Type: application/json; charset=utf-8' ];
|
||||
$POST = [ 'username' => $name, 'content' => str_replace("@", "", $msg)];
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, $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($POST));
|
||||
$response = curl_exec($ch);
|
||||
$this->asyncOperation(ASYNC_CURL_POST, array(
|
||||
"url" => $url,
|
||||
"data" => array(
|
||||
"username" => $name,
|
||||
"content" => str_replace("@", "", $msg)
|
||||
),
|
||||
), NULL);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue