@@ -467,6 +467,16 @@ namespace Discord | |||||
/// </returns> | /// </returns> | ||||
Task<ICategoryChannel> CreateCategoryAsync(string name, RequestOptions options = null); | Task<ICategoryChannel> CreateCategoryAsync(string name, RequestOptions options = null); | ||||
/// <summary> | |||||
/// Gets a collection of all the voice regions this guild can access. | |||||
/// </summary> | |||||
/// <param name="options">The options to be used when sending the request.</param> | |||||
/// <returns> | |||||
/// A task that represents the asynchronous get operation. The task result contains a read-only collection of | |||||
/// voice regions the guild can access. | |||||
/// </returns> | |||||
Task<IReadOnlyCollection<IVoiceRegion>> GetVoiceRegionsAsync(RequestOptions options = null); | |||||
Task<IReadOnlyCollection<IGuildIntegration>> GetIntegrationsAsync(RequestOptions options = null); | Task<IReadOnlyCollection<IGuildIntegration>> GetIntegrationsAsync(RequestOptions options = null); | ||||
Task<IGuildIntegration> CreateIntegrationAsync(ulong id, string type, RequestOptions options = null); | Task<IGuildIntegration> CreateIntegrationAsync(ulong id, string type, RequestOptions options = null); | ||||
@@ -192,6 +192,14 @@ namespace Discord.Rest | |||||
return RestCategoryChannel.Create(client, guild, model); | return RestCategoryChannel.Create(client, guild, model); | ||||
} | } | ||||
//Voice Regions | |||||
public static async Task<IReadOnlyCollection<RestVoiceRegion>> GetVoiceRegionsAsync(IGuild guild, BaseDiscordClient client, | |||||
RequestOptions options) | |||||
{ | |||||
var models = await client.ApiClient.GetGuildVoiceRegionsAsync(guild.Id, options).ConfigureAwait(false); | |||||
return models.Select(x => RestVoiceRegion.Create(client, x)).ToImmutableArray(); | |||||
} | |||||
//Integrations | //Integrations | ||||
public static async Task<IReadOnlyCollection<RestGuildIntegration>> GetIntegrationsAsync(IGuild guild, BaseDiscordClient client, | public static async Task<IReadOnlyCollection<RestGuildIntegration>> GetIntegrationsAsync(IGuild guild, BaseDiscordClient client, | ||||
RequestOptions options) | RequestOptions options) | ||||
@@ -443,6 +443,17 @@ namespace Discord.Rest | |||||
public Task<RestCategoryChannel> CreateCategoryChannelAsync(string name, RequestOptions options = null) | public Task<RestCategoryChannel> CreateCategoryChannelAsync(string name, RequestOptions options = null) | ||||
=> GuildHelper.CreateCategoryChannelAsync(this, Discord, name, options); | => GuildHelper.CreateCategoryChannelAsync(this, Discord, name, options); | ||||
/// <summary> | |||||
/// Gets a collection of all the voice regions this guild can access. | |||||
/// </summary> | |||||
/// <param name="options">The options to be used when sending the request.</param> | |||||
/// <returns> | |||||
/// A task that represents the asynchronous get operation. The task result contains a read-only collection of | |||||
/// voice regions the guild can access. | |||||
/// </returns> | |||||
public Task<IReadOnlyCollection<RestVoiceRegion>> GetVoiceRegionsAsync(RequestOptions options = null) | |||||
=> GuildHelper.GetVoiceRegionsAsync(this, Discord, options); | |||||
//Integrations | //Integrations | ||||
public Task<IReadOnlyCollection<RestGuildIntegration>> GetIntegrationsAsync(RequestOptions options = null) | public Task<IReadOnlyCollection<RestGuildIntegration>> GetIntegrationsAsync(RequestOptions options = null) | ||||
=> GuildHelper.GetIntegrationsAsync(this, Discord, options); | => GuildHelper.GetIntegrationsAsync(this, Discord, options); | ||||
@@ -759,6 +770,10 @@ namespace Discord.Rest | |||||
=> await CreateCategoryChannelAsync(name, options).ConfigureAwait(false); | => await CreateCategoryChannelAsync(name, options).ConfigureAwait(false); | ||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
async Task<IReadOnlyCollection<IVoiceRegion>> IGuild.GetVoiceRegionsAsync(RequestOptions options) | |||||
=> await GetVoiceRegionsAsync(options).ConfigureAwait(false); | |||||
/// <inheritdoc /> | |||||
async Task<IReadOnlyCollection<IGuildIntegration>> IGuild.GetIntegrationsAsync(RequestOptions options) | async Task<IReadOnlyCollection<IGuildIntegration>> IGuild.GetIntegrationsAsync(RequestOptions options) | ||||
=> await GetIntegrationsAsync(options).ConfigureAwait(false); | => await GetIntegrationsAsync(options).ConfigureAwait(false); | ||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
@@ -578,6 +578,18 @@ namespace Discord.WebSocket | |||||
return null; | return null; | ||||
} | } | ||||
//Voice Regions | |||||
/// <summary> | |||||
/// Gets a collection of all the voice regions this guild can access. | |||||
/// </summary> | |||||
/// <param name="options">The options to be used when sending the request.</param> | |||||
/// <returns> | |||||
/// A task that represents the asynchronous get operation. The task result contains a read-only collection of | |||||
/// voice regions the guild can access. | |||||
/// </returns> | |||||
public Task<IReadOnlyCollection<RestVoiceRegion>> GetVoiceRegionsAsync(RequestOptions options = null) | |||||
=> GuildHelper.GetVoiceRegionsAsync(this, Discord, options); | |||||
//Integrations | //Integrations | ||||
public Task<IReadOnlyCollection<RestGuildIntegration>> GetIntegrationsAsync(RequestOptions options = null) | public Task<IReadOnlyCollection<RestGuildIntegration>> GetIntegrationsAsync(RequestOptions options = null) | ||||
=> GuildHelper.GetIntegrationsAsync(this, Discord, options); | => GuildHelper.GetIntegrationsAsync(this, Discord, options); | ||||
@@ -1051,6 +1063,10 @@ namespace Discord.WebSocket | |||||
=> await CreateCategoryChannelAsync(name, options).ConfigureAwait(false); | => await CreateCategoryChannelAsync(name, options).ConfigureAwait(false); | ||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
async Task<IReadOnlyCollection<IVoiceRegion>> IGuild.GetVoiceRegionsAsync(RequestOptions options) | |||||
=> await GetVoiceRegionsAsync(options).ConfigureAwait(false); | |||||
/// <inheritdoc /> | |||||
async Task<IReadOnlyCollection<IGuildIntegration>> IGuild.GetIntegrationsAsync(RequestOptions options) | async Task<IReadOnlyCollection<IGuildIntegration>> IGuild.GetIntegrationsAsync(RequestOptions options) | ||||
=> await GetIntegrationsAsync(options).ConfigureAwait(false); | => await GetIntegrationsAsync(options).ConfigureAwait(false); | ||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||