Discord Webhooks — не отвечает

Мне нужна помощь, мой Webhook не отвечает на Discord, чтобы опубликовать сообщение журнала. Вот код, я удалил его из соображений безопасности.

<?php
?>
<script type="text/javascript">
function sendLog(){
tosend = [
'**Server added;**',
'Game Name: <?php echo(json_encode($name)); ?>',
'Game ID: <?php echo(json_encode($gid)); ?>',
'Server ID: <?php echo(json_encode($sid)); ?>',
],
msgJson = {
"attachments": [
{
"color": "#CC09EF",
"text": tosend.join('\n'),
"footer": "Infius Game Logs",
"footer_icon": "http://deersystems.net/assets/images/nfius.png",
}
]
}
post(hookurl, msgJson);
}

function post(url, jsonmsg){
xhr = new XMLHttpRequest();
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-type", "application/json");
var data = JSON.stringify(jsonmsg);
xhr.send(data);
xhr.onreadystatechange = function() {
if(this.status != 200){
alert("ttt");
}
}
}
</script>

<?php
if($token == '*****'){
$con = mysqli_connect("localhost","8888888");

if(mysqli_connect_errno()){
echo(mysqli_connect_error());
}
} elseif($type == 'add' and $sid !=NULL and $gid !=NULL and $name!=NULL and $players !=NULL){
?>
<script type="text/javascript">
sendLog();
</script>
<?php

} else {

echo"<script type=\"text/javascript\">
sendLog();
</script>";
}
?>

Я не думаю, что функция вызывается с HTTP Post Async, или Js не загружается.

0

Решение

Задача ещё не решена.

Другие решения

Других решений пока нет …

По вопросам рекламы ammmcru@yandex.ru
Adblock
detector