Added Memberships and Servers IEnumerables to User. Added doc to User.PrivateChannel.
This commit is contained in:
@@ -12,27 +12,27 @@ namespace Discord
|
||||
/// <summary> Returns a collection of all users the client can see across all servers. </summary>
|
||||
/// <remarks> This collection does not guarantee any ordering. </remarks>
|
||||
public IEnumerable<User> Users => _users;
|
||||
private AsyncCache<User, API.Models.UserReference> _users;
|
||||
internal AsyncCache<User, API.Models.UserReference> _users;
|
||||
|
||||
/// <summary> Returns a collection of all servers the client is a member of. </summary>
|
||||
/// <remarks> This collection does not guarantee any ordering. </remarks>
|
||||
public IEnumerable<Server> Servers => _servers;
|
||||
private AsyncCache<Server, API.Models.ServerReference> _servers;
|
||||
internal AsyncCache<Server, API.Models.ServerReference> _servers;
|
||||
|
||||
/// <summary> Returns a collection of all channels the client can see across all servers. </summary>
|
||||
/// <remarks> This collection does not guarantee any ordering. </remarks>
|
||||
public IEnumerable<Channel> Channels => _channels;
|
||||
private AsyncCache<Channel, API.Models.ChannelReference> _channels;
|
||||
internal AsyncCache<Channel, API.Models.ChannelReference> _channels;
|
||||
|
||||
/// <summary> Returns a collection of all messages the client has in cache. </summary>
|
||||
/// <remarks> This collection does not guarantee any ordering. </remarks>
|
||||
public IEnumerable<Message> Messages => _messages;
|
||||
private AsyncCache<Message, API.Models.MessageReference> _messages;
|
||||
internal AsyncCache<Message, API.Models.MessageReference> _messages;
|
||||
|
||||
/// <summary> Returns a collection of all roles the client can see across all servers. </summary>
|
||||
/// <remarks> This collection does not guarantee any ordering. </remarks>
|
||||
public IEnumerable<Role> Roles => _roles;
|
||||
private AsyncCache<Role, API.Models.Role> _roles;
|
||||
internal AsyncCache<Role, API.Models.Role> _roles;
|
||||
|
||||
private void CreateCaches()
|
||||
{
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
using Discord.API;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace Discord
|
||||
{
|
||||
@@ -28,10 +30,17 @@ namespace Discord
|
||||
/// <remarks> This field is only ever populated for the current logged in user. </remarks>
|
||||
public bool IsVerified { get; internal set; }
|
||||
|
||||
/// <summary> Returns the Id of the private messaging channel with this user, if one exists. </summary>
|
||||
public string PrivateChannelId { get; set; }
|
||||
/// <summary> Returns the private messaging channel with this user, if one exists. </summary>
|
||||
public Channel PrivateChannel => _client.GetChannel(PrivateChannelId);
|
||||
|
||||
//TODO: Add voice
|
||||
/// <summary> Returns a collection of all server-specific data for every server this user is a member of. </summary>
|
||||
public IEnumerable<Member> Memberships => _client._servers.Select(x => x._members[Id]).Where(x => x != null);
|
||||
/// <summary> Returns a collection of all servers this user is a member of. </summary>
|
||||
public IEnumerable<Server> Servers => _client._servers.Where(x => x._members[Id] != null);
|
||||
|
||||
//TODO: Add voice triggering lastactivity
|
||||
/// <summary> Returns the time this user last sent a message. </summary>
|
||||
/// <remarks> Is not currently affected by voice activity </remarks>
|
||||
public DateTime LastActivity { get; private set; }
|
||||
|
||||
Reference in New Issue
Block a user