@@ -70,14 +70,6 @@ namespace Discord.WebSocket | |||||
/// A read-only collection of private channels that the user currently partakes in. | /// A read-only collection of private channels that the user currently partakes in. | ||||
/// </returns> | /// </returns> | ||||
public abstract IReadOnlyCollection<ISocketPrivateChannel> PrivateChannels { get; } | public abstract IReadOnlyCollection<ISocketPrivateChannel> PrivateChannels { get; } | ||||
/// <summary> | |||||
/// Gets a collection of available voice regions. | |||||
/// </summary> | |||||
/// <returns> | |||||
/// A read-only collection of voice regions that the user has access to. | |||||
/// </returns> | |||||
[Obsolete("This property is obsolete, use the GetVoiceRegionsAsync method instead.")] | |||||
public abstract IReadOnlyCollection<RestVoiceRegion> VoiceRegions { get; } | |||||
internal BaseSocketClient(DiscordSocketConfig config, DiscordRestApiClient client) | internal BaseSocketClient(DiscordSocketConfig config, DiscordRestApiClient client) | ||||
: base(config, client) => BaseConfig = config; | : base(config, client) => BaseConfig = config; | ||||
@@ -163,16 +155,6 @@ namespace Discord.WebSocket | |||||
/// </returns> | /// </returns> | ||||
public abstract SocketGuild GetGuild(ulong id); | public abstract SocketGuild GetGuild(ulong id); | ||||
/// <summary> | /// <summary> | ||||
/// Gets a voice region. | |||||
/// </summary> | |||||
/// <param name="id">The identifier of the voice region (e.g. <c>eu-central</c> ).</param> | |||||
/// <returns> | |||||
/// A REST-based voice region associated with the identifier; <c>null</c> if the voice region is not | |||||
/// found. | |||||
/// </returns> | |||||
[Obsolete("This method is obsolete, use GetVoiceRegionAsync instead.")] | |||||
public abstract RestVoiceRegion GetVoiceRegion(string id); | |||||
/// <summary> | |||||
/// Gets all voice regions. | /// Gets all voice regions. | ||||
/// </summary> | /// </summary> | ||||
/// <param name="options">The options to be used when sending the request.</param> | /// <param name="options">The options to be used when sending the request.</param> | ||||
@@ -326,10 +308,14 @@ namespace Discord.WebSocket | |||||
=> Task.FromResult<IUser>(GetUser(username, discriminator)); | => Task.FromResult<IUser>(GetUser(username, discriminator)); | ||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
Task<IVoiceRegion> IDiscordClient.GetVoiceRegionAsync(string id, RequestOptions options) | |||||
=> Task.FromResult<IVoiceRegion>(GetVoiceRegion(id)); | |||||
async Task<IVoiceRegion> IDiscordClient.GetVoiceRegionAsync(string id, RequestOptions options) | |||||
{ | |||||
return await GetVoiceRegionAsync(id).ConfigureAwait(false); | |||||
} | |||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
Task<IReadOnlyCollection<IVoiceRegion>> IDiscordClient.GetVoiceRegionsAsync(RequestOptions options) | |||||
=> Task.FromResult<IReadOnlyCollection<IVoiceRegion>>(VoiceRegions); | |||||
async Task<IReadOnlyCollection<IVoiceRegion>> IDiscordClient.GetVoiceRegionsAsync(RequestOptions options) | |||||
{ | |||||
return await GetVoiceRegionsAsync().ConfigureAwait(false); | |||||
} | |||||
} | } | ||||
} | } |
@@ -36,9 +36,6 @@ namespace Discord.WebSocket | |||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
public override IReadOnlyCollection<ISocketPrivateChannel> PrivateChannels => GetPrivateChannels().ToReadOnlyCollection(GetPrivateChannelCount); | public override IReadOnlyCollection<ISocketPrivateChannel> PrivateChannels => GetPrivateChannels().ToReadOnlyCollection(GetPrivateChannelCount); | ||||
public IReadOnlyCollection<DiscordSocketClient> Shards => _shards; | public IReadOnlyCollection<DiscordSocketClient> Shards => _shards; | ||||
/// <inheritdoc /> | |||||
[Obsolete("This property is obsolete, use the GetVoiceRegionsAsync method instead.")] | |||||
public override IReadOnlyCollection<RestVoiceRegion> VoiceRegions => _shards[0].VoiceRegions; | |||||
/// <summary> | /// <summary> | ||||
/// Provides access to a REST-only client with a shared state from this client. | /// Provides access to a REST-only client with a shared state from this client. | ||||
@@ -264,11 +261,6 @@ namespace Discord.WebSocket | |||||
} | } | ||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
[Obsolete("This method is obsolete, use GetVoiceRegionAsync instead.")] | |||||
public override RestVoiceRegion GetVoiceRegion(string id) | |||||
=> _shards[0].GetVoiceRegion(id); | |||||
/// <inheritdoc /> | |||||
public override async ValueTask<IReadOnlyCollection<RestVoiceRegion>> GetVoiceRegionsAsync(RequestOptions options = null) | public override async ValueTask<IReadOnlyCollection<RestVoiceRegion>> GetVoiceRegionsAsync(RequestOptions options = null) | ||||
{ | { | ||||
return await _shards[0].GetVoiceRegionsAsync().ConfigureAwait(false); | return await _shards[0].GetVoiceRegionsAsync().ConfigureAwait(false); | ||||
@@ -431,11 +423,15 @@ namespace Discord.WebSocket | |||||
=> Task.FromResult<IUser>(GetUser(username, discriminator)); | => Task.FromResult<IUser>(GetUser(username, discriminator)); | ||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
Task<IReadOnlyCollection<IVoiceRegion>> IDiscordClient.GetVoiceRegionsAsync(RequestOptions options) | |||||
=> Task.FromResult<IReadOnlyCollection<IVoiceRegion>>(VoiceRegions); | |||||
async Task<IReadOnlyCollection<IVoiceRegion>> IDiscordClient.GetVoiceRegionsAsync(RequestOptions options) | |||||
{ | |||||
return await GetVoiceRegionsAsync().ConfigureAwait(false); | |||||
} | |||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
Task<IVoiceRegion> IDiscordClient.GetVoiceRegionAsync(string id, RequestOptions options) | |||||
=> Task.FromResult<IVoiceRegion>(GetVoiceRegion(id)); | |||||
async Task<IVoiceRegion> IDiscordClient.GetVoiceRegionAsync(string id, RequestOptions options) | |||||
{ | |||||
return await GetVoiceRegionAsync(id).ConfigureAwait(false); | |||||
} | |||||
internal override void Dispose(bool disposing) | internal override void Dispose(bool disposing) | ||||
{ | { | ||||
@@ -108,9 +108,6 @@ namespace Discord.WebSocket | |||||
/// </returns> | /// </returns> | ||||
public IReadOnlyCollection<SocketGroupChannel> GroupChannels | public IReadOnlyCollection<SocketGroupChannel> GroupChannels | ||||
=> State.PrivateChannels.OfType<SocketGroupChannel>().ToImmutableArray(); | => State.PrivateChannels.OfType<SocketGroupChannel>().ToImmutableArray(); | ||||
/// <inheritdoc /> | |||||
[Obsolete("This property is obsolete, use the GetVoiceRegionsAsync method instead.")] | |||||
public override IReadOnlyCollection<RestVoiceRegion> VoiceRegions => GetVoiceRegionsAsync().GetAwaiter().GetResult(); | |||||
/// <summary> | /// <summary> | ||||
/// Initializes a new REST/WebSocket-based Discord client. | /// Initializes a new REST/WebSocket-based Discord client. | ||||
@@ -337,11 +334,6 @@ namespace Discord.WebSocket | |||||
=> State.RemoveUser(id); | => State.RemoveUser(id); | ||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
[Obsolete("This method is obsolete, use GetVoiceRegionAsync instead.")] | |||||
public override RestVoiceRegion GetVoiceRegion(string id) | |||||
=> GetVoiceRegionAsync(id).GetAwaiter().GetResult(); | |||||
/// <inheritdoc /> | |||||
public override async ValueTask<IReadOnlyCollection<RestVoiceRegion>> GetVoiceRegionsAsync(RequestOptions options = null) | public override async ValueTask<IReadOnlyCollection<RestVoiceRegion>> GetVoiceRegionsAsync(RequestOptions options = null) | ||||
{ | { | ||||
if (_parentClient == null) | if (_parentClient == null) | ||||