ChatClient/ChatClient.cs
/// <summary>
/// Sends the specified text as a whisper to the specified user.
/// </summary>
/// <param name="username">The name of the user.</param>
/// <param name="message">The whisper text.</param>
/// <param name="channelName">The name of the channel; default: sole connected channel.</param>
/// <returns>False if error</returns>
Sends the specified text as a whisper to the specified user.
Sends the specified text as a whisper to the specified user .
public bool SendWhisper(string? username, string? message, string? channelName = null) {
            if (string.IsNullOrEmpty(username)) {
                LogLine($"null/empty {nameof(username)}", LogLevel.Warn);
                return false;
            }
            if (string.IsNullOrEmpty(message)) {
                LogLine($"null/empty {nameof(message)}", LogLevel.Warn);
                return false;
            }
            channelName = GetValidChannelName(channelName);
            if (string.IsNullOrEmpty(channelName)) {
                LogLine($"null/empty {nameof(channelName)}", LogLevel.Error);
                return false;
            }
            if (!SendMessage($"/w {username} {message}")) {
                LogLine($"Failed to send whisper: {username}, {message}", LogLevel.Error);
                return false;
            }
            LogLine($"Sent whisper: {username}, {message}", LogLevel.Info);
            return true;
        }
public bool SendWhisper ( string ? username , string ? message , string ? channelName = null ) { if ( string . IsNullOrEmpty ( username ) ) { LogLine ( $" null/empty  { nameof ( username ) } " , LogLevel . Warn ) ; return false ; } if ( string . IsNullOrEmpty ( message ) ) { LogLine ( $" null/empty  { nameof ( message ) } " , LogLevel . Warn ) ; return false ; } channelName = GetValidChannelName ( channelName ) ; if ( string . IsNullOrEmpty ( channelName ) ) { LogLine ( $" null/empty  { nameof ( channelName ) } " , LogLevel . Error ) ; return false ; } if ( ! SendMessage ( $" /w  { username } { message } " ) ) { LogLine ( $" Failed to send whisper:  { username } ,  { message } " , LogLevel . Error ) ; return false ; } LogLine ( $" Sent whisper:  { username } ,  { message } " , LogLevel . Info ) ; return true ; }
Sends the specified text as a whisper to the specified user.
Sends the specified text as a whisper to the specified user .
False if error
False if error
username
string?
The name of the user.
The name of the user .
message
string?
The whisper text.
The whisper text .
channelName
string?
The name of the channel; default: sole connected channel.
The name of the channel ; default : sole connected channel .