diff --git a/src/Discord.Net/Models/Channel.cs b/src/Discord.Net/Models/Channel.cs
index f739fc0f1..acbf2128e 100644
--- a/src/Discord.Net/Models/Channel.cs
+++ b/src/Discord.Net/Models/Channel.cs
@@ -59,8 +59,8 @@ namespace Discord
public string Topic { get; private set; }
/// Gets the position of this channel relative to other channels in this server.
public int Position { get; private set; }
- /// Gets the type of this channel (see ChannelTypes).
- public string Type { get; private set; }
+ /// Gets the type of this channel).
+ public ChannelType Type { get; private set; }
/// Gets true if this is a private chat with another user.
public bool IsPrivate => Recipient != null;
@@ -172,7 +172,7 @@ namespace Discord
if (position != null)
{
- Channel[] channels = Server.Channels.Where(x => x.Type == Type).OrderBy(x => x.Position).ToArray();
+ Channel[] channels = Server.AllChannels.Where(x => x.Type == Type).OrderBy(x => x.Position).ToArray();
int oldPos = Array.IndexOf(channels, this);
var newPosChannel = channels.Where(x => x.Position > position).FirstOrDefault();
int newPos = (newPosChannel != null ? Array.IndexOf(channels, newPosChannel) : channels.Length) - 1;
diff --git a/src/Discord.Net/Models/Server.cs b/src/Discord.Net/Models/Server.cs
index 181e3011b..303e150cb 100644
--- a/src/Discord.Net/Models/Server.cs
+++ b/src/Discord.Net/Models/Server.cs
@@ -68,7 +68,11 @@ namespace Discord
/// Gets a collection of the ids of all users banned on this server.
public IEnumerable BannedUserIds => _bans.Select(x => x.Key);
/// Gets a collection of all channels in this server.
- public IEnumerable Channels => _channels.Select(x => x.Value);
+ public IEnumerable AllChannels => _channels.Select(x => x.Value);
+ /// Gets a collection of text channels in this server.
+ public IEnumerable TextChannels => _channels.Select(x => x.Value).Where(x => x.Type == ChannelType.Text);
+ /// Gets a collection of voice channels in this server.
+ public IEnumerable VoiceChannels => _channels.Select(x => x.Value).Where(x => x.Type == ChannelType.Voice);
/// Gets a collection of all members in this server.
public IEnumerable Users => _users.Select(x => x.Value.User);
/// Gets a collection of all roles in this server.
@@ -386,7 +390,7 @@ namespace Discord
var user = _users.GetOrAdd(id, x => new Member(new User(Client, id, this)));
if (user.User == newUser)
{
- foreach (var channel in Channels)
+ foreach (var channel in AllChannels)
channel.AddUser(newUser);
}
return user.User;
@@ -396,7 +400,7 @@ namespace Discord
Member member;
if (_users.TryRemove(id, out member))
{
- foreach (var channel in Channels)
+ foreach (var channel in AllChannels)
channel.RemoveUser(id);
}
return member.User;
diff --git a/src/Discord.Net/Models/User.cs b/src/Discord.Net/Models/User.cs
index 454cca733..464078f3b 100644
--- a/src/Discord.Net/Models/User.cs
+++ b/src/Discord.Net/Models/User.cs
@@ -101,14 +101,14 @@ namespace Discord
{
if (Client.Config.UsePermissionsCache)
{
- return Server.Channels.Where(x =>
+ return Server.AllChannels.Where(x =>
(x.Type == ChannelType.Text && x.GetPermissions(this).ReadMessages) ||
(x.Type == ChannelType.Voice && x.GetPermissions(this).Connect));
}
else
{
ChannelPermissions perms = new ChannelPermissions();
- return Server.Channels
+ return Server.AllChannels
.Where(x =>
{
x.UpdatePermissions(this, perms);