Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

player.clan_rank returning NoneType #109

Closed
bobflem opened this issue Jul 20, 2022 · 8 comments
Closed

player.clan_rank returning NoneType #109

bobflem opened this issue Jul 20, 2022 · 8 comments

Comments

@bobflem
Copy link

bobflem commented Jul 20, 2022

Example:

import coc
client = coc.login("email", "password")
async def main():
    clan = await client.get_clan('#8U9JL80J')
    async for player in clan.get_detailed_members():
        print(type(player.clan_rank))
client.loop.run_until_complete(main())
client.close()

returns
<class 'NoneType'> for every clan member

@majordoobie
Copy link
Collaborator

What happens when you print player

@bobflem
Copy link
Author

bobflem commented Jul 20, 2022

That returns <class 'coc.players.Player'>

I'm able to return player.name and other player properties as well

@majordoobie
Copy link
Collaborator

Can you see if it works if you do the following:

import coc
client = coc.login("email", "password")
async def main():
    clan = await client.get_clan('#8U9JL80J')
    for player in clan.members:
        print(type(player.clan_rank))

client.loop.run_until_complete(main())
client.close()

@Bla005-1
Copy link

Looking at the docs, I don't think you need to iterate through Clan.get_detailed_members, instead iterate through Clan.members. The difference is detailed members returns a Player object while members returns a ClanMember object.

@majordoobie
Copy link
Collaborator

majordoobie commented Jul 20, 2022

Looking at the docs, I don't think you need to iterate through Clan.get_detailed_members, instead iterate through Clan.members. The difference is detailed members returns a Player object while members returns a ClanMember object.

Yeah, just saw that. But it looks like it is intended to return the ClanMember if available but it fails. At least from reading the source.

@bobflem
Copy link
Author

bobflem commented Jul 20, 2022

Can you see if it works if you do the following:

import coc
client = coc.login("email", "password")
async def main():
    clan = await client.get_clan('#8U9JL80J')
    for player in clan.members:
        print(type(player.clan_rank))

client.loop.run_until_complete(main())
client.close()

Returns ints! Makes sense, thanks for figuring it out

@majordoobie
Copy link
Collaborator

Awesome! Please keep the issue open so we can fix the bug.

@majordoobie
Copy link
Collaborator

Issue has been resolved with version v2.1.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants