-
Notifications
You must be signed in to change notification settings - Fork 82
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
Guild members not available in GuildCreateEvent #945
Comments
You can access the members field using the gateway API, however when using kord-core this chunking should be done by the cache, maybe it's worth reopening #55 kord.gateway.events.filterIsInstance<GuildCreate>.collect { event ->
event.guild.members.value
} |
I am using And yes, exactly what I'm trying to do is:
|
You were right in doing that I am not sure why #55 got closed (@lukellmann do you know why?) however what you're describing is exactly what the cache should already do automatically (if you specified the right intent), is there a reason why the current cache behavior doesn't work for you? |
sorry, i don't 😅 |
Closing this due to inactivity, feel free to reopen; most of this should be covered by #55 |
The Guild Create event in Discord provides additional data besides the data usually found on guild objects. Among this data is the
members
property.This property is useful to know if a guild is "chunked" or not (by comparing
memberCount
with the size ofmembers
you can know if the guild has all members populated or not). This way you can request members only for the guilds that actually needed, saving you a lot of requests in bots (mine is in 15k servers).The issue is that there is no way to access this member list in the event.
Guild.members
is a flow, and relies on cache, besides usually throwingConcurrentModificationException
just by trying to count its values. I'm currently doing it based onisLarge
property, which should be good enough, but havingmembers
available could potentially save even more requests due to large guilds that happen to bring the entire member list due to meeting the other conditions.By looking at the code, I believe this is probably not easy, and might need to introduce a
Guild
subclass to be used for this event?.The text was updated successfully, but these errors were encountered: