예제 #1
0
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)
예제 #2
0
 def __init__(self, username, password, guardCode, twoFactorCode):
     #Declare class variables
     self.client = SteamClient()
     self.guardCode = guardCode
     self.loginResult = "Not logged in"
     self.twoFactorCode = twoFactorCode
     self.username, self.password = username, password
예제 #3
0
def invite(steam_ids, bot_account, lobby_name):
    client = SteamClient()
    dota = Dota2Client(client)

    steam_ids = [int(steamid) for steamid in steam_ids]
    yielded = set()

    @client.on('connected')
    def log_in():
        client.login(username=bot_account.login, password=bot_account.password)

    @client.on('logged_on')
    def start_dota():
        dota.launch()

    @dota.once('ready')
    def create_a_lobby():
        dota.create_practice_lobby(password=token_hex(16), options={
            'game_name': lobby_name,
        })

    @dota.once('lobby_new')
    def setup_and_invite_all(lobby):
        client.emit('info', 'lobby_created', random.choice(steam_ids))
        for steam_id in steam_ids:
            dota.invite_to_lobby(steam_id)

    @dota.on('lobby_changed')
    def handle_change(lobby):
        in_lobby = {member.id for member in lobby.members if member.id in steam_ids}
        pending = {steamid for steamid in lobby.pending_invites if steamid in steam_ids}
        leavers = set(steam_ids) - (in_lobby | pending)

        nonlocal yielded
        to_yield = in_lobby - yielded
        for steam_id in to_yield:
            yielded.add(steam_id)
            client.emit('info', 'in_lobby', steam_id)

        if len(in_lobby) == len(steam_ids):
            dota.leave_practice_lobby()

        if leavers:
            leaver_id = list(leavers)[0]
            dota.destroy_lobby()
            client.emit('info', 'leaver', leaver_id)

    @dota.on('lobby_removed')
    def finish_cycle(lobby):
        client.emit('info', 'cycle_finished')

    connect_with_retry(client)
    while True:
        args = client.wait_event('info')
        if args[0] == 'cycle_finished':
            return
        else:
            assert len(args) == 2
            yield args
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()
예제 #5
0
def last_build(game_id):
    """Retrieves the timestamp of the last update to the public branch in steam"""
    sc = SteamClient()
    sc.anonymous_login()
    info = sc.get_product_info(apps=[game_id])
    fact = info['apps'][game_id]['depots']['branches']
    last_updated = int(fact['public']['timeupdated'])
    last_dt = datetime.datetime.fromtimestamp(last_updated)
    return last_dt
예제 #6
0
파일: dota_bot.py 프로젝트: taitai42/dazzar
    def __init__(self, worker_manager, credential, job):
        """Initialize the Dota bot thread for a unique job process.

        Args:
            worker_manager: `DazzarWorkerManager` this bot is linked to.
            credential: `Credential` used to connect to steam.
            job: `Job` to process by the bot.
        """
        Greenlet.__init__(self)

        self.credential = credential
        self.worker_manager = worker_manager
        self.job = job

        self.client = SteamClient()
        self.dota = dota2.Dota2Client(self.client)
        self.app = self.worker_manager.app

        self.job_started = False
        self.game_creation_call = False
        self.job_finished = False

        self.match = None
        self.players = None

        self.game_status = None
        self.lobby_channel_id = None
        self.invite_timer = None
        self.missing_players = None
        self.missing_players_count = None
        self.wrong_team_players = None
        self.wrong_team_players_count = None

        # Prepare all event handlers
        # - Steam client events
        # - Dota client events
        # - Dazzar bot events
        self.client.on('connected', self.steam_connected)
        self.client.on('logged_on', self.steam_logged)

        self.dota.on('ready', self.dota_ready)
        self.dota.on('notready', self.closed_dota)

        self.dota.on('profile_card', self.scan_profile_result)
        self.dota.on('player_info', self.scan_player_info)
        self.dota.on(dota2.features.Lobby.EVENT_LOBBY_NEW,
                     self.vip_game_created)
        self.dota.on(dota2.features.Lobby.EVENT_LOBBY_CHANGED,
                     self.game_update)
        self.dota.on(dota2.features.Chat.EVENT_CHANNEL_JOIN, self.channel_join)
        self.dota.on(dota2.features.Chat.EVENT_CHANNEL_MESSAGE,
                     self.channel_message)
예제 #7
0
def connect_to_steam():
    client = SteamClient()

    while True:
        result = client.anonymous_login()

        if result == EResult.OK:
            break
        else:
            print('{} Error while logging, retrying in 10 seconds...'.format(
                Consts.LOG_PREFIX))
            time.sleep(10)

    return client
예제 #8
0
    def run(self):
        logging.basicConfig(format="%(asctime)s | %(message)s",
                            level=logging.INFO)
        LOG = logging.getLogger()
        global client
        client = SteamClient()
        client.set_credential_location(
            ".")  # where to store sentry files and other stuff

        @client.on("error")
        def handle_error(result):
            LOG.info("Logon result: %s", repr(result))
            if result == EResult.RateLimitExceeded:
                self.loginInfo.emit(996, '')
                self.needlogin = False

        @client.on("channel_secured")
        def send_login():
            if client.relogin_available:
                client.relogin()

        @client.on("connected")
        def handle_connected():
            LOG.info("Connected to %s", client.current_server_addr)

        @client.on("reconnect")
        def handle_reconnect(delay):
            LOG.info("Reconnect in %ds...", delay)

        @client.on("disconnected")
        def handle_disconnect():
            LOG.info("Disconnected.")
            if client.relogin_available:
                LOG.info("Reconnecting...")
                client.reconnect(maxdelay=30)

        # main bit
        LOG.info("Persistent logon recipe")
        LOG.info("-" * 30)
        while True:
            self.msleep(10)
            self.run_num = 0
            if self.needlogin:
                self.login()
            if self.needlogout:
                self.logout()
            if self.needredeem:
                self.redeem()
예제 #9
0
def send_chat_message(steam_id, bot_account, message):
    client = SteamClient()
    steam_id = int(steam_id)

    @client.on('connected')
    def log_in():
        client.login(username=bot_account.login, password=bot_account.password)

    @client.on('logged_on')
    def send_message():
        recipient = client.get_user(steam_id, fetch_persona_state=False)
        recipient.send_message(message)
        client.emit('cycle_finished')

    connect_with_retry(client)
    client.wait_event('cycle_finished')
예제 #10
0
    def __init__(self):
        self.logged_on_once = False
        self.logon_details = {}

        self.steam = client = SteamClient()
        client.set_credential_location(".")

        @client.on("error")
        def handle_error(result):
            LOG.info("Logon result: %s", repr(result))

        @client.on("channel_secured")
        def send_login():
            if client.relogin_available:
                client.relogin()
            else:
                client.login(**self.logon_details)
                self.logon_details.pop('auth_code', None)
                self.logon_details.pop('two_factor_code', None)

        @client.on("connected")
        def handle_connected():
            LOG.info("Connected to %s", client.current_server_addr)

        @client.on("reconnect")
        def handle_reconnect(delay):
            LOG.info("Reconnect in %ds...", delay)

        @client.on("disconnected")
        def handle_disconnect():
            LOG.info("Disconnected.")

            if self.logged_on_once:
                LOG.info("Reconnecting...")
                client.reconnect(maxdelay=30)

        @client.on("auth_code_required")
        def auth_code_prompt(is_2fa, mismatch):
            if mismatch:
                LOG.info("Previous code was incorrect")

            if is_2fa:
                code = raw_input("Enter 2FA Code: ")
                self.logon_details['two_factor_code'] = code
            else:
                code = raw_input("Enter Email Code: ")
                self.logon_details['auth_code'] = code

            client.connect()

        @client.on("logged_on")
        def handle_after_logon():
            self.logged_on_once = True

            LOG.info("-" * 30)
            LOG.info("Logged on as: %s", client.user.name)
            LOG.info("Community profile: %s", client.steam_id.community_url)
            LOG.info("Last logon: %s", client.user.last_logon)
            LOG.info("Last logoff: %s", client.user.last_logoff)
            LOG.info("-" * 30)
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()
예제 #12
0
def wait_for_friend_request_answer(steam_id, bot_account, block=True):
    client = SteamClient()
    steam_id = int(steam_id)

    @client.on('connected')
    def log_in():
        client.login(username=bot_account.login, password=bot_account.password)

    @client.friends.on('ready')
    @client.friends.on('friend_new')
    def check_friends(*args):
        nonlocal client
        friends = {
            int(friend.steam_id)
            for friend in client.friends if friend.relationship == EFriendRelationship.Friend
        }
        if steam_id in friends:
            client.emit('cycle_finished', True)
        elif not block:
            client.emit('cycle_finished', False)

    connect_with_retry(client)
    in_friends = client.wait_event('cycle_finished')[0]
    return in_friends
예제 #13
0
def send_friend_request(steam_id, bot_account):
    client = SteamClient()
    steam_id = int(steam_id)

    @client.on('connected')
    def log_in():
        client.login(username=bot_account.login, password=bot_account.password)

    @client.friends.on('ready')
    def send_request():
        client.friends.add(steam_id)

    connect_with_retry(client)
    eresult, steam_id = client.friends.wait_event(client.friends.EVENT_FRIEND_ADD_RESULT)
    return eresult == EResult.OK, eresult
예제 #14
0
class clientData(object):
    #Initialize
    def __init__(self, username, password, guardCode, twoFactorCode):
        #Declare class variables
        self.client = SteamClient()
        self.guardCode = guardCode
        self.loginResult = "Not logged in"
        self.twoFactorCode = twoFactorCode
        self.username, self.password = username, password

    #Client login method
    def login(self):
        #Login to steam
        self.loginResult = self.client.login(self.username, self.password,
                                             None, self.guardCode,
                                             self.twoFactorCode)
예제 #15
0
    def __init__(self):
        self.logged_on_once = False

        self.steam = client = SteamClient()
        client.set_credential_location(".")

        @client.on("error")
        def handle_error(result):
            LOG.info("Logon result: %s", repr(result))

        @client.on("connected")
        def handle_connected():
            LOG.info("Connected to %s", client.current_server_addr)

        @client.on("channel_secured")
        def send_login():
            if self.logged_on_once and self.steam.relogin_available:
                self.steam.relogin()

        @client.on("logged_on")
        def handle_after_logon():
            self.logged_on_once = True

            LOG.info("-"*30)
            LOG.info("Logged on as: %s", client.user.name)
            LOG.info("Community profile: %s", client.steam_id.community_url)
            LOG.info("Last logon: %s", client.user.last_logon)
            LOG.info("Last logoff: %s", client.user.last_logoff)
            LOG.info("-"*30)

        @client.on("disconnected")
        def handle_disconnect():
            LOG.info("Disconnected.")

            if self.logged_on_once:
                LOG.info("Reconnecting...")
                client.reconnect(maxdelay=30)

        @client.on("reconnect")
        def handle_reconnect(delay):
            LOG.info("Reconnect in %ds...", delay)
예제 #16
0
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)]
예제 #17
0
#!/usr/bin/env python3
import time

from dota2.features import Party
from steam import SteamClient
from dota2 import Dota2Client
from dota2.enums import DOTA_GC_TEAM, DOTABotDifficulty, DOTA_GameMode
from dota2.features import Lobby
import click

# Setup logging.
import logging

logging.basicConfig(format='[%(asctime)s] %(levelname)s %(name)s: %(message)s', level=logging.DEBUG)

client = SteamClient()
dota = Dota2Client(client)


@client.on('logged_on')
def start_dota():
    dota.launch()


@dota.on('ready')
def dota_launched():
    # Create game lobby.
    # dotaenv.invite_to_party(76561198044453639)
    dota.create_practice_lobby(password='******', options={
        'game_mode': DOTA_GameMode.DOTA_GAMEMODE_1V1MID,
        'server_region': 0,
예제 #18
0
from __future__ import print_function
from getpass import getpass
from steam import SteamClient


print("One-off login recipe")
print("-"*20)

LOGON_DETAILS = {
    'username': raw_input("Steam user: "******"Password: "******"Logon result:", repr(result))

@client.on('auth_code_required')
def auth_code_prompt(is_2fa, mismatch):
    if is_2fa:
        code = raw_input("Enter 2FA Code: ")
        client.login(two_factor_code=code, **LOGON_DETAILS)
    else:
        code = raw_input("Enter Email Code: ")
        client.login(auth_code=code, **LOGON_DETAILS)


try:
    client.login(**LOGON_DETAILS)
예제 #19
0
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()
예제 #20
0
from gevent import monkey
monkey.patch_ssl()

from steam import SteamClient
from dota2 import Dota2Client
from dota2.enums import EDOTAGCMsg
from steam import WebAPI
import time

client = SteamClient()
dota = Dota2Client(client)

OPEN_SPEED = 0.2

api_key = ''
api = ''

print("\n\nDue to limitations imposed by valve (f**k you skin gambling) you will need:")
print("\t1. An API KEY")
print("\t2. Your profile and inventory temporarily set to public")
print("API keys can be optained easily from: http://steamcommunity.com/dev/apikey\n\n")

while True:
    api_key = input("Enter your API key: ")
    try:
        api = WebAPI(key = api_key)
        break
    except:
        print("invalid key")

print("You will now be prompted to log in. You will not see any input when entering password.")
예제 #21
0
import logging

from steam import SteamClient
from steam.base.msg.emsg import EMsg

logging.basicConfig(
    format="[%(levelname)s] %(asctime)s: %(name)s: %(message)s",
    level=logging.DEBUG)

client = SteamClient()


@client.on(EMsg.ClientAccountInfo)
async def account_info(msg):
    print(msg.body)


if __name__ == '__main__':
    try:
        client.login()
        client.run_forever()
    except KeyboardInterrupt:
        logging.info('Waiting client to close')
        client.close()
        logging.info('Client closed')
예제 #22
0
from dota2 import Dota2Client
from steam import SteamClient
from steam.enums.emsg import EMsg
from steam.enums import EResult
from steam import SteamID
from steam.client.user import SteamUser
from steam.core.msg import MsgProto
import gevent
import vdf
import re
import json
import socket

client = SteamClient()
dota = Dota2Client(client)
theSteamID = 76561198036748162
oldID = 0
game_modes = {
    "#DOTA_EventGameName_International2018": "The Underhollow",
    "#DOTA_lobby_type_name_ranked": "Ranked All Pick",
    "Overthrow": "Overthrow",
    "Underhollow": "Underhollow"
}
knownUsers = {
    '76561198049776766': 'ODPixel'
}

@client.on('logged_on')
def start_dota():
    dota.launch()
예제 #23
0
파일: dota_bot.py 프로젝트: taitai42/dazzar
class DotaBot(Greenlet):
    """A worker thread, connecting to steam to process a unique job.

    Attributes:
        worker_manager: `DazzarWorkerManager` this bot is linked to.
        credential: `Credential` used to connect to steam.
    """
    def __init__(self, worker_manager, credential, job):
        """Initialize the Dota bot thread for a unique job process.

        Args:
            worker_manager: `DazzarWorkerManager` this bot is linked to.
            credential: `Credential` used to connect to steam.
            job: `Job` to process by the bot.
        """
        Greenlet.__init__(self)

        self.credential = credential
        self.worker_manager = worker_manager
        self.job = job

        self.client = SteamClient()
        self.dota = dota2.Dota2Client(self.client)
        self.app = self.worker_manager.app

        self.job_started = False
        self.game_creation_call = False
        self.job_finished = False

        self.match = None
        self.players = None

        self.game_status = None
        self.lobby_channel_id = None
        self.invite_timer = None
        self.missing_players = None
        self.missing_players_count = None
        self.wrong_team_players = None
        self.wrong_team_players_count = None

        # Prepare all event handlers
        # - Steam client events
        # - Dota client events
        # - Dazzar bot events
        self.client.on('connected', self.steam_connected)
        self.client.on('logged_on', self.steam_logged)

        self.dota.on('ready', self.dota_ready)
        self.dota.on('notready', self.closed_dota)

        self.dota.on('profile_card', self.scan_profile_result)
        self.dota.on('player_info', self.scan_player_info)
        self.dota.on(dota2.features.Lobby.EVENT_LOBBY_NEW,
                     self.vip_game_created)
        self.dota.on(dota2.features.Lobby.EVENT_LOBBY_CHANGED,
                     self.game_update)
        self.dota.on(dota2.features.Chat.EVENT_CHANNEL_JOIN, self.channel_join)
        self.dota.on(dota2.features.Chat.EVENT_CHANNEL_MESSAGE,
                     self.channel_message)

    def _run(self):
        """Start the main loop of the thread, connecting to Steam, waiting for the job to finish to close the bot."""
        self.print_info('Connecting to Steam...')
        self.client.connect(retry=None)  # Try connecting with infinite retries

        while not self.job_finished:
            sleep(10)

        self.client.disconnect()
        self.worker_manager.bot_end(self.credential)

    # Helpers

    def print_info(self, trace):
        """Wrapper of `logging.info` with bot name prefix.

        Args:
            trace: String to output as INFO.
        """
        logging.info('%s: %s', self.credential.login, trace)

    def print_error(self, trace):
        """Wrapper of `logging.error` with bot name prefix.

        Args:
            trace: String to output as ERROR.
        """
        logging.error("%s: %s", self.credential.login, trace)

    # Callback of Steam and Dota clients

    def steam_connected(self):
        """Callback fired when the bot is connected to Steam, login user."""
        self.print_info('Connected to Steam.')
        self.client.login(self.credential.login, self.credential.password)

    def steam_logged(self):
        """Callback fired when the bot is logged into Steam, starting Dota."""
        self.print_info('Logged to Steam.')
        self.dota.launch()

    def dota_ready(self):
        """Callback fired when the Dota application is ready, resume the job processing."""
        self.print_info('Dota application is ready.')
        self.compute_job()

    def closed_dota(self):
        """Callback fired when the Dota application is closed."""
        self.print_info('Dota application is closed.')

    def compute_job(self):
        """Start the processing of the job with the appropriate handler."""
        self.print_info('Processing new job of type %s' % type(self.job))
        if not self.job_started:
            self.job_started = True
        else:
            return

        if type(self.job) is JobScan:
            self.scan_profile()
        elif type(self.job) is JobCreateGame:
            self.vip_game()
        else:
            self.end_job_processing()

    def end_job_processing(self):
        """Mark the job as finished, preparing the bot to close."""
        self.print_info('Job ended.')
        self.job = None
        self.job_finished = True

    def channel_join(self, channel_info):
        if channel_info.channel_type != dota2.enums.DOTAChatChannelType_t.DOTAChannelType_Lobby:
            self.dota.leave_channel(channel_info.channel_id)
        else:
            if self.game_status is not None:
                if channel_info.channel_name == 'Lobby_{0}'.format(
                        self.game_status.lobby_id):
                    self.lobby_channel_id = channel_info.channel_id

    def channel_message(self, message):
        pass

    ############################
    # Scan profile job section #
    ############################

    def scan_profile(self):
        """Start the process of the job as a profile scan, request the information from Steam."""
        while not self.job.scan_finish:
            self.print_info('Requesting profile for user %s' %
                            self.job.steam_id)
            user = SteamID(self.job.steam_id)
            self.dota.request_profile_card(user.as_32)

            # We give the task 30 sec to finish or retry
            sleep(30)

        if self.job.scan_finish:
            self.end_job_processing()

    def scan_player_info(self, message):
        self.print_info(message)
        self.job.scan_finish = True

    def scan_profile_result(self, account_id, profile_card):
        """Process the profile information returned by Steam.

        Extract the SoloMMR from the profile and insert the user in the good ladder.

        Args:
            account_id: steam_id (as 32bits) of the profile result
            profile_card: profile information as a protobuff message
        """
        self.print_info('Processing profile of user %s' %
                        SteamID(account_id).as_64)
        solo_mmr = None
        for slot in profile_card.slots:
            if not slot.HasField('stat'):
                continue
            if slot.stat.stat_id != 1:
                continue
            solo_mmr = int(slot.stat.stat_score)

        with self.app.app_context():
            user = User.query.filter_by(id=self.job.steam_id).first()
            user.profile_scan_info.last_scan = datetime.utcnow()
            if solo_mmr is not None:
                user.solo_mmr = solo_mmr

            if user.solo_mmr is None:
                user.section = None
            else:
                if user.solo_mmr > 4500:
                    user.section = constants.LADDER_HIGH
                else:
                    user.section = constants.LADDER_LOW

            db.session.commit()
        self.job.scan_finish = True

    ########################
    # VIP game job section #
    ########################

    def vip_game(self):
        """Start the process of the job as a game creation."""
        self.print_info('Hosting game %s' % self.job.match_id)

        # Copy the match data from the database
        with self.app.app_context():
            self.match = Match.query.filter_by(id=self.job.match_id).first()
            if self.match is None or self.match.status != constants.MATCH_STATUS_CREATION:
                self.dota.leave_practice_lobby()
                self.end_job_processing()
            else:
                self.players = {}
                for player in PlayerInMatch.query.\
                    options(joinedload_all('player')).\
                    filter(PlayerInMatch.match_id == self.job.match_id).\
                    all():
                    self.players[player.player_id] = player

                db.session.expunge(self.match)
                for player_id, player in self.players.items():
                    db.session.expunge(player)

                # Start the Dota lobby
                self.dota.create_practice_lobby(password=self.match.password)
                self.game_creation_call = True

    def vip_game_created(self, message):
        """Callback fired when the Dota bot enters a lobby.

        Args:
            message: first lobby information
        """
        self.game_status = message

        if self.job is None or not self.game_creation_call:
            self.dota.leave_practice_lobby()
        else:
            self.initialize_lobby()
            start = self.manage_player_waiting()

            if not start:
                self.dota.send_message(self.lobby_channel_id,
                                       'Annulation de la partie.')
                self.process_game_dodge()
            else:
                self.dota.send_message(self.lobby_channel_id,
                                       'Tous les joueurs sont présents.')
                self.start_game()

                # Waiting PostGame = 3 or UI = 0 (means no loading)
                while self.game_status.state != 0 and self.game_status.state != 3:
                    sleep(5)

                if self.game_status.state == 0:
                    self.process_game_dodge()
                elif self.game_status.state == 3:
                    self.process_endgame_results()

            if self.lobby_channel_id is not None:
                self.dota.leave_channel(self.lobby_channel_id)
                self.lobby_channel_id = None

            self.dota.leave_practice_lobby()
            self.end_job_processing()

    def game_update(self, message):
        """Callback fired when the game lobby change, update local information."""
        self.game_status = message

    def initialize_lobby(self):
        """Setup the game lobby with the good options, and change status in database."""
        self.print_info('Game %s created, setup.' % self.job.match_id)
        self.dota.join_lobby_channel()
        self.dota.join_practice_lobby_team()
        game_mode_encoding = {
            'ap': dota2.enums.DOTA_GameMode.DOTA_GAMEMODE_ALL_DRAFT,
            'rd': dota2.enums.DOTA_GameMode.DOTA_GAMEMODE_RD,
            'cd': dota2.enums.DOTA_GameMode.DOTA_GAMEMODE_CD
        }

        options = {
            'game_name': 'Dazzar Game {0}'.format(str(self.match.id)),
            'pass_key': self.match.password,
            'game_mode': game_mode_encoding[self.match.mode],
            'server_region': int(dota2.enums.EServerRegion.Europe),
            'fill_with_bots': False,
            'allow_spectating': True,
            'allow_cheats': False,
            'allchat': False,
            'dota_tv_delay': 2,
            'pause_setting': 1
        }
        self.dota.config_practice_lobby(options=options)
        with self.app.app_context():
            match = Match.query.filter_by(id=self.job.match_id).first()
            match.status = constants.MATCH_STATUS_WAITING_FOR_PLAYERS
            db.session.commit()

    def manage_player_waiting(self):
        """Wait for players to join the lobby with actions depending on player actions.

        Returns:
            A boolean that indicates if the game should be started after the player waiting process.
        """
        self.invite_timer = timedelta(minutes=5)
        self.compute_player_status()
        refresh_rate = 10

        while self.invite_timer != timedelta(0):
            for player in self.missing_players:
                self.dota.invite_to_lobby(player)
            sleep(refresh_rate)
            self.compute_player_status()

            if len(self.missing_players) == 0 and len(
                    self.wrong_team_players) == 0:
                return True
            else:
                if self.invite_timer.seconds != 0 and self.invite_timer.seconds % 60 in [
                        0, 30
                ]:
                    minutes = self.invite_timer.seconds // 60
                    seconds = self.invite_timer.seconds - 60 * minutes
                    self.dota.send_message(
                        self.lobby_channel_id,
                        '{:01d}:{:02d} avant annulation, {} absent(s), {} mal placé(s).'
                        .format(minutes, seconds, self.missing_players_count,
                                self.wrong_team_players_count))
                self.invite_timer = self.invite_timer - timedelta(
                    seconds=refresh_rate)
        return False

    def compute_player_status(self):
        """Helpers to manage player status from protobuff message.

        Invite all missing players to come to the lobby.
        Kick all players not supposed to be inside a lobby.
        Kick from slots all players not in the good slot.
        """
        self.missing_players = []
        self.missing_players_count = 0
        self.wrong_team_players = []
        self.wrong_team_players_count = 0

        for player_id, player in self.players.items():
            self.missing_players_count += 1
            self.missing_players.append(player_id)

        for message_player in self.game_status.members:
            if message_player.id == self.dota.steam_id:
                continue
            if message_player.id in self.missing_players:
                self.missing_players_count -= 1
                self.missing_players.remove(message_player.id)
                good_slot = message_player.slot == self.players[
                    message_player.id].team_slot
                good_team = (message_player.team == DOTA_GC_TEAM.GOOD_GUYS and
                             self.players[message_player.id].is_radiant) or \
                            (message_player.team == DOTA_GC_TEAM.BAD_GUYS and
                             not self.players[message_player.id].is_radiant)
                if not (good_team and good_slot):
                    self.wrong_team_players.append(message_player.id)
                    self.wrong_team_players_count += 1
                    if message_player.team != DOTA_GC_TEAM.PLAYER_POOL:
                        self.dota.practice_lobby_kick_from_team(
                            SteamID(message_player.id).as_32)
            else:
                # Say: Kick joueur non authorisé message_player.name
                self.dota.practice_lobby_kick(SteamID(message_player.id).as_32)

    def process_game_dodge(self):
        """Punish players stopping game start."""
        self.print_info('Game %s cancelled because of dodge.' %
                        self.job.match_id)

        # Say: Partie annulée - punish
        with self.app.app_context():
            match = Match.query.filter_by(id=self.job.match_id).first()
            match.status = constants.MATCH_STATUS_CANCELLED
            self.compute_player_status()
            for player in PlayerInMatch.query. \
                    options(joinedload_all('player')). \
                    filter(PlayerInMatch.match_id == self.job.match_id). \
                    all():
                if player.player.current_match == self.job.match_id:
                    player.player.current_match = None

                # Update Scoreboard
                if player.player_id in self.missing_players or player.player_id in self.wrong_team_players:
                    score = Scoreboard.query.filter_by(
                        ladder_name=match.section,
                        user_id=player.player_id).first()
                    if score is None:
                        score = Scoreboard(user=player.player,
                                           ladder_name=match.section)
                        db.session.add(score)
                    player.is_dodge = True
                    score.points -= 2
                    score.dodge += 1
            db.session.commit()

    def start_game(self):
        """Start the Dota game and update status in database."""
        self.print_info('Launching game %s' % self.job.match_id)

        self.dota.launch_practice_lobby()
        sleep(10)
        with self.app.app_context():
            match = Match.query.filter_by(id=self.job.match_id).first()
            match.status = constants.MATCH_STATUS_IN_PROGRESS
            if self.game_status.connect is not None and self.game_status.connect[
                    0:1] == '=[':
                match.server = self.game_status.connect[2:-1]
            elif self.game_status.server_id is not None:
                match.server = self.game_status.server_id
            db.session.commit()
        sleep(10)

    def process_endgame_results(self):
        """After a game, process lobby results into database."""
        self.print_info('Game %s over.' % self.job.match_id)

        with self.app.app_context():
            match = Match.query.filter_by(id=self.job.match_id).first()
            match.status = constants.MATCH_STATUS_ENDED
            match.server = None
            if self.game_status.match_outcome == 2:
                match.radiant_win = True
            elif self.game_status.match_outcome == 3:
                match.radiant_win = False
            else:
                match.radiant_win = None

            self.players = {}
            for player in PlayerInMatch.query. \
                    options(joinedload_all('player')). \
                    filter(PlayerInMatch.match_id == self.job.match_id). \
                    all():
                if player.player.current_match == self.job.match_id:
                    player.player.current_match = None
                self.players[player.player_id] = player

            # Process scoreboard updates
            for player_id, player in self.players.items():
                score = Scoreboard.query.filter_by(ladder_name=match.section,
                                                   user_id=player_id).first()
                if score is None:
                    score = Scoreboard(user=player.player,
                                       ladder_name=match.section)
                    db.session.add(score)
                score.matches += 1
            for player in self.game_status.members:
                if player.id == self.dota.steam_id:
                    continue
                id = player.id
                score = Scoreboard.query.filter_by(ladder_name=match.section,
                                                   user_id=id).first()
                if (self.players[id].is_radiant and self.game_status.match_outcome == 2) or \
                        (not self.players[id].is_radiant and self.game_status.match_outcome == 3):
                    score.points += 1
                    score.win += 1
                elif (self.players[id].is_radiant and self.game_status.match_outcome == 3) or \
                        (not self.players[id].is_radiant and self.game_status.match_outcome == 2):
                    score.loss += 1
            for player in self.game_status.left_members:
                score = Scoreboard.query.filter_by(ladder_name=match.section,
                                                   user_id=player.id).first()
                self.players[player.id].is_leaver = True
                score.points -= 3
                score.leave += 1

            db.session.commit()
예제 #24
0
 def boost(self, db):
     try:
         self.clients[db.username] = SteamClient()
         if db.authcode == '' or db.authcode is None:
             self.error(db)
             return
         authCodes = decode(BOOST_ENCRYPTION_KEY, db.authcode).split('-')
         authcode = authCodes[0]
         del authCodes[0]
         db.authcode = encode(BOOST_ENCRYPTION_KEY, '-'.join(authCodes))
         db.save()
         try:
             resp = self.clients[db.username].login(
                 db.username,
                 decode(BOOST_ENCRYPTION_KEY, db.password),
                 two_factor_code=authcode)
             if resp != EResult.OK:
                 raise Exception('login failed')
         except:
             self.error(
                 db,
                 message=
                 '[Hour Boost - %s] კოდი %s არასწორი იყო, ბუსტი გაგრძელდება დარჩენილი Backup კოდებით (თუ არსებობს)'
                 % (db.username, authcode))
             return
         print(
             colored(
                 '[Hour Boost] %s (%s) was started by %s Boosting %s Minutes ⌇ %s'
                 % (db.username, self.clients[db.username].user.steam_id,
                    db.user, db.target_time, db.games), 'cyan'))
         db.steam64id = str(self.clients[db.username].user.steam_id)
         db.save()
         count = 0
         while True:
             print(
                 colored(
                     '[Hour Boost] %s ⌇ %s/%s ⌇ %s' %
                     (db.username, db.boosted_time, db.target_time,
                      db.games), 'green'))
             if not self.clients[db.username].logged_on:
                 self.clients[db.username].relogin()
                 if not self.clients[
                         db.username].logged_on:  # if couldn't login
                     client.reconnect(maxdelay=30)
                     if not self.clients[
                             db.username].logged_on:  # if couldn't login
                         raise Exception('disconnected')
             self.clients[db.username].games_played(db.games.split('-'),
                                                    free=db.free)
             self.clients[db.username].sleep(1)
             count += 1
             if db.boosted_time >= db.target_time:
                 print(
                     colored(
                         '[Hour Boost] %s Finished Boosting %s Minutes ⌇ %s'
                         % (db.username, db.target_time, db.games), 'cyan'))
                 notify(User.objects.get(username=db.user),
                        '[Hour Boost - %s] ბუსტი დასრულდა' % db.username)
                 db.delete()
                 return
             # check if it's still in database (dynamic account removal)
             if not Hour_queue.objects.filter(id=db.id,
                                              finished=False).exists():
                 print(
                     colored(
                         '[Hour Boost] %s was cancelled ⌇ %s/%s ⌇ %s' %
                         (db.username, db.boosted_time, db.target_time,
                          db.games), 'cyan'))
                 del self.clients[db.username]
                 notify(User.objects.get(username=db.user),
                        '[Hour Boost - %s] ბუსტი გამოირთო' % db.username)
                 user.seen = False
                 user.save()
                 return
             if count >= 40:
                 count = 0
                 db.refresh_from_db()
                 db.boosted_time += 0.01
                 db.log = '%s/%s' % (db.boosted_time, db.target_time)
                 db.save()
     except:
         self.error(db)
예제 #25
0
 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()
예제 #26
0
	8:{
		'id': player8,
		'slot': None,
	},
	9:{
		'id': player9,
		'slot': None,
	},
	10:{
		'id': player10,
		'slot': None,
	},
}

############################
client = SteamClient()
dota = Dota2Client(client)
dota.verbose_debug = False

def converteridto32(steamid):
	cc = int(steamid) - 76561197960265728
	return cc



@client.on('logged_on')
def start_dota():
	dota.launch()
	print('Dota iniciou')

@dota.on('ready')
예제 #27
0
import logging
from steam import SteamClient
from steam.enums import EResult

# setup logging
logging.basicConfig(format="%(asctime)s | %(message)s", level=logging.INFO)
LOG = logging.getLogger()

client = SteamClient()
client.set_credential_location(".")  # where to store sentry files and other stuff

@client.on("error")
def handle_error(result):
    LOG.info("Logon result: %s", repr(result))

@client.on("channel_secured")
def send_login():
    if client.relogin_available:
        client.relogin()

@client.on("connected")
def handle_connected():
    LOG.info("Connected to %s", client.current_server_addr)

@client.on("reconnect")
def handle_reconnect(delay):
    LOG.info("Reconnect in %ds...", delay)

@client.on("disconnected")
def handle_disconnect():
    LOG.info("Disconnected.")
예제 #28
0
from __future__ import print_function
from getpass import getpass
from steam import SteamClient


print("One-off login recipe")
print("-"*20)

LOGON_DETAILS = {
    'username': raw_input("Steam user: "******"Password: "******"Logon result:", repr(result))

@client.on('auth_code_required')
def auth_code_prompt(is_2fa, mismatch):
    if is_2fa:
        code = raw_input("Enter 2FA Code: ")
        client.login(two_factor_code=code, **LOGON_DETAILS)
    else:
        code = raw_input("Enter Email Code: ")
        client.login(auth_code=code, **LOGON_DETAILS)


try:
    client.login(**LOGON_DETAILS)

from steam import SteamClient
from dota2 import Dota2Client
import logging

user_name = "chpeui0828"

user_password = "******"

logging.basicConfig(format='[%(asctime)s] %(levelname)s %(name)s: %(message)s', level=logging.DEBUG)

client = SteamClient()
dota = Dota2Client(client)

login_called = False

@client.on('connected')
def login():
    global login_called
    if not login_called:
        client.login(user_name, user_password)
        login_called = True

@client.on(client.EVENT_AUTH_CODE_REQUIRED)
def auth_code_prompt(is_2fa, code_mismatch):
    if is_2fa:
        code = input("Enter 2FA Code: ")
        client.login(user_name, user_password, two_factor_code=code)
    else:
        code = input("Enter Email Code: ")
        client.login(user_name, user_password, auth_code=code)
예제 #30
0
    def __init__(self, parent, colorDic):
        #Declare class variables
        self.activeSecrets = None
        self.client = SteamClient()
        self.colorDic = colorDic
        self.conn = dataBase()
        self.apiKey = self.conn.get_api_key()
        self.apiController = api(self.apiKey)
        self.parent = parent
        self.guiControl = guiController(self.parent, self.colorDic)
        self.steamGuardController = None
        self.steamName = ""
        self.updateProgressBarID = None
        #Initialize window's frame
        Frame.__init__(self, self.parent)
        #Everything below is created in order from top of application to the bottom
        #Menu bar
        self.menuBar = Menu(self.parent, border=0)
        self.menuBar.config(bg=self.colorDic["menuBarBackground"],
                            fg=self.colorDic["menuBarForeground"])
        self.accountMenu = Menu(self.menuBar, tearoff=0)
        #New account and Import account button
        self.accountMenu.add_command(label="New Steam Guard",
                                     command=self.new_account_window)
        self.accountMenu.add_command(label="Delete Steam Guard",
                                     command=self.delete_steam_guard)
        #Seperator makes it look fabulous
        self.accountMenu.add_separator()
        self.accountMenu.add_command(label="Import Steam Guard")
        self.menuBar.add_cascade(label="Guard", menu=self.accountMenu)
        self.accountMenu.config(bg=self.colorDic["menuBarBackground"],
                                fg=self.colorDic["menuBarForeground"])
        self.editMenu = Menu(self.menuBar, tearoff=0)
        #Security preferences and color scheme button
        self.editMenu.add_command(label="Security Preferences")
        self.editMenu.add_command(label="Color Scheme")
        self.menuBar.add_cascade(label="Edit", menu=self.editMenu)
        self.editMenu.config(bg=self.colorDic["menuBarBackground"],
                             fg=self.colorDic["menuBarForeground"])
        #Window Title
        self.windowTitle = Label(self.parent, text="Steam Guard")
        self.windowTitle.configure(font=("Segoe UI", 12),
                                   bg=self.colorDic["windowTitleBackground"],
                                   fg=self.colorDic["windowTitleForeground"],
                                   width="350",
                                   pady=10)
        self.windowTitle.pack()
        #Guard codes and Steam name frame
        self.guardCodeHolder = Frame(self.parent,
                                     bg=self.colorDic["guardCodeBackground"])
        self.guardCodeHolder.pack()
        #Generated Steam Guard text
        self.guardLabel = Label(self.guardCodeHolder, text="...")
        self.guardLabel.configure(font=("Segoe UI", 30),
                                  bg=self.colorDic["guardCodeBackground"],
                                  fg=self.colorDic["guardCodeForeground"],
                                  width="350",
                                  pady=15)
        self.guardLabel.pack()
        #Styling for progress bar
        self.barStyle = ttk.Style()
        self.barStyle.theme_use('alt')
        self.barStyle.configure(
            "blue.Horizontal.TProgressbar",
            troughrelief="flat",
            troughcolor=self.colorDic["progressBarBackground"],
            background=self.colorDic["progressBarForeground"],
            relief="flat")
        #Progress bar
        self.progressBar = ttk.Progressbar(
            self.guardCodeHolder,
            style="blue.Horizontal.TProgressbar",
            orient="horizontal",
            length=250,
            mode="determinate")
        self.progressBar.pack()
        self.progressBar["maximum"] = 58
        #Steam name text
        self.steamNameLabel = Label(self.guardCodeHolder, text=self.steamName)
        self.steamNameLabel.configure(font=("Segoe UI", 10),
                                      bg=self.colorDic["guardCodeBackground"],
                                      fg=self.colorDic["steamNameForeground"],
                                      width="350",
                                      pady=5)
        self.steamNameLabel.pack()
        #Special buttons frame
        self.specialButtonsHolder = Frame(
            self.parent, bg=self.colorDic["specialButtonBackground"])
        self.specialButtonsHolder.pack(side="top", expand=True, fill="y")
        self.specialButtonsBackground = Frame(self.specialButtonsHolder,
                                              bg=self.colorDic["hrColor"],
                                              width="350",
                                              height="241")
        self.specialButtonsBackground.pack()
        self.specialButtonsBackground.pack_propagate(0)
        #"Confirmations" button frame
        self.confirmationHolder = Frame(
            self.specialButtonsBackground,
            bg=self.colorDic["specialButtonBackground"],
            width="350",
            height="79",
            cursor="hand2")
        self.confirmationHolder.pack(pady="1")
        self.confirmationLabel = Label(
            self.confirmationHolder,
            text="Confirmations",
            font=("Segoe UI", 15),
            bg=self.colorDic["specialButtonBackground"],
            fg=self.colorDic["specialButtonForeground"],
            cursor="hand2")
        self.confirmationLabel.pack(side="left", pady="15", padx="20")
        self.confirmationHolder.pack_propagate(0)
        self.confirmationHolder.bind("<Enter>",
                                     self.guiControl.special_button_hover)
        self.confirmationHolder.bind("<Leave>",
                                     self.guiControl.special_button_leave)
        self.confirmationHolder.bind("<Button-1>", self.confirmations_window)
        self.confirmationLabel.bind("<Button-1>", self.confirmations_window)
        #"Revocation" button frame
        self.revocationCodeHolder = Frame(
            self.specialButtonsBackground,
            bg=self.colorDic["specialButtonBackground"],
            width="350",
            height="79",
            cursor="hand2")
        self.revocationCodeLabel = Label(
            self.revocationCodeHolder,
            text="Revocation Code",
            font=("Segoe UI", 15),
            bg=self.colorDic["specialButtonBackground"],
            fg=self.colorDic["specialButtonForeground"],
            cursor="hand2")
        self.revocationCodeLabel.pack(side="left", pady="15", padx="20")
        self.revocationCodeHolder.pack()
        self.revocationCodeHolder.pack_propagate(0)
        self.revocationCodeHolder.bind("<Enter>",
                                       self.guiControl.special_button_hover)
        self.revocationCodeHolder.bind("<Leave>",
                                       self.guiControl.special_button_leave)
        self.revocationCodeHolder.bind("<Button-1>",
                                       self.revocation_code_window)
        self.revocationCodeLabel.bind("<Button-1>",
                                      self.revocation_code_window)
        #"Switch Account" button frame
        self.switchAccountHolder = Frame(
            self.specialButtonsBackground,
            bg=self.colorDic["specialButtonBackground"],
            width="350",
            height="79",
            cursor="hand2")
        self.switchAccountLabel = Label(
            self.switchAccountHolder,
            text="Switch Accounts",
            font=("Segoe UI", 15),
            bg=self.colorDic["specialButtonBackground"],
            fg=self.colorDic["specialButtonForeground"],
            cursor="hand2")
        self.switchAccountLabel.pack(side="left", pady="15", padx="20")
        self.switchAccountHolder.pack(pady="1")
        self.switchAccountHolder.pack_propagate(0)
        self.switchAccountHolder.bind("<Enter>",
                                      self.guiControl.special_button_hover)
        self.switchAccountHolder.bind("<Leave>",
                                      self.guiControl.special_button_leave)
        self.switchAccountHolder.bind("<Button-1>", self.switch_account_window)
        self.switchAccountLabel.bind("<Button-1>", self.switch_account_window)
        #Copy button frame
        self.buttonHolder = Frame(self.parent,
                                  bg=self.colorDic["appBackground"])
        self.copyCodeButton = Button(
            self.buttonHolder,
            text="Copy Code",
            command=lambda: self.guiControl.copy_label_text(self.guardLabel),
            font=("Segoe UI", 12),
            relief="flat",
            cursor="hand2")
        self.copyCodeButton.configure(
            fg=self.colorDic["actionButtonForeground"],
            bg=self.colorDic["actionButtonBackground"])
        self.copyCodeButton.pack(padx=30, pady=20, ipady=10, ipadx=10)
        self.buttonHolder.pack(side="bottom")
        #Set our window properties
        self.parent.geometry("350x500")
        self.parent.resizable(0, 0)
        self.parent.configure(bg=self.colorDic["appBackground"])
        self.parent.title("Steam Guardian")
        self.parent.config(menu=self.menuBar)
        self.guiControl.center()

        if self.conn.has_active_user():
            self.update_guard()
예제 #31
0
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)

client.wait_event('logged_on')

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()
예제 #32
0
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()
예제 #33
0
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)

client.wait_event('logged_on')

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()