discordjs / RPC

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

(node:6011) UnhandledPromiseRejectionWarning: Error: Could not connect #85

Closed FamryAmri closed 3 years ago

FamryAmri commented 4 years ago

How to connect it? I use this code:

const RPC = require("discord-rpc");
const id = "ID";
const secret = "Secret";
const client = new RPC.Client({ transport: 'ipc' });

client.on('ready', () => {
    console.log('Logged in as', client.application.name);
    console.log('Authed for user', client.user.username);
    client.setActivity({
        details: "This is details",
        state: "This is state",
        startTimestamp: Date.now(),
        largeImageKey: "gd",
        largeImageText: "gd",
        smallImageKey: "red",
        smallImageKey: "red"
        });
});

// Log in to RPC with client id
client.login({
    clientId: id,
    clientSecret: secret
    });