discordjs / RPC

A simple RPC client for Discord

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Buttons are not working

YodaLightsabr opened this issue · comments

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.

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

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

Oops that's okay.

    {
        "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.

  1. what version are you on?
  2. wdym "not working"?

#91 does add documentation for this

  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.

#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.

commented

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

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

@ChingChang9 There you go ^

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

commented

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.

Good idea. Give me a minute.

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.