How can I change the status from "playing" to "listening" using the `discord-rpc` npm package?

I'm adding rich presence to my application, however it's not a game. How can I replace the text that says playing, and make it say listening? I know that it can be done with bots, however I'm not sure how to do it with rpc. Here is my current code:
const clientId = "1130369366341455872";
const rpc = new discord.Client({ transport: "ipc" });
discord.register(clientId);

async function setRpc(text) {
rpc.setActivity({
details: text,
largeImageKey: "large"
});
}

rpc.on("ready", async () => {
setRpc("test 123");
});

rpc.login({ clientId }).catch(error => console.error(error));
const clientId = "1130369366341455872";
const rpc = new discord.Client({ transport: "ipc" });
discord.register(clientId);

async function setRpc(text) {
rpc.setActivity({
details: text,
largeImageKey: "large"
});
}

rpc.on("ready", async () => {
setRpc("test 123");
});

rpc.login({ clientId }).catch(error => console.error(error));
I tried looking online, at documentation, and asking AI but I couldn't find a working answer.
8 Replies
d.js toolkit
d.js toolkit2y ago
- What's your exact discord.js npm list discord.js and node node -v version? - Post the full error stack trace, not just the top part! - Show your code! - Explain what exactly your issue is. - Not a discord.js issue? Check out #useful-servers. - Issue solved? Press the button!
MTMB
MTMBOP2y ago
I'm using [email protected] with node version v18.15.0 How do other apps and stuff do it then? Is it exclusive to bots or so I need to find another npm package?
🤖 RoboticRobot 🤖
Or use ActivityType oh RPC...
kin.ts
kin.ts2y ago
no, qjuh said discord-rpc always set type as Playing
🤖 RoboticRobot 🤖
Then @mtmb , you need to stick with "Playing" status
MTMB
MTMBOP2y ago
Both type and activityType don't seem to work then I set their values to 3 or "LISTENING" Is the listening one exclusive to bots then?
🤖 RoboticRobot 🤖
with RPCs, yes. If you need only ActivityType then no ye like so
MTMB
MTMBOP2y ago
Ok. Thanks for the help
Want results from more Discord servers?
Add your server