Discord.py: Updating "Playing"

Created on 2 Feb 2018  路  7Comments  路  Source: Rapptz/discord.py

My current playing code looks something like this:
await client.change_presence(game=discord.Game(name="GRLC: "+(price_info[0])["price_usd"]), status=discord.Status("online"))

but for whatever reason when this gets processed then it never actually changes on discord.

Most helpful comment

@pedroricardo Abstracted (user-friendly) extra presence modes aren't in this lib yet (but are planned for rewrite), but as they are just extra Game modes as of current, you can still set them by just using the type kwarg for Game with the respective values:

  • 0 - 'Playing', default
  • 1 - 'Streaming', requires valid twitch URL
  • 2 - 'Listening to'
  • 3 - 'Watching'

In future you should probably open a new issue to ask questions like this.

All 7 comments

Does it happen to be a selfbot?

what version are you using?

If you're using a standard (OAuth) bot:
In August, Discord made a change to presence that required sent presences to include type, even if it was 0.
Before v0.16.9 (async) and 1318@b8c1995 (rewrite), no type was sent by default, so when this change happened, presences wouldn't display unless you set a type explicitly. Solution for this would be to update your library.

If you're using a selfbot/userbot:
The way presence works for user accounts has changed slightly since it was last directly supported by this library.
User accounts never receive their own PRESENCE_UPDATE events, even from other clients, so a presence emitted from one client (such as your desktop Discord client) would not be seen by another (such as your phone). This applies for your bot too, if your selfbot emits a presence, your desktop Discord client won't see it.

However, now, if you play a game on your computer, you can sometimes see the presence from your phone. Why?

Turns out, at some point, Discord made the official client POST to API endpoints when you start playing a game. This only applies to user accounts, and it seems (from testing) that it only relays when the game you're playing is verified.

You could use the Networking tab from within devtools to work out how exactly this flow works, if you're very determined to have your presence relay to other clients. I wouldn't particularly recommend it though, and with the harsher sanctions Discord has been issuing for userbots, I doubt it would be added to this library.

To spare yourself the effort, I'd use an alt account, a bot, or asking another user to determine if your presence has been set correctly, as they will all receive your presence as normal from just the gateway event.

with me add, listening and watching instead of playing?

@pedroricardo Abstracted (user-friendly) extra presence modes aren't in this lib yet (but are planned for rewrite), but as they are just extra Game modes as of current, you can still set them by just using the type kwarg for Game with the respective values:

  • 0 - 'Playing', default
  • 1 - 'Streaming', requires valid twitch URL
  • 2 - 'Listening to'
  • 3 - 'Watching'

In future you should probably open a new issue to ask questions like this.

That's what I was looking for. Thank you.

Thanks guys. Issue was that I hadn't explicitly set the type and didn't know it was on the game and not change_presence.

Was this page helpful?
0 / 5 - 0 ratings