@@ -23,7 +23,7 @@ namespace Discord.Rest
public VerificationLevel VerificationLevel { get; private set; }
public VerificationLevel VerificationLevel { get; private set; }
public MfaLevel MfaLevel { get; private set; }
public MfaLevel MfaLevel { get; private set; }
public DefaultMessageNotifications DefaultMessageNotifications { get; private set; }
public DefaultMessageNotifications DefaultMessageNotifications { get; private set; }
public ulong? AFKChannelId { get; private set; }
public ulong? AFKChannelId { get; private set; }
public ulong? EmbedChannelId { get; private set; }
public ulong? EmbedChannelId { get; private set; }
public ulong? SystemChannelId { get; private set; }
public ulong? SystemChannelId { get; private set; }
@@ -114,7 +114,7 @@ namespace Discord.Rest
Update(model);
Update(model);
}
}
public async Task ModifyEmbedAsync(Action<GuildEmbedProperties> func, RequestOptions options = null)
public async Task ModifyEmbedAsync(Action<GuildEmbedProperties> func, RequestOptions options = null)
{
{
var model = await GuildHelper.ModifyEmbedAsync(this, Discord, func, options).ConfigureAwait(false);
var model = await GuildHelper.ModifyEmbedAsync(this, Discord, func, options).ConfigureAwait(false);
Update(model);
Update(model);
}
}
@@ -155,7 +155,7 @@ namespace Discord.Rest
public Task<IReadOnlyCollection<RestGuildChannel>> GetChannelsAsync(RequestOptions options = null)
public Task<IReadOnlyCollection<RestGuildChannel>> GetChannelsAsync(RequestOptions options = null)
=> GuildHelper.GetChannelsAsync(this, Discord, options);
=> GuildHelper.GetChannelsAsync(this, Discord, options);
public Task<RestGuildChannel> GetChannelAsync(ulong id, RequestOptions options = null)
public Task<RestGuildChannel> GetChannelAsync(ulong id, RequestOptions options = null)
=> GuildHelper.GetChannelAsync(this, Discord, id, options);
=> GuildHelper.GetChannelAsync(this, Discord, id, options);
public async Task<RestTextChannel> GetTextChannelAsync(ulong id, RequestOptions options = null)
public async Task<RestTextChannel> GetTextChannelAsync(ulong id, RequestOptions options = null)
{
{
var channel = await GuildHelper.GetChannelAsync(this, Discord, id, options).ConfigureAwait(false);
var channel = await GuildHelper.GetChannelAsync(this, Discord, id, options).ConfigureAwait(false);
@@ -176,6 +176,11 @@ namespace Discord.Rest
var channels = await GuildHelper.GetChannelsAsync(this, Discord, options).ConfigureAwait(false);
var channels = await GuildHelper.GetChannelsAsync(this, Discord, options).ConfigureAwait(false);
return channels.Select(x => x as RestVoiceChannel).Where(x => x != null).ToImmutableArray();
return channels.Select(x => x as RestVoiceChannel).Where(x => x != null).ToImmutableArray();
}
}
public async Task<IReadOnlyCollection<RestCategoryChannel>> GetCategoryChannelsAsync(RequestOptions options = null)
{
var channels = await GuildHelper.GetChannelsAsync(this, Discord, options).ConfigureAwait(false);
return channels.Select(x => x as RestCategoryChannel).Where(x => x != null).ToImmutableArray();
}
public async Task<RestVoiceChannel> GetAFKChannelAsync(RequestOptions options = null)
public async Task<RestVoiceChannel> GetAFKChannelAsync(RequestOptions options = null)
{
{
@@ -199,7 +204,7 @@ namespace Discord.Rest
public async Task<RestGuildChannel> GetEmbedChannelAsync(RequestOptions options = null)
public async Task<RestGuildChannel> GetEmbedChannelAsync(RequestOptions options = null)
{
{
var embedId = EmbedChannelId;
var embedId = EmbedChannelId;
if (embedId.HasValue)
if (embedId.HasValue)
return await GuildHelper.GetChannelAsync(this, Discord, embedId.Value, options).ConfigureAwait(false);
return await GuildHelper.GetChannelAsync(this, Discord, embedId.Value, options).ConfigureAwait(false);
return null;
return null;
}
}
@@ -217,6 +222,8 @@ namespace Discord.Rest
=> GuildHelper.CreateTextChannelAsync(this, Discord, name, options);
=> GuildHelper.CreateTextChannelAsync(this, Discord, name, options);
public Task<RestVoiceChannel> CreateVoiceChannelAsync(string name, RequestOptions options = null)
public Task<RestVoiceChannel> CreateVoiceChannelAsync(string name, RequestOptions options = null)
=> GuildHelper.CreateVoiceChannelAsync(this, Discord, name, options);
=> GuildHelper.CreateVoiceChannelAsync(this, Discord, name, options);
public Task<RestCategoryChannel> CreateCategoryChannelAsync(string name, RequestOptions options = null)
=> GuildHelper.CreateCategoryChannelAsync(this, Discord, name, options);
//Integrations
//Integrations
public Task<IReadOnlyCollection<RestGuildIntegration>> GetIntegrationsAsync(RequestOptions options = null)
public Task<IReadOnlyCollection<RestGuildIntegration>> GetIntegrationsAsync(RequestOptions options = null)
@@ -236,7 +243,7 @@ namespace Discord.Rest
return null;
return null;
}
}
public async Task<RestRole> CreateRoleAsync(string name, GuildPermissions? permissions = default(GuildPermissions?), Color? color = default(Color?),
public async Task<RestRole> CreateRoleAsync(string name, GuildPermissions? permissions = default(GuildPermissions?), Color? color = default(Color?),
bool isHoisted = false, RequestOptions options = null)
bool isHoisted = false, RequestOptions options = null)
{
{
var role = await GuildHelper.CreateRoleAsync(this, Discord, name, permissions, color, isHoisted, options).ConfigureAwait(false);
var role = await GuildHelper.CreateRoleAsync(this, Discord, name, permissions, color, isHoisted, options).ConfigureAwait(false);
@@ -320,6 +327,13 @@ namespace Discord.Rest
else
else
return ImmutableArray.Create<IVoiceChannel>();
return ImmutableArray.Create<IVoiceChannel>();
}
}
async Task<IReadOnlyCollection<ICategoryChannel>> IGuild.GetCategoriesAsync(CacheMode mode, RequestOptions options)
{
if (mode == CacheMode.AllowDownload)
return await GetCategoryChannelsAsync(options).ConfigureAwait(false);
else
return null;
}
async Task<IVoiceChannel> IGuild.GetVoiceChannelAsync(ulong id, CacheMode mode, RequestOptions options)
async Task<IVoiceChannel> IGuild.GetVoiceChannelAsync(ulong id, CacheMode mode, RequestOptions options)
{
{
if (mode == CacheMode.AllowDownload)
if (mode == CacheMode.AllowDownload)
@@ -359,6 +373,8 @@ namespace Discord.Rest
=> await CreateTextChannelAsync(name, options).ConfigureAwait(false);
=> await CreateTextChannelAsync(name, options).ConfigureAwait(false);
async Task<IVoiceChannel> IGuild.CreateVoiceChannelAsync(string name, RequestOptions options)
async Task<IVoiceChannel> IGuild.CreateVoiceChannelAsync(string name, RequestOptions options)
=> await CreateVoiceChannelAsync(name, options).ConfigureAwait(false);
=> await CreateVoiceChannelAsync(name, options).ConfigureAwait(false);
async Task<ICategoryChannel> IGuild.CreateCategoryAsync(string name, RequestOptions options)
=> await CreateCategoryChannelAsync(name, options).ConfigureAwait(false);
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);
@@ -368,7 +384,7 @@ namespace Discord.Rest
async Task<IReadOnlyCollection<IInviteMetadata>> IGuild.GetInvitesAsync(RequestOptions options)
async Task<IReadOnlyCollection<IInviteMetadata>> IGuild.GetInvitesAsync(RequestOptions options)
=> await GetInvitesAsync(options).ConfigureAwait(false);
=> await GetInvitesAsync(options).ConfigureAwait(false);
IRole IGuild.GetRole(ulong id)
IRole IGuild.GetRole(ulong id)
=> GetRole(id);
=> GetRole(id);
async Task<IRole> IGuild.CreateRoleAsync(string name, GuildPermissions? permissions, Color? color, bool isHoisted, RequestOptions options)
async Task<IRole> IGuild.CreateRoleAsync(string name, GuildPermissions? permissions, Color? color, bool isHoisted, RequestOptions options)
=> await CreateRoleAsync(name, permissions, color, isHoisted, options).ConfigureAwait(false);
=> await CreateRoleAsync(name, permissions, color, isHoisted, options).ConfigureAwait(false);