mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-17 03:53:29 +01:00
Make setStatus take a streaming URL param
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -85,6 +85,8 @@ class ClientUser extends User {
|
|||||||
* Set the status and playing game of the logged in client.
|
* Set the status and playing game of the logged in client.
|
||||||
* @param {string} [status] The status, can be `online` or `idle`
|
* @param {string} [status] The status, can be `online` or `idle`
|
||||||
* @param {string|Object} [game] The game that is being played
|
* @param {string|Object} [game] The game that is being played
|
||||||
|
* @param {string} [streamURL] If you want to display as streaming, set this as the URL to the stream (must be a
|
||||||
|
* twitch.tv URl)
|
||||||
* @returns {Promise<ClientUser>}
|
* @returns {Promise<ClientUser>}
|
||||||
* @example
|
* @example
|
||||||
* // set status
|
* // set status
|
||||||
@@ -92,7 +94,7 @@ class ClientUser extends User {
|
|||||||
* .then(user => console.log('Changed status!'))
|
* .then(user => console.log('Changed status!'))
|
||||||
* .catch(console.log);
|
* .catch(console.log);
|
||||||
*/
|
*/
|
||||||
setStatus(status, game) {
|
setStatus(status, game, url = null) {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
if (status === 'online' || status === 'here' || status === 'available') {
|
if (status === 'online' || status === 'here' || status === 'available') {
|
||||||
this.idleStatus = null;
|
this.idleStatus = null;
|
||||||
@@ -114,6 +116,11 @@ class ClientUser extends User {
|
|||||||
this.userGame = game;
|
this.userGame = game;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (url) {
|
||||||
|
this.userGame.url = url;
|
||||||
|
this.userGame.type = 1;
|
||||||
|
}
|
||||||
|
|
||||||
this.client.ws.send({
|
this.client.ws.send({
|
||||||
op: 3,
|
op: 3,
|
||||||
d: {
|
d: {
|
||||||
|
|||||||
Reference in New Issue
Block a user