* Fix #995 ICategoryChannel.CategoryID throws NotSupportedException * Add tests * change run mode of TestChannelCategories * Add throw for GetCategoryAsync * Add xml doc explaining why exception is thrown * Add test coverage for text and voice channel categories * initial implementation of INestedChannel * more implementation of INestedChannel design * Add case in RestChannel Create for Category type * set the CategoryID for RestVoiceChannel * rewrite channel category tests to work with existing pattern * remove outdated todo * Make IVoiceChannel implement INestedChannel * remove redundant interface implementation * Add c#7 feature from feedback * Remove redundant GetCategoryAsync methods from socket entities * Added configureawait to async methods * change signature of interface GetCategoryAsync * Add check for cachemode in rest channel GetCategory * remove redundant IGuildChannel interface from ITextChannel and IVoiceChannel
This commit is contained in:
committed by
Christopher F
parent
4d8764e124
commit
f9cbff5e42
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
@@ -9,10 +9,6 @@ namespace Discord
|
||||
/// <summary> Gets the position of this channel in the guild's channel list, relative to others of the same type. </summary>
|
||||
int Position { get; }
|
||||
|
||||
/// <summary> Gets the parentid (category) of this channel in the guild's channel list. </summary>
|
||||
ulong? CategoryId { get; }
|
||||
/// <summary> Gets the parent channel (category) of this channel. </summary>
|
||||
Task<ICategoryChannel> GetCategoryAsync();
|
||||
/// <summary> Gets the guild this channel is a member of. </summary>
|
||||
IGuild Guild { get; }
|
||||
/// <summary> Gets the id of the guild this channel is a member of. </summary>
|
||||
@@ -49,4 +45,4 @@ namespace Discord
|
||||
/// <summary> Gets a user in this channel with the provided id.</summary>
|
||||
new Task<IGuildUser> GetUserAsync(ulong id, CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
16
src/Discord.Net.Core/Entities/Channels/INestedChannel.cs
Normal file
16
src/Discord.Net.Core/Entities/Channels/INestedChannel.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Discord
|
||||
{
|
||||
/// <summary>
|
||||
/// A type of guild channel that can be nested within a category.
|
||||
/// Contains a CategoryId that is set to the parent category, if it is set.
|
||||
/// </summary>
|
||||
public interface INestedChannel : IGuildChannel
|
||||
{
|
||||
/// <summary> Gets the parentid (category) of this channel in the guild's channel list. </summary>
|
||||
ulong? CategoryId { get; }
|
||||
/// <summary> Gets the parent channel (category) of this channel, if it is set. If unset, returns null.</summary>
|
||||
Task<ICategoryChannel> GetCategoryAsync(CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null);
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,11 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Discord
|
||||
{
|
||||
public interface ITextChannel : IMessageChannel, IMentionable, IGuildChannel
|
||||
public interface ITextChannel : IMessageChannel, IMentionable, INestedChannel
|
||||
{
|
||||
/// <summary> Checks if the channel is NSFW. </summary>
|
||||
bool IsNsfw { get; }
|
||||
@@ -28,4 +28,4 @@ namespace Discord
|
||||
/// <summary> Gets the webhooks for this text channel. </summary>
|
||||
Task<IReadOnlyCollection<IWebhook>> GetWebhooksAsync(RequestOptions options = null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Discord
|
||||
{
|
||||
public interface IVoiceChannel : IGuildChannel, IAudioChannel
|
||||
public interface IVoiceChannel : INestedChannel, IAudioChannel
|
||||
{
|
||||
/// <summary> Gets the bitrate, in bits per second, clients in this voice channel are requested to use. </summary>
|
||||
int Bitrate { get; }
|
||||
@@ -13,4 +13,4 @@ namespace Discord
|
||||
/// <summary> Modifies this voice channel. </summary>
|
||||
Task ModifyAsync(Action<VoiceChannelProperties> func, RequestOptions options = null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user