Browse Source

Added more JsonIgnores

tags/docs-0.9
RogueException 9 years ago
parent
commit
a2480ebaeb
4 changed files with 9 additions and 0 deletions
  1. +2
    -0
      src/Discord.Net/Models/Member.cs
  2. +2
    -0
      src/Discord.Net/Models/Role.cs
  3. +1
    -0
      src/Discord.Net/Models/Server.cs
  4. +4
    -0
      src/Discord.Net/Models/User.cs

+ 2
- 0
src/Discord.Net/Models/Member.cs View File

@@ -61,9 +61,11 @@ namespace Discord
public IEnumerable<Role> Roles => RoleIds.Select(x => _client.Roles[x]);

/// <summary> Returns a collection of all messages this user has sent on this server that are still in cache. </summary>
[JsonIgnore]
public IEnumerable<Message> Messages => _client.Messages.Where(x => x.UserId == UserId && x.ServerId == ServerId);

/// <summary> Returns a collection of all channels this user is a member of. </summary>
[JsonIgnore]
public IEnumerable<Channel> Channels => _client.Channels.Where(x => x.ServerId == ServerId && x.UserIds.Contains(UserId));

internal Member(DiscordClient client, string userId, string serverId)


+ 2
- 0
src/Discord.Net/Models/Role.cs View File

@@ -34,8 +34,10 @@ namespace Discord
/// <summary> Returns true if this is the role representing all users in a server. </summary>
public bool IsEveryone { get; }
/// <summary> Returns a list of the ids of all members in this role. </summary>
[JsonIgnore]
public IEnumerable<string> MemberIds => IsEveryone ? Server.UserIds : Server.Members.Where(x => x.RoleIds.Contains(Id)).Select(x => x.UserId);
/// <summary> Returns a list of all members in this role. </summary>
[JsonIgnore]
public IEnumerable<Member> Members => IsEveryone ? Server.Members : Server.Members.Where(x => x.RoleIds.Contains(Id));

internal Role(DiscordClient client, string id, string serverId, bool isEveryone)


+ 1
- 0
src/Discord.Net/Models/Server.cs View File

@@ -85,6 +85,7 @@ namespace Discord
/// <summary> Return the id of the role representing all users in a server. </summary>
public string EveryoneRoleId { get; private set; }
/// <summary> Return the the role representing all users in a server. </summary>
[JsonIgnore]
public Role EveryoneRole => _client.Roles[EveryoneRoleId];
/// <summary> Returns a collection of the ids of all roles within this server. </summary>
[JsonIgnore]


+ 4
- 0
src/Discord.Net/Models/User.cs View File

@@ -42,12 +42,16 @@ namespace Discord
public Channel PrivateChannel => _client.Channels[PrivateChannelId];

/// <summary> Returns a collection of all server-specific data for every server this user is a member of. </summary>
[JsonIgnore]
public IEnumerable<Member> Memberships => _servers.Select(x => _client.GetMember(x.Key, Id));
/// <summary> Returns a collection of all servers this user is a member of. </summary>
[JsonIgnore]
public IEnumerable<Server> Servers => _servers.Select(x => _client.GetServer(x.Key));
/// <summary> Returns a collection of the ids of all servers this user is a member of. </summary>
[JsonIgnore]
public IEnumerable<string> ServersIds => _servers.Select(x => x.Key);
/// <summary> Returns a collection of all messages this user has sent that are still in cache. </summary>
[JsonIgnore]
public IEnumerable<Message> Messages => _client.Messages.Where(x => x.UserId == Id);

/// <summary> Returns the id for the game this user is currently playing. </summary>


Loading…
Cancel
Save