($payload)
| 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) { |
no outgoing calls
no test coverage detected