godjjchrome/js/tmi.js
// Send an whisper message to a user..
Send an whisper message to a user
Send an whisper message to a user
function whisper(username, message) {
        var _this25 = this;
        username = _.username(username);
        if (username === this.getUsername()) {
            return Promise.reject("Cannot send a whisper to the same account.");
        }
        return this._sendCommand(this._getPromiseDelay(), "#tmijs", "/w " + username + " " + message, function (resolve, reject) {
            var from = _.channel(username),
                userstate = _.merge({
                "message-type": "whisper",
                "message-id": null,
                "thread-id": null,
                username: _this25.getUsername()
            }, _this25.globaluserstate);
            _this25.emits(["whisper", "message"], [[from, userstate, message, true], [from, userstate, message, true]]);
            resolve([username, message]);
        });
    }
function whisper ( username , message ) { var _this25 = this ; username = _ . username ( username ) ; if ( username === this . getUsername ( ) ) { return Promise . reject ( "Cannot send a whisper to the same account." ) ; } return this . _sendCommand ( this . _getPromiseDelay ( ) , "#tmijs" , "/w " + username + " " + message , function ( resolve , reject ) { var from = _ . channel ( username ) , userstate = _ . merge ( { "message-type" : "whisper" , "message-id" : null , "thread-id" : null , username : _this25 . getUsername ( ) } , _this25 . globaluserstate ) ; _this25 . emits ( [ "whisper" , "message" ] , [ [ from , userstate , message , true ] , [ from , userstate , message , true ] ] ) ; resolve ( [ username , message ] ) ; } ) ; }
Send an whisper message to a user..
Send an whisper message to a user ..
// The server will not send a whisper to the account that sent it. // Send the command to the server and race the Promise against a delay.. // Emit for both, whisper and message.. // At this time, there is no possible way to detect if a message has been sent has been eaten // by the server, so we can only resolve the Promise.