| @@ -4,11 +4,12 @@ | |||||
| <AssemblyName>Discord.Net.Core</AssemblyName> | <AssemblyName>Discord.Net.Core</AssemblyName> | ||||
| <RootNamespace>Discord</RootNamespace> | <RootNamespace>Discord</RootNamespace> | ||||
| <Description>The core components for the Discord.Net library.</Description> | <Description>The core components for the Discord.Net library.</Description> | ||||
| <TargetFrameworks>net45;netstandard1.1;netstandard1.3</TargetFrameworks> | |||||
| <TargetFrameworks Condition=" '$(OS)' == 'Windows_NT' ">net45;netstandard1.1;netstandard1.3</TargetFrameworks> | |||||
| <TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netstandard1.1;netstandard1.3</TargetFrameworks> | |||||
| </PropertyGroup> | </PropertyGroup> | ||||
| <ItemGroup> | <ItemGroup> | ||||
| <PackageReference Include="Newtonsoft.Json" Version="10.0.2" /> | <PackageReference Include="Newtonsoft.Json" Version="10.0.2" /> | ||||
| <PackageReference Include="System.Collections.Immutable" Version="1.3.1" /> | <PackageReference Include="System.Collections.Immutable" Version="1.3.1" /> | ||||
| <PackageReference Include="System.Interactive.Async" Version="3.1.1" /> | <PackageReference Include="System.Interactive.Async" Version="3.1.1" /> | ||||
| </ItemGroup> | </ItemGroup> | ||||
| </Project> | |||||
| </Project> | |||||
| @@ -21,13 +21,13 @@ namespace Discord | |||||
| /// Returns <see langword="true"/> if this voice region is the closest to your machine. | /// Returns <see langword="true"/> if this voice region is the closest to your machine. | ||||
| /// </summary> | /// </summary> | ||||
| bool IsOptimal { get; } | bool IsOptimal { get; } | ||||
| /// <summary> | |||||
| /// Gets an example hostname for this voice region. | |||||
| /// <summary> | |||||
| /// Returns <see langword="true"/> if this is a deprecated voice region (avoid switching to these). | |||||
| /// </summary> | /// </summary> | ||||
| string SampleHostname { get; } | |||||
| /// <summary> | |||||
| /// Gets an example port for this voice region. | |||||
| bool IsDeprecated { get; } | |||||
| /// <summary> | |||||
| /// Returns <see langword="true"/> if this is a custom voice region (used for events/etc). | |||||
| /// </summary> | /// </summary> | ||||
| int SamplePort { get; } | |||||
| bool IsCustom { get; } | |||||
| } | } | ||||
| } | } | ||||
| @@ -4,9 +4,10 @@ | |||||
| <AssemblyName>Discord.Net.DebugTools</AssemblyName> | <AssemblyName>Discord.Net.DebugTools</AssemblyName> | ||||
| <RootNamespace>Discord</RootNamespace> | <RootNamespace>Discord</RootNamespace> | ||||
| <Description>A Discord.Net extension adding some helper classes for diagnosing issues.</Description> | <Description>A Discord.Net extension adding some helper classes for diagnosing issues.</Description> | ||||
| <TargetFrameworks>net45;netstandard1.3</TargetFrameworks> | |||||
| <TargetFrameworks Condition=" '$(OS)' == 'Windows_NT' ">net45;netstandard1.3</TargetFrameworks> | |||||
| <TargetFramework Condition=" '$(OS)' != 'Windows_NT' ">netstandard1.3</TargetFramework> | |||||
| </PropertyGroup> | </PropertyGroup> | ||||
| <ItemGroup> | <ItemGroup> | ||||
| <ProjectReference Include="..\Discord.Net.Core\Discord.Net.Core.csproj" /> | <ProjectReference Include="..\Discord.Net.Core\Discord.Net.Core.csproj" /> | ||||
| </ItemGroup> | </ItemGroup> | ||||
| </Project> | |||||
| </Project> | |||||
| @@ -1,4 +1,4 @@ | |||||
| #pragma warning disable CS1591 | |||||
| #pragma warning disable CS1591 | |||||
| using Newtonsoft.Json; | using Newtonsoft.Json; | ||||
| namespace Discord.API | namespace Discord.API | ||||
| @@ -13,9 +13,9 @@ namespace Discord.API | |||||
| public bool IsVip { get; set; } | public bool IsVip { get; set; } | ||||
| [JsonProperty("optimal")] | [JsonProperty("optimal")] | ||||
| public bool IsOptimal { get; set; } | public bool IsOptimal { get; set; } | ||||
| [JsonProperty("sample_hostname")] | |||||
| public string SampleHostname { get; set; } | |||||
| [JsonProperty("sample_port")] | |||||
| public int SamplePort { get; set; } | |||||
| [JsonProperty("deprecated")] | |||||
| public bool IsDeprecated { get; set; } | |||||
| [JsonProperty("custom")] | |||||
| public bool IsCustom { get; set; } | |||||
| } | } | ||||
| } | } | ||||
| @@ -6,5 +6,17 @@ using System.Runtime.CompilerServices; | |||||
| [assembly: InternalsVisibleTo("Discord.Net.Commands")] | [assembly: InternalsVisibleTo("Discord.Net.Commands")] | ||||
| [assembly: InternalsVisibleTo("Discord.Net.Tests")] | [assembly: InternalsVisibleTo("Discord.Net.Tests")] | ||||
| [assembly: TypeForwardedTo(typeof(Discord.Embed))] | |||||
| [assembly: TypeForwardedTo(typeof(Discord.EmbedBuilder))] | [assembly: TypeForwardedTo(typeof(Discord.EmbedBuilder))] | ||||
| [assembly: TypeForwardedTo(typeof(Discord.EmbedBuilderExtensions))] | [assembly: TypeForwardedTo(typeof(Discord.EmbedBuilderExtensions))] | ||||
| [assembly: TypeForwardedTo(typeof(Discord.EmbedAuthor))] | |||||
| [assembly: TypeForwardedTo(typeof(Discord.EmbedAuthorBuilder))] | |||||
| [assembly: TypeForwardedTo(typeof(Discord.EmbedField))] | |||||
| [assembly: TypeForwardedTo(typeof(Discord.EmbedFieldBuilder))] | |||||
| [assembly: TypeForwardedTo(typeof(Discord.EmbedFooter))] | |||||
| [assembly: TypeForwardedTo(typeof(Discord.EmbedFooterBuilder))] | |||||
| [assembly: TypeForwardedTo(typeof(Discord.EmbedImage))] | |||||
| [assembly: TypeForwardedTo(typeof(Discord.EmbedProvider))] | |||||
| [assembly: TypeForwardedTo(typeof(Discord.EmbedThumbnail))] | |||||
| [assembly: TypeForwardedTo(typeof(Discord.EmbedType))] | |||||
| [assembly: TypeForwardedTo(typeof(Discord.EmbedVideo))] | |||||
| @@ -4,7 +4,8 @@ | |||||
| <AssemblyName>Discord.Net.Rest</AssemblyName> | <AssemblyName>Discord.Net.Rest</AssemblyName> | ||||
| <RootNamespace>Discord.Rest</RootNamespace> | <RootNamespace>Discord.Rest</RootNamespace> | ||||
| <Description>A core Discord.Net library containing the REST client and models.</Description> | <Description>A core Discord.Net library containing the REST client and models.</Description> | ||||
| <TargetFrameworks>net45;netstandard1.1;netstandard1.3</TargetFrameworks> | |||||
| <TargetFrameworks Condition=" '$(OS)' == 'Windows_NT' ">net45;netstandard1.1;netstandard1.3</TargetFrameworks> | |||||
| <TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netstandard1.1;netstandard1.3</TargetFrameworks> | |||||
| </PropertyGroup> | </PropertyGroup> | ||||
| <ItemGroup> | <ItemGroup> | ||||
| <ProjectReference Include="..\Discord.Net.Core\Discord.Net.Core.csproj" /> | <ProjectReference Include="..\Discord.Net.Core\Discord.Net.Core.csproj" /> | ||||
| @@ -16,4 +17,4 @@ | |||||
| <ItemGroup Condition=" '$(TargetFramework)' == 'net45' "> | <ItemGroup Condition=" '$(TargetFramework)' == 'net45' "> | ||||
| <Reference Include="System.Net.Http" /> | <Reference Include="System.Net.Http" /> | ||||
| </ItemGroup> | </ItemGroup> | ||||
| </Project> | |||||
| </Project> | |||||
| @@ -1,4 +1,4 @@ | |||||
| using Discord.Rest; | |||||
| using Discord.Rest; | |||||
| using System.Diagnostics; | using System.Diagnostics; | ||||
| using Model = Discord.API.VoiceRegion; | using Model = Discord.API.VoiceRegion; | ||||
| @@ -7,11 +7,16 @@ namespace Discord | |||||
| [DebuggerDisplay("{DebuggerDisplay,nq}")] | [DebuggerDisplay("{DebuggerDisplay,nq}")] | ||||
| public class RestVoiceRegion : RestEntity<string>, IVoiceRegion | public class RestVoiceRegion : RestEntity<string>, IVoiceRegion | ||||
| { | { | ||||
| /// <inheritdoc /> | |||||
| public string Name { get; private set; } | public string Name { get; private set; } | ||||
| /// <inheritdoc /> | |||||
| public bool IsVip { get; private set; } | public bool IsVip { get; private set; } | ||||
| /// <inheritdoc /> | |||||
| public bool IsOptimal { get; private set; } | public bool IsOptimal { get; private set; } | ||||
| public string SampleHostname { get; private set; } | |||||
| public int SamplePort { get; private set; } | |||||
| /// <inheritdoc /> | |||||
| public bool IsDeprecated { get; private set; } | |||||
| /// <inheritdoc /> | |||||
| public bool IsCustom { get; private set; } | |||||
| internal RestVoiceRegion(BaseDiscordClient client, string id) | internal RestVoiceRegion(BaseDiscordClient client, string id) | ||||
| : base(client, id) | : base(client, id) | ||||
| @@ -28,8 +33,8 @@ namespace Discord | |||||
| Name = model.Name; | Name = model.Name; | ||||
| IsVip = model.IsVip; | IsVip = model.IsVip; | ||||
| IsOptimal = model.IsOptimal; | IsOptimal = model.IsOptimal; | ||||
| SampleHostname = model.SampleHostname; | |||||
| SamplePort = model.SamplePort; | |||||
| IsDeprecated = model.IsDeprecated; | |||||
| IsCustom = model.IsCustom; | |||||
| } | } | ||||
| public override string ToString() => Name; | public override string ToString() => Name; | ||||
| @@ -163,7 +163,7 @@ namespace Discord.Net.Queue | |||||
| if (!isRateLimited) | if (!isRateLimited) | ||||
| throw new TimeoutException(); | throw new TimeoutException(); | ||||
| else | else | ||||
| throw new RateLimitedException(request); | |||||
| ThrowRetryLimit(request); | |||||
| } | } | ||||
| lock (_lock) | lock (_lock) | ||||
| @@ -181,13 +181,12 @@ namespace Discord.Net.Queue | |||||
| await _queue.RaiseRateLimitTriggered(Id, null).ConfigureAwait(false); | await _queue.RaiseRateLimitTriggered(Id, null).ConfigureAwait(false); | ||||
| } | } | ||||
| if ((request.Options.RetryMode & RetryMode.RetryRatelimit) == 0) | |||||
| throw new RateLimitedException(request); | |||||
| ThrowRetryLimit(request); | |||||
| if (resetAt.HasValue) | if (resetAt.HasValue) | ||||
| { | { | ||||
| if (resetAt > timeoutAt) | if (resetAt > timeoutAt) | ||||
| throw new RateLimitedException(request); | |||||
| ThrowRetryLimit(request); | |||||
| int millis = (int)Math.Ceiling((resetAt.Value - DateTimeOffset.UtcNow).TotalMilliseconds); | int millis = (int)Math.Ceiling((resetAt.Value - DateTimeOffset.UtcNow).TotalMilliseconds); | ||||
| #if DEBUG_LIMITS | #if DEBUG_LIMITS | ||||
| Debug.WriteLine($"[{id}] Sleeping {millis} ms (Pre-emptive)"); | Debug.WriteLine($"[{id}] Sleeping {millis} ms (Pre-emptive)"); | ||||
| @@ -198,7 +197,7 @@ namespace Discord.Net.Queue | |||||
| else | else | ||||
| { | { | ||||
| if ((timeoutAt.Value - DateTimeOffset.UtcNow).TotalMilliseconds < 500.0) | if ((timeoutAt.Value - DateTimeOffset.UtcNow).TotalMilliseconds < 500.0) | ||||
| throw new RateLimitedException(request); | |||||
| ThrowRetryLimit(request); | |||||
| #if DEBUG_LIMITS | #if DEBUG_LIMITS | ||||
| Debug.WriteLine($"[{id}] Sleeping 500* ms (Pre-emptive)"); | Debug.WriteLine($"[{id}] Sleeping 500* ms (Pre-emptive)"); | ||||
| #endif | #endif | ||||
| @@ -309,5 +308,11 @@ namespace Discord.Net.Queue | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| private void ThrowRetryLimit(RestRequest request) | |||||
| { | |||||
| if ((request.Options.RetryMode & RetryMode.RetryRatelimit) == 0) | |||||
| throw new RateLimitedException(request); | |||||
| } | |||||
| } | } | ||||
| } | } | ||||
| @@ -4,7 +4,8 @@ | |||||
| <AssemblyName>Discord.Net.WebSocket</AssemblyName> | <AssemblyName>Discord.Net.WebSocket</AssemblyName> | ||||
| <RootNamespace>Discord.WebSocket</RootNamespace> | <RootNamespace>Discord.WebSocket</RootNamespace> | ||||
| <Description>A core Discord.Net library containing the WebSocket client and models.</Description> | <Description>A core Discord.Net library containing the WebSocket client and models.</Description> | ||||
| <TargetFrameworks>net45;netstandard1.1;netstandard1.3</TargetFrameworks> | |||||
| <TargetFrameworks Condition=" '$(OS)' == 'Windows_NT' ">net45;netstandard1.1;netstandard1.3</TargetFrameworks> | |||||
| <TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netstandard1.1;netstandard1.3</TargetFrameworks> | |||||
| <AllowUnsafeBlocks>true</AllowUnsafeBlocks> | <AllowUnsafeBlocks>true</AllowUnsafeBlocks> | ||||
| </PropertyGroup> | </PropertyGroup> | ||||
| <ItemGroup> | <ItemGroup> | ||||
| @@ -14,4 +15,4 @@ | |||||
| <ItemGroup Condition=" '$(TargetFramework)' == 'netstandard1.3' "> | <ItemGroup Condition=" '$(TargetFramework)' == 'netstandard1.3' "> | ||||
| <PackageReference Include="System.Net.WebSockets.Client" Version="4.3.1" /> | <PackageReference Include="System.Net.WebSockets.Client" Version="4.3.1" /> | ||||
| </ItemGroup> | </ItemGroup> | ||||
| </Project> | |||||
| </Project> | |||||