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

Fix guild subscriptions to work as intended #87

Closed jribbink closed 3 years ago

jribbink commented 3 years ago

Summary

Closes #84

General Info

dolfies commented 3 years ago

This removes a lot of safeguards for no apparent reason... Do you know which one was actually causing your issue?

jribbink commented 3 years ago

This removes a lot of safeguards for no apparent reason... Do you know which one was actually causing your issue?

I simply set this up to call ws.request_lazy_guild based off of member_count instead of _online_count (not sure why any of this was based off of the online members when we are trying to fetch all members of the server?). Additionally, there was an arbitrary ws.request_lazy_guild that was being called arbitrarily for the range [[0, 99]] at the start of execution and some sequence of events would cause it to return after this arbitrary fetch was complete.

Instead, I opted to simply ws.request_lazy_guild for all ranges of 100 in sets of 2 between 0, member_count

jribbink commented 3 years ago

I'm not entirely sure what safeguards you are talking about

jribbink commented 3 years ago

The code does not work in its current state and there is no ability to get all members on the server.

caiocinel commented 3 years ago

The code does not work in its current state and there is no ability to get all members on the server.

image Something is wrong with your code, I did some tests and I always got success, on both large and small servers.

I'm not entirely sure what safeguards you are talking about

Things that prevent what no one wants to happen

dolfies commented 3 years ago

I simply set this up to call ws.request_lazy_guild based off of member_count instead of _online_count (not sure why any of this was based off of the online members when we are trying to fetch all members of the server?).

This might be an actual problem. IIRC it should be based on _online_count for large servers, and _member_count for not large servers.

Additionally, there was an arbitrary ws.request_lazy_guild that was being called arbitrarily for the range [[0, 99]] at the start of execution and some sequence of events would cause it to return after this arbitrary fetch was complete.

That arbitrary call causes problems if it isn't there (it's what the client does as well). Discord's weird. This only returns after this if Guild.subscribe() was being called as part of the auto-guild subscription and the guild was not under the online threshold.

Closing for now, and I'll look into online vs member count.