Skip to content

Instantly share code, notes, and snippets.

@shaunidiot
Created October 1, 2017 03:33
Show Gist options
  • Save shaunidiot/2b1023ef39990ecd982e5d20dad3e9fd to your computer and use it in GitHub Desktop.
Save shaunidiot/2b1023ef39990ecd982e5d20dad3e9fd to your computer and use it in GitHub Desktop.

Steam Bot Swarm

Application for managing many steam bots networked across multiple servers with an express api. Uses redis for all IPC/RPC. Each server must start a "cluster" which can start/stop any number of bots. A central main server running the "swarm" discovers/communicates with all clusters and bots through RPC. You can have any number of clusters and bots but only 1 swarm.

Controlling Bots

Once the swarm starts and cluster is up, you must first create the bot, then start it.

/createBot

Create bot with login credentials and set steam profile.

params

  {
    botid,              //required unique bot id
    username,           //steam username of bot
    password,           //password to steam account
    identity_secret,    //mobile auth identity secret
    shared_secret,      //mobile auth shared secret
    appid,              //default appid, defaults to csgo if not specified
    profile:{
     name - Your new profile name
     realName - Your new profile "real name", or empty string to remove it
     summary - Your new profile summary
     country - A country code, like US, or empty string to remove it
     state - A state code, like FL, or empty string to remove it
     city - A numeric city code, or empty string to remove it
     customURL - Your new profile custom URL
     background - The assetid of an owned profile background which you want to equip, or empty string to remove it
     featuredBadge - The ID of your new featured badge, or empty string to remove it. Currently game badges aren't supported, only badges whose pages end in /badge/<id>
     primaryGroup - A SteamID object for your new primary Steam group, or a string which can parse into a SteamID
    }
  }

returns

See Bot Model

/startBot

start bot on cluster, takes a minute for bot to log in.

params

{
  botid,              //required unique bot id
  clusterid,          //id of cluster you want bot to start on
}

returns

See Bot Model

/stopBot

stop bot on cluster. will immediately kill its process.

params

{
  botid,              //required unique bot id
  clusterid,          //id of cluster you want bot to start on
}

/updateBot

update any of the bot information

params

{
  botid:string              //required unique bot id
  username?:string
  password?:string
  identity_secret?:string
  shared_secret?:string
  appid?:string
  clusterid?:string
  profile?:SteamProfile
}

returns

See Bot Model

/updateBotProfile

Set bots steam profile. Will take affect after logging out/in again.

params

{
  botid,              //required unique bot id
  profile:{
   name - Your new profile name
   realName - Your new profile "real name", or empty string to remove it
   summary - Your new profile summary
   country - A country code, like US, or empty string to remove it
   state - A state code, like FL, or empty string to remove it
   city - A numeric city code, or empty string to remove it
   customURL - Your new profile custom URL
   background - The assetid of an owned profile background which you want to equip, or empty string to remove it
   featuredBadge - The ID of your new featured badge, or empty string to remove it. Currently game badges aren't supported, only badges whose pages end in /badge/<id>
   primaryGroup - A SteamID object for your new primary Steam group, or a string which can parse into a SteamID
  }
}

returns

See Bot Model

/listBots

params None

returns

Array of Bot Model

/getAllBots

get specific bots and their state

params

{
  botids //array of botids
}

returns

Array of Bot Model

Send Trade Offers

Bots can send users trade offers. This describes the API for that behavior. All offers have a unique message id appended to the end of the message by the bot. This is required for this system to track offers. Trying to trade an item currently in a trade will error out.

/sendDeposit

send a user a deposit request. User sends items to bot. Steam offer originates from bot

params

{
  botid,
  tradeurl,
  itemids,
  message,
}

returns

See Trade model

/sendWithdraw

send a user a withdraw request. Bot sends items to user. Steam offer originates from bot.

params

{
  botid,
  tradeurl,
  itemids,
  message,
}

returns

See Trade model

/sendTrade

send a user a trade request. Bot and user exchange items in a single trade offer. Steam offer originates from bot.

params

{
  botid,
  tradeurl,
  towithdraw,  //array of itemids to withdraw to user
  todeposit,   //array of itemids to deposit from user
  message,
}

returns

See Trade model

/sweepBot

withdraw all items from a bot

params

{
  botid,
  tradeurl,
  message, [optional]
}

returns

See Trade model

Inventory Scanning

Each bot can scan external or internal inventory. The calls are rate limited to steam at a rate of 1 call every 30 seconds.

/scanTradeURL

scan external trade url

params

{
  botid,
  tradeurl,
  appid, //optional, defaults to bot appid or csgo
}

returns

Array of Item models

/scanBotAssets

scan bots assets

{
  botid,
  appid, //optional, defaults to bot appid or csgo
}

returns

Array of Item models

Querying Trades, Items,

/getTrade

get Trade

params

{
  tradeid,
}

returns

See Trade model

/getAllTrades

get list of Trades

params

{
  tradeids,
}

returns

Array of Trade models

/getItem

get an item, errors if item does not exist

params

{
  itemid,
}

returns

See Item model

/getAllItems

get list of items, errors if any item does not exist

post

{
  itemids,
}

returns

Array of Item models

/mapAllItems

returns

items in a key,value map. if item doesnt exist, puts null in value.

post

{
  itemids,
}

returns

Object keyed by item ids, with values as Item model

/listWithdrawableItems

list all items globally which are on bots all bots and available for withdraw

params none

returns

Array of Item models

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment