Browse Source

Made GetX methods more consistent

tags/docs-0.9
RogueException 9 years ago
parent
commit
f44afd6196
3 changed files with 16 additions and 2 deletions
  1. +2
    -0
      src/Discord.Net/DiscordClient.Channels.cs
  2. +7
    -1
      src/Discord.Net/DiscordClient.Messages.cs
  3. +7
    -1
      src/Discord.Net/DiscordClient.Servers.cs

+ 2
- 0
src/Discord.Net/DiscordClient.Channels.cs View File

@@ -51,6 +51,8 @@ namespace Discord
public Channel GetChannel(string id)
{
if (id == null) throw new ArgumentNullException(nameof(id));
CheckReady();

return _channels[id];
}


+ 7
- 1
src/Discord.Net/DiscordClient.Messages.cs View File

@@ -80,7 +80,13 @@ namespace Discord
private readonly Messages _messages;

/// <summary> Returns the message with the specified id, or null if none was found. </summary>
public Message GetMessage(string id) => _messages[id];
public Message GetMessage(string id)
{
if (id == null) throw new ArgumentNullException(nameof(id));
CheckReady();

return _messages[id];
}

/// <summary> Sends a message to the provided channel. To include a mention, see the Mention static helper class. </summary>
public Task<Message> SendMessage(Channel channel, string text)


+ 7
- 1
src/Discord.Net/DiscordClient.Servers.cs View File

@@ -62,7 +62,13 @@ namespace Discord
private readonly Servers _servers;

/// <summary> Returns the server with the specified id, or null if none was found. </summary>
public Server GetServer(string id) => _servers[id];
public Server GetServer(string id)
{
if (id == null) throw new ArgumentNullException(nameof(id));
CheckReady();

return _servers[id];
}

/// <summary> Returns all servers with the specified name. </summary>
/// <remarks> Search is case-insensitive. </remarks>


Loading…
Cancel
Save