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

get_all_members() does not return all the Members the client can see. #175

Closed Kuyumee closed 2 years ago

Kuyumee commented 2 years ago

Summary

get_all_members() does not return all the Members the client can see.

Reproduction Steps

  1. call get_all_members()
  2. create a loop that will save every member on a new line on a file
  3. see file lines
  4. despair

Code

class MyClient(discord.Client):
    async def on_ready(self):
        users = self.get_all_members()

        with open("cache.txt", "a", encoding="utf-8") as f:
            for user in users:
                f.write(f'{user} || {user.activities} || {user.raw_status}\n')
        f.close()

Expected Results

All 250,000+ Members in the file

Actual Results

Only exactly 11,413 Members in the file

System Information

Checklist

Additional Information

No response

TheOnlyWayUp commented 2 years ago

Discord doesn't send you member information directly, users don't have a special endpoint for this like bots do. Instead, user accounts need to subscribe to member events to piece it together, and as you can see from other issues, this functionality is currently broken.

Extras - https://stackoverflow.com/questions/66413043/discord-selfbot-cant-get-all-members-just-part-of-it

dolfies commented 2 years ago

The functionality works ok-ish most of the time, you just need to properly configure the GuildSubscriptionOptions or manually run guild.subscribe() for every guild you want members from.

2.0's guild member fetching will be far more robust.