If it only should work for you, there's no need to use newChatHud_addLine or clientCmdChatMessage. Here's a template of what you should do.
package foobar
{
    function NMH_Type::send( %this )
    {
        %value = %this.getValue();
        
        if ( yourProcessingFunction( %value ) )
        {
            %this.setValue( "" );
        }
        
        parent::send( %this );
    }
};
activatePackage( "foobar" );
function yourProcessingFunction( %msg )
{
    if ( %msg $= "-myping" )
    {
        newChatSO.addLine( "\c6Your ping is \c3" @ serverConnection.getPing() @ "\c6." );
    }
    else if ( %msg $= "-disconnect" )
    {
        disconnect();
    }
    else
    {
        return false;
    }
    
    return true;
}