Browse Source

Merge pull request #2 from moiph/master

Adding argument null check in sendmessage
tags/docs-0.9
RogueException 9 years ago
parent
commit
546726c027
1 changed files with 11 additions and 4 deletions
  1. +11
    -4
      src/Discord.Net/DiscordClient.cs

+ 11
- 4
src/Discord.Net/DiscordClient.cs View File

@@ -1262,10 +1262,17 @@ namespace Discord
catch (HttpException ex) when (ex.StatusCode == HttpStatusCode.NotFound) { }
}

//Chat
/// <summary> Sends a message to the provided channel. </summary>
public Task<Message[]> SendMessage(Channel channel, string text)
=> SendMessage(channel.Id, text, new string[0]);
//Chat
/// <summary> Sends a message to the provided channel. </summary>
public Task<Message[]> SendMessage(Channel channel, string text)
{
if (channel == null)
{
throw new ArgumentNullException("channel");
}

return SendMessage(channel.Id, text, new string[0]);
}
/// <summary> Sends a message to the provided channel. </summary>
public Task<Message[]> SendMessage(string channelId, string text)
=> SendMessage(channelId, text, new string[0]);


Loading…
Cancel
Save