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

Function createMessageForSimulation

scripts/Server/hooks.php:36–70  ·  view source on GitHub ↗
($message, $simName, $userName, $simDesc, $width, $height, $particles)

Source from the content-addressed store, hash-verified

34 }
35
36 function createMessageForSimulation($message, $simName, $userName, $simDesc, $width, $height, $particles) {
37 $particlesString = $particles < 1000 ? "{$particles}" : strval((int)($particles/1000)) . " K";
38 return json_encode([
39 "username" => "alien-project",
40 "avatar_url" => "https://alien-project.org/alien-server/logo.png",
41 "content" => "",
42 "embeds" => [
43 [
44 "author" => [
45 "name" => $message,
46 "icon_url" => "https://alien-project.org/alien-server/galaxy.png"
47 ],
48 "title" => $simName,
49 "description" => $simDesc,
50 "fields" => [
51 [
52 "name" => "User",
53 "value" => $userName,
54 "inline" => true
55 ],
56 [
57 "name" => "Size",
58 "value" => "{$width} x {$height}",
59 "inline" => true
60 ],
61 [
62 "name" => "Objects",
63 "value" => $particlesString,
64 "inline" => true
65 ]
66 ]
67 ]
68 ]
69 ], JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
70 }
71
72 function createMessageForGenome($message, $simName, $userName, $simDesc, $width, $height, $particles) {
73 return json_encode([

Callers 2

createAddResourceMessageFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected