SharpBit / brawlstats

(A)sync Python API wrapper for the Brawl Stars API
https://brawlstats.rtfd.io/
MIT License
101 stars 24 forks source link

brawlstats.errors.NotFoundError: An incorrect tag has been passed.Invalid characters: O, O #91

Open HumanBot000 opened 3 months ago

HumanBot000 commented 3 months ago

Describe the bug I am getting this error, but I am providing a valid tag. Even the tests on the documentation website of bs API work, but not via the python Package

Full Code

    async def user(self, interaction, tag: str = nextcord.SlashOption(
        name="tag",
        name_localizations={Locale.de: "kürzel"},
        description="Your Brawlstars-Tag found under your profile picture in your player profile (starting with a # )",
        description_localizations={
            Locale.de: "Dein Spielerkürzel (befindet sich unter deinem Profilbild in deinem Spielerprofil (beginnt mit einem # ))", Locale.en_US: "Your Brawlstars Tag found under your profile picture in your player profile (starting with a # )"},
        required=True
    )):
        await interaction.response.defer()
        if not tag.startswith("#"):
            tag = f"#{tag}"
        load_dotenv()
        client = brawlstats.Client(token=os.environ.get("BRAWLSTARSAPIKEY"), is_async=True)
        player: brawlstats.Player = await client.get_player(tag)
        if interaction.locale == Locale.de:
            pass
        else:
            embed = nextcord.Embed(title=f"{player.name} ({player.name_color})", description=tag,
                                   color=nextcord.Color.yellow())

           ...

Expected behavior Embed with player stats

Actual behavior

player: brawlstats.Player = await client.get_player(tag) -> brawlstats.errors.NotFoundError: An incorrect tag has been passed.Invalid characters: O, O
Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x0000025F20805DB0>
Unclosed connector
connections: ['[(<aiohttp.client_proto.ResponseHandler object at 0x0000025F207A2740>, 83705.031)]']
connector: <aiohttp.connector.TCPConnector object at 0x0000025F20807820>

Additional context Python Version: 3.10 brawlstats Version: 4.1.1 OS (and version): Windows 11

SharpBit commented 3 months ago

Use a zero (0), not a capital o (O). O is not a valid character for tags, but 0 is.