Closed WebFreak001 closed 7 years ago
You can update the game via the updateStatus method in client.
For example, in one of my plugins I have:
this.client.updateStatus(0, new Game("Dscord", "", GameType.DEFAULT));
This updates the status of the bot to "Playing Dscord".
same issue, but I'm not using a plugin because I don't want to make a bot. I want to modify my personal user's game. I got a token for it using the rpc.api scope in the OAuth request.
I am not sure I understand what you're trying to say. You want to write third party software to log in on Discord as you and change the name of the game you're playing? I don't think this library is built to be able to log in as a real user (most of the behaviors people might use something like that for would get them banned from Discord). Obviously, it's something you could do, but it's unclear whether it's something you should do.
If all you're trying to do is have silly names in Discord for the games you're playing, you can already do that through the Discord client without using a bot library to do so. Just click the little cog in the lower left corner, click the Games subheading, and highlight to edit the name of the game you're running so it reads as something else.
@ZeroSumGame is correct in stating that the library only supports bot accounts, and won't work for user accounts. That said throwing assertion errors with rando traces isn't the best way to make that clear. I'll add it to my backlog of things to clean up.
Additionally the OAuth2 API doesn't actually give you anything you can connect to the gateway with, the tokens there are only valid for OAuth2 HTTP API requests and for the RPC API.
@WebFreak001 for now if you want to use a user account, some other libs (discord.py, discord.js, etc) support this behavior.
@ZeroSumGame well it's not silly game names I want to have, it's automatically updating game names depending on where inside the game I am in. For example multiplayer matches or maps.
@b1naryth1ef discord.js actually doesn't work with the RPC API, there is discord-rpc but it's so broken, even the example in the README doesn't work (it just doesn't do anything without any output). Plus it has a browser version that for some reason has a different API than the node version.
@WebFreak001 generally the way people do this is not through the RPC API, there aren't great libs for it right now (I think Discord.Net has the most complete implementation although), but instead run "selfbots" which are just bots running using the users token. Thats what I was referencing w/ the libs I mentioned above.
I think supporting the RPC API would be awesome, but not something I'm focusing on right away.
I tried changing the game with this very simple code:
But it crashes with
Am I using the gateway wrongly? The documentation says nothing about how to use it and there is no example.