JnCrMx / discord-game-sdk4j

Java bindings for Discord's Game SDK
MIT License
123 stars 23 forks source link

Support custom buttons #69

Closed gravit0 closed 1 year ago

gravit0 commented 1 year ago

This PR adds support for custom buttons in an activity. Documentation: https://discord.com/developers/docs/topics/gateway-events#activity-object-activity-buttons In addition, I found out that it is impossible to send buttons and secrets at the same time, even if secrets is empty Example sending activity:

{"cmd":"SET_ACTIVITY","args":{"pid":7345,"activity":{"type":0,"state":"STATE","details":"DETAILS","instance":false,"buttons":[{"label":"MySite","url":"https://example.com"}],"timestamps":{"start":1692708216},"assets":{"large_image":"large","large_text":"Everything","small_image":"small","small_text":"Everything"},"party":{}}},"nonce":"5"}

Example received string:

{"cmd":"SET_ACTIVITY","data":{"type":0,"state":"STATE","details":"DETAILS","buttons":["MySite"],"timestamps":{"start":1692708216000},"assets":{"large_text":"Everything","small_text":"Everything"},"party":{},"name":"MyAppName","application_id":"MY_APP_ID","metadata":{"button_urls":["https://example.com"]}},"evt":null,"nonce":"5"}

I would be grateful for your help in ghosting the Pull Request in accordance with the codestyle of the project

JnCrMx commented 1 year ago

Looks overall good to me, I added some review comments about little things I would do differently, but I would be willing to merge this (after testing it), if you don't agree with my vision and don't want to change anything ^^

Thank you very much for your contribution to this library :D

gravit0 commented 1 year ago

Thank you for your reply. I don't see your comments

JnCrMx commented 1 year ago

Alright, then I will just merge this ^^