discordjs / RPC

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

Error: connection closed #96

Closed TheClashFruit closed 3 years ago

TheClashFruit commented 3 years ago
Error: connection closed
    at IPCTransport.<anonymous> (E:\ThatCakeID\zz\node_modules\discord-rpc\src\client.js:118:16)
    at Object.onceWrapper (events.js:417:26)
    at IPCTransport.emit (events.js:310:20)
    at E:\ThatCakeID\zz\node_modules\discord-rpc\src\transports\ipc.js:137:18
    at decode (E:\ThatCakeID\zz\node_modules\discord-rpc\src\transports\ipc.js:92:5)
    at Socket.<anonymous> (E:\ThatCakeID\zz\node_modules\discord-rpc\src\transports\ipc.js:120:7)
    at Socket.emit (events.js:310:20)
    at emitReadable_ (_stream_readable.js:543:12)
    at processTicksAndRejections (internal/process/task_queues.js:83:21)
devsnek commented 3 years ago

Most likely you are using scopes you don't have permission to use.

TheClashFruit commented 3 years ago

My Code: (There is no scopes)

const clientID = '';

DiscordRPC.register(clientID);

const rpc = new DiscordRPC.Client({ transport: 'ipc' });

const startTimestamp = new Date();

const endTimestamp = startTimestamp + 1000;

function setStatus() {
  rpc.updatePresence({
    state: 'Status',
    details: 'Something',
    startTimestamp,
    endTimestamp,
    largeImageKey: 'icon',
    instance: true
  });
}

rpc.on('ready', () => {
  setStatus();
});

rpc.login({ clientID }).catch(console.error);
Fyko commented 3 years ago

My guess is you're not authorized to use the IPC transport as it's invite-only.

The issue tracker is only for bug reports and enhancement suggestions. If you have a question, please ask it in the Discord server instead of opening an issue – you will get redirected there anyway.

philipjscott commented 3 years ago

Shouldn't you be using setActivity? I don't tihnk updatePresence is a function: https://github.com/discordjs/RPC/blob/master/src/client.js#L480

Also, isn't IPC transport accessible to anyone? I thought only websocket is invite-only.