Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
removed Guild from class name for ChannelCategory
Renamed all properties to use Category instead of Parent Throw exception on GetUsers / GetInvites etc for categories
- Loading branch information
Showing
19 changed files
with
145 additions
and
140 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 0 additions & 14 deletions
14
src/Discord.Net.Core/Entities/Channels/IGuildChannelCategory.cs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 0 additions & 14 deletions
14
src/Discord.Net.Rest/API/Rest/ModifyGuildChannelCategoryParams.cs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
src/Discord.Net.Rest/Entities/Channels/RestChannelCategory.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Diagnostics; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
using Model = Discord.API.Channel; | ||
|
||
namespace Discord.Rest | ||
{ | ||
[DebuggerDisplay(@"{DebuggerDisplay,nq}")] | ||
public class RestChannelCategory : RestGuildChannel, IChannelCategory | ||
{ | ||
public string Mention => MentionUtils.MentionChannel(Id); | ||
|
||
internal RestChannelCategory(BaseDiscordClient discord, IGuild guild, ulong id) | ||
: base(discord, guild, id) | ||
{ | ||
} | ||
internal new static RestChannelCategory Create(BaseDiscordClient discord, IGuild guild, Model model) | ||
{ | ||
var entity = new RestChannelCategory(discord, guild, model.Id); | ||
entity.Update(model); | ||
return entity; | ||
} | ||
|
||
private string DebuggerDisplay => $"{Name} ({Id}, Category)"; | ||
|
||
// IGuildChannel | ||
IAsyncEnumerable<IReadOnlyCollection<IGuildUser>> IGuildChannel.GetUsersAsync(CacheMode mode, RequestOptions options) | ||
=> throw new NotSupportedException(); | ||
Task<IGuildUser> IGuildChannel.GetUserAsync(ulong id, CacheMode mode, RequestOptions options) | ||
=> throw new NotSupportedException(); | ||
Task<IInviteMetadata> IGuildChannel.CreateInviteAsync(int? maxAge, int? maxUses, bool isTemporary, bool isUnique, RequestOptions options) | ||
=> throw new NotSupportedException(); | ||
Task<IReadOnlyCollection<IInviteMetadata>> IGuildChannel.GetInvitesAsync(RequestOptions options) | ||
=> throw new NotSupportedException(); | ||
|
||
//IChannel | ||
IAsyncEnumerable<IReadOnlyCollection<IUser>> IChannel.GetUsersAsync(CacheMode mode, RequestOptions options) | ||
=> throw new NotSupportedException(); | ||
Task<IUser> IChannel.GetUserAsync(ulong id, CacheMode mode, RequestOptions options) | ||
=> throw new NotSupportedException(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 0 additions & 38 deletions
38
src/Discord.Net.Rest/Entities/Channels/RestGuildChannelCategory.cs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
src/Discord.Net.WebSocket/Entities/Channels/SocketChannelCategory.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Collections.Immutable; | ||
using System.Diagnostics; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using Discord.Audio; | ||
using Discord.Rest; | ||
using Model = Discord.API.Channel; | ||
|
||
namespace Discord.WebSocket | ||
{ | ||
[DebuggerDisplay(@"{DebuggerDisplay,nq}")] | ||
public class SocketChannelCategory : SocketGuildChannel, IChannelCategory | ||
{ | ||
public override IReadOnlyCollection<SocketGuildUser> Users | ||
=> Guild.Users.Where(x => x.VoiceChannel?.Id == Id).ToImmutableArray(); | ||
|
||
internal SocketChannelCategory(DiscordSocketClient discord, ulong id, SocketGuild guild) | ||
: base(discord, id, guild) | ||
{ | ||
} | ||
internal new static SocketChannelCategory Create(SocketGuild guild, ClientState state, Model model) | ||
{ | ||
var entity = new SocketChannelCategory(guild.Discord, model.Id, guild); | ||
entity.Update(state, model); | ||
return entity; | ||
} | ||
|
||
private string DebuggerDisplay => $"{Name} ({Id}, Category)"; | ||
internal new SocketChannelCategory Clone() => MemberwiseClone() as SocketChannelCategory; | ||
|
||
// IGuildChannel | ||
IAsyncEnumerable<IReadOnlyCollection<IGuildUser>> IGuildChannel.GetUsersAsync(CacheMode mode, RequestOptions options) | ||
=> throw new NotSupportedException(); | ||
Task<IGuildUser> IGuildChannel.GetUserAsync(ulong id, CacheMode mode, RequestOptions options) | ||
=> throw new NotSupportedException(); | ||
Task<IInviteMetadata> IGuildChannel.CreateInviteAsync(int? maxAge, int? maxUses, bool isTemporary, bool isUnique, RequestOptions options) | ||
=> throw new NotSupportedException(); | ||
Task<IReadOnlyCollection<IInviteMetadata>> IGuildChannel.GetInvitesAsync(RequestOptions options) | ||
=> throw new NotSupportedException(); | ||
|
||
//IChannel | ||
IAsyncEnumerable<IReadOnlyCollection<IUser>> IChannel.GetUsersAsync(CacheMode mode, RequestOptions options) | ||
=> throw new NotSupportedException(); | ||
Task<IUser> IChannel.GetUserAsync(ulong id, CacheMode mode, RequestOptions options) | ||
=> throw new NotSupportedException(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.