Add RobloxCurlOnline.sh
This commit is contained in:
parent
64ada439b1
commit
2b074df3bf
|
|
@ -0,0 +1,35 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Script that will curl the Roblox API to get all online and in game friends
|
||||
|
||||
TARGETUSERID="???" # Me
|
||||
|
||||
CHECKONLINEFRIENDS="??? ??? ???" # The friends to check if online
|
||||
|
||||
ROBLOSECURITYCOOKIE="" # Roblox Security Cookie
|
||||
|
||||
notify-send -t 3000 -a "Roblox Curl" "Checking..." "Now checking online users!"
|
||||
|
||||
APIREQUEST=$(curl -X 'GET' \
|
||||
"https://friends.roblox.com/v1/users/$TARGETUSERID/friends/online" \
|
||||
-H 'accept: application/json' \
|
||||
-H "Cookie: .ROBLOSECURITY=$ROBLOSECURITYCOOKIE")
|
||||
|
||||
if [[ $APIREQUEST == *"Unauthorized"* ]]; then
|
||||
notify-send -u critical -a "Roblox Curl" "Failure!" "Request Unauthorized! Please check if security cookie is still valid!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ $APIREQUEST == *"Too many requests"* ]]; then
|
||||
notify-send -u critical -a "Roblox Curl" "Failure!" "Too many requests! Please check if security cookie is still valid!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
APICOUNT=$(($(echo $APIREQUEST | jq -r '.data | length') - 1))
|
||||
for friend in $CHECKONLINEFRIENDS; do
|
||||
for i in $(seq 0 $APICOUNT); do
|
||||
if [[ $(echo $APIREQUEST | jq -r .data[$i].name) == $friend ]] && [[ $(echo $APIREQUEST | jq -r .data[$i].userPresence.UserPresenceType) == "InGame" ]]; then
|
||||
notify-send -t 0 -a "Roblox Curl" "$(echo $APIREQUEST | jq -r .data[$i].displayName) ($friend)" "User is playing $(echo $APIREQUEST | jq -r .data[$i].userPresence.lastLocation)!"
|
||||
fi
|
||||
done
|
||||
done
|
||||
Loading…
Reference in New Issue