#archive-rpc-help
21942 messages · Page 20 of 22
nvm
the client id is the application id or my id?
app id
okay
is there a tut for adding buttons to rpc?
nvm figured it out
what does instance mean?
and alos how do u customize the name without changing the name in the dev portal
dev portal is the only way.
in what regards
Adding buttons to your rich presence:
Inside your setActivity call, you can use:
buttons: [ { label: " ", url: " " }, { label: " ", url: " "} ]
You can have up to 2 buttons.
You will not be able to press these buttons on your own account, so dont freak out when something doesn't pop up when you click it.
Things to consider when getting a connection closed/could not connect error:
• What transport are you using? If it's 'websocket', change that to 'ipc'.
• Is the ID you are trying to login with your user ID? If so, you should be using a Client ID from the Developer Portal (https://discord.com/developers/applications) instead.
• Is the ID a string? If not, JavaScript will truncate it's value causing the connection to fail.
• Are you using the Discord app? It won't be able to connect to the web version. Similarly, bots cannot use RPC.
• Is your code running on the same machine as the Discord app?
• Are you trying to run it from WSL? If so, it won't be able to connect either.
• Have you installed Discord from the snap store? If so, install it from your distro's package repository or directly from the Discord website.
Can I use rpc on Android?
no
Okey
They don't work for you. Try it with another device/account or ask a friend to test them
oh
ill ask a friend
ah it works
thx
Np
how make my bot online 24/7 in vscode
you simply don't stop it? also wrong channel.
at Timeout._onTimeout (C:\Users\camyw\Desktop\new-rp-bot-js\node_modules\discord-rpc\src\client.js:100:47)
at listOnTimeout (node:internal/timers:557:17)
at processTimers (node:internal/timers:500:7)
i get this in my console everytime i start my website up, here is my rpc code
rpc.setActivity({
details: `Roleplay Bot Dashboard`,
startTimestamp,
largeImageKey: 'bot',
largeImageText: 'Roleplay Bot',
buttons: [
{
label: 'Invite Link',
url: '',
},
{ label: 'Support Server', url: '' },
],
});
}
rpc.on('ready', () => {
setActivity();
setInterval(() => {
setActivity();
}, 15e3);
});
rpc.login({ clientId }).catch(console.error);
Things to consider when getting a connection closed/could not connect error:
• What transport are you using? If it's 'websocket', change that to 'ipc'.
• Is the ID you are trying to login with your user ID? If so, you should be using a Client ID from the Developer Portal (https://discord.com/developers/applications) instead.
• Is the ID a string? If not, JavaScript will truncate it's value causing the connection to fail.
• Are you using the Discord app? It won't be able to connect to the web version. Similarly, bots cannot use RPC.
• Is your code running on the same machine as the Discord app?
• Are you trying to run it from WSL? If so, it won't be able to connect either.
• Have you installed Discord from the snap store? If so, install it from your distro's package repository or directly from the Discord website.
Okay well, I'm a tad bit confused now. The code is producing no errors, it logs everything it's supposed to, and yet the RPC doesn't show up. I've ensured all my settings are correct, and I am using the Desktop App on the same machine. Can anyone help?
^^^ Nevermind, I (somehow) found a way to get what I wanted to work.
Yo, I am having some trouble with RPC in my project.
I have used this library before in the past, and have it working perfectly fine, and still works perfectly fine in my old project, but for some reason in my new project it doesn't even let it get imported without giving a fatal error.
My old project was with Electron, without any special boilerplate. It worked just fine
The new project is ALSO Electron, but this time using Electron-forge, so it uses webpack under the hood, which is where it's giving me the error (See screenshot).
It happens even if I just import it. Has anybody run into this before? Googling it didn't bring me much success
I've tried to install the exact same version as my last project, but I get the same error regardless.
I know about the "Websocket needs to be whitelisted by Discord" but I am not using the websocket transport, and I had it working no problem whatsoever in my prior project
Any help would be much appreciated. If you need the error in text format just @ me
is an syntax eror in your code
error*
No, it is not. I don't even have to write any code besides the import for it to cause the problem
How do I listen for voice channel events?
if you haven't solved this, try rebuilding discord-rpc (npm rebuild discord-rpc)
I tried now, still the same result
huh
It's really odd, I have only had this problem happen in this project, and it being webpack that complains about it
I found out this code here, 48, i added (error) after catch and that seems to have fixed it, somehow?
Perhaps it should be added to the official to fix the webpack error
Seems like webpack dislikes a catch the parameters
If anyone is curious or needs this issue fixed themselves. It needs to be done here.
node_modules\discord-rpc\src\transports\websocket.js
Line 48, change
} catch {}
to this
} catch (e) {}
It fixed the problem for me, makes it work with webpack in Electron-forge generated code
Of course this will fuck up the package if needed to be downloaded later, so I suggest putting it outside of your node_modules and part of your main code., as downloading it from npm again will just give the old not working code into the project again
how to change title
Change your application name.
This seems just an outdated version of nodejs not compatible with discord rpc
I am using node latest and used the latest Rpc version at first, so I find that odd
@dreamy verge #app-commands
oh sorry
im new to rpc, is there any tutorials or doccumentations about connecting rich presence from application to my account? tks!
If all you want is rich presence, use the wrapper package: https://www.npmjs.com/package/discord-rich-presence
Make an application (same way you make a bot); name it how you want the rich presence to appear, then copy paste the example and fill it in with your applicationId + what you want it to say
im digging into docs, and i have a question: can i just have startTimestamp (without endTimestamp)
Yes. I'd recommend looking at the rich presence visualizer in the application settings and playing with that.
thanks!
yea ik that, tysm for helping xxx
hi !
I try to get the application I use to make my RPC but rpc.application is null... why ?
Actually, this is no longer maintained, use this instead: https://npmjs.com/discord-rpc
If you just use the rich presence features, the wrapper is the way to go.
Just because there wasn't any change in the last 2 years, doesn't mean its not working.
if we are honest, neither are
Actually I don't see what's the problem. Both work ok and no change is needed as Discord didn't add new features about RPC.
The one I sent you still maintained
Many events, such as "message" have been broken for a while; people have submitted functional PRs and been denied/closed due to inactivity.
Even stuff like basic documentation fixing sits in pending PRs for 2 months, https://github.com/discordjs/RPC/pull/147
how to host My discord rpc 24/7
You would have to let your pc run 24/7
(without doing it)
Then there is no way.
The discord application needs to run 24/7 with the script
🥶
ok
Otherwise host it on a server somewhere
😳
how
What kind of app is it?
RPC apps need to be hosted in the same machine as the Discord app and also require the app open and working
Run a server/VM with a desktop OS and then you are literally just offloading who/what has to be running 24/7.
Raspberry Pis would be a prime example
actually there is
if you loginto discord.py using a usertoken you can do it, you dont need to have discord app open. but im pretty sure tho that this is against TOS
Yes that is, obviously...
not to mention that discord.py is dead
Any examples for browser rpc?
Not the browser client... but the RPC will start when you open the webpage?
RPC is not compatible with discord in the browser.
No, I am not talking about discord.com client....
Just the normal desktop client
But the rpc will start when the user opens the webpage and authorizes
uhh is it normal that the buttons in my rpc dont work?
even tho they are linked
Your buttons work, but you can't see the buttons on your own RPC
others can still view and click them though
ah right
ty
can somebody tell me why is the doc to discord-rpc in discord.js.org so wierd and without too much detail
nothing clickable here https://i.imgur.com/e48NaOr.png
this is the only thing https://i.imgur.com/VpBA2D7.png
How do you add buttons to an rpc?
see pins
thx
any way to use this for browser??
no
: (
what is this place?
read pins
you can see your own buttons, you can't click them tho
Hey I have this error
by doing that: const bot = new RPC.Client({ transport: "ipc" })
^^
thx
how to use it?
There is an example in the channel topic.
does anyone know how to use discord rpc? i want to make something that can give me a rich presence, but my code isn't working currently. the code runs and "Done" is printed out, but there is no change in my profile
const RPC = require("discord-rpc");
const clientId = require('./config/keys').clientId;
const client = new RPC.Client({ transport: "ipc" });
const activity = {
details: "I'm doing nothing.",
state: 'Deep Thinking',
startTimestamp: new Date()
}
client.on("ready", () => {
client.setActivity(activity);
console.log("Done.");
})
client.login({ clientId });
tf is an rpc
rich presence client i think
supposed to do stuff with your user basically, it's like that one vscode extension that shows what file youre editing
basically shows games youre playing, but im just using it for fun
Uhm?
nice, search somewhere else
I don't understand how the security of RPC works, can someone just set my RPC whenever they like? The only thing I need to do to set my rpc is specify my bot ID.
Unless they get access to your email/password or account token which is used to create a websocket connection to Discord, they can't get RPC on your presence.
RPC works locally. This means that the RPC client (in this case, discord.js/rpc) communicates with the Discord client (in this case, discord.com/app, desktop clients, mobile apps, etc). The Discord client then communicates to the Discord API saying "hey, this person want their presence to be XYZ, and here is my email/password or account token to prove that my end user is who they claim to be".
Oh so you don't see my RPC at the moment?
I can see it, because Discord is communicating your RPC info to my client, and everyone else's
Huh but how does discord know Im the one sending the RPC? Does it check IP address or something?
The RPC client communicates with your Discord client (aka discord.com/app, desktop client, mobile app), that's how they know.
Ahhh, so if I run it on my server it won't work. Okay thanks
The RPC is running locally and needs a direct connection with the logged in client.
So unless someone can log into your account, there is nothing to worry about
Yep thanks!! 😄
anyone?
See if the faq is any help #archive-rpc-help message
sounds good
does RPC work if i am running linux
sure
oh weird
the client id is from discord.com/developers/applications
or does it have to be mine?
i also tried websocket for transport
and it just errors
is it installed through WSL?
im directly running arch linux
no virtualization
do you have discord form the snap store?
uh i forgot
lmao
lemme check
i dont belive so
well I dont see anything wrong
nope
it isnt installed via snap
console.log(`Logged in as ${client.user.tag} ✅`);
<@&839912195994812420> ^
I get the error
Could not connect
var rpc = require("discord-rpc")
const client = new rpc.Client({ transport: 'ipc' })
client.on('ready', () => {
client.request('SET_ACTIVITY', {
pid: process.pid,
activity : {
details : ".",
assets : {
large_image : "sawallhabotlogo",
large_text : "Test"
},
buttons : [{label : "Support Server" , url : "https://discord.com/"},{label : "Invite",url : "https://discord.com/"}]
}
})
})
client.login({ clientId : "MyID" }).catch(console.error);
Does repl it the reason?
And if it. What mobile can do with rpc. I mean its possible to have rpc in mobile? Bcs my friend use same code and its work but he uses vscode
No, its not possible to use replit, and mobile doesnt support RPC anyway.
Ok thx
@foggy tundra I hope you just got the wrong channel
Yes sorry, my fault haha
how i can use rpc mobile?
It's not supported on mobile
im trying to add buttons right now, they dont seem to show
could you post the code please?
Does RPC work on mac
yes
yes
👍
I'm getting a connection error, it doesn't wanna start
can anyone help
Things to consider when getting a connection closed/could not connect error:
• What transport are you using? If it's 'websocket', change that to 'ipc'.
• Is the ID you are trying to login with your user ID? If so, you should be using a Client ID from the Developer Portal (https://discord.com/developers/applications) instead.
• Is the ID a string? If not, JavaScript will truncate it's value causing the connection to fail.
• Are you using the Discord app? It won't be able to connect to the web version. Similarly, bots cannot use RPC.
• Is your code running on the same machine as the Discord app?
• Are you trying to run it from WSL? If so, it won't be able to connect either.
• Have you installed Discord from the snap store? If so, install it from your distro's package repository or directly from the Discord website.
I already managed to figure out the problem with trial and error, but thanks for the detailed response! would 100% help me when I needed it
What is RPC
User-Bot?
Error: connection closed
at IPCTransport.<anonymous> (E:\node_modules\discord-rpc\src\client.js:111:16)
at Object.onceWrapper (events.js:520:26)
at IPCTransport.emit (events.js:400:28)
at E:\node_modules\discord-rpc\src\transports\ipc.js:141:18
at decode (E:\node_modules\discord-rpc\src\transports\ipc.js:92:5)
at Socket.<anonymous> (E:\node_modules\discord-rpc\src\transports\ipc.js:120:7)
at Socket.emit (events.js:400:28)
at emitReadable_ (internal/streams/readable.js:550:12)
at processTicksAndRejections (internal/process/task_queues.js:81:21)
what do i do
ive done everything
client.on('ready', () => {
client.request('SET_ACTIVITY', {
pid: process.pid,
activity: {
details: "Just chilling",
state: `DM me!.`,
assets: {
large_image: "large_image",
large_text: "yooo",
small_image: "valid",
small_text: "this you?",
},
buttons: [{
label: "My Favourite Song!",
url: "https://www.youtube.com/watch?v=S9bCLPwzSC0"
}]
}
})
})
thats my code
is this wrong @lyric sable
i fixed that
but now
Error: OAuth2 Authorization Error: Unknown Error
at RPCClient._onRpcMessage (E:\node_modules\discord-rpc\src\client.js:178:19)
at IPCTransport.emit (events.js:400:28)
at E:\node_modules\discord-rpc\src\transports\ipc.js:138:18
at decode (E:\node_modules\discord-rpc\src\transports\ipc.js:92:5)
at Socket.<anonymous> (E:\node_modules\discord-rpc\src\transports\ipc.js:120:7)
at Socket.emit (events.js:400:28)
at emitReadable_ (internal/streams/readable.js:550:12)
at processTicksAndRejections (internal/process/task_queues.js:81:21) {
code: 5000,
data: { code: 5000, message: 'OAuth2 Authorization Error: Unknown Error' }
fixed that
now it timeout
Error: RPC_CONNECTION_TIMEOUT
at Timeout._onTimeout (E:\node_modules\discord-rpc\src\client.js:100:47)
at listOnTimeout (internal/timers.js:557:17)
at processTimers (internal/timers.js:500:7)
bruh
just had to restart Discord
Bruh
does messages.read rpc work correctly for anyone? I'm able to authenticate/authorize with the scope, but I get message events really really slowly if at all
either that or rpc.notifications.read is what I'm trying to get working
I haven't been able to get any events at all from notifications.read
the rpc.api scope has been replaced by what?
what is rpc
pins
stands for rich presence client
after some testing, seems like messages.read and rpc.notifications.read are just broken in @discordjs/rpc
the socket gets the events correctly and I can see them if I hack the lib to add debug logging, but they just never get dispatched
o
Documentation suggestion from @tight leaf:
ClientApplication#rpcOrigins
The application's RPC origins, if enabled
how can we connect discord-rpc with vsc to work with? like i want to add custom images in rpc which i don't think is possible with the official one
To add images in rpc, you must upload them at the Dev Webportal.
You cannot do this via code.
so how vscode Discord-presence are placed? is there a application running for everyone just for rpc?
RPC must be run on the same environment as the Client you wish the RPC to be displayed on.
So yes, everyone needs to download your application to have it.
Oh I've misunderstood the question, you're asking about the vsc discord rich-presence plugin
Dunno about customizing that as I use Jetbrains products 
Crawl made an application, like you did for your bot, uploaded the pics there and then coded what picture to use.
So technically you still do it via code, except the upload part.
Best thing to do would be to fork the extention and edit it to your likings
Hello,
I have a problem with my RPC, I don't see the image in my profile.
Can you help me please ?
Here is my code :
client.on("ready", () => {
client.request("SET_ACTIVITY", {
pid: process.pid,
activity : {
details : "A MSP retro private server, like in 2010.",
assets : {
large_image : "msp_retro_pdp",
},
buttons : [{
label : "🎮 Play" ,
url : "link here"
}, {
label : "📢 Support server",
url : "link here"
}]
}});
And I have uploaded my assets :
ohkay gotta try
No image here :/
If someone has the solution please ping me!
Idk if it's the Discord cache the problem, but I think not
when did you add the pics
5 minutes
they take time to show
and I have deleted and re upload
and change the name
I don't understand why I don't see
they take time to show
AHHHHH done it's work
it's just cloudflare maybe
thanks
details: "For 1 week \n Developing Pixel Bot"
``` the \n doesnt work
how do I start from a new line
dont think thats possible, afaik it's a oneliner
so how do I get two lines, Im sure its possible
you can only have state and details, each one line
You need to use template literals (backticks `)
that’ll let you use multi line out of the box, however be ware of some weird formatting issues
Why do they use client.selectVoiceChannel('81384788862181376'); ?
whats the ratelimtit for changing rpc status?
i wanna make a clock but idk the ratelimits 😂
it updates every 15 seconds but discord handles rpc ratelimits for you anyway
alr ty, so i can just make a loop to change it every 15 sec and it should work?
sure
for you it will update instantly every time, but for others the 15 seconds apply
ah alright
so like if i start or change it it needs to have 15 seconds before others can see it?
only if the previous change was less than 15 seconds ago
else it will update instantly too
ah okay
const DiscordRPC = require("discord-rpc");
const client = new DiscordRPC.Client({ transport: "ipc" });
(async () => {
setInterval(() => {
let date_time = new Date();
let hours = date_time.getHours();
let minutes = date_time.getMinutes();
let seconds = date_time.getSeconds();
client.on('ready', async () => {
await client.setActivity({
buttons: [{ label: "RPC Time!", url: "..." }],
details: `Current time: ${hours}:${minutes}:${seconds}`,
largeImageKey: "clock",
largeImageText: `Current time: ${hours}:${minutes}:${seconds}`
}).catch(err => console.log(err));
console.log("Discord Rich Presence has been enabled.");
});
}, 1500)
await client.login({ clientId: "..." }).catch(console.error);
})();
gives me this error now: js PS C:\Users\Marni\Desktop\RPCTime> node --trace-warnings .\main.js (node:24172) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 ready listeners added to [RPCClient]. Use emitter.setMaxListeners() to increase limit at _addListener (node:events:465:17) at RPCClient.addListener (node:events:487:10) at Timeout._onTimeout (C:\Users\Marni\Desktop\RPCTime\main.js:62:16) at listOnTimeout (node:internal/timers:557:17) at processTimers (node:internal/timers:500:7)
Well, yeah. You should use the setInterval in the client.on, not the inverse lol
jesus i'm so dumb 😂 thanks xD
how to fix
By asking in the proper discord
yeah, start by using the correct discord
not sure since when javascript is go
since now ma'am
don't you dare give me the attitude
<@&839912195994812420> troll 669400902028754965
??
kindly keep whatever this bait and attitude shtick is out of this place, thank you
Hey guys, is there a cooldown regarding client logins when using RPC? I want to give my users the ability to (de)activate our softwares RPC, but once client.destroy() is used, the RPC doesn't show up when client.login() is called. Can someone tell me what I'm doing wrong?
you should create new client instances every time
after calling .destroy() it's not meant to be used to login again
Ah, didn’t know that
What function is it? Didn’t find an init one in discordjs‘ docu
new Client(...) creates a new instance
Makes sense, thanks 🙂
What's RPC? Sorry if this sounds stupid.
Rich presence client, read pins for more info
The thing you see in .any bots profile like listening to whatever but in users case a little customized
Btw is there a way to have it 24/7
I think its against tos?
yes , keep ur computer alive for 24/7 
Ye lol
Or buy vps, install discord on it and for example vsc and keep it online
Have fun paying for the resources to host a desktop OS for just a discord status
How would u install discord on a vps? And also I didn't understood the example either vscode isn't a discord application
Install windows on it
And i know that vsc isn't discord app XD
But you can run RPC inside vsc -_-
At that point just emulate you're on a Discord client in a VPS with REST requests and communicate with websockets
@limpid skiff it stands for remote procedure calls, not rich presence client
is there a package for discord rpc?
or how would i declare something like this const presence = new Presence({
You can use the package in the channel topic
How to change the RPC activity type?
how can i clear activity
client.clearActivity() not working
i want stop it or some like clear it but i cant find any method
Where is the full doc ?
Because I didn't find it ;-;
what's clientId?
is it my userid or what
the application id I think
can someone help me no matter what i do i get this error, it used to work few days ago without any problems i didnt change anything since then and neither did i change anything in the discord app im using
I dropped a project for a month related to rich presence because it wasn’t working for me and then I just turned on showing activity status and it worked lmao
Hello guys!
Can I add this rpc in my bot's activity?
No, rich presence is only supported for normal users
Oo
can I host the rpc outside of my comp?
ha now way Im doing that
how to add buttons in rpc status
<@&839912195994812420> thats... scam?
and spam its everywhere
hello
hello
can you help me
depends if you post your issue or not
okay
when i try to run my rpc file
it says
Error: Could not connect
at Socket.onerror (/data/data/com.termux/files/home/a/node_modules/discord-rpc/src/transports/ipc.js:32:16)
Things to consider when getting a connection closed/could not connect error:
• What transport are you using? If it's 'websocket', change that to 'ipc'.
• Is the ID you are trying to login with your user ID? If so, you should be using a Client ID from the Developer Portal (https://discord.com/developers/applications) instead.
• Is the ID a string? If not, JavaScript will truncate it's value causing the connection to fail.
• Are you using the Discord app? It won't be able to connect to the web version. Similarly, bots cannot use RPC.
• Is your code running on the same machine as the Discord app?
• Are you trying to run it from WSL? If so, it won't be able to connect either.
• Have you installed Discord from the snap store? If so, install it from your distro's package repository or directly from the Discord website.
alr ipc
Probably the best place to ask id think, is this something your allowed to do TOS wise? I use the oauth API to get a token from my server then login to the client with that token via ipc
https://cdn.discordapp.com/attachments/814900284974563408/910606634034806824/q46q0EDZ11.gif
How can i make a button like the MEE6?
That has nothing to do with RPC, thats Bot Discovery.
oh, ok
so I'm subbing to voice channel change events and seems the event fires twice for some reason. Can anyone else confirm this is intended or reproducible?
mvp code:
const RPC = require("discord-rpc");
const client = new RPC.Client({ transport: "ipc" });
const clientId = "redacted";
const accessToken = "redacted";
client.on("ready", () => {
console.log("Authed for user", client.user.username);
client.subscribe("VOICE_CHANNEL_SELECT");
});
client.on("VOICE_CHANNEL_SELECT", channel => {
console.log(channel.channel_id);
});
// Log in to RPC with access token
client.login({
clientId,
scopes: ["rpc"],
prompt: "none",
accessToken
});
I'm using this code:
const RPC = require('discord-rpc')
const Activitys = {
detail: "I'm testing!",
assets: {
large_image: "image_1",
large_text: "My name is jeff"
},
buttons: [
{
"label": "Check this!",
"url": "youtube.com"
}
],
timestamps: {start: Date.now()},
instance: true
}
client.on("ready", ()=> {
client.request("SET_ACTIVITY", {pid: process.pid, activity: Activitys})
console.log("RichPresenceWorked!")
})
It does nothing
Well, if you don't login...
its my ready.js
I have the login in a different channel
or do I need to add client.login({ clientId: "123456789"})
You need to login via your token..
If you have a Json with all of that information then at the top do:
const { token } = require('./config.json')
And at the bottom:
client.login(token)
If it works let me know.
No... thats not how RPC works 
Yes, you do.
Does anyone know how to add "invite people" option?
can u show a ss?
I wonder what tutorial people use when I see client.request('SET_ACTIVITY') when we have a completely fine method for it. client.setActivity()
Rich Presence in Web version?
I heard it's possible with sdk
not with discord-rpc.
and can I do it? let me know the channel about 🙂
well, not on this discord, #useful-servers
Is this library okay to use? https://github.com/devsnek/discord-rich-presence
(node:25677) UnhandledPromiseRejectionWarning: Error: Could not connect
at Socket.onerror (/usr/lib/ElectronApp/resources/app/node_modules/discord-rpc/src/transports/ipc.js:32:16)
at Object.onceWrapper (events.js:422:26)
at Socket.emit (events.js:315:20)
at emitErrorNT (internal/streams/destroy.js:92:8)
at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
at processTicksAndRejections (internal/process/task_queues.js:84:21)
It's not working for me on Linux.
yes it is
Things to consider when getting a connection closed/could not connect error:
• What transport are you using? If it's 'websocket', change that to 'ipc'.
• Is the ID you are trying to login with your user ID? If so, you should be using a Client ID from the Developer Portal (https://discord.com/developers/applications) instead.
• Is the ID a string? If not, JavaScript will truncate it's value causing the connection to fail.
• Are you using the Discord app? It won't be able to connect to the web version. Similarly, bots cannot use RPC.
• Is your code running on the same machine as the Discord app?
• Are you trying to run it from WSL? If so, it won't be able to connect either.
• Have you installed Discord from the snap store? If so, install it from your distro's package repository or directly from the Discord website.
Hi, thanks for a response. I want to clarify that it's not my app per-say, but I am working on fixing a bug of it. To answer all your questions:
- ipc
- I believe so, it's an id specified by the developer and has been working for everyone.
- yes
- yes (flatpak), but it works with spotify rpc. Spotify is also a flatpak, maybe that makes a difference?
- yes
- nope, fedora 35 bare metal.
- no, flatpak.
Looks like it doesn't work with flatpak.
install it from your distro's package repository or directly from the Discord website.
odd, what makes it not work with flatpak?
No idea
Most likely the same thing that makes it not work with snap store xD
spotify doesn't use ipc I think
anyway, you could try if it works with the rpmfusion version instead
there were reasons I didn't use the discord rpm
but I forget why
ah
meh I can try it again, that was mainly when I was still setting things up in my system
ah right, you need to launch it with --no-sandbox for some reason. but yeah the rpc does work now.
¯_(ツ)_/¯
await client.setActivity({
buttons: [{ label: "My Bot", url: "https://pixelpasta.github.io/Bot.html" }, { label: "Minecraft SMP", url: "invite" } ],
details: "File: Time_Trial.js",
state: "Workspace: Arcade Racing Pro",
largeImageKey: "js",
startTimestamp: 0,
largeImageText: "I like Tacos"
}).catch(err => console.log(err));
``` Ik startTimestamp is wrong but how do I fix it?
updating the activity detail/text part according to api rate limit may work?
You need to provide an endTimestamp at some point in the future; play with the rich presence visualizer in the application settings on https://discord.dev
Hi! Is there a way to make a "progress bar" like spotify has in rpc?
doubt that
no there's not
the closest you'd get to that would be a countdown
Make a multi billion dollar app then get in contact with Discord for custom rpc functionality. (Aka no)
The same goes for stuff like Twitters image embeds or Spotify's listen along embed
listen along can be replicated in your game, it allows ppl to join ur game via an embed
^ can anyone show an example of that please?
@plush coyote
thx
how do you implement this with discord.js?
you dont
this has nothing to do with djs
atleast that's what i used
wait so do i use RPC or some other library?
yes
that lib tho is made by the djs team
i linked it here
thank you 😊
how long does it take for assets to show up after upload
normally instant. But you may need to clear your browser cache by reloading with ctrl + F5
its not instant at all, it takes atleast 5 minutes
Oh I looked in the completely wrong discord and thought this was about something else 😅 I’m sorry for the inconvenience
https://github.com/discordjs/rpc
do I need to apply for anything special to use this, or just get the scopes on my oauth2 url?
i thought you had to get special permission for this
What is this?
I know that, but is that like the rich presence thing? So it shows what I’m on like YouTube and all that?
a bit more than that, but yes
I’ve been looking for something like that for ages
does anyone know a portfolio maker
Not related to discord-rpc #useful-servers #archive-offtopic #resources
is it possible to show browser ram usage in rpc?
Yes but your browser would have to support it
no?
you wouldnt even need to interact with the browser
get a list of system processes, and just find the process(es) of the browser and there is probably some sort of function in one of the builtin modules to get ram usage of a specific process
q
Error: Could not connect
at Socket.onerror (/root/RPC/node_modules/discord-rpc/src/transports/ipc.js:32:16)```
Can anyone help me?
Things to consider when getting a connection closed/could not connect error:
• What transport are you using? If it's 'websocket', change that to 'ipc'.
• Is the ID you are trying to login with your user ID? If so, you should be using a Client ID from the Developer Portal (https://discord.com/developers/applications) instead.
• Is the ID a string? If not, JavaScript will truncate it's value causing the connection to fail.
• Are you using the Discord app? It won't be able to connect to the web version. Similarly, bots cannot use RPC.
• Is your code running on the same machine as the Discord app?
• Are you trying to run it from WSL? If so, it won't be able to connect either.
• Have you installed Discord from the snap store? If so, install it from your distro's package repository or directly from the Discord website.
What is the format of the "args" object in RPCClient#setActivity?
https://i.imgur.com/mwiVKLW.png
This format from discord api webpage seems to be wrong, since I'm trying to set "type" to 2 ("listening to ..."), but it doesn't work
https://i.imgur.com/QICEAqs.png
you can't change the type via rpc
uhm... is there a way to do it via js then?
only for bot instances
anyone who knows how to make a RPC for a app in windows?
Is it evem possible to make a rpc with the uptime? Like:
Uptime
Last Restart since
00:00 elapsed```
Pls ping me btw
bots cannot have rpc
how does RPC differ from "self-botting" ?
RPC is basically a transfer of data from your Discord client to wherever your origin is (your program, essentially), it can do a couple of things like connect to a voice channel, list guilds IIRC, etc. the most basic things (https://discord.com/developers/docs/topics/rpc#commands-and-events-rpc-commands). RPC in this context is popular for allowing you to set your activity legally. what's the difference then? account automation is when either use the API with your account token to do any API call or connect to the WebSocket server of Discord to function like a normal account in a Discord app (say, for example, desktop), because Discord supposedly is the one that logs you in, sends a message or most things you can do in the user interface
what different between login with ({ transport: 'websocket' })
and login with ({ transport: 'ipc' }) ?
https://github.com/discordjs/RPC/tree/master/example it use ipc on electron app, so should i use ipc too ?
websocket is whitelisted, you have to apply for that from Discord.
ipc is exposed so you can use that without applying ^^
ayo wtf they nothign alike
literally no similiarity in them
yuh just making sure yea
rpc for android
Nop
this my code https://sourceb.in/v4lQiug5q2
but the problem is im not able to get the button to work. the button appears, but when i click nothing happens
oh wait, is it like i cant click my own buttons ?
oh yes it is lol
Yep
I want to make my own Discord RPC client without any plugins
directly via API
i can't learn anything from docs
How do I?
works on desktop client as well
its only that u cant click ur own button
so u can make an alt acc and click it with too
ahh isee
yea that works too
This channel is for support with the discord-rpc package, not making your own
bruh
@raven ember can you please-
uh is rpc against tos?
no
not sure
havent touched rpc
see pins
how to use rpc without discord client?
just with node
The discord client has to run in the background
Is discord-rpc supposed to work only when a nodejs process is available? I'm trying it in a React app, but it totally doesn't work and I just keep getting lots of errors...
Firstly, I received an error from webpack saying that it's not able to compile the 'timers' module, then, after removing it from the discord-rpc, it successfully compiled but I receive a lot of runtime errors, like process is not defined.
So, is this package supposed to not work with something like a webpage (I tried because I saw "browser example" in the README...)?
Well, now there is another problem 
I keep getting "Connection closed" if I use "websocket" as transport, as shown in the example, and something like "o.createConnection is not a function" if I use "ipc"
I've heard that to use "websocket" we should be whitelisted by Discord... So there's no way? 😂
The RPC needs to be hosted on a nodejs app
and yes, websocket is whitelisted
see pins
Ok, thanks for the reply!
no, i can't run it. because i'm arm
Then you're out of luck. Whatever you write will have to connect to rpc server running in the discord app.
And since websocket is whitelisted, you can only use IPC, which means that said discord app has to run next to your rpc stuff
when I try to login the client, it immediately crashes with this error: ```js
[dirname]\node_modules\discord-rpc\src\transports\ipc.js:32
reject(new Error('Could not connect'));
^
Error: Could not connect```
transport is set to IPC, and the client ID exists
Things to consider when getting a connection closed/could not connect error:
• What transport are you using? If it's 'websocket', change that to 'ipc'.
• Is the ID you are trying to login with your user ID? If so, you should be using a Client ID from the Developer Portal (https://discord.com/developers/applications) instead.
• Is the ID a string? If not, JavaScript will truncate it's value causing the connection to fail.
• Are you using the Discord app? It won't be able to connect to the web version. Similarly, bots cannot use RPC.
• Is your code running on the same machine as the Discord app?
• Are you trying to run it from WSL? If so, it won't be able to connect either.
• Have you installed Discord from the snap store? If so, install it from your distro's package repository or directly from the Discord website.
turns out something's wrong with my discord canary client, because it only works on the normal discord client
Change the Activity Type of the user rich presence(Playing to Listening)
It's not currently supported by Discord AFAIK
something made by discord wont be against discord's policies
hi
How to read user's rich presence?
@verbal timber
lmao
What transport should I choose?
What are the cons and pros?
Ipc cuz you need to be whitelisted for websocket
White listed?
What are the differences?
One you can use, one you cant
is there any good tutorial on rpc?
For most people's use-case, you just want a pretty rich presence and you aren't actually leveraging the rpc protocol; if that's the case, use the wrapper package: https://www.npmjs.com/package/discord-rich-presence
The provided code snippet in the npm package should cover what you need.
Hello, I want to use rpc to mute my self. But first is rpc deprecated in favour for the game-sdk ? And how do I mute myself?
wht is rpc
A rich presence client for discord
*remote procedure call
with this combination you can mute yourself xd
im saying this because if you dont find anything so you can use this xd
that's not entirely useful, as that shortcut only works when your discord is in focus. For that to not be a problem, you'd have to create your own toggle mute keyboard shortcut.
but even then those are for manual use, where rpc allows to do that programmatically
help reject(new Error('Could not connect'));
Things to consider when getting a connection closed/could not connect error:
• What transport are you using? If it's 'websocket', change that to 'ipc'.
• Is the ID you are trying to login with your user ID? If so, you should be using a Client ID from the Developer Portal (https://discord.com/developers/applications) instead.
• Is the ID a string? If not, JavaScript will truncate it's value causing the connection to fail.
• Are you using the Discord app? It won't be able to connect to the web version. Similarly, bots cannot use RPC.
• Is your code running on the same machine as the Discord app?
• Are you trying to run it from WSL? If so, it won't be able to connect either.
• Have you installed Discord from the snap store? If so, install it from your distro's package repository or directly from the Discord website.
ok
What is this channel
Same question
does nobody read the channel description? 
Or any messages at all
what is RPCLoginOptions.accessToken actually used for
Can I use RPC On discord web ?
Can you use RPC without having discord client open in the background? (Any way)
No
Considering that it needs to transmit data via IPC locally, you likely have Discord running in the background.
Hello i have a problem because, my button is not working. ```js
const RPC = require("discord-rpc");
const rpc = new RPC.Client({
transport: "ipc"
});
const Gamedig = require('gamedig')
let date = new Date();
rpc.setActivity({
details: any,
state: any,
largeImageKey: "any",
smallImageText: 'any',
smallImageKey: '"',
startTimestamp: date,
buttons: [{ label: 'Discord', url: 'https://discord.gg/MyServerDiscord' }],
largeImageText: "any"
});
As if I click on a button and nothing happens ..
It is working, you can't click your own buttons.
My friend clicked and it doesn't work
Then you probably banned your friend from your discord, I'm telling you, it works.
The button wouldn't even show up if its not working.
Sure
Error: Failed all 1 attempts
at QueryRunner.run (C:\Users\kuba3\Downloads\MTA-RPC\node_modules\gamedig\lib\QueryRunner.js:95:21)
at async Gamedig.query (C:\Users\kuba3\Downloads\MTA-RPC\node_modules\gamedig\lib\index.js:11:16)
at async Function.query (C:\Users\kuba3\Downloads\MTA-RPC\node_modules\gamedig\lib\index.js:19:16)
Attempt #1 - Port=22126 Retry=0:
What
not related to rpc
Can you try a different link?
Not a Discord invite but something else like YouTube.
I encountered this issue twice where my discord invite link buttons weren't working. The workaround I found was using a link shortener like bit.ly.
Nvm my bad, is working
It was working...
Okay.
is there anyway to automaticly get user's id for discord-rpc?
can the rpc use any other type for activities? rn its just 0. i want to be able to use type 3
according to https://discord.com/developers/docs/topics/gateway#activity-object i should be able set the types
you can't change the type via rpc, no
hmmm is it possible any other way then?
only through the bot gateway
awww
connection closed? anyone know why?
... the error was in /node_modules/gamedig, its a query runner error
why was discord rpc deprecated anyway, is there anyway to use game-sdk with javascript?
How would you remove or reset someones RPC ?
You cant set the RPC of others, just yourself.
Do you even know what RPC is? 
uh
you can see others
if i made an app
with rpc
and it has an activity, others can see it. aslong as their in the beta tester thing in my discord dev application
and in the apps code, i was to remove the activity, how would i do that
and its a rich presence client i think
It's a Remote Procedure Call.
damn it
either way
is there any way to clear a rich presence/activity
from a user
I think you're searching this https://discord.js.org/#/docs/rpc/master/class/RPCClient?scrollTo=clearActivity
how to change button style?
tyy
Why did I get this Error?
TypeError: Cannot read properties of null (reading 'write')```
idk
then dont answer
code?
sorry
can we set rpc on bots too ?
no
I have a new Code, with a new Error:
Error: connection closed
Code:
const RPC = require("discord-rpc");
const rpc = new RPC.Client({
transport: "ipc"
})
rpc.on("ready", () => {
rpc.setActivity({
details: "details",
state: "state",
largeImageKey: "testImg",
smallImageKey: "testImg",
largeImageText: "test",
smallImageText: "test",
startTimestamp: new Date(),
buttons: [
{
'label': "test",
'url': "test.de"
}
]
})
})
rpc.login({
clientId: "926602498251325522"
})```
Things to consider when getting a connection closed/could not connect error:
• What transport are you using? If it's 'websocket', change that to 'ipc'.
• Is the ID you are trying to login with your user ID? If so, you should be using a Client ID from the Developer Portal (https://discord.com/developers/applications) instead.
• Is the ID a string? If not, JavaScript will truncate it's value causing the connection to fail.
• Are you using the Discord app? It won't be able to connect to the web version. Similarly, bots cannot use RPC.
• Is your code running on the same machine as the Discord app?
• Are you trying to run it from WSL? If so, it won't be able to connect either.
• Have you installed Discord from the snap store? If so, install it from your distro's package repository or directly from the Discord website.
your id is wrong
lol
Thanks, it works! 😄
Is it possible to change the style of the button
Not that I know, highly doubt it
I have question
if i use the clientId of my main bot
will the RPC and discordjsv13 work
?
together?
you are setting the rpc of yourself, not the bot
that are two unrelated things
L
Thx
Please don't get off-topic, regular conversations belong in #archive-offtopic or #869649231357566996
Class constructor RPCClient cannot be invoked without 'new'
I get this error even though i use new
Can you show your code?
const RPC = require("discord-rpc")
const rpc = new RPC.Client({
transport: "ipc"
})
rpc.on("ready", () => {
rpc.setActivity({
details: "details",
state: "state",
largeImageKey: "testImg",
smallImageKey: "testImg",
largeImageText: "test",
smallImageText: "test",
startTimestamp: new Date(),
buttons: [
{
'label': "test",
'url': "test.com"
}
]
})
})
rpc.login({
clientId: "932513153554743316"
})
Is there the possibility that you didn't save the file lol
nope, i figured it might be something to do with cached files. So i shifted the code 1 line down to check if the error message corresponds
it did
so there must be something else at play
any idea why its messed up?
show the full error
thats the entire error
Where... Are you using it
The code you provided above works fine for me
yes in a standard node environment it works fine, but im trying to use it in a electron app
is that chrome devtools ?
oh ok
yes, it is
hello I have a question how to create a party with the discord-rpc lib ?
hi guys
i tried to use rpc to set user text channel but
i've this error ```js
body: { redirect_uri: [ 'Not a well formed URL.' ] }
Error: 400
at async RPCClient.authorize (D:\Developpement\NodeJS\Discord RPC\node_modules\discord-rpc\src\client.js:215:22)
at async RPCClient.login (D:\Developpement\NodeJS\Discord RPC\node_modules\discord-rpc\src\client.js:143:21) {
body: { redirect_uri: [ 'Not a well formed URL.' ] }
}
anyone can help me
my code
const RPC = require("discord-rpc")
const rpc = new RPC.Client({
transport: "ipc"
})
rpc.on("ready", async () => {
await rpc.selectTextChannel("sussybaka", 5000)
})
rpc.login({
clientId: "sus",
scopes: ["rpc"] // <-- need this
})
You need to pass a redirect uri (one listed in your application redirect URIs) in the login method
Not sure if passing an empty string works the same
redirect_url: "url from Oauth"
Like this?
It's called redirectUrl and should be listed in the oauth2 section of your application page in the developer portal, like this:
yup! Thank you
I have this whenever I try to invite a channel/person to play
RPC Version: 4.0.1
const rpcClient = new discordRPC.Client({ transport: "ipc" });
rpcClient.on("ready", async () => {
await rpcClient.setActivity({
buttons: [{ label: "Website", url: "https://moodybot.tk/" }],
details: "Moody. The new way to manage",
largeImageKey: "rpc_icon",
largeImageText: "Beta Released!",
});
logger.info("RPC Status Ready!");
});
rpcClient.login({ clientId: "896042594210037810", scopes: ["rpc"], redirectUrl: "https://moodybot.tk/" })```
Could not connect
Do you have your discord app open?
Not in the browser
Check this: #archive-rpc-help message
The mobile app?
Why would I need that to be open to have a rich presence on my bot?
It's... Not for your bot?
@burnt cloud
...
I saw someone using it though??
Wait nvm
Welp thanks
Hello guys,
I was thinking of making a thing that displays the music that I'm currently playing on discord as an activity, I use Apple Music (iTunes app on windows). Is setting your own activity against the self bot rule in discord TOS? If no how could I even update my own user activity and update it every second. And would it be possible to replicate the progress bar seen for spotify users?
(Unrelated to discord, but is to my little project how could I fetch only the music being played in the Windows iTunes app)
You can set your own RPC, thats literally the purpose of it, you can't set it every second tho. 15 seconds at least.
No, you cannot replicate the progress bar.
How you can fetch stuff like that -> #useful-servers
ty
Hello does anyone have good examples to get started with rpc bc i seems a bit dry on information
there is an example in the channel description
yes i saw but it didnt really help me so much, unlike discord.js main lib which has some really great examples
and the client id is just my id?
it's the id of the application that you want the rpc to be for
alright :) how do i link it with my user profile?
it does that automatically
it connects to the account that's currently logged in on that device
alright nice thx
If I use custom RPC did I will get banned from discord?
What? RPC was made by discord for discord... Not sure what you mean with "custom"
Like Join in my discord server rpc
Uhm, I don't think it's against Discord TOS to put a server invite in the activity although I'm not really sure ↓
its not
Thanks
How do I set rich presence on my bot with images, buttons etc...?
you can't use rpc on a bot
it's for users only
Ok
anyone knows anything about this?
does rpc not have ts typings?
nvm
It does
its completely unrelated to djs
like something happen to my account if use it
rpc isn't against tos
so
so i can use it
idk, can you?
yes you can
:O
bots can run rpc?
why image not working?
No
They take some time to get cached
Is there any way to stop displaingy Rich Presence on the user with the discord-rpc
Is there a guide or something for making a basic rich presence status?
no i dont think so but heres the json
{
"details": "Top text",
"state": "bottom Text",
"largeImageKey": "URL OR KEY",
"largeImageText": "large hover text",
"smallImageKey": "URL OR KEY",
"smallImageText": "small hover text",
"startTimestamp": Date.now()
}
to set a presence
<RPC_CLIENT>.setActivity(json_i_showed_you_here, process.pid);
ah ok. Would I need to run this in my bot or-
so could I like just clone the github example
who uses your app or other stuff
?
Set my status as playing a game that's not an actual game
e.g.
Oh ur status
yeah!
download discord-rpc: npm i discord-rpc
const client = new RPC.Client({ transport: "ipc" });
client.login({ clientId: "ID" });
const presence = {
details: "Top text",
state: "bottom Text",
largeImageKey: "URL OR KEY",
largeImageText: "large hover text",
smallImageKey: "URL OR KEY",
smallImageText: "small hover text",
startTimestamp: Date.now()
}
client.setActivity(presence, process.pid);
then run the file and thats it node filename.js
to add buttons
buttons: [{ label: "Cool button", url: "https://example.com" }]
i might be wrong with the url thing tho
@smoky scroll
oh
so the clientId would be a bot ID or my ID?
Is this against TOS?
the application id
go to the developers dashboard thing on discord
Create an application and get the client id (application id)
you can use URLs for images or upload images into the application and use the key
how will it appear as my status tho
wehn you run the file
itll appear on ur status
hmm ok
Playing [APPLICATION_NAME]
And it's not against TOS?
not at all
Great
I see people using like BetterDiscord and shit and I get so mad
why lol
anywat i gtg sleep
Hmm ok
Gn
Uh, how do i define "RPC"?
Error
a) "ipc"? b) why is this on a phone c) wtf
Lmao
it's ipc in the code
...
const rpc = new DiscordRPC.Client({ transport: 'ipc' });
also make sure you required discord-rpc
and const DiscordRPC = require('discord-rpc')?
^
yes
at Object.<anonymous> (C:\Users\Patron\Downloads\rpc\index.js:3:16)
at Module._compile (node:internal/modules/cjs/loader:1097:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1149:10)
at Module.load (node:internal/modules/cjs/loader:975:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
at node:internal/main/run_main_module:17:47
Node.js v17.4.0```
can i see your code
const DiscordRPC = require('discord-rpc')
const RPC = new DiscordRPC.Client({ transport: 'ipc' });
const client = new RPC.Client({ transport: "ipc" });
client.login({ clientId: "936472354467500052" });
const presence = {
details: "♫ https://cloudy.gay",
state: "bottom Text",
largeImageKey: "froggie",
largeImageText: "large hover text",
smallImageKey: "froggie",
smallImageText: "small hover text",
startTimestamp: Date.now()
}
client.setActivity(presence, process.pid);``` this is `index.js`
line 3
you should not need to define client
oh did i do that twice
yea
when rpc is defined that is it
wait
and where ever it says client replace tat with RPC
const DiscordRPC = require('discord-rpc')
const client = new DiscordRPC.Client({ transport: 'ipc' });
client.login({ clientId: "936472354467500052" });
const presence = {
details: "♫ https://cloudy.gay",
state: "bottom Text",
largeImageKey: "froggie",
largeImageText: "large hover text",
smallImageKey: "froggie",
smallImageText: "small hover text",
startTimestamp: Date.now()
}
client.setActivity(presence, process.pid);``` ->> ``` this.socket.write(encode(op, data));
^
TypeError: Cannot read properties of null (reading 'write')
at IPCTransport.send (C:\Users\Patron\Downloads\rpc\node_modules\discord-rpc\src\transports\ipc.js:155:17)
at C:\Users\Patron\Downloads\rpc\node_modules\discord-rpc\src\client.js:159:22
at new Promise (<anonymous>)
at RPCClient.request (C:\Users\Patron\Downloads\rpc\node_modules\discord-rpc\src\client.js:157:12)
at RPCClient.setActivity (C:\Users\Patron\Downloads\rpc\node_modules\discord-rpc\src\client.js:518:17)
at Object.<anonymous> (C:\Users\Patron\Downloads\rpc\index.js:15:8)
at Module._compile (node:internal/modules/cjs/loader:1097:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1149:10)
at Module.load (node:internal/modules/cjs/loader:975:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
Node.js v17.4.0```
is that your full index page
yep
have you looked at the recourses listed in the the channel topic
I don't have an app, I just want a status
e.g.
you need a app to do that
Wait I do
yes
Then what was @dense summit on?
he talked about application ID here
yeah I have an app on discord dev portal
I added the client ID
Like apply
no in the js file
how
DiscordRPC.register(clientId);
it does not go were you define RPC
on the github link it shows you how to properly make a RPC
just ignore all the stuff that is not rpc related
if it says app on it then that is a part of electron and is unnecessary
@smoky scroll if it works let me know i got to switch to mobile but i should still be able to help if you need any more help. 🙂
oke
so do I do DiscordRPC.register(clientId); BEFORE client.login({ clientId: "936472354467500052" }); or after
Yes
Wait hold on
Let me check something rq
Your client login should be at the bottom like a discord bot
ok
this.socket.write(encode(op, data));
^
TypeError: Cannot read properties of null (reading 'write')
at IPCTransport.send (C:\Users\Patron\Downloads\rpc\node_modules\discord-rpc\src\transports\ipc.js:155:17)
at C:\Users\Patron\Downloads\rpc\node_modules\discord-rpc\src\client.js:159:22 at new Promise (<anonymous>)
at RPCClient.request (C:\Users\Patron\Downloads\rpc\node_modules\discord-rpc\src\client.js:157:12)
at RPCClient.setActivity (C:\Users\Patron\Downloads\rpc\node_modules\discord-rpc\src\client.js:518:17)
at Object.<anonymous> (C:\Users\Patron\Downloads\rpc\index.js:16:8)
at Module._compile (node:internal/modules/cjs/loader:1097:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1149:10)
at Module.load (node:internal/modules/cjs/loader:975:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
Node.js v17.4.0``` is the error from ```js
const DiscordRPC = require('discord-rpc')
const client = new DiscordRPC.Client({ transport: 'ipc' });
let clientId = "936472354467500052"
DiscordRPC.register(clientId);
const presence = {
details: "♫ https://cloudy.gay",
state: "bottom Text",
largeImageKey: "froggie",
largeImageText: "large hover text",
smallImageKey: "froggie",
smallImageText: "small hover text",
startTimestamp: Date.now()
}
client.setActivity(presence, process.pid);
client.login({ clientId: "936472354467500052" });```
At the bottom where you login your clientId can be replaced with your variable of your client ID
ok
I changed it to client.login(clientId) and now the error is ```C:\Users\Patron\Downloads\rpc\node_modules\discord-rpc\src\transports\ipc.js:155
this.socket.write(encode(op, data));
^
TypeError: Cannot read properties of null (reading 'write')
at IPCTransport.send (C:\Users\Patron\Downloads\rpc\node_modules\discord-rpc\src\transports\ipc.js:155:17)
at C:\Users\Patron\Downloads\rpc\node_modules\discord-rpc\src\client.js:159:22 at new Promise (<anonymous>)
at RPCClient.request (C:\Users\Patron\Downloads\rpc\node_modules\discord-rpc\src\client.js:157:12)
at RPCClient.setActivity (C:\Users\Patron\Downloads\rpc\node_modules\discord-rpc\src\client.js:518:17)
at Object.<anonymous> (C:\Users\Patron\Downloads\rpc\index.js:16:8)
at Module._compile (node:internal/modules/cjs/loader:1097:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1149:10)
at Module.load (node:internal/modules/cjs/loader:975:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
Node.js v17.4.0```
full code is ```js
const DiscordRPC = require('discord-rpc')
const client = new DiscordRPC.Client({ transport: 'ipc' });
let clientId = "936472354467500052"
DiscordRPC.register(clientId);
const presence = {
details: "♫ https://cloudy.gay",
state: "bottom Text",
largeImageKey: "froggie",
largeImageText: "large hover text",
smallImageKey: "froggie",
smallImageText: "small hover text",
startTimestamp: Date.now()
}
client.setActivity(presence, process.pid);
client.login(clientId);```
async function setActivity() {
if (!rpc ) {
return;
}
rpc.setActivity({
details: `booped ${boops} times`,
state: 'in slither party',
startTimestamp,
largeImageKey: 'snek_large',
largeImageText: 'tea is delicious',
smallImageKey: 'snek_small',
smallImageText: 'i am my own pillows',
instance: false,
});
}
rpc.on('ready', () => {
setActivity();
// activity can only be set every 15 seconds
setInterval(() => {
setActivity();
}, 15e3);
});
rpc.login({ clientId }).catch(console.error);
This the way of setting the activity
ah
would that be the entire index.js file?
That would be in-between wear you define clown and we’re you login
Also change client to rpc
mk
Just that was from the rpc example
It should work if not I will rewrite it so it does
uhh
this does not work, no
fuck sorry that's mine
You did not put it in brackets
If you look in the GitHub I sent you it shows you how to do it
Ah oke
This one
I did this now:
const DiscordRPC = require('discord-rpc')
const rpc = new DiscordRPC.Client({ transport: 'ipc' });
let clientId = "936472354467500052"
DiscordRPC.register(clientId);
async function setActivity() {
if (!rpc ) {
return;
}
rpc.setActivity({
details: `booped some times`,
state: 'in slither party',
largeImageKey: 'froggie',
largeImageText: 'tea is delicious',
smallImageKey: 'froggie',
smallImageText: 'i am my own pillows',
instance: false,
});
}
rpc.on('ready', () => {
setActivity();
// activity can only be set every 15 seconds
setInterval(() => {
setActivity();
}, 15e3);
});
rpc.login({ clientId }).catch(console.error);```
and this doesn't show on my profile
Do you get a error
I did node ., no message appears
Nothing should log In console
mk good, so then how come it doesn't show up on my profile?
Are you singed into the discord app on your computer
yes, but the regular one, should it be canary?
No it should be the regular one
Try to re run it
ok
I re-ran it, does it show up?
Weird I don’t see it
yeah...
this is the whole index code:
const DiscordRPC = require('discord-rpc')
const rpc = new DiscordRPC.Client({ transport: 'ipc' });
let clientId = "936472354467500052"
DiscordRPC.register(clientId);
async function setActivity() {
if (!rpc ) {
return;
}
rpc.setActivity({
details: `booped some times`,
state: 'in slither party',
largeImageKey: 'froggie',
largeImageText: 'tea is delicious',
smallImageKey: 'froggie',
smallImageText: 'i am my own pillows',
instance: false,
});
}
rpc.on('ready', () => {
setActivity();
// activity can only be set every 15 seconds
setInterval(() => {
setActivity();
}, 15e3);
});
rpc.login({ clientId }).catch(console.error);```
Hold on I will get back on my computer and compare them
Cause I am missing something
okay
dont thin this will fix it but remove the return in the if statement
if(!rpc){
}
did it work?
wait
waiting
nv did not work
const DiscordRPC = require('discord-rpc');
const clientId = '';
// register the RPC
const rpc = new DiscordRPC.Client({ transport: 'ipc' });
DiscordRPC.register(clientId);
const startTimestamp = new Date();
async function setActivity() {
if (!rpc) {
return;
}
rpc.setActivity({
buttons: [{ label: RPCButtonName , url: RPCButtonLink }],
details: `${RPCDetails}`,
state: `${RPCState}`,
startTimestamp,
largeImageKey: 'largelogo',
largeImageText: 'Working on shit',
smallImageKey: 'online',
smallImageText: 'online',
instance: false,
});
}
rpc.on('ready', () => {
setActivity();
setInterval(() => {
setActivity();
}, 15e3);
});
rpc.login({ clientId }).catch(console.error);
just use this this is my complete code there should be no reason why it fails
okay
I'll try, thanks
I''ll replace the keys and stuff
remove the value in detail and state
how do I define RCButtonState
^
ReferenceError: RPCButtonName is not defined
at setActivity (C:\Users\Patron\Downloads\rpc\index.js:20:24)
at RPCClient.<anonymous> (C:\Users\Patron\Downloads\rpc\index.js:34:3)
at RPCClient.emit (node:events:520:28)
at RPCClient.login (C:\Users\Patron\Downloads\rpc\node_modules\discord-rpc\src\client.js:139:12)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
Node.js v17.4.0```
the buttons
its at the top of where i set the activity
thanks!
oh
did it work
wait those are just variables i used
ya i replaced them with "button"
go in your settings and look in here make sure it is not disabled
cause that might be what is causing it to not appear on your discord account
AHA
THANKS
Can I add a second button or no?
buttons: [ { label: " ", url: " " }, { label: " ", url: " "} ]
you do this and you can have 2 buttons
ooh thanks
Oh, why is your discord bot going down?
cause i no longer have time to maintain it
Ah
Why not just keep hosting it tho?
I dont want to host a dead project that i am no longer maintaining
Ah okay
since there will never be updates to it and also my v13 bots suck cause i am not the best with 13 It use to be made with discord js and commando
ah okay D:
uhhh @thin tundra Error: RPC_CONNECTION_TIMEOUT at Timeout._onTimeout (C:\Users\Patron\Downloads\rpc\node_modules\discord-rpc\src\client.js:100:47) at listOnTimeout (node:internal/timers:559:17) at processTimers (node:internal/timers:502:7)
You could not connect to the api in time
oh,, shitty wifi problem?
We’re you restarting the index.js file a bunch
yes
If so you were rate limited
ohh
that makes sense
how long is the rate limit?
I am not 100% I waited 5 minutes and came back
It is probably less though
mk
Sumone pls help meh
ignoring apparent lack of most basic js, that's not going to work at all. bots cannot have rpc, and that rpc will not work on repl or whatever that is anyway.
bruh
are u gonna add rpc to bot 😂
You cannot.
i can access rpc from browser right ?
or it has to run in user os to work ?
Hey generally I was not interested in this before, but why should i remove the token from the file (Rich presence)? After all, there is not much to hack there except changing the graphics or possibly the name.
wdym, there is no token used for rpc
no
rpc.login({
clientId: "121313141" //Exampel token
});
thats just the application id
you cant change anything with that, thats just used to access assets etc. from that application
Hey, do you know how can I implement the "ask to join button" and the "join button on the invite sent"?
I already put the secrets, and the party id, but I can't find the right event to listen when both buttons are pressed
getting connection closed?
what?
im getting the connection closed error
ah ok, idk
Things to consider when getting a connection closed/could not connect error:
• What transport are you using? If it's 'websocket', change that to 'ipc'.
• Is the ID you are trying to login with your user ID? If so, you should be using a Client ID from the Developer Portal (https://discord.com/developers/applications) instead.
• Is the ID a string? If not, JavaScript will truncate it's value causing the connection to fail.
• Are you using the Discord app? It won't be able to connect to the web version. Similarly, bots cannot use RPC.
• Is your code running on the same machine as the Discord app?
• Are you trying to run it from WSL? If so, it won't be able to connect either.
• Have you installed Discord from the snap store? If so, install it from your distro's package repository or directly from the Discord website.
I have the same problem, but none of the above helped me.
code:
const RPC = require("discord-rpc"),
rpc = new RPC.Client({transport: "ipc"}),
clientId = '846017522704580668';
RPC.register(clientId);
rpc.on("ready", () => {
if (!rpc) {
return;
}
rpc.setActivity({
details: "details",
state: "state",
largeImageKey: "largeImageKey",
smallImageKey: "smallImageKey",
largeImageText: "largeImageText",
smallImageText: "smallImageText",
startTimestamp: new Date()
})
})
rpc.login({clientId})
is the id correct?
are you using the desktop app for discord
Yes and yes
As soon as I wrote it, everything worked. After a while, it began to give this error.
Damn... This is all cus Discord was started as an administrator...
Hey i keep on getting this error
name\node_modules\discord-rpc\src\client.js:111
reject(new Error('connection closed'));
^
Error: connection closed
any help ?
Things to consider when getting a connection closed/could not connect error:
• What transport are you using? If it's 'websocket', change that to 'ipc'.
• Is the ID you are trying to login with your user ID? If so, you should be using a Client ID from the Developer Portal (https://discord.com/developers/applications) instead.
• Is the ID a string? If not, JavaScript will truncate it's value causing the connection to fail.
• Are you using the Discord app? It won't be able to connect to the web version. Similarly, bots cannot use RPC.
• Is your code running on the same machine as the Discord app?
• Are you trying to run it from WSL? If so, it won't be able to connect either.
• Have you installed Discord from the snap store? If so, install it from your distro's package repository or directly from the Discord website.
- IPC
- Client ID
- it is a string
- i suppose your talking about the program
- Yes
- Nope
- never heard of the snap store and i downloaded it from the DSC (aka Discord) website
what client id exactly
The bots id
show the code
rpc.login({
clientId: Client.user.id,
clientSecret: 'secret'
})
rpc.on('ready', () => {
let counter = 0
const status = [
`Trusted Servers: ${Client.guilds.cache.size}`,
`Verified: False`,
`Seen Users: ${Client.users.cache.size}`
]
const update = () => {
rpc.setActivity({
details: `Currently being developed`,
state: `${status[counter]}`,
largeImageKey: Client.user.displayAvatarURL({dynamic: true}),
largeImageText: `Bot: ${Client.user.tag}`,
smallImageKey: Client.users.cache.get('601364286731714591').displayAvatarURL({dynamic: true}),
smallImageText: `Developer: ${Client.users.cache.get('601364286731714591').tag}`,
buttons: [
{
label: 'Invite Link', url: 'not showing it here'
},
{
label: 'Support', url: 'dont wanna get banned so not gonna show the link'
}
]
})
if(++counter >= status.length){
counter = 0
}
setTimeout(update, 1000 * 10)
}
update()
console.log('RPC has loaded')
})
are you trying to set rpc on a bot? 
btw i just realized that i had to add the Client.user.id and not Client.id and also it won't show which is sus
on me
you have to put your application id there, not the bot id
either do it manually or Client.application.id
doesn't show the error but neither the rpc
where are you running the rpc code
my directory 
the login is in the client.on ready event
but the rpc.on ready in a different file
and you are sure the ready event is being called
well if my bot loads up then yes
(i mean yes)
you said the rpc.on ready is in a different file, where do you actually call that in your main file
so my main is the command,slash cmd,events handler that goes through a folder that goes through another folder that goes to the file aka commands,slash cmds,events
but also in the main file is the Client.login
if you understand
if not then i can show the code
dont get it
you have to make sure the code in the file gets executed
it does get executed
if its not throwing an error, nor does it load, its not getting executed.
but then how does it send that the bot loaded
aight imma go figure this thing out then
I'm not speaking about your bots ready event
I'm speaking about the rpc's ready event
carp i'm dumb it was always using a new one but not the same one
yup that's the error it was always making a new one
still thanks for trying to help
:)
my turn i guess
i tried both ipc and ws neither worked
reinstalled discord and everything
.......
wow
does anyone know how i can get rid of 'kzpresence' here?
that's what i named my discord application and idk how to remove it
i only have these properties
i guess i cant
You can't get rid of it
yeah i figured
thx
Does anybody know how to implement the "Ask to join" feature? @here
It's a bit of a hacky solution, but rename your application to unidode 1CBC per https://www.remote.tools/remote-work/invisible-discord-name
You'll still have the line, but no title visible.
yeah i'll just keep it
wouldn't like the empty space anyway
Needs partyId, partySize, and joinSecret specified.
I already put those, but I don't know how to listen when the user click the button nor how to reply
const redirectUrl = "https://neklioz.notion.site/";
const client = new RPC.Client({ transport: 'ipc' });
const presence = {
details: "Top text",
state: "bottom Text",
buttons: [{ label: "Example", url: "https://example.com" }]
}
client.on('ready', () => {
client.setActivity(presence, process.pid);
});
client.login({ clientId, redirectUrl });
I'm not getting any error but setActivity doesn't work, redirectUrl is specified on developers page.
If I put scopes = ["rpc"] I get: body: { redirect_uri: [ 'Not a well formed URL.' ] }
Any idea?
@solar sentinel did you figure out for the "Ask to join" button?
I dont use the RPC thing, but I use Discord.client with client.setPresence but my bot keeps losing its activities?
not rpc related
AHHHH, you are not friendly... It is related... I need to know if I can better use RPC thing...
no, its not related.
then please help at #djs-help-v14
maybe when I have time 
Can someone help me?
rpc doesnt work on repl or whatever that is
why is this channel made anyway lol
what is this question lmao
this channel is for RPC specifically, not whatever you asked above
You seem to be in the wrong channel since it looks like your making a discord bot. Move to the channel #djs-help-v14
Can I've a good documentation on how to use rpc, the documentation has just one example and that doesn't work perfectly
How to use authenticate and authorize to get getGuilds perms?
That's what I'm looking for too, but if you ask for one they'll tell you to write one yourself and then make a pull request lol
I get this error for discord-rpc
where are you executing that code
railway
that has to run on the same machine discord is running
Any idea of animated images?
Is clientId the application ID in the dev portal?
yes
what's the client secret then?
im trying to make my own rich presence status but i keep this error:
show the full error
k
Just having issues logging in, that's all, thanks
show code
pastebin or just send it here in a codeblock?
pastebin
what why are you defining the client, destroying it and then redefining it
that makes absolutely no sense
i was referencing other code
tbf it didn't make sense to me either
i just went with it anyways
why are you doing it like you do it there anyway

I suggest you look at the example from the channel description and build on that
(the rpc part, not the website part)
looking
Client doesn't log in. No messages returned to console so it's not readying.
why why why why why do you all use that code
that makes absolutely no sense
lol, that's besides the point, it's for something else. I need it to login.
then I suggest you start by calling the makeRPC method
cuz if you dont log in and dont get any errors, its not getting called
Lol dude
It's not in the screenshot, I called it.
did you, then debug it
place console.log()'s and see what part it reaches and what not
I already told you. It doesn't get login correctly. I've already determined that, I'll just solve this elsewhere.
No, you didn't, but sure, do what have to
@nimble yarrow i looked at the example and wrote it myself but got the same error...
here's the updated code: https://pastebin.com/KuSJxFpZ
