@@ -37,6 +37,6 @@ namespace Discord | |||||
Task<IWebhook> GetWebhookAsync(ulong id, RequestOptions options = null); | Task<IWebhook> GetWebhookAsync(ulong id, RequestOptions options = null); | ||||
Task<int> GetRecommendedShardCount(RequestOptions options = null); | |||||
Task<int> GetRecommendedShardCountAsync(RequestOptions options = null); | |||||
} | } | ||||
} | } |
@@ -126,8 +126,8 @@ namespace Discord.Rest | |||||
public void Dispose() => Dispose(true); | public void Dispose() => Dispose(true); | ||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
public Task<int> GetRecommendedShardCount(RequestOptions options = null) | |||||
=> ClientHelper.GetRecommendShardCount(this, options); | |||||
public Task<int> GetRecommendedShardCountAsync(RequestOptions options = null) | |||||
=> ClientHelper.GetRecommendShardCountAsync(this, options); | |||||
//IDiscordClient | //IDiscordClient | ||||
ConnectionState IDiscordClient.ConnectionState => ConnectionState.Disconnected; | ConnectionState IDiscordClient.ConnectionState => ConnectionState.Disconnected; | ||||
@@ -164,7 +164,7 @@ namespace Discord.Rest | |||||
return models.Select(x => RestVoiceRegion.Create(client, x)).FirstOrDefault(x => x.Id == id); | return models.Select(x => RestVoiceRegion.Create(client, x)).FirstOrDefault(x => x.Id == id); | ||||
} | } | ||||
public static async Task<int> GetRecommendShardCount(BaseDiscordClient client, RequestOptions options) | |||||
public static async Task<int> GetRecommendShardCountAsync(BaseDiscordClient client, RequestOptions options) | |||||
{ | { | ||||
var response = await client.ApiClient.GetBotGatewayAsync(options); | var response = await client.ApiClient.GetBotGatewayAsync(options); | ||||
return response.Shards; | return response.Shards; | ||||
@@ -75,7 +75,7 @@ namespace Discord.WebSocket | |||||
{ | { | ||||
if (_automaticShards) | if (_automaticShards) | ||||
{ | { | ||||
var shardCount = await GetRecommendedShardCount().ConfigureAwait(false); | |||||
var shardCount = await GetRecommendedShardCountAsync().ConfigureAwait(false); | |||||
_shardIds = Enumerable.Range(0, shardCount).ToArray(); | _shardIds = Enumerable.Range(0, shardCount).ToArray(); | ||||
_totalShards = _shardIds.Length; | _totalShards = _shardIds.Length; | ||||
_shards = new DiscordSocketClient[_shardIds.Length]; | _shards = new DiscordSocketClient[_shardIds.Length]; | ||||