GithubHelp home page GithubHelp logo

fregate / sgbot Goto Github PK

View Code? Open in Web Editor NEW
1.0 0.0 0.0 160 KB

SteamGifts bot to enter for whitelisted games

Go 63.58% Python 9.34% HTML 26.32% Shell 0.49% Dockerfile 0.27%
steam steamgifts golang

sgbot's Introduction

sgbot

SteamGifts bot to enter only for whitelisted games

I wish I would win all my followed and wishlisted games ;) I don't want win all the games in SG and this bot will apply only for whilelisted games.

This is my first project in GO (and there no some goish features like channels and coroutines - just syntax)

This is python implementation which inspired me to do this https://github.com/theWaR13/SteamGiveawayManager

Preparations for 'onpremise' installation

  1. config.json - bot config. Optional
  • profile - If you want to parse your steam profile. You need only name, not whole URL. Optional.
  • mail - set smtp settings for sends some notifications (optional)
    • smtp - smtp server
    • port-num - smtp server port
    • username - smtp authorization username (mail will be sent from this email)
    • password - smtp auth password (not tested without auth)
    • subjecttag - tag in mail subject (i.e. [SG_BOT])
    • recipient - mail will be send to this email
  • digest - send daily digest for the previous day (or in panic message - current digest)
  • if there is no "recipient" or "mail" not filled properly - no mail at all simple server config (optional). these paramters can'be changed through web ui. to apply changes bot must be restarted
  • httpauth - http simple auth login
  • httppwd - http simple auth password
  • web-port-num - http server listening port (default 8080) (don't forget to open it in firewall!)
  1. gameslist.json - Optional. Fill it with games. "SteamID":"Name", Name - optional, all game titles takes from gifts page: you can leave it empty: "") If no games loaded (profile + list) - bot stops

  2. cookies.json Required. You need to autorize in SG through browser, go to the DevTools in it and copy all cookies (I think only session cookie works, but anyway). "Name":"Value:Domain:Path" (separated by colon) If you wish parse giveaways that points to /sub/ steam pages with age check, you have to set these cookies: "wants_mature_content": "1:store.steampowered.com:/", "birthtime": "60368401:store.steampowered.com:/", # about 1972/4/4 "lastagecheckage": "1-0-1972:store.steampowered.com:/"

  3. To run as daemon (tested only for linux)

  • sudo ./bot install
  • Set service working dir for ./bot path (/etc/systemd/system/sgbotservice.service -> [Service] -> WorkingDirectory=/path/to/executable
  • (sudo) systemctl daemon-reload
  • sudo service sgbotservice start
  • service sgbotservice status
  • profit!

SGBot as a cloud function

If you have some cloud functions service (AWS Lambda, Yandex.Cloud, etc) you could try to install this bot as cloud function. At this point you can install it on Yandex.Cloud (as I did). Frankly, there is 3 cloud functions: bot which checks, email sender and script with db seeding.

Create DB for games, cookies and digest

  1. Create YandexDB (YDB) serverless database
  2. Copy DB 'location'

Create bot init function

  1. Run yandex.botinit-func.deploy.sh - it prepares all mandatory files
  2. Create function from zip archive, choose Go/1.17, set 128M, 60sec timeout, set bot-init-func.RunInitBotDB as entry point
  3. Create service account with editor privelegies for YDB
  4. Set STEAM_PROFILE and YDB_DATABASE (this is location from YDB) environment variables
  5. Finish function creation
  6. Run function once (test). It has to create 3 tables into YDB: games (id:uint64, name:string), cookies (name:string, domain:string, path:string, value:string) and digest (message:UTF8)

Create bot function

  1. Run yandex.bot-func.deploy.sh - it prepares all mandatory files
  2. Create function from zip archive, choose Go/1.17, set 128M, 60sec timeout, set bot-func.RunSGBOTFunc as entry point
  3. Create service account with editor privelegies for YDB
  4. Set STEAM_PROFILE and YDB_DATABASE (this is location from YDB) environment variables
  5. Finish function creation
  6. Create trigger for schedule function invokation (hourly - but you can check as you wish)
  7. Create service account (or add to existing serverless.invoker role)
  8. It's has to work!

Create digest function

  1. Run yandex.digest-bot.deploy.sh - it prepares all mandatory files
  2. Create function from zip archive, choose Go/1.17, set 128M, 5sec timeout, set digest-func.SendDigest as entry point
  3. Create service account with editor privelegies for YDB (or use existing)
  4. Set MAILER_SMTP, MAILER_PORT, MAILER_AUTH_NAME, MAILER_AUTH_PWD, MAILER_SUBJECT, MAILER_RECIPIENT environment variables for mailer creation and YDB_DATABASE for DB connection
  5. Finish function creation
  6. Create trigger for schedule function invokation (daily - but you can send as you wish)
  7. Create (select) service account with serverless.invoker role
  8. It's has to work!

External imports

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.