From fe8a7661330fbe4dba74f7b6397d7f6c5a436f45 Mon Sep 17 00:00:00 2001 From: RogueException Date: Thu, 9 Jun 2016 13:39:39 -0300 Subject: [PATCH] Added Available to IGuild --- src/Discord.Net/Entities/Guilds/Guild.cs | 1 + src/Discord.Net/Entities/Guilds/IGuild.cs | 4 +++- src/Discord.Net/Entities/WebSocket/CachedGuild.cs | 4 ++-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Discord.Net/Entities/Guilds/Guild.cs b/src/Discord.Net/Entities/Guilds/Guild.cs index c8e79238b..0778d3597 100644 --- a/src/Discord.Net/Entities/Guilds/Guild.cs +++ b/src/Discord.Net/Entities/Guilds/Guild.cs @@ -303,6 +303,7 @@ namespace Discord private string DebuggerDisplay => $"{Name} ({Id})"; + bool IGuild.Available => false; IRole IGuild.EveryoneRole => EveryoneRole; IReadOnlyCollection IGuild.Emojis => Emojis; IReadOnlyCollection IGuild.Features => Features; diff --git a/src/Discord.Net/Entities/Guilds/IGuild.cs b/src/Discord.Net/Entities/Guilds/IGuild.cs index 9949b788d..3300132b0 100644 --- a/src/Discord.Net/Entities/Guilds/IGuild.cs +++ b/src/Discord.Net/Entities/Guilds/IGuild.cs @@ -18,6 +18,8 @@ namespace Discord string IconUrl { get; } /// Returns the url to this guild's splash image, or null if one is not set. string SplashUrl { get; } + /// Returns true if this guild is currently connected and ready to be used. Only applies to the WebSocket client. + bool Available { get; } /// Gets the id of the AFK voice channel for this guild if set, or null if not. ulong? AFKChannelId { get; } @@ -90,7 +92,7 @@ namespace Discord Task GetUserAsync(ulong id); /// Gets the current user for this guild. Task GetCurrentUserAsync(); - /// Downloads all users for this guild if the current list is incomplete. + /// Downloads all users for this guild if the current list is incomplete. Only applies to the WebSocket client. Task DownloadUsersAsync(); /// Removes all users from this guild if they have not logged on in a provided number of days or, if simulate is true, returns the number of users that would be removed. Task PruneUsersAsync(int days = 30, bool simulate = false); diff --git a/src/Discord.Net/Entities/WebSocket/CachedGuild.cs b/src/Discord.Net/Entities/WebSocket/CachedGuild.cs index 058cd5b52..0e567fba1 100644 --- a/src/Discord.Net/Entities/WebSocket/CachedGuild.cs +++ b/src/Discord.Net/Entities/WebSocket/CachedGuild.cs @@ -24,7 +24,7 @@ namespace Discord private ConcurrentDictionary _presences; private ConcurrentDictionary _voiceStates; - public bool Available { get; private set; } //TODO: Add to IGuild + public bool Available { get; private set; } public int MemberCount { get; private set; } public int DownloadedMemberCount { get; private set; } @@ -102,7 +102,7 @@ namespace Discord if (model.VoiceStates != null) { for (int i = 0; i < model.VoiceStates.Length; i++) - AddOrUpdateCachedVoiceState(model.VoiceStates[i], _voiceStates); + AddOrUpdateCachedVoiceState(model.VoiceStates[i], voiceStates); } _voiceStates = voiceStates; }