#archive-rpc-help
21942 messages · Page 6 of 22
Is there a way to stop rich presence if the user is idle, ive tried rpc.setActivity() but you end up with this:
setActivity() then kill the process
as in rpc.destroy() or process.exit() because ive tried killing the rpc client but it still leaves the rich presence there. and I cant kill the node process
if its open it will continute to say its playing
👍 thanks!
is it possible to add more fields to the rich presence
:^)
@ancient anchor thats a very useful and relevant reply to my question
i added a tonne of bird reactions
then someone removed them i guess
thats also very useful to my question thanks very much!
How can i get my ClientID for make me a RichPresence?
https://discordapp.com/developers/applications/me
Choose your app and you'll see the client id.
But its not working
I do that
On the ready event the console log "ready" but dont add me the RichPresence
@scarlet aspen the name of the application have to be a specific name?
The Name of the application is that
Si if i want "Playing Studio"
THe name of my application have to be "Studio"
?
Yes.
OHH
xD
And the "Studio" have to be in "details" of the RichPresence?
@scarlet aspen Nothing change
const Discord = require("discord.js");
const DiscordRPC = require("discord-rpc")
const moment = require("moment")
const ClientId = '394198437001822220';
const rpc = new DiscordRPC.Client({ transport: 'ipc'});
rpc.on('ready', () => {
console.log("Je suis ok !")
rpc.setActivity({
details: 'Application Name',
state: 'xd',
instance: true,
});
});
rpc.login(ClientId)```
There is my code
@scarlet aspen What i do wrong?
everything
why is my node reading -0.1 as NEGATIVE_INFINITY

what
lol
I like discord.py better don't ban me
we won't ban you, we'll wonder why you're here and why you're saying that in this channel 

isnt there server for discord py
How I can stop the rich presence?
ctrl+c?
No :/
instance: true, <<
you may have an old node process running
run taskkill /f /im node.exe in your command prompt
hey, is there a way I could get a user's id through RPC?
preferably without having to authenticate anything
why dont you just use the discord client and right click them
because it will be in an application?
app starts on user's machine, needs the id of the currently logged in user
you can’t
How I can set a NodeJS process in the tray? (The icon in the main bar will be not showed)
@mint dew :: You can't star your own messages.
what???
wtf msg did i try to star you retarded bot
i wasnt even looking at this ser er until you freaking ponged me
and why am i talking to a bot smh some server staff fix this bot bye
Jesus calm down lmao
@mint dew get ponged
ok ill leave
...
Lol
...
...
...
I want to have a nice rpc on my client
How do I start?
Look at the example.
It's simple as hell
Just a few lines of code
...
Just look at some open-source rpc applications
if you dont get it, look at the done example
if you still dont get it, read discord docs
@normal basin, a link?
look at the github of it

yes
and if you dont get it look at the discord docs of rich presence
Now I get it
Smh
So rpc is for like music stuff
its for a lot of stuff
what else can a bot do in a voice channel?
rpc has nothing to do with voice channels
i mean like with a discord bot rpc would be used for muisc?
not playing music
no
bots can't use rpc
displaying what you're listening to etc
¯_(ツ)_/¯
like this
maybe
you could set up a server
between the bot
and your rpc app
but that seems annoying
looks cool
or this ¯_(ツ)_/¯
thats uggo
mine looks good
what is urs
better
yours doesn't have emojis
Without emojis it looks better imo
^

someone knows how to put "elapsed" in an RPC?
startTimestamp
and where would i put that?
inside the rpc
rpc.on('ready', () => {
console.log(rpc)
console.log("ready");
rpc.setActivity({
details: `Editing: index.js`,
state: 'Workspace: Discord Bot',
largeImageKey: 'plaintext',
largeImageText: 'plaintext',
smallImageKey: 'visualstudiocode',
smallImageText: 'Visual Studio Code',
startTimestamp: 0,
instance: true,
});
});```
probably done this wrong
not familiar with rpc
provide a startTimestamp with no endTimestamp
make the startTimestamp new Date()
const startTimestamp = new Date()
like that?
sure
got it to work
thanks
@smoky scroll are you making a separate rpc thing for each workspace to get a look like others?
It's literally a public add-on for VSCode
i got one
thanks though
no prob
How do I make a spotify rpc?
- learn javascript
- look at Discord Rich Presence Docs
- look at RPC docs
- ???
- Profit
- Code it
all disgusting
yeah, at least be a decent human being and use dims
imma ban you for self advertising
wow :(
Getting Error [RPC_CONNECTION_TIMEOUT], discord (canary) is open, added nodejs as a game then launched it and nothing
nodejs isnt a game 
How do I get my bot to message a specific user? Without them messaging it first.
ur in the wrong channel
but client.users.get('id').send()
Can I get their ID from their full username? Or is that what it is?
Doesn't really explain it
He's telling you this isn't where to ask for that type of support.
This channel is for supporting users of the discord-rpc library, not for bots
mhm
@sinful rose your app and discord have to run with the same elevation
So I can find the username through the newbie-lib?
forgot to say im on linux and both apps are running under the same user, i'll try running node w/ sudo to see if it helps
o
on linux it doesn't matter
i've just only seen that issue on windows
which has retarded elevation rules
okay lol
gotta go though
Hi guys, Its gonna be the first time I'll use RPC for the rich presence and I was wondering if it is possible to use both the RPC and the main library ? and if yes, how to do it ?
The aim would be to assign myself a rich presence
you dont need the main lib to assign urself the rich presence
yes, but I need it to use my selfbot commands etc :/
its separate
completely separate
as long as your selfbot doesn't send any presence stuff you're find
Okay, so I've got to create a "true" app on the dev center that isn't a botuser right ?
it can have a bot user
just scroll down and click "enable rich presence"
okay, thank you
DID I HEAR SELFBOT
then when I've setted up Rich Presence on the app / bot, do I have to make a fake App to hook it ?
@mint dew You "read" selfbot 😉
still
selfbot
fake app?
Gus why tf are you helping someone break the discord ToS 
like do I have to use the C library they putted on their Git or ?
i'm helping them with rpc
not their selfbot
replace that id with the id of your application
then from there its pretty straight forward
is that rich presence used with the RPC instance or the real one ?
I do not understand how it "know" that I'm playing that thing 🤔
you run it
put that code in a file and run it
Hoooooo ok I understand
correct my if I'm wrong:
I run an RPC instance on my account (token etc) then at this moment, Discord already know I runned that app and I only need to update the settings using the discord-rich-presence ?
rpc connects to your discord client.. the code you have on there will change your client's presence
yeah no need to use your token at all
unless you wanna get banned for selfbotting
Then I do not understand the structure:
const clientID = '187406016902594560'; does that refers to the "app" client ID or the user client ID (me) ?
app client ID
so how can it know its "me" playing that game ? '-'
its where teh assets are coming from
client id
it hooks into your discord client
user client id isn't a thing
client ids are just for applications
ok 🤔
Ok I've got it (I think)
Because of the scopes, when I will authorize the app to access the RPC scope of my account, it will put the game up ?
u run the code and have ur discord client running
ur game goes on
simple
you no has to authroize it
Yeah that's simple if I only have to run, but I want to understand how it makes the connection between us :/
it hooks into your process, just like how discord finds out what game youre playing
its the same thing
it gives you a game to play, except you code what it sends
Imagine, I'm running the RPC app on a server so it never stop working, how will discord know that its my Rich Presence they need to update, because they have to reference to me '-'
(Sorry if I'm bothering you guys, maybe my questions are stupid but... I want to understand it)
it doesn't run on a server
it runs on your pc
it connects to your discord client
it was said like 3-4 times it goes with ur discord client
yes, that's where I was lost, because I planned to run that all on my server :/
But its ok, I'll run it on my PC gonna be easier
Mission accomplished, thank you guys 👌
Okay, im a newbie, just trying to get this work never used rcp yet. The example doesnt seem to work
const params = new URLSearchParams(document.location.hash.slice(1));
oh wait wrong library, but with the discord-rich-presence one what is the id?
(node:9206) UnhandledPromiseRejectionWarning: Error [ERR_UNHANDLED_ERROR]: Unhandled error. ([object Object])
at RP.emit (events.js:140:19)
at rpc.login.then.catch (/home/dries/node_modules/discord-rich-presence/index.js:54:28)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:160:7)
(node:9206) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:9206) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
this is my error from the example
the id is your client id created on the applications page
okay
so if i want it to show my playing game, how would that work?
like, use rich presence for myself
okay, i made it work, but how do you add a picture?
add an asset in your application
didnt work
@plush pumice what to do with the Asset?
Deliver the asset to the rendezvous point for extraction.
what?
^, what?
are you using discord-rich-presence
or discord-rpc
discord-rich-presence
then in updatePresence you have largeImageKey: 'snek_large', smallImageKey: 'snek_small',
yes
i put my asset there
but it didnt work
are you sure you put the right format
like largeImageKey is a large image in the app
i know
ookay now it works
forgot a capital
😃
rip
Can you use Rich presence on a bot?
no
Okay
4:20pm
Wow haha very funny the weed number
ikr
shit wrong channel lol
when i try node the example i get this error in console
module.js:472
throw err;
^
Error: Cannot find module '../'
at Function.Module._resolveFilename (module.js:470:15)
at Function.Module._load (module.js:418:25)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (C:\Users\Thifyan\Desktop\rpc\index.js:6:20)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
?rte
yes i have..
20 error File: C:\Users\Havoc\Desktop\rpc\package.json
21 error Failed to parse package.json data.
21 error package.json must be actual JSON, not just JavaScript.
21 error
21 error This is not a bug in npm.
21 error Tell the package author to fix their package.json file. JSON.parse
22 verbose exit [ 1, true ]
?rte
again...
YES i have
it's a json file not js
look inside
{
"name": "rpc-test",
"version": "1.0.0",
"description": "test",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "havoc",
"license": "ISC",
"dependencies": {
"discord-rpc": "^3.0.0-beta.8"
}
}
i'm copying and pasting the example exactly and getting a error saying cannot find module when ive alr installed the modules i would appreciate it if you would try help or not say aything rather than spam ?rte when as i have stated twice i have
i told you to read the error for two different errors
send the code
i used that
okay i just found this example off youtube. it gets past the error i was getting before
const DiscordRPC = require("discord-rpc");
const ClientId = '397809839008645132';
DiscordRPC.register(ClientId);
const rpc = new DiscordRPC.Client({ transport: 'ipc' });
rpc.on('ready', () => {
console.log("ready");
rpc.setActivity({
details: `test`,
state: 'test',
largeImageKey: 'test',
largeImageText: 'test',
smallImageKey: 'test',
smallImageText: 'test',
instance: false,
});
});
rpc.login(ClientId).catch(console.error);
hmmm, but i get this
(node:7836) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: (Date.now(...) - EPOCH).toString(...).padStart is not a function
(node:7836) DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
what node.js version are you using?
7.6+ is required
v7.8.0
8.1+
don't listen to randos
oh?
dont know that you use the real new shit there Gus

ah okay, i'll update my node and try it
tbh just stick with 8.9.3 the LTS atm
should be good
ok will do
all working now, thanks :)

and Gus im not a rando

rando with money
rood 
damn
when i upload the add the image and then upload my asset the image doesn't show up. any idea why?
i've tried different images. it's still not working
sometimes it takes a bit of time
oh okay
it's been around an hour and it's still like that
any suggestions on what i should try?
ah i see, thanks for letting me know 👍
const DiscordRPC = require("discord-rpc");
const ClientId = 'my applications client id (rich presence is enabled)';
DiscordRPC.register(ClientId);
const rpc = new DiscordRPC.Client({ transport: 'ipc' });
rpc.on('ready', () => {
console.log("ready");
rpc.setActivity({
details: `test`,
state: 'test',
largeImageKey: 'test',
largeImageText: 'test',
smallImageKey: 'test',
smallImageText: 'test',
instance: false,
});
});
rpc.login(ClientId).catch(console.error);
it logged "ready", looked at it on other pc (diff. account) and the rich presence status wasn't there.
make sure you add the game

Had the same issue
Oh
And adding the game fixed it
Progress
now it pops up with the info
time to figure out how to configure it to my liking
I've got rich presence working, but I have no clue where to start with actually controlling the client
I have an rpc_token but I can't figure out how to get the lib to accept that
?
client.login(id, { rpcToken: whatever })
Error [RPC_CLIENT_ERROR]: 4009 Token does not match current user ?
Oh
I see what I'm doing wrong
try just this
const client = require('discord-rich-presence')('your app token');
client.updatePresence({
state: 'test',
details: 'test',
startTimestamp: Date.now(),
endTimestamp: Date.now() + 2900,
largeImageKey: 'test',
smallImageKey: 'test',
instance: true,
});
oops
wow
my discord totally didnt show all the answers

const client = require('discord-rich-presence')('180984871685062656');
function updatePresence() { client.updatePresence({ state: 'slithering', details: '🐍', largeImageKey: 'snek_large', smallImageKey: 'snek_small', instance: true, }); }
and i get this UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 5): TypeError: (Date.now(...) - EPOCH).toString(...).padStart is not a function
and nothing happens
update node.js to latest LTS
i updated still nothing
@zenith edge what version are you on
8.9.4 lts
should be good then
I updated every dependency, electron, discord-rich-presence but still getting the same error in console
btw tried to put the code both in main and in the renderer process
What do I do??
is that largeImageKey the name of the image w/o file extension
@zenith edge could you run node -v in your console?
if you're running in electron its probably on like 7.x
check process.versions in the electron console
I did run node -v and it returned v8.9.4
if you're running in electron check the version of electron
Ill check process.version tomorow, thanks for help
electron bundles its own node
what's node 
brb gonna go neck because im in wrong channel
Sorry for my noobie question, but how does one set Rich Presence from d.js?
read the example
auto npm discord-rich-presence
you don't use discord.js to set rich presence
either discord-rich-presence or discord-rpc
Ok, welp, R.I.P. Thanks tho! I'll try it out
Okay, how does one get someone's token without logging in with a token?

?token
Open the dev tools using Ctrl + Shift + I on Windows and Linux, or Cmd + Option + I on macOS.
Then https://a.safe.moe/p6xJ7.png
you mean that?
Yeah
you would need to use a selfbot what is against ToS 
since bots cant use RPC
i don't think simply logging with a user account is against the TOS
just a user account responding to commands, from anyone or the user
it is
if it annoys discord that bad why dont they somehow block people logging in to user accounts with bots ¯_(ツ)_/¯
oh :/
All I wont is my Atom package to set my rich presence to my workspace name and the currently file I am editing etc
then why do you need a token
I said without a token
1 google search
jfc
I tried atom-discord, it does not work for me
And I kind of want to create my own
Which does not work
For me at least
what doesn't work
Atom-Discord doesn't even set any richpresence to my account
not for me atleast
did you actually add it as a game
as it says to do
I added Atom
which was as much as I understood
I am on a Mac, does that matter?
Got it working...
lol
don't use atom-discord's code as an example
its pretty shit
https://i.ronthecookie.me/txgRA5H.png
RPC isn't working for me w/ this vscode ext and i'm pretty sure it isnt the ext since it does that on other exts that do the same thing, but with less error details.
Running Ubuntu 16.10 and Discord Canary
For anyone using electron with discord-rpc you might get errors cause its running node v7 lts
Okay, so I seem to have a bit of a problem. I'm trying to install discord-rpc, and I'm getting this error:
Command failed: C:\Program Files\Git\cmd\git.EXE submodule update -q --init --recursive
warning: templates not found C:\Users\<Username>\AppData\Local\Temp\pacote-git-template-tmp\git-clone-34e74cca
fatal: unable to access 'https://github.com/zajrik/discord.js-typings/': SSL certificate problem: unable to get local issuer certificate
fatal: clone of 'https://github.com/zajrik/discord.js-typings' into submodule path 'C:/Users/<Username>/AppData/Roaming/npm-cache/_cacache/tmp/git-clone-46090232/typings' failed
Failed to clone 'typings'. Retry scheduled
warning: templates not found C:\Users\<Username>\AppData\Local\Temp\pacote-git-template-tmp\git-clone-34e74cca
fatal: unable to access 'https://github.com/zajrik/discord.js-typings/': SSL certificate problem: unable to get local issuer certificate
fatal: clone of 'https://github.com/zajrik/discord.js-typings' into submodule path 'C:/Users/<Username>/AppData/Roaming/npm-cache/_cacache/tmp/git-clone-46090232/typings' failed
Failed to clone 'typings' a second time, aborting
I don't get this error on my VPS though, only on my PC. Does anyone know what's up with that?
I've managed to get it working in the end by temporarily disabling SSL verification, but obviously that's not a proper solution...
that has nothing to do with my rpc
Well, all other packages I've tried install normally, including discord.js.
I have no idea what the cause is, but the end result is that it kept me from installing discord-rpc. :/
?rte
fatal: unable to access 'https://github.com/zajrik/discord.js-typings/': SSL certificate problem: unable to get local issuer certificate
looks like your pc is fucked
¯_(ツ)_/¯
Yes, I have tried reading the error. That's why I was able to get around it by temporarily disabling git's SSL verification...
I mean, what kinda question is that?
neet
reinstall git
and use mono certs
unless that's not a hit error
git
I'm not sure what you mean by "mono certs", tbh.
Hey, stupid question, I am trying to use the RPC and it shows on my account but when I check an alt it doesn't show the RP on my account. No errors are given.
Does anyone know why this would happen?
https://hastebin.com/ulivukuyuq.js
My code^
Ahh I didn't even see my node was out of date. I will update and see
No luck. Any ideas as to why it would come up on my screen but not my alt's?
What I see
What my alt sees
your app can't be named spotify
here's one a friend and i made
Ahhh
Thanks Gus
I kinda wanted to make my own
Which is why I asked. I will rename it tho. Thanks for the info
Yay it works. Thx 
Also I met rose a while back in discord bots. They are really nice. Haven't seen them since tho
they
oh
i thought you were talking about multiple people
Nahh
I just don't know their gender and didn't want to be rude
rose is a she
Ahhh
Good to know
Also again, seriously great work on the rpc. It's really well done
@carmine mica i dnt make shit 😄
dont be pushing ur shit code onto me
pmsl
(in all serious tho 99.9% was not me)
you made me
pmsl

in Snek's RPC, what does that require('something/otherthing') mean in the dep name
huh?
@tranquil iris
like const discordrpc = require('discord-rpc/browser')
whats the / about
its a path
require('discord-rpc') resolves to node_modules/discord-rpc/src/index.js
require('discord-rpc/browser') resolves to node_modules/discord-rpc/browser.js
Ah, I see. I'm trying to figure out how you did it. Package.json is a bit ambig. theres also no Browser.js in the root
its created at publish time
so its not in the repo
in fact its in the gitignore so that it can't be pushed to github
Ah, the whole jsdelivr stuff. That's pretty neat
i also have snekfetch on jsdelivr
and unpkg
Neato. Is Snekfetch like a cleaner version of Axios?
yes
?rpc
RPC = Rich Presence Client
BUT WHAT THE HECK IS THAT I HEAR YOU ASK
Example: https://github.com/devsnek/discord-rpc/tree/master/example
NPM: https://www.npmjs.com/package/discord-rpc
GitHub: https://github.com/devsnek/discord-rpc
?tagdel rpc
@raw holly can you delete this tag
it's literally just the channel topic
?tagdel rpc
:HEART:
literally topic
says Rich Presence Client
Sure it is Gus.
So is 15 seconds the rate limit on updating the Activity?
yes
Mkay
Thx
Just being sure
👍

how could i fix invalid client ID?
do i have to register my id anywhere?
first time in RPC
/* eslint-disable no-console */
const DiscordRPC = require('discord-rpc');
const ClientId = '261805872332800001';
DiscordRPC.register(ClientId);
const rpc = new DiscordRPC.Client({ transport: 'ipc' });
async function setActivity() {
if (!rpc)
return;
rpc.setActivity({
details: `test`,
state: 'test2',
//largeImageKey: 'later',
//largeImageText: 'later',
//smallImageKey: 'later',
//smallImageText: 'later',
instance: false,
});
}
rpc.on('ready', () => {
setActivity();
setInterval(() => {
setActivity();
}, 15e3);
});
rpc.login(ClientId).catch(console.error);
Thats my code 🏧 ... and the error is
{ code: 4000, message: 'Invalid Client ID' }
the client id is the id of your application
not your user ID
so i have to create a new application
and the name of it will be the "playing name" on discord rich presence?
@noble pond
yes
what scopes do i have to use for oauth
only rpc or also rpc.api?
or isnt this even necessary
you don't need oauth
ok
the only thing you need to do is create a rich presence application, get the client ID of it and set assets
ok
thank you very much
np
@noble pond
const client = require('discord-rich-presence')('401670249801449494');
client.updatePresence({
state: 'testing',
details: '🐍',
startTimestamp: Date.now(),
endTimestamp: Date.now() + 1337,
largeImageKey: 'test_test1',
largeImageText: 'test1'
smallImageKey: 'test_test2',
smallImageText: 'text2'
instance: true,
});
Using another package of devsnek called discord-rich-presence
so i uploaded all assets with names:
for large i use test_test1
for small i use test_test2
but it just doesnt want to work
is there smth i am doing wrong?
i see
nvm
ok but now i get the error unexpected identifier for test_test2
but i uploaded it to discord-rich-presence assets...
hmm
because you're missing commas
tf? it doesn't look like that?
How do I access these settings 🤔
@raw holly
found it, no idea what any do
? this has nothing to do with rpc
at least not the module here
Not sure where else to ask. Point me in the righ direction 👍
github issue tracker
you even linked it yourself
yeah ill just put a passive agressive "What the fuck you on it doesnt look like that?" on someone elses issue
well thats not really an issue anyway, if you want it an other way take Crawls source code and write it like you want

how to be anal 101
how to be rude 101
tbf i do feel pretty victimised
tbh just rewrite stuff instead writing in here now
Crawl wont do that anyway
get out of my channel
didnt want it, was curious and didn't want to be that guy who shits on peoples issues
probabyl would've saved the tears by just posting in general lol
[Request] Preference to display
[REQUEST]
im not going to say more
¯_(ツ)_/¯
i have no idea what this convo is about at this point
with a javascript guide 
if you mean with oauth, then you would get their profile with the identify scope i guess
discord.gg/discord-api would be your best bet
oh you said guide
i thought you said guild lol
the discordapp.com/developers documentation would suffice
just read through it
that cant be done with oauth
oauth has its limits
this doesn't seem very rpc-related 
Stupid question: You can't set an image key to be an image URL right?
Like you can only use discord's CDN for the image keys
Yeah only discords cdn
Damn alright
you can upload images with hidden endpoints
O
But that's not very rpc related
Tru, still wanna look into it tho
Or at least lib related
force push?
When using the discord.js RPC when you register a new app what are you supposed to set the uri redirect to?
You don't need a redirect uri for the RPC
ah thanks the wording discord used made it sound like you needed one for any app @uncut sapphire
Ye
np
ayyy it works
I'm getting an error with discord-rpc, the error is:
Error: Cannot find module 'discord.js/src/errors'
at Function.Module._resolveFilename (module.js:538:15)
at Function.Module._load (module.js:468:25)
at Module.require (module.js:587:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/app/node_modules/discord-rpc/src/index.js:1:78)
at Module._compile (module.js:643:30)
at Object.Module._extensions..js (module.js:654:10)
at Module.load (module.js:556:32)
at tryModuleLoad (module.js:499:12)
at Function.Module._load (module.js:491:3)```
?rte
I just found out the problem, when rpc installed it didn't install discord.js like it was supposed to...
is there anyway I can fix RPC_CONNECTION_TIMEOUT? im trying to run , im running windows 7 64-bit, latest discord canary, latest spotify
check that the rpc process and discord have the same elevation
is this permitted to do with rpc
Yes
holy shit that's an amazing idea
i should monitor my cpu temps with that
it'll always be above 50
:>
module.js:540
throw err;
^
Error: Cannot find module 'discord-rpc'
at Function.Module._resolveFilename (module.js:538:15)
at Function.Module._load (module.js:468:25)
at Module.require (module.js:587:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (C:\Users\acer\index.js:1:82)
at Module._compile (module.js:643:30)
at Object.Module._extensions..js (module.js:654:10)
at Module.load (module.js:556:32)
at tryModuleLoad (module.js:499:12)
at Function.Module._load (module.js:491:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! discord-spotify-rpc@1.1.0 start: node index.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the discord-spotify-rpc@1.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional log
ging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to in
stall?
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\acer\AppData\Roaming\npm-cache_logs\2018-01-25T16_26_28_1
98Z-debug.log
can someone help me
Sounds like it's uhhh not installed
lol
eh
what can i do
Install it
i did
Everything in your error indicates otherwise
Also like this isn't Spotify rpc support 👀
what's the ratelimit for updating rpc again?
15 seconds
getting this, help?
https://hastebin.com/kikusimihu.tex
@TurboCheetah - ターボ#2665 it’s most likely your internet. Restart your PC and try again
@uncut sapphire get out
@hallow dust check that discord and your rpc are running at the same elevation
@carmine mica geez sorry
Hi I'm using discord-rpc for an RichPresence application, now I want to run some code if an error occurs like connection timed out. How can I do this?
try catch
or process.on
or .catch
try {
it();
} catch (e) {
comeBackIfItDoesntWork(e);
}
thanks
largeImageKey: 'discord',
``` how can i make this any picture? (if thats even possble)
by uploading an asset to your application
uh...? how
Read it lol
README.txt @smoky scroll
md*
I mean the process, where does it send things, sends what etc
send things?
What are some uses of rpc?
?
doing what the spotify integration now does
like this https://github.com/olvrb/sRPotifyC
can bots/userbots send rpc invites in a chat?
(X) Doubt
do i need to make a rich presence app? I just made one now how 2 use it it my account?
Wait there's two npm packages? 
one is simple one is not
damn i was going to ask a question about rich presence in here cause i though that's what this channel was for
that's what it is for
my discord's built in rpc client won't connect and my custom one can't aswell
help?
const { Client } = require('discord-rpc');
const clientID = '187406016902594560';
const scopes = ['rpc', 'rpc.api', 'messages.read'];
// This demonstrates discord's implicit oauth2 flow
// http://discordapi.com/topics/oauth2#implicit-grant
const params = new URLSearchParams(document.location.hash.slice(1));
const accessToken = params.has('access_token') ?
params.get('access_token') : localStorage.accessToken;
localStorage.accessToken = accessToken;
if (!accessToken) {
// Redirect to discord to get an access token
document.location.href = `https://discordapp.com/oauth2/authorize?response_type=token&client_id=${clientID}&scope=${scopes.join(' ')}`;
}
const client = new Client({ transport: 'websocket' });
client.on('ready', () => {
console.log('Logged in as', client.application.name);
console.log('Authed for user', client.user.tag);
client.selectVoiceChannel('81384788862181376');
});
// Log in to RPC with client id and access token
client.login(clientID, { accessToken, scopes });
how the fr*ck am I supposed to use this
paste it into electron or?
im so confuse
this includes node.js stuff like require() but also has DOM stuff like document.location
??????? help
Hey, so I'm aware you can get the 'listening to' while using RPC by using discord.js as a selfbot and setting up your acitvity type, which is what I tried to do but without success., it just shows the RPC as 'playing'.
Any example or guideline on how I can achieve this ? Thanks.
what are the rpc ratelimits
just like, all of them
You can't use things other than playing for rpc
Dunno about rate limits except one activity per 15 sec
i know but like
take osu for instance
my game
[picture] osu!
AFK
changing game rates,
changing picture rates,
and changing status rates(afk)
any call to rpc in terms of changing activity is 1 call per 15s
ok
but what about the others 
what others
picture and game
thats the same as changing activity
oh
ok thanks bella 💜
np
So I have this one issue with discord-rpc, mainly, in my Electron app I am calling rpc.setActivity (where rpc is a DiscordRPC.Client and DiscordRPC is the library).
So, I pass a new Date to the setActivity function, and when I run my Electron app, I get the following error:
[Unhandled Promise Error] TypeError: (Date.now(...) - EPOCH).toString(...).padStart is not a function
at Function.generate (C:\Users\redacted\work\Dino\node_modules\discord-rpc\node_modules\discord.js\src\util\Snowflake.js:35:56)
at Promise (C:\Users\redacted\work\Dino\node_modules\discord-rpc\src\Client.js:137:31)
at RPCClient.request (C:\Users\redacted\work\Dino\node_modules\discord-rpc\src\Client.js:136:12)
at RPCClient.setActivity (C:\Users\redacted\work\Dino\node_modules\discord-rpc\src\Client.js:476:17)
at setActivity (C:\Users\redacted\work\Dino\index.js:53:7)
I tried removing the timestamp from setActivity but it still throws this error. Any help?
And from what I can tell, it seems to be this specific line causing the issue in the main Discord.js library, https://github.com/discordjs/discord.js/blob/master/src/util/Snowflake.js#L35
Since it's been ~30 minutes now, I'll just go ahead and ping <@&222087754366844928>
woaahhh dino dev??
sorry
it seems like there are lots of people with questions about rpc, but almost no one who can answer them 🤔
only 1 person actively maintains rpc
is that you?
nop
o..
@obsidian ridge
shit
@obsidian ridge
??????
but this is a really desirable feature. you should maybe find more people who can help with support for it
ok i give up
cant force people to do it if they dont want to
o,
I nominate num for support
oh.
can someone at least tell me how to use rpc first
still have no clue how to even run code that uses discord-rpc module
there's one example
have you looked at that?
yeah
don't know what context that block of code is supposed to be run in though
it has node.js require(), but also includes random DOM methods that don't make any sense outside of electron
so not sure how i'm supposed to use that 
i know like basic support but i dont know about actual lib inconsistencies. @carmine mica error a bit above please, guy pinged helpers
can someone please just tell me where to paste the example code pls
do i run it in node or
clone repo, run npm i, then run npm run example
oh npm.
is there some way for me to make my own stuff though
yeah, u can edit the app file thats inside the example folder iirc
like without using npm run example every time
oh
pretty much just electron stuff, as far as the example goes
wait so you can use electron stuff in node??
uh, yeah, require electron
WHAT
this is off topic now
just look at the repo 👀
woah can I simulate a browser then too?
oh.
o7
carry on the discussion in general, literally stop posting here
what
@smoky scroll is your version of electron up to date?
gus, was to the guy that pinged helpers, not hard to see
I'm on 1.6.13

then I'm confused
not oudated node?
oh
My node.js is on 8.9.3
electron is on node 7.9
lul
well padStart is only available from certain node version and above so if it says you dont have it then the only thin gi can be lead to believe is that your node version isnt up to date, but, i guess i may be wrong
@smoky scroll hint
Just copy paste gus's id
yea i did later
Lul
just shouldnt have happened to begin with
Ya but this is discord xD
It'll take them forever to fix this bug
Anyways def not rpc talk so peace
@Lewdcario#0448 no i meant like
fuck
@smoky scroll no i meant like what was going on
why was i pinged
something about outdated electron?
the dude that pinged helpers
they were telling who develops the rpc thing./
he has an error message, you own the lib, im sure youd know how to fix it
isa you told someone they can require electron in node

not the issue here
fix his issue
who
what
THE DUDE THAT PINGED HELPERS

(Date.now(...) - EPOCH).toString(...).padStart is not a function
update to a version of node that has padStart
end of story
oh okay so wasnt wrong in the node version thing
if I can't require electron, how do I use DOM stuff 
you can require electron when your code runs in electron
wonder what this means then
if you're just running in node you don't have a dom
isa
wtf are you smoking
what??
?????
my example code runs in electron
yea im aware
not node
but @smoky scroll said that you just paste the code in node
wait
ok i was wrong
oof
what?
so no one really knows how to even use rpc at all then
i wrote and maintain the rpc lib
i know how to use it
omg thank you
i know how to use it, but i dont know shit about electron
require('electron') only works in electron
which uses a custom build of node
but i don't call that node
ok please tell me lord snek
ok so node is relevant here
where do I paste the example
so i wasnt completely off the mark
dude
clone repo
npm i
npm run example
i need to make another example
@smoky scroll does the package discord-rich-presence fulfill your needs
there has to be some way to interact with rpc module without npm run example
umm-
there's an example on the npm page
you can paste that into a js file
and run it with node
ohhhh thank you thank you thank you
👍🏻
do I need to npm install electron
then?
no
electron isn't needed
oh.
the example just uses electron cuz rpc is generally intended to be used with games and shit
wait how are you using DOM methods then??
oh.
well that's pretty unclear on a npm page
huh
to use electron?
-- oh.
OH
so if I wanted to do my own thing, I would just run electron app.js
or something like that?
no
if you wanted to ship with electron
you would bundle it
into a proper app
??? wh
just forget about electron
you aren't using it
just know that its basically chrome + node.js
oh, okay
but when I tried running the example in electron, it said "require is not a function" 
so does it not have all the node.js features or?
you ran it wrong then
what happen
C:\Users\num\Documents\Visual Studio Code\Discord.js\rpc.js:9
const params = new URLSearchParams(document.location.hash.slice(1));
^
ReferenceError: URLSearchParams is not defined
at Object.<anonymous> (C:\Users\num\Documents\Visual Studio Code\Discord.j
s\rpc.js:9:16)
at Module._compile (module.js:612:30)
at Object.Module._extensions..js (module.js:623:10)
at Module.load (module.js:531:32)
at tryModuleLoad (module.js:494:12)
at Function.Module._load (module.js:486:3)
at Function.Module.runMain (module.js:653:10)
at startup (bootstrap_node.js:187:16)
at bootstrap_node.js:608:3
@carmine mica yea I'm still not sure how to run this example from the docs
you can't run the "browser example" in node
well, it didn't work in my browser. 🤔
oh Jesus christ
it's intended for webpack
what??
wow, ok.
can't you just use the discord-rich-presence module
umm, sure I guess
you cant use any of the other rpc features
oh.
they're whitelisted
o, ok understandable
alright so discord-rich-presence works, is there any documentation or anything for using it @carmine mica?
the example
that's all it does
that's all the fields you can use?
kk, got it
and then I'd set up my own application and paste the ID in there if I want something custom
yea
i assume
kk, thanks :D
Hi
how do i set up rpc
because i want to set the status so it is playing a twitter account and for the picture it has the twiter profiles pic
look at the example
"For now, RPC is in a private beta, which means that only apps that have signed up and been approved can access it."
Does this mean I can't create my own RPC applications or?
you can create your own RPC applications
Okay phew 😅
thannks
👍
Are there better docs for d.js RPC?
I don't see anything for RPCCleint.setActivity()
Those don't seem to have full documentation?
You could look at the example: https://github.com/discordjs/RPC/tree/master/example
I think https://discord.js.org/#/docs/rpc/master/general/welcome is the full documentation.
That's not documentation though 
That's an example
The official documentation is https://discord.js.org/#/docs/rpc/master/general/welcome.
I gave you an example just to look at if you don't know how it works.
Taht documentation is missing parts. Ex RPCClient.setActivity()
It also doesn't provide what RPCClientOptions could be
14:51:43 - error: Error [RPC_CONNECTION_TIMEOUT]
Is there any reason why it just timeouts when logging in?
When I run my application under sudo it doesn't let me login my RPC client. Why is that 
could be permissions issue
@rough thicket are you possibly running wsl
Wsl? @obsidian ridge
@obsidian ridge
Rip
@carmine mica @rough thicket
@carmine mica sheesh change your name already lol
@rough thicket are you running on linux
people tryna ping you and you legit just sent a message not long ago
yet it's pinging me lol
change your username
ez
nah you
@obsidian ridge I’m on lcoalhost (mac)
And yeah your usernames are the name lmfao
fuking dodo @rough thicket
i said use @carmine mica @rough thicket
ya dodo @rough thicket
@obsidian ridge when I run RPC without using Sudo it works perfectly
But when I use sudo it times out logging jn
@rough thicket fucking dodo use @carmine mica to ping gus
@rough thicket you dodo
I’m on mobile sheesh
@carmine mica
idgaf it's called copy paste
it’s not my fault discord linked you guys together by fate
Haha
and it's not my fault you're a dodo brain @rough thicket
How did you both end up with the same Disc
That’s not supposed to happen
he's capital L
i'm lowercase
@rough thicket can we talk through the bug from the start
without all whatever the fuck this conversation was
Okay, so in the channel desc, there's an example.
If you run sudo npm run example the login of the RPC client times out
Figured it out
it's because of elevation
the example runs as root while the client runs as the logged in user
same thing as on windows
The file needs to be ran on the account's machine? Like I wouldn't be able to run my rpc.js on my server?
Yeah you would just have to port forward and connect to your pc remotely 
can someone help me a bit with getting rpc auth from an electron app?
mention me pls if anyone can help. kthx
Is it depressing that I dunno how to use electron?
nah
make sure you have rich presence assets enabled and upload them from the bot page https://reee.ee/Gg7n4I.png
Thank you
😆
do I have to check for ratelimiting myself or is there a protection implemented in the library?
Personally I just did the same interval as in the RPC example, but RPC works off your clients local host RPC server iirc so no rate limits to worry about afaik
i need all models **npm i -S hydrabolt/discord.js
**
whats this got to do with rpc
ah I forgot to specify that I'm working with rich presence
so idk if there are rate limits about how often you're allowed to update the status
Hello, how can I test Rich Presence with websocket connection? I've read this is a whitelisted feature, but I've expected this to work with my own app
I've imported discord-rpc from https://unpkg.com/discord-rpc@3.0.0-beta.8/browser.js
My code:
console.log(DiscordRPC);
const CLIENT_ID = '409446468651450368';
DiscordRPC.register(CLIENT_ID);
const rpc = new DiscordRPC.Client({ transport: 'websocket' });
const startTimestamp = new Date();
let times = 0;
rpc.login(CLIENT_ID).then(() => {
rpc.setActivity({
details: `booped ${times} times`,
state: 'in slither party',
startTimestamp,
instance: false,
});
});
hey I have the same problem rn
I wonder if it's a library bug (because it says 'invalid origin'), or it shouldn't actually work
I think I should try to build discord-rpc module myself to figure that out, but... 🤔
I used webpack to build it and I'm also trying to use it in a chrome extension background script
it's in there but I didn't know OAuth2 was needed for that
my guess is, Rich Presence is only possible with IPC instead of WebSocket?
It should be available with ws without approval for testers from Discord, I guess
What do use to make chrome extension with Webpack? I found too hard way, I think
the way Rich Presence is currently set is via IPC which is essentially a local TCP socket
and I don't think that will work in a Chrome Extension
so there would be the need for some kind of node.js daemon running communicating with the extension
I don't want to set up a daemon 🤔
yeah I don't want to either
Maybe if I specify origin in discord-rpc's code, it will work
nah that's not the problem
Error says 'Invalid Origin', so I think I should try to modify code
for using the WebSocket it expects you to be authenticated via OAuth2
but I have no idea if there is any way for doing an authenciation process in a chrome extension
I think there is a way
since it doesn't accept the chrome-extension:// Protocol as Origin
But I don't think that's necessary
You can intercept loading of a blank page I think
the problem is that any website could just set your Rich Presence
if that would be allowed
using WebSocket without authentication for setting Rich Presence that is
But there are browser's cross-domain rules
I don't think they would allow connecting to ws://localhost
Discord's WebSocket server probably sends CORS headers
cause otherwise it would be useless
since it's supposed to be used in web apps too
Oh, I should to set Origin header myself
And in app settings
you can try it but I doubt it will change anything
https://discordapp.com/developers/docs/topics/rpc#commands-and-events-rpc-commands there's not even a command for the websocket to change the rich presence
I think IPC and WebSocket in discord-rpc are two completely different protocols for two different use cases
rpc would be kinda bad if it allowed remote manipulation 
yeah that's what I'm saying, if rich presence is able to be changed via websocket, it needs authentication
but I don't even think it is able to change it
well i guess remote manipulation is the point
but ye
@hoary citrus I think that's not full list
not super familiar with rpc but to my knowledge you typically use it over ipc
Because I don't see that this list doesn't apply to IPC
And using IPC you can actually set rich presence
ok seems like Rich Presence in the browser has to be whitelisted by Discord staff themselves
thus the Invalid Origin error
I found that one can specify origin when creating client
I'll try this now
It looks like it's indeed not possible to use this with current library version.. even if I specify origin as localhost that doesn't work. I don't even see where should I set expected origin in app settings on discord dev panel
Origin still unmodified
pretty sure chrome overwrites the Origin header
maybe this could work
but according to the README of this (https://github.com/devsnek/discord-rich-presence) library which is officially linked on the discord repo it's not possible to use Rich Presence in the browser without being whitelisted by Discord staff themselves
but this might only be true for regular webpages and not extensions which have "superpowers"
I didn't try to make a request with modidied origin actually, just tried to help lib to do that
Actually that wasn't overwritten by chrome, just lib didn't pass that
it would be overwritten anyway
Maybe if one tries to do separate XHR from background page, that would work?
I'll try something tommorow, I should go sleep I guess 
Did you see any ipc proxies on github?
all of this seems pretty complicated to me for a rather simple task
I'll write one I think
webRequest API by Chrome might be possible to use
idk how it handles ws://
its a websocket protocol why do i just come into conversations like this
I think it's not possible to use ws with that 🤔
Well, I think I'll leave now, prepare to sleep
Ping me if you find something out
chrome.webRequest.onBeforeSendHeaders.addListener(
function(details) {
for (var i = 0; i < details.requestHeaders.length; ++i) {
if (details.requestHeaders[i].name === 'Origin') {
details.requestHeaders[i].content = "your origin" // idk if it's 'content'
break;
}
}
return {requestHeaders: details.requestHeaders};
},
{urls: ["<all_urls>"]},
["blocking", "requestHeaders"]
);```
kinda like this
copied from chrome extension docs
problem with OAuth2 Flow in Chrome Extension still stands tho