MCPcopy Create free account
hub / github.com/chrxh/alien / sendDiscordMessage

Function sendDiscordMessage

scripts/Server/hooks.php:2–15  ·  view source on GitHub ↗
($payload)

Source from the content-addressed store, hash-verified

1<?php
2 function sendDiscordMessage($payload) {
3 if (strlen($payload) >= 0) {
4 $ch = curl_init("[webhook URL]");
5 curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-type: application/json'));
6 curl_setopt($ch, CURLOPT_POST, 1);
7 curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
8 curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
9 curl_setopt($ch, CURLOPT_HEADER, 0);
10 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
11 $response = curl_exec($ch);
12 curl_close($ch);
13 return $response;
14 }
15 }
16
17 // functions for Discord messages
18 function createAddResourceMessage($type, $simName, $userName, $simDesc, $width, $height, $particles) {

Callers 4

activateuser.phpFile · 0.85
movesimulation.phpFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected