initial commit
This commit is contained in:
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
.env
|
||||
9
README.md
Normal file
9
README.md
Normal file
@@ -0,0 +1,9 @@
|
||||
Steam game automation, by detecting and running specific Steam games, allows you to appear as if you are unemployed, rarely touching the grass, or perhaps looking busy. Without having to worry about automatically logging out on your current device.
|
||||
|
||||
Required env variables:
|
||||
|
||||
```
|
||||
STEAM_RUNGAMEID=<game-u-wanna-run>
|
||||
STEAM_KEY=<ur-steam-key-api>
|
||||
STEAM_USERID64=<<ur-userid>>
|
||||
```
|
||||
31
run.sh
Normal file
31
run.sh
Normal file
@@ -0,0 +1,31 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ -f .env ]; then
|
||||
set -a
|
||||
source .env
|
||||
set +a
|
||||
fi
|
||||
|
||||
FULL_URL=https://api.steampowered.com/ISteamUser/GetPlayerSummaries/v2
|
||||
|
||||
RESPONSE=$(curl -s "$FULL_URL/?key=$STEAM_KEY&steamids=$STEAM_USERID64")
|
||||
|
||||
if ! echo "$RESPONSE" | jq empty 2>/dev/null; then
|
||||
echo "Error response from API: $RESPONSE"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
APPID=$(echo $RESPONSE | jq -r '.response.players[0].gameid')
|
||||
|
||||
if [ "$APPID" != "null" ] && [ -n "$APPID" ]; then
|
||||
if pgrep -fa "AppId=$STEAM_RUNGAMEID" > /dev/null && [ "$APPID" = "$STEAM_RUNGAMEID" ]; then
|
||||
echo "[automate steam] detected playing: $APPID on this device. skipping"
|
||||
elif pgrep -f steam > /dev/null; then
|
||||
# If not playing on CURRENT DEVICE but DETECTED PLAYING ON ACCOUNT
|
||||
echo "[automate steam] detected playing: $APPID ON OTHER DEVICE. quitting"
|
||||
steam steam://exit
|
||||
fi
|
||||
else
|
||||
echo "[automate steam] not playing anything on any device, running game..."
|
||||
steam -cef-disable-gpu steam://rungamid/$STEAM_RUNGAMEID
|
||||
fi
|
||||
Reference in New Issue
Block a user