discordjs / RPC

A simple RPC client for Discord
MIT License
466 stars 191 forks source link

Buttons are not working #123

Closed YodaLightsabr closed 3 years ago

YodaLightsabr commented 3 years ago

image What am I supposed to pass to the object? I have tried many different configurations, but there's no documentation about it and I keep getting errors.

xiBread commented 3 years ago

It's the same as ActivityOptions. Disregard, was looking at the wrong docs.

YodaLightsabr commented 3 years ago

~It's the same as ActivityOptions.~ Disregard, was looking at the wrong docs.

Oops that's okay.

YodaLightsabr commented 3 years ago
    {
        "startTimestamp": "Date.now()",
        "details": "Google",
        "buttons": [
            { "label": "Google1", "url": "https://google.com" },
            { "label": "Google2", "url": "https://google.com" }
        ]
    }

that's the object I'm passing, but the buttons are not working.

advaith1 commented 3 years ago
  1. what version are you on?
  2. wdym "not working"?
NotSugden commented 3 years ago

91 does add documentation for this

YodaLightsabr commented 3 years ago
  1. what version are you on?
  2. wdym "not working"?
  1. Previously 3.1.4, but I updated and it still didn't work
  2. Everything works except for the buttons. Also, the object I'm passing is essnetially read from a JSON file and it replaces "Date.now()" as a string with the time that the status is set so that the time can be from when I start my program. image That's a picture of what the status looks like, where the buttons should be working, but they aren't.
YodaLightsabr commented 3 years ago

91 does add documentation for this

Ok, so after looking at that, my buttons property is an array of two button objects. They look like:

{ "label": "Visit Google", "url": "https://google.com" }

just like it is supposed to, but it's not working. The buttons aren't being displayed.

cocoliliace commented 3 years ago

I am on 3.2.0 and it works for me. The arguments you pass in look right, so my guess is this: You said you are reading from a JSON file and replacing certain fields. Are you parsing the JSON file correctly? Maybe try to console.log the json data and use typeof to check the data type of each field in the json. Make sure they are an array of objects, not a string

YodaLightsabr commented 3 years ago

Okay I'll show you what the console.log'd data looks like

YodaLightsabr commented 3 years ago

image

YodaLightsabr commented 3 years ago

@ChingChang9 There you go ^

advaith1 commented 3 years ago

Have you tried fully uninstalling and reinstalling discord-rpc? it may not have updated properly

cocoliliace commented 3 years ago

Hm yeah it seems to be in the proper format. Check your node_modules/discord-rpc/src/client.js. It should have buttons: args.buttons, on line 537 if you're on 3.2.0. Otherwise, you might have not updated the package properly.

YodaLightsabr commented 3 years ago

Good idea. Give me a minute.

YodaLightsabr commented 3 years ago

Welp. Apparently my package.json got moved to the parent directory somehow, and when I ran npm install it said

removed 3 packages in 0.622s

so I fixed that and now it's working. Sorry for bugging the issue section about my stupid mistake.