@@ -12,7 +12,7 @@ namespace Discord | |||||
/// <summary> Gets the parentid (category) of this channel in the guild's channel list. </summary> | /// <summary> Gets the parentid (category) of this channel in the guild's channel list. </summary> | ||||
ulong? CategoryId { get; } | ulong? CategoryId { get; } | ||||
/// <summary> Gets the parent channel (category) of this channel. </summary> | /// <summary> Gets the parent channel (category) of this channel. </summary> | ||||
Task<ICategoryChannel> GetCategory(); | |||||
Task<ICategoryChannel> GetCategoryAsync(); | |||||
/// <summary> Gets the guild this channel is a member of. </summary> | /// <summary> Gets the guild this channel is a member of. </summary> | ||||
IGuild Guild { get; } | IGuild Guild { get; } | ||||
/// <summary> Gets the id of the guild this channel is a member of. </summary> | /// <summary> Gets the id of the guild this channel is a member of. </summary> | ||||
@@ -84,7 +84,7 @@ namespace Discord | |||||
Task<IReadOnlyCollection<ITextChannel>> GetTextChannelsAsync(CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null); | Task<IReadOnlyCollection<ITextChannel>> GetTextChannelsAsync(CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null); | ||||
Task<ITextChannel> GetTextChannelAsync(ulong id, CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null); | Task<ITextChannel> GetTextChannelAsync(ulong id, CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null); | ||||
Task<IReadOnlyCollection<IVoiceChannel>> GetVoiceChannelsAsync(CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null); | Task<IReadOnlyCollection<IVoiceChannel>> GetVoiceChannelsAsync(CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null); | ||||
Task<IReadOnlyCollection<ICategoryChannel>> GetCategoryChannelsAsync(CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null); | |||||
Task<IReadOnlyCollection<ICategoryChannel>> GetCategoriesAsync(CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null); | |||||
Task<IVoiceChannel> GetVoiceChannelAsync(ulong id, CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null); | Task<IVoiceChannel> GetVoiceChannelAsync(ulong id, CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null); | ||||
Task<IVoiceChannel> GetAFKChannelAsync(CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null); | Task<IVoiceChannel> GetAFKChannelAsync(CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null); | ||||
Task<ITextChannel> GetSystemChannelAsync(CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null); | Task<ITextChannel> GetSystemChannelAsync(CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null); | ||||
@@ -95,7 +95,7 @@ namespace Discord | |||||
/// <summary> Creates a new voice channel. </summary> | /// <summary> Creates a new voice channel. </summary> | ||||
Task<IVoiceChannel> CreateVoiceChannelAsync(string name, RequestOptions options = null); | Task<IVoiceChannel> CreateVoiceChannelAsync(string name, RequestOptions options = null); | ||||
/// <summary> Creates a new channel category. </summary> | /// <summary> Creates a new channel category. </summary> | ||||
Task<ICategoryChannel> CreateCategoryChannelAsync(string name, RequestOptions options = null); | |||||
Task<ICategoryChannel> CreateCategoryAsync(string name, 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); | ||||
@@ -17,7 +17,7 @@ namespace Discord.Rest | |||||
public string Name { get; private set; } | public string Name { get; private set; } | ||||
public int Position { get; private set; } | public int Position { get; private set; } | ||||
public ulong? CategoryId { get; private set; } | public ulong? CategoryId { get; private set; } | ||||
public async Task<ICategoryChannel> GetCategory() => CategoryId == null ? null : await Guild.GetChannelAsync(CategoryId.Value) as ICategoryChannel; | |||||
public async Task<ICategoryChannel> GetCategoryAsync() => CategoryId == null ? null : await Guild.GetChannelAsync(CategoryId.Value).ConfigureAwait(false) as ICategoryChannel; | |||||
public ulong GuildId => Guild.Id; | public ulong GuildId => Guild.Id; | ||||
@@ -311,7 +311,7 @@ namespace Discord.Rest | |||||
else | else | ||||
return ImmutableArray.Create<IVoiceChannel>(); | return ImmutableArray.Create<IVoiceChannel>(); | ||||
} | } | ||||
async Task<IReadOnlyCollection<ICategoryChannel>> IGuild.GetCategoryChannelsAsync(CacheMode mode , RequestOptions options) | |||||
async Task<IReadOnlyCollection<ICategoryChannel>> IGuild.GetCategoriesAsync(CacheMode mode, RequestOptions options) | |||||
{ | { | ||||
if (mode == CacheMode.AllowDownload) | if (mode == CacheMode.AllowDownload) | ||||
return await GetCategoryChannelsAsync(options).ConfigureAwait(false); | return await GetCategoryChannelsAsync(options).ConfigureAwait(false); | ||||
@@ -357,7 +357,7 @@ 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.CreateCategoryChannelAsync(string name, RequestOptions options) | |||||
async Task<ICategoryChannel> IGuild.CreateCategoryAsync(string name, RequestOptions options) | |||||
=> await CreateCategoryChannelAsync(name, options).ConfigureAwait(false); | => await CreateCategoryChannelAsync(name, options).ConfigureAwait(false); | ||||
async Task<IReadOnlyCollection<IGuildIntegration>> IGuild.GetIntegrationsAsync(RequestOptions options) | async Task<IReadOnlyCollection<IGuildIntegration>> IGuild.GetIntegrationsAsync(RequestOptions options) | ||||
@@ -58,7 +58,7 @@ namespace Discord.Rpc | |||||
public override string ToString() => Name; | public override string ToString() => Name; | ||||
//IGuildChannel | //IGuildChannel | ||||
public Task<ICategoryChannel> GetCategory() | |||||
public Task<ICategoryChannel> GetCategoryAsync() | |||||
{ | { | ||||
//Always fails | //Always fails | ||||
throw new InvalidOperationException("Unable to return this entity's parent unless it was fetched through that object."); | throw new InvalidOperationException("Unable to return this entity's parent unless it was fetched through that object."); | ||||
@@ -19,7 +19,7 @@ namespace Discord.WebSocket | |||||
public int Position { get; private set; } | public int Position { get; private set; } | ||||
public ulong? CategoryId { get; private set; } | public ulong? CategoryId { get; private set; } | ||||
public ICategoryChannel Category => CategoryId == null ? null : Guild.GetChannel(CategoryId.Value) as ICategoryChannel; | public ICategoryChannel Category => CategoryId == null ? null : Guild.GetChannel(CategoryId.Value) as ICategoryChannel; | ||||
Task<ICategoryChannel> IGuildChannel.GetCategory() => Task.FromResult(Category); | |||||
Task<ICategoryChannel> IGuildChannel.GetCategoryAsync() => Task.FromResult(Category); | |||||
public IReadOnlyCollection<Overwrite> PermissionOverwrites => _overwrites; | public IReadOnlyCollection<Overwrite> PermissionOverwrites => _overwrites; | ||||
public new virtual IReadOnlyCollection<SocketGuildUser> Users => ImmutableArray.Create<SocketGuildUser>(); | public new virtual IReadOnlyCollection<SocketGuildUser> Users => ImmutableArray.Create<SocketGuildUser>(); | ||||
@@ -639,7 +639,7 @@ namespace Discord.WebSocket | |||||
=> Task.FromResult<ITextChannel>(GetTextChannel(id)); | => Task.FromResult<ITextChannel>(GetTextChannel(id)); | ||||
Task<IReadOnlyCollection<IVoiceChannel>> IGuild.GetVoiceChannelsAsync(CacheMode mode, RequestOptions options) | Task<IReadOnlyCollection<IVoiceChannel>> IGuild.GetVoiceChannelsAsync(CacheMode mode, RequestOptions options) | ||||
=> Task.FromResult<IReadOnlyCollection<IVoiceChannel>>(VoiceChannels); | => Task.FromResult<IReadOnlyCollection<IVoiceChannel>>(VoiceChannels); | ||||
Task<IReadOnlyCollection<ICategoryChannel>> IGuild.GetCategoryChannelsAsync(CacheMode mode , RequestOptions options) | |||||
Task<IReadOnlyCollection<ICategoryChannel>> IGuild.GetCategoriesAsync(CacheMode mode , RequestOptions options) | |||||
=> Task.FromResult<IReadOnlyCollection<ICategoryChannel>>(CategoryChannels); | => Task.FromResult<IReadOnlyCollection<ICategoryChannel>>(CategoryChannels); | ||||
Task<IVoiceChannel> IGuild.GetVoiceChannelAsync(ulong id, CacheMode mode, RequestOptions options) | Task<IVoiceChannel> IGuild.GetVoiceChannelAsync(ulong id, CacheMode mode, RequestOptions options) | ||||
=> Task.FromResult<IVoiceChannel>(GetVoiceChannel(id)); | => Task.FromResult<IVoiceChannel>(GetVoiceChannel(id)); | ||||
@@ -655,7 +655,7 @@ namespace Discord.WebSocket | |||||
=> 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.CreateCategoryChannelAsync(string name, RequestOptions options) | |||||
async Task<ICategoryChannel> IGuild.CreateCategoryAsync(string name, RequestOptions options) | |||||
=> await CreateCategoryChannelAsync(name, options).ConfigureAwait(false); | => await CreateCategoryChannelAsync(name, options).ConfigureAwait(false); | ||||
async Task<IReadOnlyCollection<IGuildIntegration>> IGuild.GetIntegrationsAsync(RequestOptions options) | async Task<IReadOnlyCollection<IGuildIntegration>> IGuild.GetIntegrationsAsync(RequestOptions options) | ||||