Added status checks to a several properties of DiscordClient.
This commit is contained in:
@@ -66,7 +66,7 @@ namespace Discord
|
||||
}
|
||||
|
||||
/// <summary> Returns a collection of all servers this client is a member of. </summary>
|
||||
public IEnumerable<Channel> PrivateChannels => _channels.PrivateChannels;
|
||||
public IEnumerable<Channel> PrivateChannels { get { CheckReady(); return _channels.PrivateChannels; } }
|
||||
internal Channels Channels => _channels;
|
||||
private readonly Channels _channels;
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ namespace Discord
|
||||
}
|
||||
|
||||
/// <summary> Returns a collection of all servers this client is a member of. </summary>
|
||||
public IEnumerable<Server> AllServers => _servers;
|
||||
public IEnumerable<Server> AllServers { get { CheckReady(); return _servers; } }
|
||||
internal Servers Servers => _servers;
|
||||
private readonly Servers _servers;
|
||||
|
||||
|
||||
@@ -134,10 +134,10 @@ namespace Discord
|
||||
private User _privateUser;
|
||||
|
||||
/// <summary> Returns information about the currently logged-in account. </summary>
|
||||
public GlobalUser CurrentUser => _privateUser.Global;
|
||||
public GlobalUser CurrentUser { get { CheckReady(); return _privateUser.Global; } }
|
||||
|
||||
/// <summary> Returns a collection of all unique users this client can currently see. </summary>
|
||||
public IEnumerable<GlobalUser> AllUsers => _globalUsers;
|
||||
public IEnumerable<GlobalUser> AllUsers { get { CheckReady(); return _globalUsers; } }
|
||||
internal GlobalUsers GlobalUsers => _globalUsers;
|
||||
private readonly GlobalUsers _globalUsers;
|
||||
|
||||
@@ -146,6 +146,9 @@ namespace Discord
|
||||
|
||||
public GlobalUser GetUser(long userId)
|
||||
{
|
||||
if (userId <= 0) throw new ArgumentOutOfRangeException(nameof(userId));
|
||||
CheckReady();
|
||||
|
||||
return _globalUsers[userId];
|
||||
}
|
||||
/// <summary> Returns the user with the specified id, along with their server-specific data, or null if none was found. </summary>
|
||||
|
||||
Reference in New Issue
Block a user