From 30303a3ad0d0f31d93c25f42bfd10d70e8277b72 Mon Sep 17 00:00:00 2001 From: Minteck Date: Sat, 10 Dec 2022 22:27:08 +0100 Subject: Update --- pages/travelling.inc | 112 +++++++++++++++++++++++++++++++-------------------- 1 file changed, 68 insertions(+), 44 deletions(-) (limited to 'pages/travelling.inc') diff --git a/pages/travelling.inc b/pages/travelling.inc index b7b772b..a38ea87 100644 --- a/pages/travelling.inc +++ b/pages/travelling.inc @@ -1,6 +1,6 @@ date("c"), - "end" => null + "end" => null, + "equestria" => $equestria ]; - // Insert code here to run after a travelling member is ADDED. - // $id is the member ID (e.g. rirgf) - // $member is the member - // $system is the system the member comes from - // $metadata is the ponies.equestria.horse metadata - // $travellingMember is unset here - // Store the travelling member ID in $travelling[$id]['pluralkit'] - $reqOptions = [ - 'http' => [ - 'method' => "POST", - 'header' => "Authorization: " . $app["pluralkit"][$travellingSystem === "gdapd" ? "raindrops" : "cloudburst"] . "\r\n" . - "Content-Type: application/json", - 'content' => json_encode([ - 'name' => "$member[name]-travelling", - 'display_name' => $member["display_name"], - 'color' => $member["color"], - 'birthday' => $member["birthday"], - 'created' => $member["created"], - 'pronouns' => $member["pronouns"], - 'avatar_url' => $member["avatar_url"], - 'banner' => $member["banner"], - 'description' => "**This pony is visiting this system from the " . ($system === "gdapd" ? "Raindrops System" : "Cloudburst System") . ". They are not a permanent member of this system**\n\n$member[description]", - 'proxy_tags' => array_map(function ($i) { - $i["prefix"] = "+" . $i['prefix']; - return $i; - }, $member["proxy_tags"]), - 'privacy' => $member["privacy"] - ]) - ] - ]; + if (!$equestria) { + // Insert code here to run after a travelling member is ADDED. + // $id is the member ID (e.g. rirgf) + // $member is the member + // $system is the system the member comes from + // $metadata is the ponies.equestria.horse metadata + // $travellingMember is unset here + // Store the travelling member ID in $travelling[$id]['pluralkit'] + $reqOptions = [ + 'http' => [ + 'method' => "POST", + 'header' => "Authorization: " . $app["pluralkit"][$travellingSystem === "gdapd" ? "raindrops" : "cloudburst"] . "\r\n" . + "Content-Type: application/json", + 'content' => json_encode([ + 'name' => "$member[name]-travelling", + 'display_name' => $member["display_name"], + 'color' => $member["color"], + 'birthday' => $member["birthday"], + 'created' => $member["created"], + 'pronouns' => $member["pronouns"], + 'avatar_url' => $member["avatar_url"], + 'banner' => $member["banner"], + 'description' => "**This pony is visiting this system from the " . ($system === "gdapd" ? "Raindrops System" : "Cloudburst System") . ". They are not a permanent member of this system**\n\n$member[description]", + 'proxy_tags' => array_map(function ($i) { + $i["prefix"] = "+" . $i['prefix']; + return $i; + }, $member["proxy_tags"]), + 'privacy' => $member["privacy"] + ]) + ] + ]; - $reqContext = stream_context_create($reqOptions); + $reqContext = stream_context_create($reqOptions); - sleep(1); - $member = json_decode(file_get_contents("https://api.pluralkit.me/v2/members", false, $reqContext), true); + sleep(1); + $member = json_decode(file_get_contents("https://api.pluralkit.me/v2/members", false, $reqContext), true); - // Member exists? - if (isset($member)) { - $travelling[$id]['pluralkit'] = $member["id"]; + // Member exists? + if (isset($member)) { + $travelling[$id]['pluralkit'] = $member["id"]; + } } } } @@ -120,9 +125,9 @@ global $travelling; ...array_values(array_filter(scoreOrderGlobal(), function ($i) use ($travelling) { return $travelling[$i['id']]["travelling"]; })), - ...array_values(array_filter(scoreOrderGlobal(), function ($i) use ($travelling) { - return !$travelling[$i['id']]["travelling"]; - })) + ...array_values(array_filter(scoreOrderGlobal(), function ($i) use ($travelling) { + return !$travelling[$i['id']]["travelling"]; + })) ] as $member): ?>
"> @@ -131,9 +136,13 @@ global $travelling;
- Current system:
+ Current location:
+ + Equestria +
">.png"> System + () @@ -142,9 +151,24 @@ global $travelling;
- Stop travelling + - Start travelling +
-- cgit