Browse Source

fixed conflicts

pull/1383/head
Casino Boyale 6 years ago
parent
commit
70f4bb2f54
5 changed files with 14 additions and 5 deletions
  1. +2
    -0
      src/Discord.Net.WebSocket/API/Gateway/IdentifyParams.cs
  2. +1
    -0
      src/Discord.Net.WebSocket/DiscordSocketApiClient.cs
  3. +2
    -0
      src/Discord.Net.WebSocket/DiscordSocketClient.cs
  4. +8
    -3
      src/Discord.Net.WebSocket/DiscordSocketConfig.cs
  5. +1
    -2
      test/Discord.Net.Tests.Unit/EmbedBuilderTests.cs

+ 2
- 0
src/Discord.Net.WebSocket/API/Gateway/IdentifyParams.cs View File

@@ -17,5 +17,7 @@ namespace Discord.API.Gateway
public Optional<int[]> ShardingParams { get; set; }
[JsonProperty("presence")]
public Optional<StatusUpdateParams> Presence { get; set; }
[JsonProperty("guild_subscriptions")]
public Optional<bool> GuildSubscriptions { get; set; }
}
}

+ 1
- 0
src/Discord.Net.WebSocket/DiscordSocketApiClient.cs View File

@@ -245,6 +245,7 @@ namespace Discord.API
Properties = props,
LargeThreshold = largeThreshold,
Presence = args
GuildSubscriptions = guildSubscriptions
};
if (totalShards > 1)
msg.ShardingParams = new int[] { shardID, totalShards };


+ 2
- 0
src/Discord.Net.WebSocket/DiscordSocketClient.cs View File

@@ -43,6 +43,7 @@ namespace Discord.WebSocket
private DateTimeOffset? _statusSince;
private RestApplication _applicationInfo;
private bool _isDisposed;
private bool _guildSubscriptions;

/// <summary>
/// Provides access to a REST-only client with a shared state from this client.
@@ -135,6 +136,7 @@ namespace Discord.WebSocket
State = new ClientState(0, 0);
Rest = new DiscordSocketRestClient(config, ApiClient);
_heartbeatTimes = new ConcurrentQueue<long>();
_guildSubscriptions = config.GuildSubscriptions;

_stateLock = new SemaphoreSlim(1, 1);
_gatewayLogger = LogManager.CreateLogger(ShardId == 0 && TotalShards == 1 ? "Gateway" : $"Shard #{ShardId}");


+ 8
- 3
src/Discord.Net.WebSocket/DiscordSocketConfig.cs View File

@@ -77,7 +77,7 @@ namespace Discord.WebSocket
/// <para>
/// By default, the Discord gateway will only send offline members if a guild has less than a certain number
/// of members (determined by <see cref="LargeThreshold"/> in this library). This behaviour is why
/// sometimes a user may be missing from the WebSocket cache for collections such as
/// sometimes a user may be missing from the WebSocket cache for collections such as
/// <see cref="Discord.WebSocket.SocketGuild.Users"/>.
/// </para>
/// <para>
@@ -86,7 +86,7 @@ namespace Discord.WebSocket
/// downloaded to the WebSocket cache.
/// </para>
/// <para>
/// For more information, please see
/// For more information, please see
/// <see href="https://discordapp.com/developers/docs/topics/gateway#request-guild-members">Request Guild Members</see>
/// on the official Discord API documentation.
/// </para>
@@ -95,7 +95,7 @@ namespace Discord.WebSocket
/// traffic. If you are using the command system, the default user TypeReader may fail to find the user
/// due to this issue. This may be resolved at v3 of the library. Until then, you may want to consider
/// overriding the TypeReader and use
/// <see cref="DiscordRestClient.GetUserAsync(System.UInt64,Discord.RequestOptions)"/>
/// <see cref="DiscordRestClient.GetUserAsync(System.UInt64,Discord.RequestOptions)"/>
/// or <see cref="DiscordRestClient.GetGuildUserAsync"/>
/// as a backup.
/// </note>
@@ -119,6 +119,11 @@ namespace Discord.WebSocket
/// </summary>
public bool? ExclusiveBulkDelete { get; set; } = null;

/// <summary>
/// Gets or sets enabling dispatching of guild subscription events e.g. presence and typing events.
/// </summary>
public bool GuildSubscriptions { get; set; } = true;

/// <summary>
/// Initializes a default configuration.
/// </summary>


+ 1
- 2
test/Discord.Net.Tests.Unit/EmbedBuilderTests.cs View File

@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using System.Text;
using Xunit;

namespace Discord
@@ -250,7 +249,7 @@ namespace Discord
.WithFooter("This is the footer", url)
.WithImageUrl(url)
.WithThumbnailUrl(url)
.WithTimestamp(DateTime.MinValue)
.WithTimestamp(DateTimeOffset.MinValue)
.WithTitle("This is the title")
.WithUrl(url)
.AddField("Field 1", "Inline", true)


Loading…
Cancel
Save