Could not connect on Linux
rhaym-tech opened this issue · comments
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 (node:events:629:26)
at Socket.emit (node:events:514:28)
at emitErrorNT (node:internal/streams/destroy:151:8)
at emitErrorCloseNT (node:internal/streams/destroy:116:3)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
Node.js v20.5.1
Code:
const { Client } = require('discord-rpc');
const { DETAILS, STATE, LARGE_IMAGE, LARGE_TEXT, SMALL_IMAGE, SMALL_TEXT, BUTTONS } = require('./config');
const checkConfig = require('./helpers/checkConfig');
require("dotenv").config();
checkConfig();
const client = new Client({
transport: 'ipc'
});
client.on('ready', async () => {
console.log("Loading Rich Presence...");
try {
await client.request('SET_ACTIVITY', {
pid: process.pid,
activity: {
details: DETAILS,
state: STATE,
timestamps: {
start: Date.now()
},
assets: { //comment this part if you don't want to add images or comment a specific part
large_image: LARGE_IMAGE,
large_text: LARGE_TEXT,
small_image: SMALL_IMAGE,
small_text: SMALL_TEXT
},
buttons: BUTTONS
}
});
console.log("Rich Presence loaded successfully");
} catch (error) {
console.error("Error loading Rich Presence", error);
}
});
client.login({
clientId: process.env.CLIENT_ID,
clientSecret: process.env.CLIENT_SECRET
});
I'm sorry but I just realised the problem is from Discord itself, now installed an update and it got fixed