#Could not connect RPC

27 messages · Page 1 of 1 (latest)

wheat plover
#

• What's your exact discord.js npm list discord.js and node node -v version?
• Post the full error stack trace, not just the top part!
• Show your code!
• Explain what exactly your issue is.
• Not a discord.js issue? Check out #useful-servers.

sand narwhal
#
const clientId = '1037707297587200090'
const DiscordRPC = require('discord-rpc')
const RPC = new DiscordRPC.Client({ transport: 'ipc' })

DiscordRPC.register(clientId)

async function setActivity() {
  if(!RPC) return;
  RPC.setActivity({
  state: "Playing Solo",
details: "Competitive",
startTimestamp: Date.now(),
largeImageKey: `discord-icon`,
largeImageText: `Discord icon.`,
smallImageKey: `discord-icon`,
smallImageText: `Small icon.`,
instance: false,
    buttons: [
      {
        label: 'Button', 
        url: 'https://www.google.com/'
      }
    ]
  })
}

RPC.on('ready', async () => {
  setActive();
  setInterval(() => {
  setActive();
               
  }, 15 * 1000);
})

Rpc.login({ clientId }).catch(err => console.error(err))```
rare void
#

transport not trasnport

sand narwhal
#

@rare void

rare void
#

you can't run this on a server

#

you need to run it on your PC

sand narwhal
#

vs code?

rare void
#

whatever

sand narwhal
#

okk

#

same @rare void

sand narwhal
#

Could not connect RPC

woeful anchor
#

Do you have discord running on that PC?

sand narwhal
#

web

#

@woeful anchor

woeful anchor
#

So no… there’s your issue

sand narwhal
#

you mean that i need to install the discord desktop app?

#

@woeful anchor

woeful anchor
#

There’s literally no reason to ping me in a post I already joined…

sand narwhal
#

ok

woeful anchor
#

And yes, RPC works with discord app

sand narwhal
#

okay

dawn junco
# sand narwhal i got this error

I’m guessing you wanted to call your function called setActivity instead of setActive. You must learn the basics of JavaScript before doing anything. (Well really programming since anyone with compsci knowledge would know that variable no exist in code snippet)

sand narwhal
#

sorry

dawn junco
#

Don’t be sorry, everyone starts somewhere

sand narwhal
#

thx it workedRa3d

dawn junco
#

np, but you should really learn what you’re actually doing