def Start(): url = input("Market url: ") count = int(input("Number of items to load: ")) wanted = float(input("Which float are you aiming for? ")) specificity = float( input("How much above float are you willing to show? ")) inspect_price_list = getMarketItems(url, count) inspect_list = inspect_price_list[0] price_list = inspect_price_list[1] print("") ready = False while (ready == False): try: print("Try to log in") client = SteamClient() cs = CSGOClient(client) @client.on('logged_on') def start_csgo(): cs.launch() @cs.on('ready') def gc_ready(): pass client.cli_login() ready = True except: print("There was an error, try again") print("Waiting 10 seconds for CSGO to start") print("") gevent.sleep(10) Get_Item_Data(inspect_list, price_list, cs, wanted, specificity)
def Start(): once = 0 while True: if (once == 0): client = SteamClient() cs = CSGOClient(client) @client.on('logged_on') def start_csgo(): cs.launch() @cs.on('ready') def gc_ready(): pass client.cli_login() print("Waiting 10 seconds for CSGO to start") print("") gevent.sleep(10) once += 1 db = sqlite3.connect('database.db') c = db.cursor() c.execute('CREATE TABLE IF NOT EXISTS inspectsTable(inspects TEXT)') c.execute('SELECT * FROM inspectsTable') alreadyHave = [] for row in c.fetchall(): inspectlink = row[0] alreadyHave.append(inspectlink) inspect_list = [] price_list = [] n = 0 fail = 0 while(n < len(externalLists.marketIndex)): cs.launch() current_market_link = externalLists.marketIndex[n] inspect_price_temp = Get_Inspects(current_market_link, alreadyHave, db, c, fail) if (len(inspect_price_temp) == 2 or inspect_price_temp[0] == 'none'): if (inspect_price_temp[0] == 'none'): n += 1 else: inspect_list = inspect_list + inspect_price_temp[0] price_list = price_list + inspect_price_temp[1] n += 1 if (inspect_price_temp[0] == 'fail'): print("Retrying %s waiting 30 seconds..." % current_market_link) gevent.sleep(30) c.close() db.close() print("") bg = sqlite3.connect('bluegem.db') d = bg.cursor() d.execute('CREATE TABLE IF NOT EXISTS bluegemTable(info TEXT)') Get_Item_Data(inspect_list, price_list, cs, bg, d) d.close() bg.close()
def main(dirname): client = SteamClient() print("Steam Cards Wallpaper Downloader") print("-" * 20) try: result = client.cli_login() except (EOFError, KeyboardInterrupt): _user_aborted() raise SystemExit if result != EResult.OK: print("Failed to login: %s" % repr(result)) raise SystemExit print("-" * 20) print("Logged on as:", client.user.name) try: scraper.scrape(client, dirname) except KeyboardInterrupt: _user_aborted() finally: client.logout()
if(res['status'] == '15'): print("Inventory or profile private. Please make both public.") else: print("failed:\n\tstatus: " + str(res['status']) + "\n\tdetails: " + str(res['statusDetail'])) print("Trying again in 30 seconds...") time.sleep(30) res = api.IEconItems_570.GetPlayerItems(steamid=client.user.steam_id)['result'] return(res) def find_packs(inventory): pack_ids = [] for item in inventory['items']: ##TI7 = 17297 17272 if(item['defindex'] == 17430 or item['defindex'] == 17431): pack_ids.append(item['id']) return(pack_ids) def open_packs(packs): i = 0 for pack in packs: i += 1 jobid = dota.send(EDOTAGCMsg.EMsgClientToGCOpenPlayerCardPack, {'player_card_pack_item_id' : pack}) if(not OPEN_SPEED == 0): time.sleep(OPEN_SPEED) if(i % 5 == 0): print('.', end='', flush=True) print("") client.cli_login() client.run_forever()
class Bot(object): def __init__(self, steam_user, steam_pass, steam_owner_id): self.steam_user = steam_user self.steam_pass = steam_pass self.steam_owner_id = steam_owner_id self.client = SteamClient() def Show_Login_Info(self): """ Show username and steamid from User! """ msg = self.client.wait_msg(EMsg.ClientAccountInfo) print('Logged on as: %s'%msg.body.persona_name) print('SteamID: %s'%repr(self.client.steam_id)) def Change_Status_And_Name(self, status, user_name=None): """ Change User status for friends and Name!! 0 - Offline, 1 - Online, 2 - Busy, 3 - Away, 4 - Snooze, 5 - looking to trade, 6 - looking to play. status type: int status example: 1 user_name type: string user_name example: 'STEAM BOT' """ msg = MsgProto(EMsg.ClientChangeStatus) msg.body.persona_state = status if user_name != None: msg.body.player_name = user_name else: pass self.client.send_message_and_wait(msg, None) def Send_Friend_Msg(self, friend_steam_id, message): """ Send a message to a friend with his steamID! friend_steam_id type: int friend_steam_id example: 77777777777777777 message type: string message example: 'Hello' """ msg = MsgProto(EMsg.ClientFriendMsg) msg.body.steamid = friend_steam_id msg.body.chat_entry_type = 1 msg.body.message = message.encode('utf-8') self.client.send_message_and_wait(msg, None) def Send_Friend_Request(self, friend_steam_id): """ Send a friend request to a friend! friend_steam_id type: int friend_steam_id example: 77777777777777777 """ msg = MsgProto(EMsg.ClientAddFriend) msg.body.steamid_to_add = friend_steam_id self.client.send_message_and_wait(msg, None) def Console(self): """ Terminal to control the bot via friend msg!! """ self.commands = {'-shutdown': 'self.Change_Status_And_Name(0, None)' \ '\nself.Send_Friend_Msg(self.steam_owner_id, "BOT OFF!")'} while True: msg = self.client.wait_msg(EMsg.ClientFriendMsgIncoming) if msg.body.chat_entry_type == 1: msg_decoded = str(msg.body.message.decode().strip('\x00')) if msg_decoded.startswith('-'): for command in self.commands: if command == msg_decoded: exec(self.commands['%s'%command]) else: self.Send_Friend_Msg(self.steam_owner_id, "There is no command with this name!") else: print('message') else: print('writing') def Stay_Online(self): """ If you not comunicate with steam in 90 seconds, you are disconnected, so this function helps to stay connected """ while True: self.Change_Status_And_Name(1, None) gevent.sleep(85) def Run(self): """ Start the bot! """ self.client.cli_login(self.steam_user, self.steam_pass) self.Show_Login_Info() self.Change_Status_And_Name(1, None) self.Send_Friend_Msg(self.steam_owner_id, 'BOT ON!') self.t_stay_online = [gevent.spawn(self.Stay_Online), gevent.spawn(self.Console)]
from __future__ import print_function from steam import SteamClient from steam.enums import EResult client = SteamClient() print("One-off login recipe") print("-"*20) result = client.cli_login() if result != EResult.OK: print("Failed to login: %s" % repr(result)) raise SystemExit print("-"*20) print("Logged on as:", client.user.name) print("Community profile:", client.steam_id.community_url) print("Last logon:", client.user.last_logon) print("Last logoff:", client.user.last_logoff) client.logout()
from __future__ import print_function from steam import SteamClient from steam.enums import EResult client = SteamClient() print("One-off login recipe") print("-" * 20) result = client.cli_login() if result != EResult.OK: print("Failed to login: %s" % repr(result)) raise SystemExit print("-" * 20) print("Logged on as:", client.user.name) print("Community profile:", client.steam_id.community_url) print("Last logon:", client.user.last_logon) print("Last logoff:", client.user.last_logoff) client.logout()
dota.practice_lobby_kick(account_id=steam32) if obj.members[i].team == 4: playerslot[9]['slot'] = None if obj.members[i].id == player10: steam32 = converteridto32(player10) if player10time == 'rad': if obj.members[i].team == 0: playerslot[10]['slot'] = obj.members[i].name if obj.members[i].team == 1: playerslot[10]['slot'] = None dota.practice_lobby_kick(account_id=steam32) if obj.members[i].team == 4: playerslot[10]['slot'] = None elif player10time == 'dir': if obj.members[i].team == 1: playerslot[10]['slot'] = obj.members[i].name if obj.members[i].team == 0: playerslot[10]['slot'] = None dota.practice_lobby_kick(account_id=steam32) if obj.members[i].team == 4: playerslot[10]['slot'] = None client.cli_login(username=bot_user, password=bot_pass) client.run_forever()