|
|
@@ -20,6 +20,14 @@ namespace Discord.WebSocket |
|
|
|
Permissions.ResolveChannel(Guild, x, this, Permissions.ResolveGuild(Guild, x)), |
|
|
|
ChannelPermission.ViewChannel)).ToImmutableArray(); |
|
|
|
|
|
|
|
/// <summary> |
|
|
|
/// Gets the child channels of this category. |
|
|
|
/// </summary> |
|
|
|
/// <returns> |
|
|
|
/// A read-only collection of <see cref="SocketGuildChannel" /> whose |
|
|
|
/// <see cref="Discord.INestedChannel.CategoryId" /> matches the snowflake identifier of this category |
|
|
|
/// channel. |
|
|
|
/// </returns> |
|
|
|
public IReadOnlyCollection<SocketGuildChannel> Channels |
|
|
|
=> Guild.Channels.Where(x => x is INestedChannel nestedChannel && nestedChannel.CategoryId == Id).ToImmutableArray(); |
|
|
|
|
|
|
@@ -35,6 +43,7 @@ namespace Discord.WebSocket |
|
|
|
} |
|
|
|
|
|
|
|
//Users |
|
|
|
/// <inheritdoc /> |
|
|
|
public override SocketGuildUser GetUser(ulong id) |
|
|
|
{ |
|
|
|
var user = Guild.GetUser(id); |
|
|
@@ -52,8 +61,10 @@ namespace Discord.WebSocket |
|
|
|
internal new SocketCategoryChannel Clone() => MemberwiseClone() as SocketCategoryChannel; |
|
|
|
|
|
|
|
// IGuildChannel |
|
|
|
/// <inheritdoc /> |
|
|
|
IAsyncEnumerable<IReadOnlyCollection<IGuildUser>> IGuildChannel.GetUsersAsync(CacheMode mode, RequestOptions options) |
|
|
|
=> ImmutableArray.Create<IReadOnlyCollection<IGuildUser>>(Users).ToAsyncEnumerable(); |
|
|
|
/// <inheritdoc /> |
|
|
|
Task<IGuildUser> IGuildChannel.GetUserAsync(ulong id, CacheMode mode, RequestOptions options) |
|
|
|
=> Task.FromResult<IGuildUser>(GetUser(id)); |
|
|
|
/// <inheritdoc /> |
|
|
@@ -66,8 +77,10 @@ namespace Discord.WebSocket |
|
|
|
=> throw new NotSupportedException(); |
|
|
|
|
|
|
|
//IChannel |
|
|
|
/// <inheritdoc /> |
|
|
|
IAsyncEnumerable<IReadOnlyCollection<IUser>> IChannel.GetUsersAsync(CacheMode mode, RequestOptions options) |
|
|
|
=> ImmutableArray.Create<IReadOnlyCollection<IUser>>(Users).ToAsyncEnumerable(); |
|
|
|
/// <inheritdoc /> |
|
|
|
Task<IUser> IChannel.GetUserAsync(ulong id, CacheMode mode, RequestOptions options) |
|
|
|
=> Task.FromResult<IUser>(GetUser(id)); |
|
|
|
} |
|
|
|