Discord.js: setGame does not function with the new API update

Created on 19 Aug 2017  ·  4Comments  ·  Source: discordjs/discord.js

Please describe the problem you are having in as much detail as possible:
Hi. I hope I am not incorrect in filing this issue, and putting this in the wrong place, as this is my first time making an issue like this.

I was made aware today that on the 16th, Discord introduced an API update to the Gateway Game object definition that makes it no longer an optional parameter, or something? (I don't really understand how this all works underneath, but I do know that the issue exists).

August 16, 2017 — Breaking Change

The type field in the game object for Gateway Status 
Update and Presence Update payloads is no longer 
optional when the game object is not null.

https://discordapp.com/developers/docs/change-log#august-16-2017-—-breaking-change

This for whatever reason is causing the gateway to ignore any request to update the current game being played with the coroutine call:

const Discord = require('discord.js');
const client = new Discord.Client( );
... ... ...
client.setGame("Some game title here");

The bot does not have any change, nor is any error registered as far as I am aware. It just purely does nothing.

I know that I have had to update bots using other APIs such as discord.py today to get around this issue.

Once again, I did check earlier the current release for this library, which seems to match the release I am using, and I checked the issues and recent commits to see whether this had been issued, but there is a good chance I may have missed something, as I am quite new to this still.

I hope this helps out!

Further details:

  • discord.js version:

My package.json file contains this key-value pair in the root object:

"dependencies" : { "discord.js": ">=11.1.0" }

... so I am assuming I am using v11.1.0 which according to the releases for this repository is the most recent release version:
image

  • node.js version:
> nodejs --version
v8.4.0
  • Operating system:
> lsb_release -a && uname -a
No LSB modules are available.
Distributor ID: Raspbian
Description:    Raspbian GNU/Linux 8.0 (jessie)
Release:        8.0
Codename:       jessie
Linux discord-bots 4.9.35-v7+ #1014 SMP Fri Jun 30 14:47:43 BST 2017 armv7l GNU/Linux
  • Priority this issue should have – please be realistic and elaborate if possible:

This isn't a breaking issue in my opinion, as it is only a minor feature, however, it would still be nice if anyone is able to fix it and push an update out to have this addressed!

  • [ ] I found this issue while running code on a __user account__
  • [ ] I have also tested the issue on latest master, commit hash:

Many thanks once again, and if you need any more information, just let me know and I will try my best to help out. If I have been dumb and this has already been resolved somewhere else, I am extremely sorry for any time wasted. I have tried to check first though.

already fixed

Most helpful comment

Excellent. Thank you ever so much for the speedy replies!

All 4 comments

fixed in #1785

Update to latest commit of the 11.1-dev branch or use this workaround:
client.user.setPresence({ game: { name: 'nameGoesHere', type: 0 } });

Excellent. Thank you ever so much for the speedy replies!

🏃 ⚡️

Was this page helpful?
0 / 5 - 0 ratings