Repository: twitch-apis/twitch-js (js)

Issue:
bug v2: whisper function is using /whisper instead of /w
## Expected behaviour

`client.chat.whisper(username, 'message')` should send whisper to `username` through /w command

## Actual behaviour

Unrecognized command: /whisper

## Steps to reproduce

Do a whisper throught whisper command

## Your environment

* Operating system(s):
* TwitchJS version: 2.0.0-beta.9
* NodeJS version: 10.7
* Browser(s):


Pull request description:
Bugfix: whispers
Resolves #135.

Patch:
diff --git a/docs/reference/class.md b/docs/reference/class.md
index 90e30e0..da88bb4 100644
--- a/docs/reference/class.md
+++ b/docs/reference/class.md
@@ -230,6 +230,7 @@ Chat client
     * [.join(channel)](#Chat+join) ⇒ <code>Promise.&lt;ChannelState, string&gt;</code>
     * [.part(channel)](#Chat+part)
     * [.say(channel, message)](#Chat+say) ⇒ <code>Promise.&lt;UserStateMessage, string&gt;</code>
+    * [.whisper(user, message)](#Chat+whisper) ⇒ <code>Promise.&lt;undefined&gt;</code>
     * [.broadcast(message)](#Chat+broadcast) ⇒ <code>Promise.&lt;Array.&lt;UserStateMessage&gt;&gt;</code>
     * ["*"](#Chat+event_*)
     * ["JOIN"](#Chat+event_JOIN)
@@ -481,6 +482,29 @@ Send a message to a channel.
 </table>
 
 
+* * *
+
+<a name="Chat+whisper"></a>
+
+### chat.whisper(user, message) ⇒ <code>Promise.&lt;undefined&gt;</code>
+Whisper to another user.
+
+**Kind**: instance method of [<code>Chat</code>](class#Chat)  
+<table>
+  <thead>
+    <tr>
+      <th>Param</th><th>Type</th>
+    </tr>
+  </thead>
+  <tbody>
+<tr>
+    <td>user</td><td><code>string</code></td>
+    </tr><tr>
+    <td>message</td><td><code>string</code></td>
+    </tr>  </tbody>
+</table>
+
+
 * * *
 
 <a name="Chat+broadcast"></a>
diff --git a/src/Chat/constants.js b/src/Chat/constants.js
index 14d2a5d..ffc886d 100644
--- a/src/Chat/constants.js
+++ b/src/Chat/constants.js
@@ -91,6 +91,7 @@ export const TAG_COMMANDS = {
 export const OTHER_COMMANDS = {
   PING: 'PING',
   PONG: 'PONG',
+  WHISPER: 'PRIVMSG #jtv',
 }
 
 // See https://dev.twitch.tv/docs/irc/commands/.
@@ -215,5 +216,5 @@ export const CHAT_COMMANDS = {
   UNBAN: 'unban',
   UNHOST: 'unhost',
   UNMOD: 'unmod',
-  WHISPER: 'whisper',
+  // WHISPER: 'w',
 }
diff --git a/src/Chat/index.js b/src/Chat/index.js
index 8291e42..24ca84c 100644
--- a/src/Chat/index.js
+++ b/src/Chat/index.js
@@ -364,6 +364,18 @@ class Chat extends EventEmitter {
     ])
   }
 
+  /**
+   * Whisper to another user.
+   * @param {string} user
+   * @param {string} message
+   * @return {Promise<undefined>}
+   */
+  whisper(user, message) {
+    this.send(`${constants.COMMANDS.WHISPER} :/w ${user} ${message}`)
+
+    return Promise.resolve()
+  }
+
   /**
    * Broadcast message to all connected channels.
    * @param {string} message


Test patch:
diff --git a/src/Chat/__tests__/index.test.js b/src/Chat/__tests__/index.test.js
index 05419da..2a718d4 100644
--- a/src/Chat/__tests__/index.test.js
+++ b/src/Chat/__tests__/index.test.js
@@ -396,6 +396,18 @@ describe('Chat', () => {
 
         emitHelper(chat._client, raw)
       })
+
+      test('whisper', async done => {
+        const chat = new Chat(options)
+        await chat.connect()
+
+        server.once('message', message => {
+          expect(message).toEqual('PRIVMSG #jtv :/w dallas Kappa Keepo Kappa')
+          done()
+        })
+
+        chat.whisper('dallas', 'Kappa Keepo Kappa')
+      })
     })
 
     describe('deviations', () => {