brawlstats icon indicating copy to clipboard operation
brawlstats copied to clipboard

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

Open HumanBot000 opened this issue 1 year ago • 1 comments

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

HumanBot000 avatar Aug 03 '24 20:08 HumanBot000