Skip to content
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

Support Gateway Intents #1566

Merged
merged 5 commits into from
Jun 18, 2020
Merged

Support Gateway Intents #1566

merged 5 commits into from
Jun 18, 2020

Conversation

moiph
Copy link
Contributor

@moiph moiph commented Jun 14, 2020

Allows supplying gateway intents through DiscordSocketConfig which will be passed through the IDENTIFY payload, in order to choose what gateway events you want to receive.

Allows supplying gateway intents through DiscordSocketConfig which will be passed through the IDENTIFY payload, in order to choose what gateway events you want to receive.
@@ -517,7 +519,7 @@ private async Task ProcessMessageAsync(GatewayOpCode opCode, int? seq, string ty
_sessionId = null;
_lastSeq = 0;

await ApiClient.SendIdentifyAsync(shardID: ShardId, totalShards: TotalShards).ConfigureAwait(false);
await ApiClient.SendIdentifyAsync(shardID: ShardId, totalShards: TotalShards, guildSubscriptions: _guildSubscriptions, gatewayIntents: _gatewayIntents).ConfigureAwait(false);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was not clear to me why guildSubscriptions was omitted here previously...

@moiph
Copy link
Contributor Author

moiph commented Jun 14, 2020

From initial testing on my bot I'm seeing about a 25% reduction in CPU usage and ~3.5GB of memory savings (~60K guilds) from trimming down to GUILDS, GUILD_MEMBERS, GUILD_BANS, GUILD_VOICE_STATES, GUILD_MESSAGES, GUILD_MESSAGE_REACTIONS, DIRECT_MESSAGES

src/Discord.Net.Core/GatewayIntents.cs Outdated Show resolved Hide resolved
src/Discord.Net.Core/GatewayIntents.cs Outdated Show resolved Hide resolved
@foxbot foxbot merged commit d5d10d3 into discord-net:dev Jun 18, 2020
anonymousheadless pushed a commit to anonymousheadless/Discord.Net that referenced this pull request Mar 29, 2021
* Support Gateway Intents

Allows supplying gateway intents through DiscordSocketConfig which will be passed through the IDENTIFY payload, in order to choose what gateway events you want to receive.

* Fixing enum casing

* Feedback

* Updating comment for GuildSubscriptions

* Comment update
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants