public MessagePermitted ( string message ) : bool | ||
message | string | |
Résultat | bool |
/// <summary> /// Sends a RAW IRC message. /// </summary> /// <param name="message">The RAW message to be sent.</param> public void SendRaw(string message) { if (ChatThrottler == null || !ChatThrottler.ApplyThrottlingToRawMessages || ChatThrottler.MessagePermitted(message)) { _client.WriteLine(message); } }
/// <summary> /// Sends a RAW IRC message. /// </summary> /// <param name="message">The RAW message to be sent.</param> public void SendRaw(string message) { ConsoleColor prevColor = Console.ForegroundColor; Console.ForegroundColor = ConsoleColor.DarkYellow; log($"Writing: {message}"); if (ChatThrottler == null || !ChatThrottler.ApplyThrottlingToRawMessages || ChatThrottler.MessagePermitted(message)) { _client.Send(message); } OnSendReceiveData?.Invoke(this, new OnSendReceiveDataArgs { Direction = Enums.SendReceiveDirection.Sent, Data = message }); Console.ForegroundColor = prevColor; }
/// <summary> /// Sends a formatted whisper message to someone. /// </summary> /// <param name="receiver">The receiver of the whisper.</param> /// <param name="message">The message to be sent.</param> /// <param name="dryRun">If set to true, the message will not actually be sent for testing purposes.</param> public void SendWhisper(string receiver, string message, bool dryRun = false) { if (dryRun) { return; } if (WhisperThrottler != null && !WhisperThrottler.MessagePermitted(message)) { return; } string twitchMessage = $":{_credentials.TwitchUsername}~{_credentials.TwitchUsername}@{_credentials.TwitchUsername}" + $".tmi.twitch.tv PRIVMSG #jtv :/w {receiver} {message}"; // This is a makeshift hack to encode it with accomodations for at least cyrillic, and possibly others _client.WriteLine(Encoding.Default.GetString(Encoding.UTF8.GetBytes(twitchMessage))); OnWhisperSent?.Invoke(this, new OnWhisperSentArgs { Receiver = receiver, Message = message }); }