discordjs / RPC

A simple RPC client for Discord

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Connection closed

sinjs opened this issue · comments

commented

Following code

const RPC = require('discord-rpc');

const clientId = 'abc';
const clientSecret = 'def';
const scopes = ['rpc'];

const client = new RPC.Client({ "transport": "websocket" });

const startTimestamp = new Date()

client.on('ready', () => {
    console.log('Logged in as', client.application.name);
    console.log('Authed for user', client.user.username);

    client.setActivity({
        details: "Test",
        state: "Test",
        startTimestamp,
        instance: false,
    });
});

client.login({ clientId, scopes, clientSecret });

Gives an error:

(node:10784) UnhandledPromiseRejectionWarning: Error: connection closed

I also tried changing the transport to IPC, I get the authorization screen on my discord client. When I click on authorize, this happens:

(node:15016) UnhandledPromiseRejectionWarning: Error: OAuth2 Error: invalid_request: Missing "redirect_uri" in request.

Can anyone help me?

commented

actually I am dumb, I thought that was for discord client lol