From f75701484724745c06f49b76a8eb67180b4bea09 Mon Sep 17 00:00:00 2001 From: nomi-nonsz Date: Tue, 10 Feb 2026 15:51:16 +0000 Subject: [PATCH] initial commit --- .gitignore | 1 + README.md | 9 +++++++++ run.sh | 31 +++++++++++++++++++++++++++++++ 3 files changed, 41 insertions(+) create mode 100644 .gitignore create mode 100644 README.md create mode 100644 run.sh diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2eea525 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.env \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..735004e --- /dev/null +++ b/README.md @@ -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= +STEAM_KEY= +STEAM_USERID64=<> +``` \ No newline at end of file diff --git a/run.sh b/run.sh new file mode 100644 index 0000000..57827be --- /dev/null +++ b/run.sh @@ -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 \ No newline at end of file