feature: Support Gateway Intents (#1566)
* 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
This commit is contained in:
@@ -209,7 +209,7 @@ namespace Discord.API
|
||||
await _sentGatewayMessageEvent.InvokeAsync(opCode).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
public async Task SendIdentifyAsync(int largeThreshold = 100, int shardID = 0, int totalShards = 1, bool guildSubscriptions = true, RequestOptions options = null)
|
||||
public async Task SendIdentifyAsync(int largeThreshold = 100, int shardID = 0, int totalShards = 1, bool guildSubscriptions = true, GatewayIntents? gatewayIntents = null, RequestOptions options = null)
|
||||
{
|
||||
options = RequestOptions.CreateOrClone(options);
|
||||
var props = new Dictionary<string, string>
|
||||
@@ -220,12 +220,16 @@ namespace Discord.API
|
||||
{
|
||||
Token = AuthToken,
|
||||
Properties = props,
|
||||
LargeThreshold = largeThreshold,
|
||||
GuildSubscriptions = guildSubscriptions
|
||||
LargeThreshold = largeThreshold
|
||||
};
|
||||
if (totalShards > 1)
|
||||
msg.ShardingParams = new int[] { shardID, totalShards };
|
||||
|
||||
if (gatewayIntents.HasValue)
|
||||
msg.Intents = (int)gatewayIntents.Value;
|
||||
else
|
||||
msg.GuildSubscriptions = guildSubscriptions;
|
||||
|
||||
await SendGatewayAsync(GatewayOpCode.Identify, msg, options: options).ConfigureAwait(false);
|
||||
}
|
||||
public async Task SendResumeAsync(string sessionId, int lastSeq, RequestOptions options = null)
|
||||
|
||||
Reference in New Issue
Block a user