VRChat-Curl-Online/VRChatCurlOnline.sh

25 lines
895 B
Bash

#!/bin/bash
# Script that will curl the VRChat API to get all online and in game friends
CHECKONLINEFRIENDS="??? ??? ???" # The friends to check if online
VRCSECURITYCOOKIE="auth=authcookie_???; twoFactorAuth=???"
notify-send -t 3000 -a "VRChat Curl" "Checking..." "Now checking online users!"
APIREQUEST=$(curl -X 'GET' \
"https://vrchat.com/api/1/auth/user/friends?offline=false&n=50&offset=0" \
-H 'accept: application/json' \
-H "Cookie: $VRCSECURITYCOOKIE" \
-H "User-Agent: ***")
APICOUNT=$(($(echo $APIREQUEST | jq -r '. | length') - 1))
for friend in $CHECKONLINEFRIENDS; do
for i in $(seq 0 $APICOUNT); do
if [[ $(echo $APIREQUEST | jq -r .[$i].displayName) == $friend ]]; then
notify-send -t 0 -a "VRChat Curl" "$(echo $APIREQUEST | jq -r .[$i].displayName)" "User is in $(echo $APIREQUEST | jq -r .[$i].location) world!"
fi
done
done