diff --git a/src/Discord.Net.Core/Entities/Guilds/IGuild.cs b/src/Discord.Net.Core/Entities/Guilds/IGuild.cs index 8f9108d95f..9b91b9440a 100644 --- a/src/Discord.Net.Core/Entities/Guilds/IGuild.cs +++ b/src/Discord.Net.Core/Entities/Guilds/IGuild.cs @@ -467,6 +467,16 @@ public interface IGuild : IDeletable, ISnowflakeEntity /// Task CreateCategoryAsync(string name, RequestOptions options = null); + /// + /// Gets a collection of all the voice regions this guild can access. + /// + /// The options to be used when sending the request. + /// + /// A task that represents the asynchronous get operation. The task result contains a read-only collection of + /// voice regions the guild can access. + /// + Task> GetVoiceRegionsAsync(RequestOptions options = null); + Task> GetIntegrationsAsync(RequestOptions options = null); Task CreateIntegrationAsync(ulong id, string type, RequestOptions options = null); diff --git a/src/Discord.Net.Rest/Entities/Guilds/GuildHelper.cs b/src/Discord.Net.Rest/Entities/Guilds/GuildHelper.cs index 823d41a05e..b8b66f802e 100644 --- a/src/Discord.Net.Rest/Entities/Guilds/GuildHelper.cs +++ b/src/Discord.Net.Rest/Entities/Guilds/GuildHelper.cs @@ -192,6 +192,14 @@ public static async Task CreateCategoryChannelAsync(IGuild return RestCategoryChannel.Create(client, guild, model); } + //Voice Regions + public static async Task> 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 public static async Task> GetIntegrationsAsync(IGuild guild, BaseDiscordClient client, RequestOptions options) diff --git a/src/Discord.Net.Rest/Entities/Guilds/RestGuild.cs b/src/Discord.Net.Rest/Entities/Guilds/RestGuild.cs index fda9b609d3..9c4ecd8485 100644 --- a/src/Discord.Net.Rest/Entities/Guilds/RestGuild.cs +++ b/src/Discord.Net.Rest/Entities/Guilds/RestGuild.cs @@ -443,6 +443,17 @@ public Task CreateVoiceChannelAsync(string name, Action CreateCategoryChannelAsync(string name, RequestOptions options = null) => GuildHelper.CreateCategoryChannelAsync(this, Discord, name, options); + /// + /// Gets a collection of all the voice regions this guild can access. + /// + /// The options to be used when sending the request. + /// + /// A task that represents the asynchronous get operation. The task result contains a read-only collection of + /// voice regions the guild can access. + /// + public Task> GetVoiceRegionsAsync(RequestOptions options = null) + => GuildHelper.GetVoiceRegionsAsync(this, Discord, options); + //Integrations public Task> GetIntegrationsAsync(RequestOptions options = null) => GuildHelper.GetIntegrationsAsync(this, Discord, options); @@ -758,6 +769,10 @@ async Task IGuild.CreateVoiceChannelAsync(string name, Action IGuild.CreateCategoryAsync(string name, RequestOptions options) => await CreateCategoryChannelAsync(name, options).ConfigureAwait(false); + /// + async Task> IGuild.GetVoiceRegionsAsync(RequestOptions options) + => await GetVoiceRegionsAsync(options).ConfigureAwait(false); + /// async Task> IGuild.GetIntegrationsAsync(RequestOptions options) => await GetIntegrationsAsync(options).ConfigureAwait(false); diff --git a/src/Discord.Net.WebSocket/Entities/Guilds/SocketGuild.cs b/src/Discord.Net.WebSocket/Entities/Guilds/SocketGuild.cs index 06b0488725..b4f87e12a4 100644 --- a/src/Discord.Net.WebSocket/Entities/Guilds/SocketGuild.cs +++ b/src/Discord.Net.WebSocket/Entities/Guilds/SocketGuild.cs @@ -578,6 +578,18 @@ internal SocketGuildChannel RemoveChannel(ClientState state, ulong id) return null; } + //Voice Regions + /// + /// Gets a collection of all the voice regions this guild can access. + /// + /// The options to be used when sending the request. + /// + /// A task that represents the asynchronous get operation. The task result contains a read-only collection of + /// voice regions the guild can access. + /// + public Task> GetVoiceRegionsAsync(RequestOptions options = null) + => GuildHelper.GetVoiceRegionsAsync(this, Discord, options); + //Integrations public Task> GetIntegrationsAsync(RequestOptions options = null) => GuildHelper.GetIntegrationsAsync(this, Discord, options); @@ -1050,6 +1062,10 @@ async Task IGuild.CreateVoiceChannelAsync(string name, Action IGuild.CreateCategoryAsync(string name, RequestOptions options) => await CreateCategoryChannelAsync(name, options).ConfigureAwait(false); + /// + async Task> IGuild.GetVoiceRegionsAsync(RequestOptions options) + => await GetVoiceRegionsAsync(options).ConfigureAwait(false); + /// async Task> IGuild.GetIntegrationsAsync(RequestOptions options) => await GetIntegrationsAsync(options).ConfigureAwait(false);