Browse Source

Add call to ClientHelper and expose to public API

pull/962/head
Darnell Williams 7 years ago
parent
commit
72034b9332
2 changed files with 12 additions and 2 deletions
  1. +7
    -1
      src/Discord.Net.Rest/ClientHelper.cs
  2. +5
    -1
      src/Discord.Net.Rest/DiscordRestClient.cs

+ 7
- 1
src/Discord.Net.Rest/ClientHelper.cs View File

@@ -1,4 +1,4 @@
using Discord.API.Rest;
using Discord.API.Rest;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.IO;
@@ -163,5 +163,11 @@ namespace Discord.Rest
var models = await client.ApiClient.GetVoiceRegionsAsync(options).ConfigureAwait(false);
return models.Select(x => RestVoiceRegion.Create(client, x)).FirstOrDefault(x => x.Id == id);
}

public static async Task<int> GetRecommendShardCount(BaseDiscordClient client, RequestOptions options)
{
var response = await client.ApiClient.GetBotGatewayAsync(options);
return response.Shards;
}
}
}

+ 5
- 1
src/Discord.Net.Rest/DiscordRestClient.cs View File

@@ -1,4 +1,4 @@
using System.Collections.Generic;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.IO;
using System.Threading.Tasks;
@@ -88,6 +88,10 @@ namespace Discord.Rest
/// <inheritdoc />
public Task<IReadOnlyCollection<RestVoiceRegion>> GetVoiceRegionsAsync(RequestOptions options = null)
=> ClientHelper.GetVoiceRegionsAsync(this, options);

/// <inheritdoc />
public Task<int> GetRecommendedShardCount(RequestOptions options = null)
=> ClientHelper.GetRecommendShardCount(this, options);
/// <inheritdoc />
public Task<RestVoiceRegion> GetVoiceRegionAsync(string id, RequestOptions options = null)
=> ClientHelper.GetVoiceRegionAsync(this, id, options);


Loading…
Cancel
Save