From f90e41271a2a8eb59c16e0db161def2612095cca Mon Sep 17 00:00:00 2001 From: Brandon Smith Date: Fri, 21 Aug 2015 18:32:09 -0300 Subject: [PATCH] Added Server documentation --- src/Discord.Net/Server.cs | 42 ++++++++++++++++++++++++++++++--------- 1 file changed, 33 insertions(+), 9 deletions(-) diff --git a/src/Discord.Net/Server.cs b/src/Discord.Net/Server.cs index 0532c8ba2..6a51fa3a0 100644 --- a/src/Discord.Net/Server.cs +++ b/src/Discord.Net/Server.cs @@ -9,32 +9,56 @@ namespace Discord { private readonly DiscordClient _client; + /// Returns the unique identifier for this server. public string Id { get; } + /// Returns the name of this channel. public string Name { get; internal set; } - public string AFKChannelId { get; internal set; } + /// Returns the amount of time (in seconds) a user must be inactive for until they are automatically moved to the AFK channel (see AFKChannel). public int AFKTimeout { get; internal set; } + /// Returns the date and time your joined this server. public DateTime JoinedAt { get; internal set; } + /// Returns the region for this server (see Regions). public string Region { get; internal set; } - + + /// Returns the id of the user that first created this server. public string OwnerId { get; internal set; } + /// Returns the user that first created this server. public User Owner => _client.GetUser(OwnerId); + /// Returns true if the current user created this server. public bool IsOwner => _client.UserId == OwnerId; - + + /// Returns the id of the AFK voice channel for this server (see AFKTimeout). + public string AFKChannelId { get; internal set; } + /// Returns the AFK voice channel for this server (see AFKTimeout). + public Channel AFKChannel => _client.GetChannel(AFKChannelId); + + /// Returns the id of the default channel for this server. public string DefaultChannelId => Id; + /// Returns the default channel for this server. public Channel DefaultChannel =>_client.GetChannel(DefaultChannelId); internal ConcurrentDictionary _members; + /// Returns a collection of all channels within this server. public IEnumerable Members => _members.Values; internal ConcurrentDictionary _bans; + /// Returns a collection of all users banned on this server. + /// Only users seen in other servers will be returned. To get a list of all users, use BanIds. public IEnumerable Bans => _bans.Keys.Select(x => _client.GetUser(x)); + /// Returns a collection of the ids of all users banned on this server. + public IEnumerable BanIds => _bans.Keys; + /// Returns a collection of all channels within this server. public IEnumerable Channels => _client.Channels.Where(x => x.ServerId == Id); + /// Returns a collection of all roles within this server. public IEnumerable Roles => _client.Roles.Where(x => x.ServerId == Id); - //Not Implemented + //TODO: Not Implemented + /// Not implemented, stored for reference. public object Presence { get; internal set; } + //TODO: Not Implemented + /// Not implemented, stored for reference. public object[] VoiceStates { get; internal set; } internal Server(string id, DiscordClient client) @@ -45,11 +69,6 @@ namespace Discord _bans = new ConcurrentDictionary(); } - public override string ToString() - { - return Name; - } - internal void AddMember(Membership membership) { _members[membership.UserId] = membership; @@ -78,5 +97,10 @@ namespace Discord bool ignored; return _bans.TryRemove(banId, out ignored); } + + public override string ToString() + { + return Name; + } } }