mirror of
https://github.com/Mestima/GM-Discord.git
synced 2025-05-06 06:10:13 +00:00
Web part upload
There are redirection PHP scripts to redirect Garry's Mod GET and POST requests to the Discord API. CloudFlare that uses Discord do not allows GMod browser to send GET and POST requests that is the reason you must use redirection. Just upload this files to your web-server and configure api links at /lua/autorun/server/discord.lua
This commit is contained in:
parent
5d03d97b72
commit
c25c198dc4
25
web/request.php
Normal file
25
web/request.php
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
COPYRIGHT:
|
||||||
|
Made by Mestima © 2019
|
||||||
|
|
||||||
|
If you're reading this at the GitHub, you need to know
|
||||||
|
that this script is licensed under the GPLv3 License (https://www.gnu.org/licenses/gpl-3.0.html)
|
||||||
|
Copyright removing is NOT allowed!
|
||||||
|
|
||||||
|
http://steamcommunity.com/id/mestima
|
||||||
|
http://github.com/Mestima
|
||||||
|
*/
|
||||||
|
|
||||||
|
function file_get_contents_utf8($fn) {
|
||||||
|
$content = file_get_contents($fn);
|
||||||
|
$content = iconv('windows-1251', 'utf-8', $content);
|
||||||
|
return $content;
|
||||||
|
}
|
||||||
|
|
||||||
|
$channel = $_GET['channel'];
|
||||||
|
$token = $_GET['token'];
|
||||||
|
|
||||||
|
$result = file_get_contents_utf8("https://discordapp.com/api/channels/" . $channel . "/messages?token=" . $token);
|
||||||
|
echo $result;
|
||||||
|
?>
|
29
web/send.php
Normal file
29
web/send.php
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
COPYRIGHT:
|
||||||
|
Made by Mestima © 2019
|
||||||
|
|
||||||
|
If you're reading this at the GitHub, you need to know
|
||||||
|
that this script is licensed under the GPLv3 License (https://www.gnu.org/licenses/gpl-3.0.html)
|
||||||
|
Copyright removing is NOT allowed!
|
||||||
|
|
||||||
|
http://steamcommunity.com/id/mestima
|
||||||
|
http://github.com/Mestima
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (isset($_POST["content"]) != true || isset($_POST["webhook"]) != true ||
|
||||||
|
$_POST["content"] == "" || $_POST["webhook"] == "") {
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
$options = array(
|
||||||
|
'http' => array(
|
||||||
|
'header' => "Content-type: application/json\r\n",
|
||||||
|
'method' => 'POST',
|
||||||
|
'content' => $_POST["content"]
|
||||||
|
)
|
||||||
|
);
|
||||||
|
$context = stream_context_create($options);
|
||||||
|
|
||||||
|
$result = file_get_contents($_POST["webhook"], false, $context);
|
||||||
|
?>
|
Loading…
x
Reference in New Issue
Block a user