From 32a9321cfdd6258abab0e14f445234bdf410aceb Mon Sep 17 00:00:00 2001 From: hydrabolt Date: Wed, 30 Sep 2015 20:52:07 +0100 Subject: [PATCH] Added setPlaying to docs --- docs/docs_client.rst | 19 +++++++++++++++++-- lib/Client.js | 5 +++++ src/Client.js | 4 ++++ 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/docs/docs_client.rst b/docs/docs_client.rst index d312ab6a2..cb5ed2bab 100644 --- a/docs/docs_client.rst +++ b/docs/docs_client.rst @@ -402,9 +402,22 @@ Gets a PMChannel_ that matches the specified criteria. E.g: setPlayingGame(id) ~~~~~~~~~~~~~~~~~~ +**Aliases** : `playGame`, `playingGame` + Sets the client as playing the specified game name/id. -- **id** - Either a `Number` or a `String`. If it's a Number, it's assumed that you are using the Discord Game ID +- **id** - Either a `Number` or a `String`. If it's a Number, it's assumed that you are using a `Discord Game ID`_ and know what you want. If you supply a `String`, it will assume you are entering a game name and try resolving it to a Discord Game ID if it's available. Example: + +.. code-block:: js + + client.setPlayingGame(18); + // sets the client as playing Minecraft, game ID 18 + + client.setPlayingGame("Minecraft"); + // sets the client as playing Minecraft by resolving the ID to 18 + + client.setPlayingGame("my magical made up game") + // will stop the client from playing anything as it is unresolved, not a valid game. ----- @@ -592,4 +605,6 @@ Called when a WebSocket message is received and it gives you the message. - **data** - A `JSON Object` which is the message received over WebSocket. -.. _official API here : https://discordapp.com/api/voice/regions \ No newline at end of file +.. _official API here : https://discordapp.com/api/voice/regions + +.. _Discord Game ID : https://raw.githubusercontent.com/hydrabolt/discord.js/master/ref/gameMap.json \ No newline at end of file diff --git a/lib/Client.js b/lib/Client.js index 8b9c7f5c6..67c27c047 100644 --- a/lib/Client.js +++ b/lib/Client.js @@ -1844,6 +1844,11 @@ var Client = (function () { } })); } + }, { + key: "playGame", + value: function playGame(id) { + this.setPlayingGame(id); + } }, { key: "playingGame", value: function playingGame(id) { diff --git a/src/Client.js b/src/Client.js index ef3d7009c..336d704f9 100644 --- a/src/Client.js +++ b/src/Client.js @@ -1571,6 +1571,10 @@ class Client { } + playGame(id){ + this.setPlayingGame(id); + } + playingGame(id){ this.setPlayingGame(id);