dolfies / discord.py-self

A fork of the popular discord.py for user accounts.
https://discordpy-self.rtfd.io/en/latest/
MIT License
717 stars 163 forks source link

[BUG] I cannot get owners of guilds that have more than 10 members and aren't owned by me. #64

Closed TigranKhachatryan0 closed 3 years ago

TigranKhachatryan0 commented 3 years ago
for i in client.guilds:
    if i.member_count>10:
        if not(str(i.owner) == str(client.user)):
            print(str(i.owner) == "None" or str(i.owner) == "None#0")
True
True
True
True
True
True
True
True
True
True
True
True
True
True
True
TigranKhachatryan0 commented 3 years ago

It's worth noting that whenever str(i.owner)=="None#0", one can get the wanted result by doing the following dirty and slow (at least for me) profile "hack":

if str(i.owner) == "None#0":
    UserProfile=await bot.fetch_user_profile(i.owner.id)
    print(str(UserProfile.user))

Reminds me of LazyUsers when trying to fetch buddy list (known bug, right? doesn't really matter since you're getting rid of them in the next release), but these are Members (when "None#0", of course)... Otherwise i.owner is None

TigranKhachatryan0 commented 3 years ago
async def testing_command():
    for i in client.guilds:
        if i.member_count>10:
            if not(str(i.owner) == str(client.user)):
                UserProfile=await client.fetch_user_profile(i.owner_id)
                print(str(UserProfile.user))

Okay, this is working. But still, just like the buddy list, this is slow to load.

caiocinel commented 3 years ago

image

Github Copilot recommended this method to me, and it actually returns the server owner ID, just use fetch_user_profile to get their information.

This test was done on a considerably large server (50,000 members)

dolfies commented 3 years ago

Unfortunately, Discord just doesn't really provide this information seperately. The next version will have a method to subscribe to a guild's member list, which will include the guild owner if they are not offline.

dolfies commented 3 years ago

I noticed that this information isn't always provided to bots, either (i.e. you need the members intent). So, this is working as intended.