#discord-rpc

110 messages Β· Page 1 of 1 (latest)

woven trenchBOT
woven trenchBOT
woven trenchBOT
woven trenchBOT
#

I can run the same code when running from my local windows PC but when I try to run it on my server, it crashes with the following error. (I did edit the code here ). Anyone know why the RPC cannot connect when ran from a server?

Error: Could not connect
    at Socket.onerror (/home/marv1/apps/RPC/src/transports/ipc.js:32:16)
    at Object.onceWrapper (node:events:628:26)
    at Socket.emit (node:events:513:28)
    at emitErrorNT (node:internal/stre...
woven trenchBOT
#

While attempting to create a lobby, I get this error

C:\Users\USER\Documents\DRPC\node_modules\discord-rpc\src\client.js:178
        const e = new Error(message.data.message);
                  ^

Error: child "id" fails because ["id" must be a string]
    at RPCClient._onRpcMessage (C:\Users\USER\Documents\DRPC\node_modules\discord-rpc\src\client.js:178:19)
    at IPCTransport.emit (node:events:513:28)
    at C:\Users\USER\Documents\DRPC\node_modules\discord-rpc\src\transpo...
woven trenchBOT
woven trenchBOT
#

While trying to make my custom rich presence for discord, I encountered the following error

PS E:\DiscordRPC> node index.js
Error: connection closed
    at IPCTransport. (E:\DiscordRPC\node_modules\discord-rpc\src\client.js:111:16) 
    at Object.onceWrapper (node:events:642:26)
    at IPCTransport.emit (node:events:527:28)
    at E:\DiscordRPC\node_modules\discord-rpc\src\transports\ipc.js:141:18
    at decode (E:\DiscordRPC\node_modules\discord-rpc\src\transports\ipc.js:92:...
woven trenchBOT
#

This pull request aims to fix #173.

I have made appropriate changes to the client.js file in the src folder such that variable naming won't cause the 'connection closed' error. Developers writing code for custom rich presence can use any variable name instead of 'clientId' and 'accessToken' only.
For more info about the error, please check #173

Changes Made

  • Removed the destructuring of object 'options' on line 136.
  • An array called 'values' now stores the clientId and acc...
#

This user cold DM'ed me on Discord asking to take a look at this -- this change makes absolutely zero sense and breaks how the login method works. Yes, it works if you pass a perfect object where the first two key/value pairs happen to be clientId and then accessToken, but in any other scenario it does not. It is an object, and it is being destructured, as it should be.

woven trenchBOT
woven trenchBOT
woven trenchBOT
#

For some reason, the code works on my host machine but when I try to make it into a docker container, it gives me this error:

Error: Could not connect
    at Socket.onerror (/root/trollge/node_modules/discord-rpc/src/transports/ipc.js:32:16)
    at Object.onceWrapper (events.js:421:26)
    at Socket.emit (events.js:314:20)
    at emitErrorNT (internal/streams/destroy.js:92:8)
    at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
    at processTicksAndRejections (internal/p...
woven trenchBOT
woven trenchBOT
woven trenchBOT
woven trenchBOT
#

Just to clarify something: This PR was only meant to provide feature-complete integration according to the API docs, assuming in the future the use of these constants would open up to the public. I'm aware it's not working right now (since there is no public access to most of the constants) and I'm willing to close this request if there's no need for it.

woven trenchBOT
woven trenchBOT
#

Observed bug

Sometimes creating subscriptions or sending commands through IPC would result in the promise never resolving, i.e. the message with the expected nonce never getting received.

Reason

The original code to parse the received IPC packets:

https://github.com/discordjs/RPC/blob/9e7de2a6d917591f10a66389e62e1dc053c04fec/src/transports/ipc.js#L82-L100

The code has an assumption that a packet will at most one message.

The code will skip the processing of a message i...

woven trenchBOT
woven trenchBOT
#

Here's a reproducible example:

const RPC = require('discord-rpc')

;(async () => {
    const client = new RPC.Client({ transport: 'ipc' })
    await client.login({
        clientId: '',
        clientSecret: '',
        redirectUri: '',
        scopes: ['rpc', 'rpc.voice.read', 'rpc.voice.write'],
    })
    client.subscribe('VOICE_SETTINGS_UPDATE')
    client.setVoiceSettings({ input: { volume: 100 } })
    client.setVoiceSettings({ output: { volume: 100 } })
}...
woven trenchBOT
#

I wrote a simple code to run a custom rich presence on MacOS and tested it too in Windows, but now when I'm using Debian it gives me this error:

> node .

/home/rhaym/Documents/DJS-RichPresence/node_modules/discord-rpc/src/transports/ipc.js:32
        reject(new Error('Could not connect'));
               ^

Error: Could not connect
    at Socket.onerror (/home/rhaym/Documents/DJS-RichPresence/node_modules/discord-rpc/src/transports/ipc.js:32:16)
    at Object.onceWrapper (nod...
woven trenchBOT
woven trenchBOT
woven trenchBOT
#

Same error but trying in Bun

import {register, Client} from "discord-rpc"
register(':D');
const rpc = new Client({transport: 'ipc'});
rpc.on('ready', () => {
    console.log('Client is ready');
})
rpc.login({clientId: ":D});

Enviroment Details

DiscordRPC ^4.0.1
Bun 1.0.22
Running in KDE Neon (Ubuntu)

woven trenchBOT
#

Hi, sorry if this is the wrong place to ask.
Looking around discord docs, found that discord-rpc is going to be depreciated and will be replaced by Game SDK.
My use case is to control the user's own and other voice channel member's voice settings with hardware controllers.
Doing a quick test tonight, discord.js/RPC just does this, I'm so far happy with the results.
Curious to know if my happiness will go away with an API depreciation.
Thanks!

woven trenchBOT
woven trenchBOT
woven trenchBOT
#

It looks like this is a Discord desktop client issue. I also don't have the buttons when I look on the desktop app (MacOS), but I do see the buttons if I check my profile on the iOS app. Discord are updating profiles with the new compact versions and that's likely messing with / hiding the buttons on purpose to make them more compact.

woven trenchBOT
woven trenchBOT
woven trenchBOT
woven trenchBOT
woven trenchBOT
woven trenchBOT
woven trenchBOT
woven trenchBOT
woven trenchBOT
woven trenchBOT
woven trenchBOT
woven trenchBOT
woven trenchBOT
woven trenchBOT
woven trenchBOT
woven trenchBOT
woven trenchBOT
woven trenchBOT
woven trenchBOT
woven trenchBOT
woven trenchBOT
ocean basin
#

discord-rpc

woven trenchBOT
woven trenchBOT
woven trenchBOT
woven trenchBOT
woven trenchBOT