diff --git a/src/Discord.Net.Core/Entities/Channels/IChannelCategory.cs b/src/Discord.Net.Core/Entities/Channels/ICategoryChannel.cs
similarity index 74%
rename from src/Discord.Net.Core/Entities/Channels/IChannelCategory.cs
rename to src/Discord.Net.Core/Entities/Channels/ICategoryChannel.cs
index bd20d7639..0f7f5aa62 100644
--- a/src/Discord.Net.Core/Entities/Channels/IChannelCategory.cs
+++ b/src/Discord.Net.Core/Entities/Channels/ICategoryChannel.cs
@@ -6,7 +6,7 @@ using System.Threading.Tasks;
namespace Discord
{
- public interface IChannelCategory : IGuildChannel
+ public interface ICategoryChannel : IGuildChannel
{
}
}
diff --git a/src/Discord.Net.Core/Entities/Channels/IGuildChannel.cs b/src/Discord.Net.Core/Entities/Channels/IGuildChannel.cs
index d2683018f..6d830672b 100644
--- a/src/Discord.Net.Core/Entities/Channels/IGuildChannel.cs
+++ b/src/Discord.Net.Core/Entities/Channels/IGuildChannel.cs
@@ -12,7 +12,7 @@ namespace Discord
/// Gets the parentid (category) of this channel in the guild's channel list.
ulong? CategoryId { get; }
/// Gets the parent channel (category) of this channel.
- Task GetCategory();
+ Task GetCategory();
/// Gets the guild this channel is a member of.
IGuild Guild { get; }
/// Gets the id of the guild this channel is a member of.
diff --git a/src/Discord.Net.Core/Entities/Guilds/IGuild.cs b/src/Discord.Net.Core/Entities/Guilds/IGuild.cs
index aa61fbd80..83953cf12 100644
--- a/src/Discord.Net.Core/Entities/Guilds/IGuild.cs
+++ b/src/Discord.Net.Core/Entities/Guilds/IGuild.cs
@@ -84,7 +84,7 @@ namespace Discord
Task> GetTextChannelsAsync(CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null);
Task GetTextChannelAsync(ulong id, CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null);
Task> GetVoiceChannelsAsync(CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null);
- Task> GetChannelCategoriesAsync(CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null);
+ Task> GetCategoryChannelsAsync(CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null);
Task GetVoiceChannelAsync(ulong id, CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null);
Task GetAFKChannelAsync(CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null);
Task GetSystemChannelAsync(CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null);
@@ -95,7 +95,7 @@ namespace Discord
/// Creates a new voice channel.
Task CreateVoiceChannelAsync(string name, RequestOptions options = null);
/// Creates a new channel category.
- Task CreateChannelCategoryAsync(string name, RequestOptions options = null);
+ Task CreateCategoryChannelAsync(string name, RequestOptions options = null);
Task> GetIntegrationsAsync(RequestOptions options = null);
Task CreateIntegrationAsync(ulong id, string type, RequestOptions options = null);
diff --git a/src/Discord.Net.Rest/Entities/Channels/RestChannelCategory.cs b/src/Discord.Net.Rest/Entities/Channels/RestCategoryChannel.cs
similarity index 86%
rename from src/Discord.Net.Rest/Entities/Channels/RestChannelCategory.cs
rename to src/Discord.Net.Rest/Entities/Channels/RestCategoryChannel.cs
index acea5a981..f0140ed9e 100644
--- a/src/Discord.Net.Rest/Entities/Channels/RestChannelCategory.cs
+++ b/src/Discord.Net.Rest/Entities/Channels/RestCategoryChannel.cs
@@ -9,17 +9,17 @@ using Model = Discord.API.Channel;
namespace Discord.Rest
{
[DebuggerDisplay(@"{DebuggerDisplay,nq}")]
- public class RestChannelCategory : RestGuildChannel, IChannelCategory
+ public class RestCategoryChannel : RestGuildChannel, ICategoryChannel
{
public string Mention => MentionUtils.MentionChannel(Id);
- internal RestChannelCategory(BaseDiscordClient discord, IGuild guild, ulong id)
+ internal RestCategoryChannel(BaseDiscordClient discord, IGuild guild, ulong id)
: base(discord, guild, id)
{
}
- internal new static RestChannelCategory Create(BaseDiscordClient discord, IGuild guild, Model model)
+ internal new static RestCategoryChannel Create(BaseDiscordClient discord, IGuild guild, Model model)
{
- var entity = new RestChannelCategory(discord, guild, model.Id);
+ var entity = new RestCategoryChannel(discord, guild, model.Id);
entity.Update(model);
return entity;
}
diff --git a/src/Discord.Net.Rest/Entities/Channels/RestGuildChannel.cs b/src/Discord.Net.Rest/Entities/Channels/RestGuildChannel.cs
index f00755219..3484a333e 100644
--- a/src/Discord.Net.Rest/Entities/Channels/RestGuildChannel.cs
+++ b/src/Discord.Net.Rest/Entities/Channels/RestGuildChannel.cs
@@ -17,7 +17,7 @@ namespace Discord.Rest
public string Name { get; private set; }
public int Position { get; private set; }
public ulong? CategoryId { get; private set; }
- public async Task GetCategory() => CategoryId == null ? null : await Guild.GetChannelAsync(CategoryId.Value) as IChannelCategory;
+ public async Task GetCategory() => CategoryId == null ? null : await Guild.GetChannelAsync(CategoryId.Value) as ICategoryChannel;
public ulong GuildId => Guild.Id;
@@ -35,7 +35,7 @@ namespace Discord.Rest
case ChannelType.Voice:
return RestVoiceChannel.Create(discord, guild, model);
case ChannelType.Category:
- return RestChannelCategory.Create(discord, guild, model);
+ return RestCategoryChannel.Create(discord, guild, model);
default:
// TODO: Channel categories
return new RestGuildChannel(discord, guild, model.Id);
diff --git a/src/Discord.Net.Rest/Entities/Guilds/GuildHelper.cs b/src/Discord.Net.Rest/Entities/Guilds/GuildHelper.cs
index 64c5899e4..a33f27243 100644
--- a/src/Discord.Net.Rest/Entities/Guilds/GuildHelper.cs
+++ b/src/Discord.Net.Rest/Entities/Guilds/GuildHelper.cs
@@ -157,14 +157,14 @@ namespace Discord.Rest
var model = await client.ApiClient.CreateGuildChannelAsync(guild.Id, args, options).ConfigureAwait(false);
return RestVoiceChannel.Create(client, guild, model);
}
- public static async Task CreateChannelCategoryAsync(IGuild guild, BaseDiscordClient client,
+ public static async Task CreateCategoryChannelAsync(IGuild guild, BaseDiscordClient client,
string name, RequestOptions options)
{
if (name == null) throw new ArgumentNullException(nameof(name));
var args = new CreateGuildChannelParams(name, ChannelType.Category);
var model = await client.ApiClient.CreateGuildChannelAsync(guild.Id, args, options).ConfigureAwait(false);
- return RestChannelCategory.Create(client, guild, model);
+ return RestCategoryChannel.Create(client, guild, model);
}
//Integrations
diff --git a/src/Discord.Net.Rest/Entities/Guilds/RestGuild.cs b/src/Discord.Net.Rest/Entities/Guilds/RestGuild.cs
index 101d9ca21..7dcb631f5 100644
--- a/src/Discord.Net.Rest/Entities/Guilds/RestGuild.cs
+++ b/src/Discord.Net.Rest/Entities/Guilds/RestGuild.cs
@@ -176,10 +176,10 @@ namespace Discord.Rest
var channels = await GuildHelper.GetChannelsAsync(this, Discord, options).ConfigureAwait(false);
return channels.Select(x => x as RestVoiceChannel).Where(x => x != null).ToImmutableArray();
}
- public async Task> GetChannelCategoriesAsync(RequestOptions options = null)
+ public async Task> GetCategoryChannelsAsync(RequestOptions options = null)
{
var channels = await GuildHelper.GetChannelsAsync(this, Discord, options).ConfigureAwait(false);
- return channels.Select(x => x as RestChannelCategory).Where(x => x != null).ToImmutableArray();
+ return channels.Select(x => x as RestCategoryChannel).Where(x => x != null).ToImmutableArray();
}
public async Task GetAFKChannelAsync(RequestOptions options = null)
@@ -222,8 +222,8 @@ namespace Discord.Rest
=> GuildHelper.CreateTextChannelAsync(this, Discord, name, options);
public Task CreateVoiceChannelAsync(string name, RequestOptions options = null)
=> GuildHelper.CreateVoiceChannelAsync(this, Discord, name, options);
- public Task CreateChannelCategoryAsync(string name, RequestOptions options = null)
- => GuildHelper.CreateChannelCategoryAsync(this, Discord, name, options);
+ public Task CreateCategoryChannelAsync(string name, RequestOptions options = null)
+ => GuildHelper.CreateCategoryChannelAsync(this, Discord, name, options);
//Integrations
public Task> GetIntegrationsAsync(RequestOptions options = null)
@@ -311,10 +311,10 @@ namespace Discord.Rest
else
return ImmutableArray.Create();
}
- async Task> IGuild.GetChannelCategoriesAsync(CacheMode mode , RequestOptions options)
+ async Task> IGuild.GetCategoryChannelsAsync(CacheMode mode , RequestOptions options)
{
if (mode == CacheMode.AllowDownload)
- return await GetChannelCategoriesAsync(options).ConfigureAwait(false);
+ return await GetCategoryChannelsAsync(options).ConfigureAwait(false);
else
return null;
}
@@ -357,8 +357,8 @@ namespace Discord.Rest
=> await CreateTextChannelAsync(name, options).ConfigureAwait(false);
async Task IGuild.CreateVoiceChannelAsync(string name, RequestOptions options)
=> await CreateVoiceChannelAsync(name, options).ConfigureAwait(false);
- async Task IGuild.CreateChannelCategoryAsync(string name, RequestOptions options)
- => await CreateChannelCategoryAsync(name, options).ConfigureAwait(false);
+ async Task IGuild.CreateCategoryChannelAsync(string name, RequestOptions options)
+ => await CreateCategoryChannelAsync(name, options).ConfigureAwait(false);
async Task> IGuild.GetIntegrationsAsync(RequestOptions options)
=> await GetIntegrationsAsync(options).ConfigureAwait(false);
diff --git a/src/Discord.Net.Rpc/Entities/Channels/RpcChannelCategory.cs b/src/Discord.Net.Rpc/Entities/Channels/RpcCategoryChannel.cs
similarity index 70%
rename from src/Discord.Net.Rpc/Entities/Channels/RpcChannelCategory.cs
rename to src/Discord.Net.Rpc/Entities/Channels/RpcCategoryChannel.cs
index 229753cf4..cac766f92 100644
--- a/src/Discord.Net.Rpc/Entities/Channels/RpcChannelCategory.cs
+++ b/src/Discord.Net.Rpc/Entities/Channels/RpcCategoryChannel.cs
@@ -11,21 +11,19 @@ using Model = Discord.API.Rpc.Channel;
namespace Discord.Rpc
{
[DebuggerDisplay(@"{DebuggerDisplay,nq}")]
- public class RpcChannelCategory : RpcGuildChannel
+ public class RpcCategoryChannel : RpcGuildChannel, ICategoryChannel
{
public IReadOnlyCollection CachedMessages { get; private set; }
public string Mention => MentionUtils.MentionChannel(Id);
- // TODO: Check if RPC includes the 'nsfw' field on Channel models
- public bool IsNsfw => ChannelHelper.IsNsfw(this);
- internal RpcChannelCategory(DiscordRpcClient discord, ulong id, ulong guildId)
+ internal RpcCategoryChannel(DiscordRpcClient discord, ulong id, ulong guildId)
: base(discord, id, guildId)
{
}
- internal new static RpcChannelCategory Create(DiscordRpcClient discord, Model model)
+ internal new static RpcCategoryChannel Create(DiscordRpcClient discord, Model model)
{
- var entity = new RpcChannelCategory(discord, model.Id, model.GuildId.Value);
+ var entity = new RpcCategoryChannel(discord, model.Id, model.GuildId.Value);
entity.Update(model);
return entity;
}
diff --git a/src/Discord.Net.Rpc/Entities/Channels/RpcGuildChannel.cs b/src/Discord.Net.Rpc/Entities/Channels/RpcGuildChannel.cs
index 92f5e9013..47eb5cc80 100644
--- a/src/Discord.Net.Rpc/Entities/Channels/RpcGuildChannel.cs
+++ b/src/Discord.Net.Rpc/Entities/Channels/RpcGuildChannel.cs
@@ -58,7 +58,7 @@ namespace Discord.Rpc
public override string ToString() => Name;
//IGuildChannel
- public Task GetCategory()
+ public Task GetCategory()
{
//Always fails
throw new InvalidOperationException("Unable to return this entity's parent unless it was fetched through that object.");
diff --git a/src/Discord.Net.WebSocket/Entities/Channels/SocketChannelCategory.cs b/src/Discord.Net.WebSocket/Entities/Channels/SocketCategoryChannel.cs
similarity index 83%
rename from src/Discord.Net.WebSocket/Entities/Channels/SocketChannelCategory.cs
rename to src/Discord.Net.WebSocket/Entities/Channels/SocketCategoryChannel.cs
index e1f764551..905b219d8 100644
--- a/src/Discord.Net.WebSocket/Entities/Channels/SocketChannelCategory.cs
+++ b/src/Discord.Net.WebSocket/Entities/Channels/SocketCategoryChannel.cs
@@ -12,24 +12,24 @@ using Model = Discord.API.Channel;
namespace Discord.WebSocket
{
[DebuggerDisplay(@"{DebuggerDisplay,nq}")]
- public class SocketChannelCategory : SocketGuildChannel, IChannelCategory
+ public class SocketCategoryChannel : SocketGuildChannel, ICategoryChannel
{
public override IReadOnlyCollection Users
=> Guild.Users.Where(x => x.VoiceChannel?.Id == Id).ToImmutableArray();
- internal SocketChannelCategory(DiscordSocketClient discord, ulong id, SocketGuild guild)
+ internal SocketCategoryChannel(DiscordSocketClient discord, ulong id, SocketGuild guild)
: base(discord, id, guild)
{
}
- internal new static SocketChannelCategory Create(SocketGuild guild, ClientState state, Model model)
+ internal new static SocketCategoryChannel Create(SocketGuild guild, ClientState state, Model model)
{
- var entity = new SocketChannelCategory(guild.Discord, model.Id, guild);
+ var entity = new SocketCategoryChannel(guild.Discord, model.Id, guild);
entity.Update(state, model);
return entity;
}
private string DebuggerDisplay => $"{Name} ({Id}, Category)";
- internal new SocketChannelCategory Clone() => MemberwiseClone() as SocketChannelCategory;
+ internal new SocketCategoryChannel Clone() => MemberwiseClone() as SocketCategoryChannel;
// IGuildChannel
IAsyncEnumerable> IGuildChannel.GetUsersAsync(CacheMode mode, RequestOptions options)
diff --git a/src/Discord.Net.WebSocket/Entities/Channels/SocketGuildChannel.cs b/src/Discord.Net.WebSocket/Entities/Channels/SocketGuildChannel.cs
index 7255a7fa3..8eed157cc 100644
--- a/src/Discord.Net.WebSocket/Entities/Channels/SocketGuildChannel.cs
+++ b/src/Discord.Net.WebSocket/Entities/Channels/SocketGuildChannel.cs
@@ -18,8 +18,8 @@ namespace Discord.WebSocket
public string Name { get; private set; }
public int Position { get; private set; }
public ulong? CategoryId { get; private set; }
- public IChannelCategory Category => CategoryId == null ? null : Guild.GetChannel(CategoryId.Value) as IChannelCategory;
- Task IGuildChannel.GetCategory() => Task.FromResult(Category);
+ public ICategoryChannel Category => CategoryId == null ? null : Guild.GetChannel(CategoryId.Value) as ICategoryChannel;
+ Task IGuildChannel.GetCategory() => Task.FromResult(Category);
public IReadOnlyCollection PermissionOverwrites => _overwrites;
public new virtual IReadOnlyCollection Users => ImmutableArray.Create();
@@ -38,7 +38,7 @@ namespace Discord.WebSocket
case ChannelType.Voice:
return SocketVoiceChannel.Create(guild, state, model);
case ChannelType.Category:
- return SocketChannelCategory.Create(guild, state, model);
+ return SocketCategoryChannel.Create(guild, state, model);
default:
// TODO: Proper implementation for channel categories
return new SocketGuildChannel(guild.Discord, model.Id, guild);
diff --git a/src/Discord.Net.WebSocket/Entities/Guilds/SocketGuild.cs b/src/Discord.Net.WebSocket/Entities/Guilds/SocketGuild.cs
index 9d64db415..657bf5335 100644
--- a/src/Discord.Net.WebSocket/Entities/Guilds/SocketGuild.cs
+++ b/src/Discord.Net.WebSocket/Entities/Guilds/SocketGuild.cs
@@ -94,8 +94,8 @@ namespace Discord.WebSocket
=> Channels.Select(x => x as SocketTextChannel).Where(x => x != null).ToImmutableArray();
public IReadOnlyCollection VoiceChannels
=> Channels.Select(x => x as SocketVoiceChannel).Where(x => x != null).ToImmutableArray();
- public IReadOnlyCollection ChannelCategories
- => Channels.Select(x => x as SocketChannelCategory).Where(x => x != null).ToImmutableArray();
+ public IReadOnlyCollection CategoryChannels
+ => Channels.Select(x => x as SocketCategoryChannel).Where(x => x != null).ToImmutableArray();
public SocketGuildUser CurrentUser => _members.TryGetValue(Discord.CurrentUser.Id, out SocketGuildUser member) ? member : null;
public SocketRole EveryoneRole => GetRole(Id);
public IReadOnlyCollection Channels
@@ -318,8 +318,8 @@ namespace Discord.WebSocket
=> GuildHelper.CreateTextChannelAsync(this, Discord, name, options);
public Task CreateVoiceChannelAsync(string name, RequestOptions options = null)
=> GuildHelper.CreateVoiceChannelAsync(this, Discord, name, options);
- public Task CreateChannelCategoryAsync(string name, RequestOptions options = null)
- => GuildHelper.CreateChannelCategoryAsync(this, Discord, name, options);
+ public Task CreateCategoryChannelAsync(string name, RequestOptions options = null)
+ => GuildHelper.CreateCategoryChannelAsync(this, Discord, name, options);
internal SocketGuildChannel AddChannel(ClientState state, ChannelModel model)
{
@@ -639,8 +639,8 @@ namespace Discord.WebSocket
=> Task.FromResult(GetTextChannel(id));
Task> IGuild.GetVoiceChannelsAsync(CacheMode mode, RequestOptions options)
=> Task.FromResult>(VoiceChannels);
- Task> IGuild.GetChannelCategoriesAsync(CacheMode mode , RequestOptions options)
- => Task.FromResult>(ChannelCategories);
+ Task> IGuild.GetCategoryChannelsAsync(CacheMode mode , RequestOptions options)
+ => Task.FromResult>(CategoryChannels);
Task IGuild.GetVoiceChannelAsync(ulong id, CacheMode mode, RequestOptions options)
=> Task.FromResult(GetVoiceChannel(id));
Task IGuild.GetAFKChannelAsync(CacheMode mode, RequestOptions options)
@@ -655,8 +655,8 @@ namespace Discord.WebSocket
=> await CreateTextChannelAsync(name, options).ConfigureAwait(false);
async Task IGuild.CreateVoiceChannelAsync(string name, RequestOptions options)
=> await CreateVoiceChannelAsync(name, options).ConfigureAwait(false);
- async Task IGuild.CreateChannelCategoryAsync(string name, RequestOptions options)
- => await CreateChannelCategoryAsync(name, options).ConfigureAwait(false);
+ async Task IGuild.CreateCategoryChannelAsync(string name, RequestOptions options)
+ => await CreateCategoryChannelAsync(name, options).ConfigureAwait(false);
async Task> IGuild.GetIntegrationsAsync(RequestOptions options)
=> await GetIntegrationsAsync(options).ConfigureAwait(false);