ChatClient/ChatClient.cs
/// <summary>
/// Times out the specified user.
/// </summary>
/// <param name="username">The name of the user.</param>
/// <param name="seconds">The amount of time in seconds; default: 600.</param>
/// <param name="channelName">The name of the channel; default: sole connected channel.</param>
/// <returns>False if error.</returns>
Times out the specified user.
Times out the specified user .
public bool TimeoutUser(string? username, int seconds = 600, string? channelName = null) {
            if (string.IsNullOrEmpty(username)) {
                LogLine($"null/empty {nameof(username)}", LogLevel.Warn);
                return false;
            }
            if (seconds <= 0 || seconds > int.MaxValue) {
                LogLine($"Invalid {nameof(seconds)}", LogLevel.Warn);
                return false;
            }
            channelName = GetValidChannelName(channelName);
            if (string.IsNullOrEmpty(channelName)) {
                LogLine($"null/empty {nameof(channelName)}", LogLevel.Error);
                return false;
            }
            if (!SendMessage($"/timeout {username} {seconds}")) {
                LogLine($"Failed to timeout user: {username}, {seconds}", LogLevel.Error);
                return false;
            }
            LogLine($"Timed out user: {username}, {seconds}", LogLevel.Info);
            return true;
        }
public bool TimeoutUser ( string ? username , int seconds = 600 , string ? channelName = null ) { if ( string . IsNullOrEmpty ( username ) ) { LogLine ( $" null/empty  { nameof ( username ) } " , LogLevel . Warn ) ; return false ; } if ( seconds <= 0 || seconds > int . MaxValue ) { LogLine ( $" Invalid  { nameof ( seconds ) } " , LogLevel . Warn ) ; return false ; } channelName = GetValidChannelName ( channelName ) ; if ( string . IsNullOrEmpty ( channelName ) ) { LogLine ( $" null/empty  { nameof ( channelName ) } " , LogLevel . Error ) ; return false ; } if ( ! SendMessage ( $" /timeout  { username } { seconds } " ) ) { LogLine ( $" Failed to timeout user:  { username } ,  { seconds } " , LogLevel . Error ) ; return false ; } LogLine ( $" Timed out user:  { username } ,  { seconds } " , LogLevel . Info ) ; return true ; }
Times out the specified user.
Times out the specified user .
False if error.
False if error .
username
string?
The name of the user.
The name of the user .
seconds
int
The amount of time in seconds; default: 600.
The amount of time in seconds ; default : 600 .
channelName
string?
The name of the channel; default: sole connected channel.
The name of the channel ; default : sole connected channel .