Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

232
Views
if discord rpc cant find discord running how to make it refresh

Hi so my problem is that when i run my application which uses discord-rpc it connects to discord if it is already running. However if Discord is not running and the application is launched before Discord the rpc will not connect to discord automatically. How can i make this code sort of refresh say every 10 seconds

rpc = require("discord-rpc")
const client = new rpc.Client({ transport: 'ipc' })
client.on('ready', () => {
    client.request('SET_ACTIVITY', {
        pid: process.pid,
        

        
        activity : {
            details : "Loading Melody (Beta)",
            
           
            assets : {
                large_image : ""
                large_text : "This Is A Test"
            },
            
            buttons : [{label : "Download Melody" , url : "https://github.com/unofficialdxnny/Melody"}]
        
        
        }
        
    })
    

})

client.login({ clientId : "token" } ).catch(console.error);

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

First of all, make a Boolean which is saved globally. Now if you can successfully login, set it to true. Now wrap the whole code in a set interval, and a if condition based on that boolean to check whether do you need to run the code again or not. You probably need to run the client login part in that set interval.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!