Added a few overloads
This commit is contained in:
@@ -47,7 +47,7 @@ namespace Discord
|
|||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public User Recipient => _client.Users[RecipientId];
|
public User Recipient => _client.Users[RecipientId];
|
||||||
|
|
||||||
private string[] _userIds;
|
/// <summary> Returns a collection of the IDs of all users with read access to this channel. </summary>
|
||||||
public IEnumerable<string> UserIds
|
public IEnumerable<string> UserIds
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -60,7 +60,10 @@ namespace Discord
|
|||||||
return _userIds;
|
return _userIds;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public IEnumerable<Member> Members => UserIds.Select(x => _client.Members[x, ServerId]);
|
private string[] _userIds;
|
||||||
|
/// <summary> Returns a collection of all users with read access to this channel. </summary>
|
||||||
|
public IEnumerable<Member> Members => UserIds.Select(x => _client.Members[x, ServerId]);
|
||||||
|
/// <summary> Returns a collection of all users with read access to this channel. </summary>
|
||||||
public IEnumerable<User> Users => UserIds.Select(x => _client.Users[x]);
|
public IEnumerable<User> Users => UserIds.Select(x => _client.Users[x]);
|
||||||
|
|
||||||
/// <summary> Returns a collection of the ids of all messages the client has seen posted in this channel. This collection does not guarantee any ordering. </summary>
|
/// <summary> Returns a collection of the ids of all messages the client has seen posted in this channel. This collection does not guarantee any ordering. </summary>
|
||||||
@@ -71,7 +74,8 @@ namespace Discord
|
|||||||
public IEnumerable<Message> Messages => _messages.Select(x => _client.Messages[x.Key]);
|
public IEnumerable<Message> Messages => _messages.Select(x => _client.Messages[x.Key]);
|
||||||
|
|
||||||
/// <summary> Returns a collection of all custom permissions used for this channel. </summary>
|
/// <summary> Returns a collection of all custom permissions used for this channel. </summary>
|
||||||
public PermissionOverwrite[] PermissionOverwrites { get; internal set; }
|
private PermissionOverwrite[] _permissionOverwrites;
|
||||||
|
public IEnumerable<PermissionOverwrite> PermissionOverwrites => _permissionOverwrites;
|
||||||
|
|
||||||
internal Channel(DiscordClient client, string id, string serverId, string recipientId)
|
internal Channel(DiscordClient client, string id, string serverId, string recipientId)
|
||||||
{
|
{
|
||||||
@@ -96,7 +100,7 @@ namespace Discord
|
|||||||
|
|
||||||
if (model.PermissionOverwrites != null)
|
if (model.PermissionOverwrites != null)
|
||||||
{
|
{
|
||||||
PermissionOverwrites = model.PermissionOverwrites.Select(x => new PermissionOverwrite
|
_permissionOverwrites = model.PermissionOverwrites.Select(x => new PermissionOverwrite
|
||||||
{
|
{
|
||||||
Type = x.Type,
|
Type = x.Type,
|
||||||
Id = x.Id,
|
Id = x.Id,
|
||||||
@@ -105,7 +109,7 @@ namespace Discord
|
|||||||
}).ToArray();
|
}).ToArray();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
PermissionOverwrites = null;
|
_permissionOverwrites = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string ToString() => Name;
|
public override string ToString() => Name;
|
||||||
|
|||||||
@@ -191,8 +191,12 @@ namespace Discord
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
//TODO: Add GetServerPermissions
|
//TODO: Add GetServerPermissions
|
||||||
public PackedChannelPermissions GetPermissions(string channelId)
|
public PackedChannelPermissions GetPermissions(Channel channel)
|
||||||
|
=> GetPermissions(channel?.Id);
|
||||||
|
public PackedChannelPermissions GetPermissions(string channelId)
|
||||||
{
|
{
|
||||||
|
if (channelId == null) throw new ArgumentNullException(nameof(channelId));
|
||||||
|
|
||||||
PackedChannelPermissions perms;
|
PackedChannelPermissions perms;
|
||||||
if (_permissions.TryGetValue(channelId, out perms))
|
if (_permissions.TryGetValue(channelId, out perms))
|
||||||
return perms;
|
return perms;
|
||||||
|
|||||||
Reference in New Issue
Block a user