dmcallejo / ASFBot

Control your ArchiSteamFarm with Telegram
GNU General Public License v3.0
46 stars 10 forks source link
archisteamfarm asf bot docker hacktoberfest linux python python3 telegram telegrambot

ASFbot

Telegram Bot coded in python to control your ASF instance.

Control your ASF instance anywhere.

Docker Build Action Docker Pulls

Usage:

You can also use environment variables to configure the bot. Environment variables would override any command argument set. The naming is pretty self-explanatory:

Once the bot has started and verified the connection to the ASF instance, you can send commands through your telegram bot using standard ASF notation (i.e.: !status asf) or Telegram notation (i.e.: /status asf). The bot also reads messages containing Steam cd-keys. It will automatically parse every key and activate them on your accounts with !redeem asf {{parsed_cdkey}} notifying you the process.

Quickstart (with docker)

  1. Create a bot via @botfather.
  2. Copy and fill the docker-compose.yml example below.
  3. Start it!

ASF Configuration

ASF must have a permissive IPC configuration in order to allow ASFBot to interact. A permissive IPC.json configuration looks like this:

{
  "Kestrel": {
    "Endpoints": {
      "IPv4-http": {
        "Url": "http://0.0.0.0:1242"
      }
    },
    "PathBase": "/"
  }
}

You may also need to add this properties to ASF.json file:

{
  "IPCPrefixes": [
    "http://*:1242/"
  ]
}

Notes

I recommend running ASFBot via its Docker image. Here it is an example docker-compose.yml to run bot ASF and the bot on Docker. Copy this to a file named docker-compose.yml, fill the appropriate missing data:

P.S.: ARMv7 and ARM64 docker builds are untested. Did you try them? Contact me!

docker-compose.yml template

version: '3.2'
services:
  asf:
    image: justarchi/archisteamfarm
    container_name: asf
    hostname: asf
    restart: unless-stopped
    environment:
      - ASF_ARGS=--server
    ports:
      - 1242:1242
    volumes:
      - <(1) paste here your old ASF/config directory>:/app/config
  asfbot:
    image: ghcr.io/dmcallejo/asfbot
    container_name: asfbot
    hostname: asfbot
    restart: unless-stopped
    depends_on: 
      - asf
    environment:
      - ASF_IPC_HOST=asf
      - TELEGRAM_BOT_TOKEN=<(2) paste here your API token given by @botfather>
      - TELEGRAM_USER_ALIAS=<(3) paste here your Telegram alias i.e.: @myalias>