Пример #1
0
def cmd_steamid(args):
    from steam.steamid import SteamID

    if args.s_input.startswith('http'):
        _LOG.debug("Input is URL. Making online request to resolve SteamID")
        s = SteamID.from_url(args.s_input) or SteamID()
    else:
        s = SteamID(args.s_input)

    lines = [
        "SteamID: {s.as_64}",
        "Account ID: {s.as_32}",
        "Type: {s.type} ({stype})",
        "Universe: {s.universe} ({suniverse})",
        "Instance: {s.instance}",
        "Steam2: {s.as_steam2}",
        "Steam2Legacy: {s.as_steam2_zero}",
        "Steam3: {s.as_steam3}",
    ]

    if s.community_url:
        lines += ["Community URL: {s.community_url}"]

    lines += ["Valid: {is_valid}"]

    print("\n".join(lines).format(
        s=s,
        stype=str(s.type),
        suniverse=str(s.universe),
        is_valid=str(s.is_valid()),
    ))
Пример #2
0
    def __init__(self,
                 ident: Union[SteamID, int, str, EGSID] = None,
                 stats: dict = None,
                 persona_name: str = None,
                 id_intstr_base: int = 16):
        super().__init__()

        self._steam_id = SteamID(0)
        self._egs_id = EGSID(0)

        if not stats:
            stats = {}
        self._stats = stats

        if isinstance(ident, SteamID):
            self._steam_id = ident
        elif isinstance(ident, EGSID):
            self._egs_id = ident
        elif isinstance(ident, int):
            self._steam_id = SteamID(ident)
        elif isinstance(ident, str):
            self._steam_id = SteamID(int(ident, id_intstr_base))
        else:
            raise ValueError(f"invalid steam_id type: {type(ident)}, expected "
                             f"{Union[SteamID, int, str]}")

        self._persona_name = persona_name
Пример #3
0
 def test_args_only(self):
     self.compare(SteamID(1, 2),
                  [1, 2, 0, 0])
     self.compare(SteamID(1, 2, 3),
                  [1, 2, 3, 0])
     self.compare(SteamID(1, 2, 3, 4),
                  [1, 2, 3, 4])
Пример #4
0
def run_register_command(update, context):
    chat_id = update.message.chat_id
    telegram_handle = update.message.from_user.username

    try:
        identifier = context.args[0]

        user = user_services.lookup_user_by_telegram_handle(telegram_handle) or User(
            telegram_handle, "", chat_id
        )

        if SteamID(identifier).is_valid():
            # If the identifier is a valid steamid, convert it and done
            account_id = SteamID(identifier).as_32
        elif SteamID.from_url(identifier):
            # If the identifier is a link to a steam profile, get the id from there
            account_id = SteamID.from_url(identifier).as_32
        else:
            # Check if the Steam API gives us a valid profile
            account_id_from_vanity = resolve_steam_vanity_url(identifier)
            if account_id_from_vanity is not None:
                account_id = account_id_from_vanity

        user.account_id = account_id
        save_user(user)
        update.message.reply_text(
            f"Successfully registered user {telegram_handle} as {SteamID(account_id).community_url}"
        )
    except (IndexError, ValueError):
        update.message.reply_text("No dota friend ID was given")
    except (UnboundLocalError):
        update.message.reply_text(
            "I couldn't make sense of your profile ID! You can give me a Dota friend code, a Steam ID number, a link to your Steam profile or your custom URL."
        )
Пример #5
0
    def test_kwarg_instance(self):
        self.assertEqual(SteamID(id=5, instance=1234).instance, 1234)

        for etype in EType:
            self.assertEqual(
                SteamID(id=5, type=etype).instance,
                1 if etype in (EType.Individual, EType.GameServer) else 0)
Пример #6
0
def GET_IDs(profile):
    steam64 = 0
    if profile[0] == 'h':  #link
        steam64 = SteamID.from_url(profile).as_64
    else:  #simply a pasted steam64
        steam64 = int(SteamID(profile))
    steam3 = SteamID(steam64).as_steam3
    steam1 = SteamID(steam64).as_steam2
    return {'64': steam64, '3': steam3, '1': steam1}
Пример #7
0
 def test_arg_steam64(self):
     self.compare(SteamID(76580280500085312),
                  [123456, EType.Individual, EUniverse.Public, 4444])
     self.compare(SteamID('76580280500085312'),
                  [123456, EType.Individual, EUniverse.Public, 4444])
     self.compare(SteamID(103582791429521412),
                  [4, EType.Clan, EUniverse.Public, 0])
     self.compare(SteamID('103582791429521412'),
                  [4, EType.Clan, EUniverse.Public, 0])
Пример #8
0
def string_to_steamid(string, resolve_customurl=True):
    try:
        steamid = SteamID(string)
        if not steamid.is_valid() and resolve_customurl:
            steamid = SteamID(
                steam_api.ISteamUser.ResolveVanityURL(vanityurl=string).get(
                    'response', {}).get('steamid'))
        return steamid
    except ValueError:
        return SteamID()
Пример #9
0
 def test_community_url(self):
     # user url
     self.assertEqual(
         SteamID(76580280500085312).community_url,
         'https://steamcommunity.com/profiles/76580280500085312')
     # group url
     self.assertEqual(
         SteamID('[g:1:4]').community_url,
         'https://steamcommunity.com/gid/103582791429521412')
     # else None
     self.assertEqual(SteamID('[A:1:4]').community_url, None)
Пример #10
0
 def get_steam_id(self):
     loginuser_path = STEAM_LOGINUSER.format(self.steam_path)
     if os.path.isfile(loginuser_path):
         with open(loginuser_path, 'r', encoding='utf-8') as f:
             login_user = vdf.load(f)
         login_steamids = list(login_user['users'].keys())
         if len(login_steamids) == 1:
             return SteamID(int(login_steamids[0]))
         elif len(login_steamids) == 0:
             return SteamID()
         else:
             for id, value in login_user.items():
                 if value.get("mostrecent") == 1:
                     return int(id)
             return SteamID(int(login_steamids[0]))
Пример #11
0
    def test_kwargs_invalid(self):
        invalid = [0, EType.Invalid, EUniverse.Invalid, 0]

        self.compare(SteamID(), invalid)
        self.compare(SteamID(id=0, type=0, universe=0, instance=0), invalid)
        self.compare(SteamID(id=0,
                             type=EType.Invalid,
                             universe=EUniverse.Invalid,
                             instance=0,
                             ), invalid)
        self.compare(SteamID(id=0,
                             type='Invalid',
                             universe='Invalid',
                             instance=0,
                             ), invalid)
Пример #12
0
 async def link(self, ctx: commands.Context, steamID_input: str):
     self.logger.debug(
         f'{ctx.author}: {ctx.prefix}{ctx.invoked_with} {ctx.args[2:]}')
     steamID = SteamID(steamID_input)
     if not steamID.is_valid():
         steamID = from_url(steamID_input, http_timeout=15)
         if steamID is None:
             steamID = from_url(
                 f'https://steamcommunity.com/id/{steamID_input}/',
                 http_timeout=15)
             if steamID is None:
                 raise commands.UserInputError(
                     message='Please enter a valid SteamID or community url.'
                 )
     db = Database('sqlite:///main.sqlite')
     await db.connect()
     await db.execute(
         '''
                     REPLACE INTO users (discord_id, steam_id)
                     VALUES( :discord_id, :steam_id )
                     ''', {
             "discord_id": str(ctx.author.id),
             "steam_id": str(steamID.as_steam2_zero)
         })
     embed = discord.Embed(
         description=
         f'Connected {ctx.author.mention} \n [{steamID.as_steam2}]({steamID_input})',
         color=0x00FF00)
     await ctx.send(embed=embed)
     #add another way to add roles for the users after login.
     #await ctx.author.add_roles(ctx.guild.get_role(808304852676378624))
     self.logger.info(f'{ctx.author} connected to {steamID.as_steam2}')
Пример #13
0
 def test_as_invite_url(self):
     self.assertEqual(
         SteamID(0, EType.Individual, EUniverse.Public,
                 instance=1).invite_url, None)
     self.assertEqual(
         SteamID(123456, EType.Individual, EUniverse.Public,
                 instance=1).invite_url, 'https://s.team/p/cv-dgb')
     self.assertEqual(
         SteamID(123456, EType.Individual, EUniverse.Beta,
                 instance=1).invite_url, 'https://s.team/p/cv-dgb')
     self.assertEqual(
         SteamID(123456, EType.Invalid, EUniverse.Public,
                 instance=1).invite_url, None)
     self.assertEqual(
         SteamID(123456, EType.Clan, EUniverse.Public,
                 instance=1).invite_url, None)
Пример #14
0
 def test_as_invite_code(self):
     self.assertEqual(
         SteamID(0, EType.Individual, EUniverse.Public,
                 instance=1).as_invite_code, None)
     self.assertEqual(
         SteamID(123456, EType.Individual, EUniverse.Public,
                 instance=1).as_invite_code, 'cv-dgb')
     self.assertEqual(
         SteamID(123456, EType.Individual, EUniverse.Beta,
                 instance=1).as_invite_code, 'cv-dgb')
     self.assertEqual(
         SteamID(123456, EType.Invalid, EUniverse.Public,
                 instance=1).as_invite_code, None)
     self.assertEqual(
         SteamID(123456, EType.Clan, EUniverse.Public,
                 instance=1).as_invite_code, None)
    def unblock(self, steamid):
        """
        Unblock Steam user

        :param steamid: their steamid
        :type  steamid: :class:`int`, :class:`.SteamID`, :class:`.SteamUser`
        :return: result
        :rtype: :class:`EResult`
        """
        if isinstance(steamid, SteamUser):
            steamid = steamid.steam_id
        elif not isinstance(steamid, SteamID):
            steamid = SteamID(steamid)

        resp = self._steam.send_um_and_wait("Player.IgnoreFriend#1", {
            "steamid": steamid,
            "unignore": True
        },
                                            timeout=10)

        if not resp:
            return EResult.Timeout
        elif resp.header.eresult == EResult.OK:
            if steamid in self._fr:
                self._fr[steamid].relationship = EFriendRelationship(
                    resp.body.friend_relationship)

        return resp.header.eresult
Пример #16
0
    def get_steamids_from_ip(self, server_ips):
        """Resolve SteamIDs from IPs

        :param steam_ids: a list of ips (e.g. ``['1.2.3.4:27015',...]``)
        :type steam_ids: list
        :return: map of steamids to ips
        :rtype: dict

        Sample response:

        .. code:: python

            {'1.2.3.4:27060': SteamID(id=123456, type='AnonGameServer', universe='Public', instance=1234)}
        """
        resp = self.steam.unified_messages.send_and_wait(
            "GameServers.GetServerSteamIDsByIP#1", {
                "server_ips": server_ips,
            },
            timeout=30)

        if resp is None: return None

        return {
            server.addr: SteamID(server.steamid)
            for server in resp.servers
        }
Пример #17
0
    def get_ips_from_steamid(self, server_steam_ids):
        """Resolve IPs from SteamIDs

        :param server_steam_ids: a list of steamids
        :type server_steam_ids: list
        :return: map of ips to steamids
        :rtype: dict

        Sample response:

        .. code:: python

            {SteamID(id=123456, type='AnonGameServer', universe='Public', instance=1234): '1.2.3.4:27060'}
        """
        resp = self.steam.unified_messages.send_and_wait(
            "GameServers.GetServerIPsBySteamID#1", {
                "server_steamids": server_steam_ids,
            },
            timeout=30)

        if resp is None: return None

        return {
            SteamID(server.steamid): server.addr
            for server in resp.servers
        }
Пример #18
0
    def get_steamids_from_ips(self, server_ips, timeout=30):
        """Resolve SteamIDs from IPs

        :param steam_ids: a list of ips (e.g. ``['1.2.3.4:27015',...]``)
        :type  steam_ids: list
        :param timeout: (optional) timeout for request in seconds
        :type  timeout: int
        :return: map of steamids to ips
        :rtype: dict
        :raises: :class:`.SteamError`

        Sample response:

        .. code:: python

            {'1.2.3.4:27060': SteamID(id=123456, type='AnonGameServer', universe='Public', instance=1234)}
        """
        resp = self._s.send_um_and_wait("GameServers.GetServerSteamIDsByIP#1",
                                        {"server_ips": server_ips},
                                        timeout=timeout,
                                        )
        if resp is None:
            return None
        if resp.header.eresult != EResult.OK:
            raise SteamError(resp.header.error_message, resp.header.eresult)

        return {server.addr: SteamID(server.steamid) for server in resp.body.servers}
Пример #19
0
    def get_server_list(self, filter_text, max_servers=10, timeout=20):
        """
        Get list of servers. Works similiarly to :meth:`query`, but the response has more details.

        :param filter_text: filter for servers
        :type  filter_text: str
        :param max_servers: (optional) number of servers to return
        :type  max_servers: int
        :param timeout: (optional) timeout for request in seconds
        :type  timeout: int
        :returns: list of servers, see below. (``None`` is returned steam doesn't respond)
        :rtype: :class:`list`, :class:`None`
        :raises: :class:`.SteamError`


        Sample response:

        .. code:: python

            [{'addr': '1.2.3.4:27067',
              'appid': 730,
              'bots': 0,
              'dedicated': True,
              'gamedir': 'csgo',
              'gameport': 27067,
              'gametype': 'valve_ds,empty,secure',
              'map': 'de_dust2',
              'max_players': 10,
              'name': 'Valve CS:GO Asia Server (srcdsXXX.XXX.XXX)',
              'os': 'l',
              'players': 0,
              'product': 'csgo',
              'region': 5,
              'secure': True,
              'steamid': SteamID(id=3279818759, type='AnonGameServer', universe='Public', instance=7011),
              'version': '1.35.4.0'}
            ]
        """
        resp = self._s.send_um_and_wait("GameServers.GetServerList#1",
                                        {
                                         "filter": filter_text,
                                         "limit": max_servers,
                                        },
                                        timeout=20,
                                        )

        if resp is None:
            return None
        if resp.header.eresult != EResult.OK:
            raise SteamError(resp.header.error_message, resp.header.eresult)

        resp = proto_to_dict(resp.body)

        if not resp:
            return []
        else:
            for server in resp['servers']:
                server['steamid'] = SteamID(server['steamid'])

            return resp['servers']
Пример #20
0
    def get_ips_from_steamids(self, server_steam_ids, timeout=30):
        """Resolve IPs from SteamIDs

        :param server_steam_ids: a list of steamids
        :type  server_steam_ids: list
        :param timeout: (optional) timeout for request in seconds
        :type  timeout: int
        :return: map of ips to steamids
        :rtype: dict
        :raises: :class:`.UnifiedMessageError`

        Sample response:

        .. code:: python

            {SteamID(id=123456, type='AnonGameServer', universe='Public', instance=1234): '1.2.3.4:27060'}
        """
        resp, error = self._um.send_and_wait(
            "GameServers.GetServerIPsBySteamID#1",
            {"server_steamids": server_steam_ids},
            timeout=timeout,
        )
        if error:
            raise error
        if resp is None:
            return None

        return {
            SteamID(server.steamid): server.addr
            for server in resp.servers
        }
Пример #21
0
    def create_account(self, account_name, password, email=''):
        """Create a new Steam account

        :param account_name: desired account name
        :type  account_name: :class:`str`
        :param password: desired password
        :type  password: :class:`str`
        :param email: desired email
        :type  email: :class:`str`
        :return: (EResult, SteamID)
        :rtype: :class:`tuple`
        """
        message = MsgProto(EMsg.ClientCreateAccountProto)
        message.body.account_name = account_name
        message.body.password = password

        if email:
            message.body.email = email

        resp = self.send_job_and_wait(message, timeout=10)

        if resp is None:
            return EResult.Timeout, None
        else:
            return EResult(
                resp.eresult), SteamID(resp.steamid) if resp.steamid else None
Пример #22
0
    def _handle_logon(self, msg):
        result = msg.body.eresult

        if result in (EResult.TryAnotherCM, EResult.ServiceUnavailable):
            self.cm_servers.mark_bad(self.current_server_addr)
            self.disconnect()
        elif result == EResult.OK:
            self._seen_logon = True

            self._LOG.debug("Logon completed")

            self.steam_id = SteamID(msg.header.steamid)
            self.session_id = msg.header.client_sessionid
            self.cell_id = msg.body.cell_id

            if self._heartbeat_loop:
                self._heartbeat_loop.kill()

            self._LOG.debug("Heartbeat started.")

            interval = msg.body.out_of_game_heartbeat_seconds
            self._heartbeat_loop = gevent.spawn(self.__heartbeat, interval)
        else:
            self.emit(self.EVENT_ERROR, EResult(result))
            self.disconnect()
Пример #23
0
def resolve_steam_vanity_url(handle):
    response = api.call("ISteamUser.ResolveVanityURL",
                        vanityurl=handle,
                        url_type=1)

    if response["response"]["success"] == 1:
        return SteamID(response["response"]["steamid"]).as_32
Пример #24
0
 async def link(self, ctx: commands.Context, steamID_input: str):
     steamID = SteamID(steamID_input)
     if not steamID.is_valid():
         steamID = from_url(steamID_input, http_timeout=15)
         if steamID is None:
             steamID = from_url(
                 f'https://steamcommunity.com/id/{steamID_input}/',
                 http_timeout=15)
             if steamID is None:
                 raise commands.UserInputError(
                     message='Please enter a valid SteamID or community url.'
                 )
     db = Database('sqlite:///main.sqlite')
     await db.connect()
     await db.execute(
         '''
                     REPLACE INTO users (discord_id, steam_id)
                     VALUES( :discord_id, :steam_id )
                     ''', {
             "discord_id": str(ctx.author.id),
             "steam_id": str(steamID.as_steam2_zero)
         })
     embed = discord.Embed(
         description=
         f'Connected {ctx.author.mention} \n `{steamID.as_steam2}`',
         color=0x00FF00)
     await ctx.send(embed=embed)
Пример #25
0
 def test_as_steam3(self):
     self.assertEqual(SteamID('[U:1:1234]').as_steam3, '[U:1:1234]')
     self.assertEqual(SteamID('[U:1:1234:56]').as_steam3, '[U:1:1234:56]')
     self.assertEqual(SteamID('[g:1:4]').as_steam3, '[g:1:4]')
     self.assertEqual(SteamID('[A:1:1234:567]').as_steam3, '[A:1:1234:567]')
     self.assertEqual(SteamID('[G:1:1234:567]').as_steam3, '[G:1:1234]')
     self.assertEqual(SteamID('[T:1:1234]').as_steam3, '[T:1:1234]')
     self.assertEqual(SteamID('[c:1:1234]').as_steam3, '[c:1:1234]')
     self.assertEqual(SteamID('[L:1:1234]').as_steam3, '[L:1:1234]')
def main(local_mode = True):
    try:
        steam_path = SteamDataReader.get_steam_installpath()
    except:
        print("Could not find steam install path")
        sys.exit(1)
    print("Steam path:",steam_path)

    

    if local_mode:
        steam_data_reader = SteamDataReaderLocal(steam_path)
        try:
            steamid = steam_data_reader.get_steam_id()
            if not steamid.is_valid():
                steamid = SteamID(input_steamid())
            if not steamid.is_valid():
                print("Invalid steam id")
                sys.exit(2)
            print("SteamID:",steamid.as_32)
            
            
        except Exception as error:
            print(error)
            print("Switch to remote mode")
            local_mode = False


    if not local_mode:
        client = SteamClient()
        if client.cli_login() != EResult.OK:
            print("Login Error")
            sys.exit(3)
        else:
            print("Login Success")

        steam_data_reader = SteamDataReaderRemote(client)

        steamid = client.steam_id
        print("SteamID:",steamid.as_32)
        
    steam_grid_path = STEAM_GRIDPATH.format(steam_path,steamid.as_32)
    if not os.path.isdir(steam_grid_path):
        os.mkdir(steam_grid_path)
    print("Steam grid path:",steam_grid_path)
    missing_cover_app_dict =  steam_data_reader.get_missing_cover_app_dict(not local_mode)
    
    print("Total games missing cover in library:",len(missing_cover_app_dict))
    local_cover_appids = {int(file[:len(file)-5]) for file in os.listdir(steam_grid_path) if re.match(r"^\d+p.(png|jpg)$",file)}
    print("Total local covers found:",len(local_cover_appids))
    local_missing_cover_appids = missing_cover_app_dict.keys() - local_cover_appids
    print("Total missing covers locally:",len(local_missing_cover_appids))
    
    print("Finding covers from steamgriddb.com")
    local_missing_cover_appids = list(local_missing_cover_appids)
    local_missing_cover_appids.sort()
    
    total_downloaded = asyncio.run(download_covers_temp(local_missing_cover_appids,steam_grid_path,missing_cover_app_dict))
    print("Total cover downloaded:",total_downloaded)
Пример #27
0
    def test_from_invite_code(self):
        self.assertIsNone(steamid.from_invite_code('invalid_format'))
        self.assertIsNone(
            steamid.from_invite_code('https://steamcommunity.com/p/cv-dgb'))
        self.assertIsNone(steamid.from_invite_code('b'))
        self.assertIsNone(
            steamid.from_invite_code('aaaaaaaaaaaaaaaaaaaaaaaaa'))

        self.assertEqual(steamid.from_invite_code('c', EUniverse.Beta),
                         SteamID(1, EType.Individual, EUniverse.Beta, 1))
        self.assertEqual(steamid.from_invite_code('c'),
                         SteamID(1, EType.Individual, EUniverse.Public, 1))
        self.assertEqual(
            steamid.from_invite_code('http://s.team/p/c', EUniverse.Beta),
            SteamID(1, EType.Individual, EUniverse.Beta, 1))
        self.assertEqual(steamid.from_invite_code('http://s.team/p/c'),
                         SteamID(1, EType.Individual, EUniverse.Public, 1))
        self.assertEqual(
            steamid.from_invite_code('https://s.team/p/cv-dgb'),
            SteamID(123456, EType.Individual, EUniverse.Public, 1))
        self.assertEqual(
            steamid.from_invite_code('https://s.team/p/cv-dgb/ABCDE12354'),
            SteamID(123456, EType.Individual, EUniverse.Public, 1))
        self.assertEqual(
            steamid.from_invite_code('http://s.team/p/wwww-wwww'),
            SteamID(4294967295, EType.Individual, EUniverse.Public, 1))
    async def profile(self, ctx, user: discord.Member = ''):
        if user == '':
            member = ctx.author
        else:
            member = user

        if not mydb.is_connected():
            mydb.connect()

        embed = discord.Embed(color=discord.Color.orange())
        cursor.execute(
            "SELECT * FROM players_activity WHERE discord_id = '%s'" %
            member.id)
        activity_list = cursor.fetchall()
        if activity_list:
            group = SteamID(activity_list[0][0])
            session = aiohttp.ClientSession()
            response = await session.get(
                f'http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key=892E7FF7A834087D6E16F9F073D73F67&steamids={group.as_64}'
            )
            data = json.loads(await response.text())
            await session.close()
            steam_name = data['response']['players'][0]['personaname']
            steam_profile_pic = data['response']['players'][0]['avatarfull']
            steam_id_2 = group.as_steam2
            steam_profile_url = group.community_url
            month_activity = sum([day[2] for day in activity_list])
            act = time_conv(month_activity)  # This change
            date_list = [day[1] for day in activity_list]
            embed.set_author(name=f"{member.name}'s profile.")
            embed.description = f"**[Steam Profile]({steam_profile_url})**"
            embed.add_field(name=':label:SteamID',
                            value=f'**`{steam_id_2}`**',
                            inline=False)
            embed.add_field(name=':bust_in_silhouette:Steam Name',
                            value=f'**{steam_name}**',
                            inline=False)
            embed.add_field(name=':clock4:Last activity',
                            value=f'**{max(date_list)}**',
                            inline=True)
            embed.add_field(name=':hourglass_flowing_sand:Activity past month',
                            value=f'**{act}**',
                            inline=True)
            embed.add_field(
                name=':warning:Giveaway Ban',
                value=
                f'**{":x:Yes" if is_banned(member.roles) else ":white_check_mark:No"}**',
                inline=True)
            embed.set_thumbnail(url=steam_profile_pic)
        else:
            if user == '':
                embed.description = f"{ctx.author.name}. I could not find your profile. Maybe you haven't joined our servers in more than a month\nOr you haven't applied yet. Type `{ctx.prefix}apply [steamurl]`"
            else:
                embed.description = f"{ctx.author.name}. I could not find this user profile. Maybe he hasn't joined our servers in more than a month\n"
            embed.color = discord.Color.red()

        await ctx.send(embed=embed)
Пример #29
0
 def test_arg_steam32(self):
     self.compare(SteamID(1), [1, EType.Individual, EUniverse.Public, 1])
     self.compare(SteamID('1'), [1, EType.Individual, EUniverse.Public, 1])
     self.compare(SteamID(12), [12, EType.Individual, EUniverse.Public, 1])
     self.compare(SteamID('12'),
                  [12, EType.Individual, EUniverse.Public, 1])
     self.compare(SteamID(123),
                  [123, EType.Individual, EUniverse.Public, 1])
     self.compare(SteamID('123'),
                  [123, EType.Individual, EUniverse.Public, 1])
     self.compare(SteamID(12345678),
                  [12345678, EType.Individual, EUniverse.Public, 1])
     self.compare(SteamID('12345678'),
                  [12345678, EType.Individual, EUniverse.Public, 1])
     self.compare(SteamID(0xffffFFFF),
                  [0xffffFFFF, EType.Individual, EUniverse.Public, 1])
     self.compare(SteamID(str(0xffffFFFF)),
                  [0xffffFFFF, EType.Individual, EUniverse.Public, 1])
Пример #30
0
 def test_rich_comperison(self):
     for test_value in [SteamID(5), 5]:
         self.assertFalse(SteamID(10) == test_value)
         self.assertTrue(SteamID(10) != test_value)
         self.assertTrue(SteamID(10) > test_value)
         self.assertTrue(SteamID(10) >= test_value)
         self.assertFalse(SteamID(10) < test_value)
         self.assertFalse(SteamID(10) <= test_value)