Added method to send notices

This commit is contained in:
Alexandre Oliveira 2015-08-16 17:56:35 -03:00
parent b1edf96cbc
commit 908741d5f8
1 changed files with 12 additions and 0 deletions

View File

@ -38,6 +38,18 @@ namespace ChatSharp
SendRawMessage("PRIVMSG {0} :\x0001ACTION {1}{2}\x0001", to, PrivmsgPrefix, message);
}
/// <summary>
/// Sends a NOTICE to one or more destinations (channels or users).
/// </summary>
public void SendNotice(string message, params string[] destinations)
{
const string illegalCharacters = "\r\n\0";
if (!destinations.Any()) throw new InvalidOperationException("Message must have at least one target.");
if (illegalCharacters.Any(message.Contains)) throw new ArgumentException("Illegal characters are present in mesasge.", "message");
string to = string.Join(",", destinations);
SendRawMessage("NOTICE {0} :{1}{2}", to, PrivmsgPrefix, message);
}
/// <summary>
/// Leaves the specified channel.
/// </summary>