question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cache conflict when using Guilds and GuildMembers intents together

See original GitHub issue

I’ve attached a project that just connects and prints the member list from the ready event.

On the discord end, I’ve turned on the GUILD_MEMBERS flag.

I’m finding that if I configure Kord with just +Intent.GuildMember then I get all the members back from guild.members against my test server. But if I add +Intent.Guild it only returns the bot’s own user.

	val kord = Kord(botToken) {
		intents {
			+Intent.Guilds // If uncommented then the full member list isn't seen
			+Intent.GuildMembers
		}
	}

It’s weird to turn on an intent and get less data. The difference seems to be that Guild is causing the cache to be initialized prematurely. I’m wondering if that’s supposed to happen or how I should work around it. This is kind of a one-off; I don’t necessarily want the whole member list in cache, but if I ask for it, it’s surprising if I don’t get it. I guess I can use RestEntitySupplier directly…

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:12 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
HopeBaroncommented, Jan 14, 2021

You can view #55 for updates on the matters. Your question has sparked a discussion And it seems better in your case to just use the GUILD_PRESENCE intent which will provide us with the members in GuildCreateEvent, which in turn will allow us to cache them

If you are using Gateway Intents, members and presences returned in this event will only contain your bot and users in voice channels unless you specify the GUILD_PRESENCES intent.

look more into it here: https://discord.com/developers/docs/topics/gateway#guilds

0reactions
HopeBaroncommented, Mar 17, 2021

The issue has been closed due to inactivity, feel free to open it again if you face further problems.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Gateway Intents and Member Cache Policy - GitHub
Under the Privileged Gateway Intents section, enable SERVER MEMBERS INTENT. If you use these intents you are limited to 100 guilds on your...
Read more >
Gateway Intents and Member Cache Policy - JDA Wiki
To properly maintain a cache of all members, you need the GUILD_MEMBERS intent, because it will enable the GuildMemberRemoveEvent to remove members from...
Read more >
None of my discord.js guildmember events are emitting, my ...
GUILD_PRESENCES. member and user caches are empty (or very close to it) on startup; Guild.memberCount returns count as of ready · GUILD_MEMBERS.
Read more >
Guild (JDA 4.4.0_352 API)
Modifier and Type Method Description default MemberAction addMember​(String accessToken, User user) Adds the provided us... Task cancelRequestToSpeak() Cancels the Request‑t... ChannelAction createCategory​(String name) Creates a new...
Read more >
Gateway Intents - discord.js Guide
The GuildMembers intent keeps cached guild members up to date, including changes to their roles and permissions, nickname etc. Note that you ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found