#archive-rpc-help

21942 messages · Page 22 of 22 (latest)

smoky scroll
spring dune

Yes I don't get why you require auth if you redirect to youtube

lmao

Setting a rich presence doesn't require authorization

smoky scroll

Why it happens then

const RPC = require("discord-rpc")
const clientId = "843505868275449866";
const scopes = ["rpc", "messages.read"];

const client = new RPC.Client({ transport: "ipc" });
RPC.register(clientId)
client.on("ready", () => {
  console.log("Logged in as", client.application.name);
  console.log("Authed for user", client.user.username);

  client.selectVoiceChannel("950022618369650768");
});

// Log in to RPC with client id
client.login({ clientId, scopes });
spring dune

Cause you clicked on it?

First off why do you have messages.read scope

Ah, selecting a voice channel

I know nothing of that side of the RPC.
I only know how to set the rich presence.
However I do recommend using game SDK if you plan to do advanced stuff.

smoky scroll
smoky scroll
spring dune

Yeah, what are you trying to do here?

Set RPC or set a voicechannel

smoky scroll

Just trying to use rpc to set button in my bio

spring dune

Then I can tell you this copypasted code won't work xd

smoky scroll

Removed voice channel line

spring dune

Yeah

smoky scroll
const RPC = require("discord-rpc");
const clientId = "843505868275449866";

const client = new RPC.Client({ transport: "ipc" });

client.on("ready", () => {
  console.log("Authed for user", client.user.username);
});

// Log in to RPC with client id
client.login({ clientId });
spring dune

you should use
<RPCClient>.setActivity(optionsObject);
in the ready event to set your presence.

smoky scroll

It worked

Thanks

pseudo linden

i get this error when pressing save changes after adding an asset, does anyone know why??

viscid shale

Is there a way to do in-app authorization with scopes without deploying the client_secret to production?

solar sentinel

For RPC you are already fairly limited in functionality and locked to people in the test group- if you are referring to general OAuth2, you'd be looking for the Implicit Grant flow

latent junco

whats a discord-rpc

viscid shale
solar sentinel Sounds a bit like an XY problem, what are you trying to do?

I built an application that gets all the people the user's voice channel, even after they switch channels.
I use the ['rpc', 'rpc.voice.read'] scopes.

What Im doing right now is the app opens a link in the default browser where the user authenticates and the token is sent back to the app. But it would be better to have it just authenticates in discord itself as users need to login to the browser.

quaint sable
dry grove

Does anyone know how I can open OAuth2s links on the client instead of the browser?

quaint sable

for me at least

using the code in the readme on github it opens directly in the client

dry grove

Can you give some example or url reference, please? 🙏

quaint sable

`const clientId = '287406016902594560';
const scopes = ['rpc', 'rpc.api', 'messages.read'];

const client = new RPC.Client({ transport: 'websocket' });

client.on('ready', () => {
console.log('Logged in as', client.application.name);
console.log('Authed for user', client.user.username);

client.selectVoiceChannel('81384788862181376');
});

// Log in to RPC with client id
client.login({ clientId, scopes });`

this literally opens in the client

dry grove

Oh, let me check because I'm using transport: 'websocket'

quaint sable
quaint sable

nvr mind i used ipc, but i cant figure out what the redirect_url should be cause I always get "not a well formed url"

pastel trench

An URL listed in your application oauth page

dry grove
quaint sable

what do i do then

quaint sable
pastel trench

Uhm, you like... Run it? Lol

quaint sable

as if thats not what im doing rn

this is what i always get

nothing else

pastel trench

The redirect Uri btw is only needed if you use RPC scopes and I've heard someone using an empty string instead and get it working properly (didn't try personally though)

pastel trench
quaint sable
nimble yarrow

you are still missing a redirect uri

quaint sable

where

nimble yarrow

in the login method

quaint sable

i have it in the application portal

wait

dry grove
quaint sable

so we need one in both???

pastel trench

You should set the redirect_uri in the login options

And it should be a registered redirect URL in the Dev portal

quaint sable

hmm

interesting

ok

so like this?

and then the url inside

nimble yarrow

uri not url, but I dont think thats a thing looking at the sauce code

quaint sable

ok

nimble yarrow

wait it is

god I hate the docs of rpc

quaint sable

bruh

its still not working

nimble yarrow

but its redirectUri according to sauce

quaint sable

ohh

pastel trench

Thonk

quaint sable

now it says invalid client

nimble yarrow

show full error

quaint sable
pastel trench
quaint sable

the id is copy pasted from the application portal

pastel trench

What about the client secret?

quaint sable

wait we need that as well?

pastel trench

Yeah iirc you need it in order to use RPC scopes

nimble yarrow

yes

quaint sable

BRUH

ok

nimble yarrow

someone really needs to redo the whole documentation for this

quaint sable

ikr

pastel trench

Yeah 😂

At least types are ok

quaint sable

:0

no errors

nimble yarrow

types ARE the problem

pastel trench

Mmh?

nimble yarrow

you dont see shit in the docs

pastel trench

I meant Typescript type definitions

Lol

quaint sable

and now i dont see any pop-ups

awesome

nimble yarrow

yeah, why in hell is that not documented on docs

quaint sable

fr

pastel trench

¯\_(ツ)_/¯

quaint sable

bro i think is broken or something

sometimes nothing happens

then once it connects with no error

and then other times it says invalid client

all with the exact same code

no changes

quaint sable

istg this is broken

im getting 'invalid_client' with the same code before that worked

dry grove

Mmm I tried this

discordRPCClient.login({
  clientId: 'id', 
  scopes: [
        "identify",
        "email",
        "connections",
        "rpc",
        "rpc.notifications.read",
        "rpc.voice.read",
        "rpc.voice.write"
  ],
  redirectUri: 'http://localhost:53134',
  clientSecret: 'secret'
});

rpc.activity.read doesn't work idk why

quaint sable

and this worked for you?

dry grove

yup

quaint sable

hmm

dry grove
quaint sable

where did you get discordRPCClient from

oh i mean

im getting invalid client

after hitting authorize on the pop-up

dry grove

oh it is just a new DiscordRPC client

discordRPCClient = new DiscordRPC.Client({ transport: 'ipc' });
quaint sable

ah ok

where did Constants come from

dry grove

it is 'ipc'. I just have a json file with all of that info

quaint sable

ah ok

and you have var DiscordRPC = require('discord-rpc') before that right?

dry grove

yup

quaint sable

interesting

i have literally the same thing

nimble yarrow

hide your secret, but not the id

quaint sable

wait i hid both

is that fine

dry grove

I want to do this thing in express (so I can hide the clientSecret) in my electron app. I guess this will not help me to do what I want...

nimble yarrow

no I want to see the id

quaint sable

ok

i made a new application and replaced the old id with the new one and the old secret with the new one

and it still didnt work

dry grove

it's clientSecret

quaint sable

hmm

strange

cause it worked earlier

HOLY

IT WORKED

BRO WHAT

HOW

dry grove

XD

quaint sable

DUDE THX

OMG

shy helmBOT

method RPCClient#login()
Performs authentication flow. Automatically calls Client#connect if needed.

dry grove
quaint sable
dry grove

Let me check, ty

quaint sable

ok i meant to say authenticate() not authorize()

shy helmBOT
dry grove

oh

quaint sable

yea its private but i think you can still use it

dry grove

okok

shy helmBOT
quaint sable

yea and turns out authenticate doesnt really need clientSecret

according to the source

dry grove

Nice, I'll try it, ty

quaint sable

yea np

viscid shale

you can't pass a refresher token as you still need to provide your client secret to refresh it

dry grove
viscid shale

yea, since you already connected, you dont have to login ans the login method does both auth and connect for you

dry grove

I have a dumb question, I'm creating an electron app that will be public in the future, I can't put in the clientSecret in the source code right?

I'm asking for this because I cannot find an example on the internet :(

So I'm opting to create an express server which handles all credentials

viscid shale

I wish discord would give us an option to host atleast 1 serverless function

Would make life so much easier

solar sentinel

Given the limitations of developer RPC, is there a reason you can't just provide users the source code and let them make their own application + token?

If you use your own, you are capped at 50 people, and they have to go through localhost anyway

lofty peak
                       ^^^^^^^

SyntaxError: Malformed arrow function parameter list```

Not sure what i've done wrong but any help would be appricated
nimble yarrow

async, not await

lofty peak

damn it, yeah sorry

const client = new DiscordRPC.Client({ transport: "ipc" });
const { id } = require("./config.js");

DiscordRPC.register(id);

client.on("ready", async () => {
    await client.setActivity({
        largeImageKey: "kayne",
        largeImageText: "kayne",
        startTimestamp: Date.now()
    })
});

client.login({ id }).catch(err => console.log(err))```

Why does this always return ```Error: connection closed```?
nimble yarrow
lofty peak

yeah i got that

i just put id as the variable

oh wait

does it need to spelt exactly like that?

nimble yarrow

yes

either do clientId: id or rename id to clientId

lofty peak

alright thanks

smoky scroll

guys i am trying to install discord-rpc package but it shows some errors

nimble yarrow

Show the whole log

smoky scroll

@nimble yarrow

nimble yarrow

You dont need to ping me on every message...

smoky scroll

sorry haha

well u know the solution'

?

nimble yarrow

And the rest of the log? Its not complete

Including what you wrote

smoky scroll

oh

thats it

karmic jolt

the discord-rpc version in your package.json seems to be outdated

smoky scroll

let me see

i have to install the 4.0.1 right?

karmic jolt

that's the version of your package, not of the dependency

smoky scroll

showing error too when i try to install that

smoky scroll

here

but it shows the same error

karmic jolt

maybe try installing with --no-optional?

smoky scroll

npm i discord-rpc--no-optional?

wym

karmic jolt

separate from the name

smoky scroll

oh okay

npm i discord-rpc --no-optional

karmic jolt

yeah

smoky scroll

same err

wtf is happening

quaint sable

try updating npm

if npm is on the latest update, try uninstalling and reinstalling it

pastel trench
smoky scroll

I would try to delete the package-lock.json and the node_modules folder than run npm i

pulsar crest
const RPC = require('discord-rpc');

const clientId = '469789887298535424';
const scopes = ['rpc', 'rpc.api', 'messages.read'];

const client = new RPC.Client({ transport: 'websocket' });

client.on('ready', () => {
    console.log('Logged in as', client.application.name);
    console.log('Authed for user', client.user.username);
});

client.login({ clientId, scopes });
H:\IdrisGaming\Discord Bot\RPC\node_modules\discord-rpc\src\client.js:111
        reject(new Error('connection closed'));
               ^

Error: connection closed
    at WebSocketTransport.<anonymous> (H:\IdrisGaming\Discord Bot\RPC\node_modules\discord-rpc\src\client.js:111:16)
    at Object.onceWrapper (node:events:646:26)
    at WebSocketTransport.emit (node:events:526:28)
    at WebSocketTransport.onClose (H:\IdrisGaming\Discord Bot\RPC\node_modules\discord-rpc\src\transports\websocket.js:42:10)
    at WebSocket.onClose (H:\IdrisGaming\Discord Bot\RPC\node_modules\ws\lib\event-target.js:136:16)
    at WebSocket.emit (node:events:526:28)
    at WebSocket.emitClose (H:\IdrisGaming\Discord Bot\RPC\node_modules\ws\lib\websocket.js:246:10)
    at Socket.socketOnClose (H:\IdrisGaming\Discord Bot\RPC\node_modules\ws\lib\websocket.js:1127:15)
    at Socket.emit (node:events:526:28)
    at TCP.<anonymous> (node:net:687:12)
nimble yarrow

rpc.api isnt a valid scope

also you should use ipc instead of websocket

pulsar crest

what's the difference?

nimble yarrow

one works

the other doesnt

KEK

pulsar crest

still the same error ._.

const RPC = require('discord-rpc');

const clientId = '469789887298535424';
const scopes = ['rpc', 'messages.read'];

const client = new RPC.Client({ transport: 'ipc' });

client.on('ready', () => {
    console.log('Logged in as', client.application.name);
    console.log('Authed for user', client.user.username);
});

client.login({ clientId, scopes });
nimble yarrow

how about using the id of your application...

pulsar crest

ah

H:\IdrisGaming\Discord Bot\RPC\node_modules\discord-rpc\src\client.js:178
        const e = new Error(message.data.message);
                  ^

Error: OAuth2 Error: invalid_request: Missing "redirect_uri" in request.
    at RPCClient._onRpcMessage (H:\IdrisGaming\Discord Bot\RPC\node_modules\discord-rpc\src\client.js:178:19)
    at IPCTransport.emit (node:events:526:28)
    at H:\IdrisGaming\Discord Bot\RPC\node_modules\discord-rpc\src\transports\ipc.js:138:18
    at decode (H:\IdrisGaming\Discord Bot\RPC\node_modules\discord-rpc\src\transports\ipc.js:92:5)
    at Socket.<anonymous> (H:\IdrisGaming\Discord Bot\RPC\node_modules\discord-rpc\src\transports\ipc.js:120:7)
    at Socket.emit (node:events:526:28)
    at emitReadable_ (node:internal/streams/readable:578:12)
    at processTicksAndRejections (node:internal/process/task_queues:82:21) {
  code: 5000,
  data: {
    code: 5000,
    message: 'OAuth2 Error: invalid_request: Missing "redirect_uri" in request.'
  }
}
nimble yarrow

the error is pretty clear

pulsar crest

what's a "redirect_uri" ?

nimble yarrow
pulsar crest

I just need to pass a random URL in it?

nimble yarrow

you pass whatever redirect url you have

quaint sable

basically

pulsar crest

I tried discord-rpc's npm page and I got this:

H:\IdrisGaming\Discord Bot\RPC\node_modules\discord-rpc\src\client.js:64
          const e = new Error(r.status);
                    ^

Error: 400
    at H:\IdrisGaming\Discord Bot\RPC\node_modules\discord-rpc\src\client.js:64:21
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async RPCClient.authorize (H:\IdrisGaming\Discord Bot\RPC\node_modules\discord-rpc\src\client.js:215:22)
    at async RPCClient.login (H:\IdrisGaming\Discord Bot\RPC\node_modules\discord-rpc\src\client.js:143:21) {
  body: { redirect_uri: [ 'Not a well formed URL.' ] }
}
quaint sable

add a redirect url in the oauth2 page

pulsar crest

done

quaint sable

then pass the same url to redirectUri in client.login

and then pass clientSecret to client.login as well

the discord-rpc docs seriously needs to be rewritten

any success?

pulsar crest

I'll try right now

quaint sable

ok

pulsar crest

thanks for info

quaint sable

np

pulsar crest

it works fine

thanks!

quaint sable

np

pulsar crest

is there something like « a bot which is in more than 100 guilds cannot do a RPC for a user » ?

nimble yarrow

no?

pulsar crest

a limit

quaint sable
low escarp

How can Discord.js RPC write activity status if it requires approval?
activities.write allows your app to update a user's activity - requires Discord approval (NOT REQUIRED FOR GAMESDK ACTIVITY MANAGER)
rpc.activities.write for local rpc server access, this allows you to update a user's activity - requires Discord approval

At the same time, all other functions except setActivity do not work without permission

nimble yarrow
nimble yarrow
pulsar crest
low escarp
nimble yarrow

and where do you have that from

low escarp
nimble yarrow

where did you read that

nimble yarrow

oauth2 isnt rpc tho?

low escarp
spring dune

I don't recall rpc requiring discord approval

Yeah rpc scope doesn't require authorization

dry grove

Do someone know what is qos?

{
  automaticGainControl: true,
  echoCancellation: false,
  noiseSuppression: false,
  qos: false,
  silenceWarning: true,
  deaf: false,
  mute: false,
  input: {
    availableDevices: [ [Object], [Object] ],
    device: '{0.0.1.00000000}.{ecd61229-2e38-4800-a135-af4660f36c5f}',
    volume: 100
  },
  output: {
    availableDevices: [ [Object], [Object], [Object] ],
    device: '{0.0.0.00000000}.{aeb959dd-a06b-4a0e-ac20-d24a6a0b5d8d}',
    volume: 100
  },
  mode: {
    type: 'VOICE_ACTIVITY',
    autoThreshold: false,
    threshold: -44.92307692307692,
    shortcut: [],
    delay: 20
  }
}
shy helmBOT
nimble yarrow

qos | boolean | state of voice quality of service

dry grove

Okok, ty c:

low escarp
spring dune

I'm literally using the rpc scope without any redirect_uris or authorization

Could be the rpc lib uses an older version or smth and the screenshot is from new, dunno

low escarp
karmic jolt

you only need to be whitelisted to do it over websocket, not for ipc

spring dune

ah that explains it

quaint sable

makes sense

the docs really needs to be redone

spring dune

Feel free to

quaint sable

i dont have time rn

ill see if i can do it later

spring dune

No-one cares/knows enough/has time to do it

quaint sable

exactly

low escarp
nimble yarrow

did you enable those scopes

karmic jolt

rich presence is pretty much the only thing you can do with rpc without oauth2

the rest requires authorization

low escarp
karmic jolt

no

low escarp

Yeah, it's hard enough to understand. Thanks anyway

low escarp
karmic jolt

about oauth2?

low escarp
karmic jolt about oauth2?

More about those cases where oauth2 is not required (if you're talking about the rich-presence feature being pretty much the only one that doesn't require authorization)

karmic jolt

i'm not sure if there are any others

low escarp

I just don't quite understand why rich presence doesn't require authorization, but is mentioned in the oauth2 article

karmic jolt

the article says "for local rpc server access"

that's why i made the distinction between websocket (using the local rpc server) and ipc

low escarp
karmic jolt

yeah

low escarp
dry grove

Is there a way to get a user voice settings by id?
something like RPCClient#getVoiceSettings()

steady edge

Can you do Client.clearActivity without stopping the current process?

My Console always gets closed when doing client.clearActivity

pastel trench

Probably because the process has nothing else to do

quaint sorrel

i get this error Error: Could not connect

nimble yarrow

djs 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.

Thank you for using the Chewie express.

quaint sorrel

it used to work but it dosnt now

nimble yarrow

The answer stays the same

show your code if you dont know any further

quaint sorrel
nimble yarrow

where do you host that

quaint sorrel

my pc durng development

nimble yarrow

and during production

quaint sorrel

no it only runs during development

i just reloaded discord and it connected :/

steady edge
client.on("ready", async () => {
  console.log("ready")
  console.log(client.user?.username)
  setInterval(() => {
    config = JSON.parse(
      fs.readFileSync(
       path, "utf8"
      )
    );
    let i=0
    Object.keys(config).forEach(key => {
      if(key == ""){
        i+=1
      }
    })
    let lenght = Object.keys(config).length
    if(i == lenght-1){
      console.log("cleared")
      setTimeout(() => {
        client.clearActivity()  
      }, 3000);
      
    }
    else{
    
    client.setActivity({
      details: config.Details,
      state: config.State,
      buttons: [
        {
          label: config.Button1,
          url: config.Url1,
        },
        {
          label: config.Button2,
          url: config.Url2,
        },
      ],
      largeImageKey: config.LargeImage,
      largeImageText: config.LargeImageText,
      smallImageKey: config.SmallImage,
      smallImageText: config.SmallImageText,
      startTimestamp: config.StartTimestamp,
      endTimestamp: config.EndTimestamp
    }, process.pid);
    }
  }, 5 * 1000);
});
client.login({ clientId: config.ClientID});
steady edge
nimble yarrow

why dont you just set the new activity, there is no need to clear it in the first place, discord is just gonna update it for you

steady edge

But I don't want anything as Activity

steady edge
nimble yarrow

I meant what I said, but your code doesnt make much sense to me either mmLol

steady edge
steady edge

So IDK what to do lmao

zinc matrix

can an rpc app thing read channels in guilds?

i could make a discord bot and then have the code for starting rpc in that bot Thonk

zinc matrix

😦

so i could not have a bot activate the rpc client?

thats annoying lolz

ight rpc is a lost cause

nimble yarrow

RPC is meant for users, not for bots

A bot doesnt need RPC

zinc matrix

i know

but i want to use a bot to change the rpc

and start it

nimble yarrow

That does work, if you run the bot on your local machine.

zinc matrix

oh

nice

trying around with scopes for rpc was a waste of an hour of my lifge

so if this works thats great

have a button to change rpc and activate it Thonkang

steady edge
nimble yarrow

clearActivity

steady edge

sended it @nimble yarrow

steady edge

sry I wasn't there @nimble yarrow

nimble yarrow

sucks, now I'm not available

forest pelican

Moin @steady edge

nimble yarrow

this isnt a small talk channel

steady edge

Yeah I sended it @nimble yarrow If u got time then u can look over it

exotic agate

hmm

proper bear

does this set RPC on the bot ?

nimble yarrow

no

umbral peak

Hello, does the latest discord-rpc supports node 8? I know this thing is old asf but i must use it sadly

if not, which discord-rpc version that supports node 8

quaint sable

first of all

why do you need such an old version of node

umbral peak

i want to make adobe extension, i wan't to use the CEP 9.0 which uses node 8

quaint sable

ohh

interesting

umbral peak

mm, let me try something

want to create something that support older version

umbral peak

god turns out CC 2017 uses iojs 1.2.0

well the only way is to use external library, run with local latest nodejs instead of using after effects one

umbral peak

finally did it

quaint sable

nice

umbral peak

god it take so long

because this thing is not directly tied to after effects (using external app, so i guess i need to make this app autostart

steady edge

Thx @nimble yarrow I found the wrong value and fixed it.

smoky scroll

I get this error when i use ipc transport:

Error: Could not connect
    at Socket.onerror (/home/runner/rich/node_modules/discord-rpc/src/transports/ipc.js:32:16)
    at Object.onceWrapper (node:events:642:26)
    at Socket.emit (node:events:527:28)
    at emitErrorNT (node:internal/streams/destroy:164:8)
    at emitErrorCloseNT (node:internal/streams/destroy:129:3)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)```
nimble yarrow
smoky scroll I get this error when i use `ipc` transport: ``` Error: Could not connect at...

djs 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.

nimble yarrow

yep

smoky scroll
nimble yarrow

yep

smoky scroll

ok

tiny bane
nimble yarrow
tiny bane

djs 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.

smoky scroll
tiny bane

rpc doesn't not works on bots and in replit, you must run it on your pc

tiny bane

hmm

tiny bane
smoky scroll
nimble yarrow

I am the devil of djs Things to consider when getting a connection closed/could not connect error

zinc matrix

so i am trying to make a bot where i can press buttons to set my presence. So far, works like a charm. Only issue is when i close dc and open again. I tried setting an rpc.destroy and then logging it in again, but doesnt seem like that works either. Any thoughts on if this is possible?

youd think destroying the rpc client and logging in newly would allow you to set you presence with it again

also dont see the difference between closing the rpc and opening it again through the console and calling rpc.destroy

quaint sable
zinc matrix

I have a BOT where I can press buttons to set MY presence

quaint sable

yea that’s what im saying

many people mistake this channel for rich presence for bots

this channel is for rpc for local clients

nimble yarrow

read their question again

quaint sable

this channel is for ‘discord-rpc’

aka the library for interacting with local clients

they want rich presence for bots, which this channel isn’t for

quaint sable

in the docs for discord.js I don’t see anything about rpc.destroy

nimble yarrow

read their message again

which you failed for a third time now

quaint sable

ohhhhhh

lol

rip I understood something else

quaint sable

do you mean close discord?

nimble yarrow

When they stop discord and start it again.

quaint sable

ah ok

zinc matrix

Xd

The discord bot handles my presence, but it doesn't allow my rpc to reconnect (or even do anything) when I've closed the discord app

It's weird, even if I make rpc destroy itself and log it again it just doesn't want to

quaint sable

so after closing, it stops working even if you re open discord?

zinc matrix

Yes

quaint sable

strange

zinc matrix

Like it's lost connection and doesn't reopen it

quaint sable

interesting

zinc matrix

And annoying

Xd

karmic jolt

@zinc matrix you can't use the same client multiple times

zinc matrix

?

karmic jolt

after it's destroyed/disconnected you need to create a new client

zinc matrix

Ah

Well thats shit

haha

okay

nimble yarrow

use ipc instead of websocket, also rpc.api doesnt exist anymore

quaint sable

yea someone should

it’s so outdated

deft crypt

It's possible integrate chrome extension with Discord RPC?

smoky scroll

no

karmic jolt

@deft crypt you can run a server (like express) for the rpc stuff on localhost and let the extension interact with that

deft crypt
summer juniper

What language is that?

nimble yarrow

C#? Java? Idk
Not js tho

smoky scroll
summer juniper

thanks

red wedge

that's C++ / C due to use of memset and pointer-of operators

fringe solar
const RPC = require('discord-rpc');
const clientId = '851945606799949844';
const scopes = ['rpc', 'messages.read'];

const client = new RPC.Client({ transport: 'ipc' });

client.on('ready', () => {
  console.log('Logged in as', client.application.name);
  console.log('Authed for user', client.user.username);

  client.selectVoiceChannel('960837263405764618');
});

// Log in to RPC with client id
client.login({ clientId, scopes });
        const e = new Error(message.data.message);
                  ^

Error: OAuth2 Error: invalid_scope: The requested scope is invalid, unknown, or malformed.
    at RPCClient._onRpcMessage (D:\github\email\node_modules\discord-rpc\src\client.js:178:19)
    at IPCTransport.emit (node:events:394:28)
    at D:\github\email\node_modules\discord-rpc\src\transports\ipc.js:138:18
    at decode (D:\github\email\node_modules\discord-rpc\src\transports\ipc.js:92:5)
    at Socket.<anonymous> (D:\github\email\node_modules\discord-rpc\src\transports\ipc.js:120:7)
    at Socket.emit (node:events:394:28)
    at emitReadable_ (node:internal/streams/readable:573:12)
    at processTicksAndRejections (node:internal/process/task_queues:82:21) {
  code: 5000,
  data: {
    code: 5000,
    message: 'OAuth2 Error: invalid_scope: The requested scope is invalid, unknown, or malformed.'
  }
}

what's wrong with scope?

nimble yarrow
fringe solar
fringe solar
nimble yarrow

Then you missed something.

quaint sable

you need to give those as well

nimble yarrow

Thats what we already elaborated, thanks for repeating me.

quaint sable

oh lol

didnt read that properly

stiff violet

Thonk

How do I use rpc with scopes without exposing clientSecret?

stiff violet

If I can't, I guess no one can. It means I can just extract this key from other apps that use discord rpc

quaint sable

I guess so

what u can do tho

I just thought of it

stiff violet

An app to mute discord remotely

And unmute

quaint sable

send like an encoded version or an encrypted version of clientSecret to a server

actually nvr mind lol

stiff violet

Yeah I can't control discord client from my server

quaint sable
quaint sable
stiff violet

I don't know why discord haven't implemented this themselves

quaint sable

something to hide clientSecret?

stiff violet

Nah, remote muting and unmuting

quaint sable

well they kind of have it in the discord overlay

stiff violet

Using discord client from other device

quaint sable

but then fully remote isn’t done yet

quaint sable
stiff violet

I usually speak from my desktop PC cause it has a good mic, but sometimes I work from my laptop and lay on my couch

quaint sable

mhm

oh ic

stiff violet

I move my mic closer to me so others can hear me, but I can't mute and unmute

quaint sable

why not?

oh wait

ur on the call from the desktop?

stiff violet

Yea

quaint sable

ohh ic

to do something like that

if you could make a p2p connection between the desktop and laptop

and send the rpc calls through there

stiff violet

I have a prototype without the remote part, I think I'll just make an API for this app

quaint sable

wait i just remembered

iirc mute and deafen is synced through desktop and web right?

cause MAYBE muting on one desktop could mute on the other

idk if it will work tho

stiff violet

Idk tbh, I don't use web

quaint sable

like desktop as well

stiff violet

Desktop definitely not

quaint sable

iirc I muted on one laptop on the desktop app and the other laptop it muted

but I wasn’t in a vc

stiff violet

Hmm

quaint sable

it’s bc it runs on electron

stiff violet

I don't think it works

quaint sable

i remember it worked without being in a vc

idk abt being in a vc tho

stiff violet

If I connect to a vc from one PC, it doesn't show my mute status on other PC to me

On Android it doesn't even show me on vc participants list joelmao

prime sonnet

this has nothing

is there any other docs for rpc with node?

prime sonnet

Yeah used that but don't know the use of those keys

pseudo sluice

hi! I'm trying to use the rpc package, but I have an "invalid origin" error... any way to fix this?
I copied the code from the documentation, and replaced client id with my actual client id.

pseudo sluice
nimble yarrow

remove rpc.api, replace websocket with ipc and provide a clientSecret and redirectUri to login if you want to use scopes

pseudo sluice

i tried using this:
client.login({ clientId, scopes, clientSecret: process.env.CLIENT_SECRET, redirectURI: "http://127.0.0.1:3233/lgi" });
but it returns me "OAuth2 Error: invalid_request: Missing "redirect_uri" in request."

(but at least the authorization popup opens)

pseudo sluice
pseudo sluice

@nimble yarrow

quaint sable

and is it the same one as the one you put there?

pseudo sluice

yup

pseudo sluice
nimble yarrow
pseudo sluice

none or them are working tho

nimble yarrow

it will always be redirectUri and you have to have the same uri set on the dashboard

thats all there is to that error

nothing less, nothing more

pseudo sluice

huh

actually

nimble yarrow

show your dashboard

pseudo sluice

oh wait im dumb

I actually forgot to put the redirect uri on the dashboard

nimble yarrow

thought so

pseudo sluice

sorry for making you losing your time, I thought I already set it

steady edge

Nice. Somehow my rpc doesn't work anymore. Idk why but it just stopped working. Error is always that it timed out

It worked before

faint isle

Hi, I've recently started learning about RPCs, as per my understanding, it's basically some functions exposed on a particular port of server but I can't really understand is that how is it any better from normal REST api client that we already use to communicate with discord?
Also, why do we need electron for rpc call, is it used only for browser client libraries?

nimble yarrow

we dont need electron

and rpc is the only way to communicate with the actual user, thus its locally

faint isle

I was checking example you've setup in rpc repo, it uses electron, is it only for gui for that example?

we can't use rpc with bots? Thonk

there are some RPCEvents mentioned in constants that bots can use tho

nimble yarrow
faint isle

this constraint is on discord or the library?

nimble yarrow

discord

faint isle

thanks

nimble yarrow

Thonk

trim hornet

i was wondering, can detail, state, and largeImage have links?, like how spotify rpc will take u go the artist, song, album in the web/app?

spring dune

Spotify is a special case

RPC assets must be uploaded to the webportal

wintry spruce
spring dune

WOT

This epic

wintry spruce
cobalt tusk

guys What is Discord-Rpc

nimble yarrow

see channel topic

cobalt tusk

oh tnx

shell zephyr

how do I sub to an event in v4.0.1??? with callback

shell zephyr

(specifically interested in ACTIVITY_JOIN and ACTIVITY_JOIN_REQUEST

chrome dew
chrome dew
azure minnow

Hey, I was wondering if it's possible to remove/fake the origin. I'm trying to establish a connection between a webpage (chrome) and my discord client. But it gives me an invalid origin error everytime.

nimble yarrow

dont think rpc runs from chrome

azure minnow

Only because chrome adds an origin header

my goal is to remove that header

because if i do so it will work

spring dune

Sadly we aren't experienced in Chrome extensions/modifications

analog portal

put it in a preload

how would i clear the presence?

but i just got this error ```js
C:\Users\Fr0g_\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\Fr0g_\node_modules\discord-rpc\src\transports\ipc.js:155:17)
at C:\Users\Fr0g_\node_modules\discord-rpc\src\client.js:159:22
at new Promise (<anonymous>)
at RPCClient.request (C:\Users\Fr0g_\node_modules\discord-rpc\src\client.js:157:12)
at RPCClient.clearActivity (C:\Users\Fr0g_\node_modules\discord-rpc\src\client.js:540:17)
at Timeout.onTimeout (C:\Users\Fr0g\Desktop\myRPC\dddddd\node_modules\rrpc\index.js:45:12)
at listOnTimeout (node:internal/timers:557:17)
at processTimers (node:internal/timers:500:7)```

smoky scroll
unborn plover

help

nimble yarrow

discord-rpc

not discor rpc

unborn plover
nimble yarrow

I suggest you read the error

unborn plover

but the project is the same

nimble yarrow

Exactly

Its not supposed to be

unborn plover

??

trail terrace

because discord- is not a module..

unborn plover

oh i am dum

zinc matrix

Xd

analog portal

client.destroy()

doesnt work

client.clearActivity() doesnt work either

the library is a mess

smoky scroll
analog portal

no

i wasnt using djs

im using discord-rpc

its for the user

const rpc = require("discord-rpc");
var client = new rpc.Client({ transport: 'ipc' });```
spring dune

You don't do client.user?
Unless the code changed

analog portal

wdym

oh

that still doesnt work

client.setPresence isnt a function

idk

the docs lied

spring dune

It's setActivity

Unless it got changed

analog portal

OH

OH IT WORKS TYYY

TYYY TYY TYYY

YESS

IV BEEN LOOKING FOR DAYS

nimble yarrow
analog portal

they had smthn like clear activity

and that didnt work

i even looked at the code example they gave

spring dune

I'm pretty sure rpc docs don't have client.user tho

analog portal

yeah they dont

its just client

client.clearActivity([pid])

nimble yarrow

And that does what the name implies

it yeets the activity

analog portal

it didnt work for me

proper bear

what does instance do in args ?

viscid shale

Is there a way to fetch more than 50 messages using the rpc?

viscid shale

nvm found it

wintry spruce

hi

mint wigeon

bye

low escarp

Guys, can anyone help with understanding the RPC discord? I'd be very grateful. I would like to ask about the process of working with it in practice

smoky scroll

hi guys, can i connect a discord rpc with just opening a program without getting the discord token of the user? (only with the id)

smoky scroll

for example put this rpc to an user that opened the program

nimble yarrow

discord needs to run in the background

everything else is automated

smoky scroll

ohhh so when the user open the program it put the rpc automated?

and it search the discord user automated too?

nimble yarrow

rpc connects to the rpc server that gets started by the discord application

smoky scroll

nice

and for what is this? const client = new rpc.Client({ transport: 'ipc' })

transport ipc?

nimble yarrow

thats just the transport mode
there is websocket and ipc, but websocket is whitelisted only

smoky scroll

i see

smoky scroll

drl.jpg

or just drl

nimble yarrow

it either takes a url or an asset name

smoky scroll

nice

so without the .jpg?

nimble yarrow
smoky scroll

yeah yeah

so this should work right?

nimble yarrow

kindly dont ghostping me, thanks

low escarp

Guys, can I ask for help with understanding the RPC?
What is the difference between IPC and WS in this case?

smoky scroll
nimble yarrow

try it

smoky scroll

lets see

connection closed? xd

nimble yarrow

djs 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.

smoky scroll

ohh yeah in my rdp i don't have discord downloaded

nimble yarrow

then thats your issue

or at least one of them

smoky scroll

working fine 🙂

also can i put that rdp into a bot?

or it's just for users

btw @nimble yarrow is it working with bot.on etc?

i see yeah

smoky scroll

why it says 'connection timed out'?? after a seconds

zinc matrix

Did you close your discord? Otherwise your internet connection may have disconnected I think

low escarp

guys, am I correct in assuming that these functions cannot be used without discord approval?

north marsh
low escarp
north marsh

I'm in the sense that it's not possible without it at all

north marsh
low escarp
north marsh

well, the same thing is written in front of the rpc.activities.write, but it works

shy helmBOT

• "Can I use Rich Presence for my bot?" - No.
• "Will I ever be able to use Rich Presence for my Bot?" - Ask Discord.

slender eagle

Can someone explain why my RPC isn't working?

const { Client } = require('discord-rpc');
const config = require('../settings/config.json');
const client = new Client({ transport: 'ipc' });
const { log, error } = new (require('../log/console'));
function buttons() {
    client.request('SET_ACTIVITY', {
        pid: process.pid,
        state: config.status.state,
        details: config.status.details,
        activity: {
            assets: {
                large_image: config.assets.image_key,
                large_text: config.assets.image_text,
            },
            buttons: [
                { label: config.button_one.label_name, url: config.button_one.label_url },
                { label: config.button_two.label_name, url: config.button_two.label_url },
            ],
            instance: config.instance || true
        },
    });

    client.on('ready', async () => {
        log("CUSTOM BUTTONS",`Auto-Linked to ${client.user.username}#${client.user.discriminator} & Showing!`)
    });

    client.login({ clientId: config.client_id }).catch((error)=>{
        error("BUTTON ERROR", error)
    });
}
module.exports = buttons;

[9:23:19 PM] INFO [CUSTOM BUTTONS]: Auto-Linked to 2G4U#6908 & Showing!

nimble yarrow
slender eagle

it just doesnt display

teal basin
shy helmBOT

We are not Discord, just some nerds who develop discord bots!
/report reports (harassment/hacking/spam/abuse) and appeals
/support anything discord related
/billing payment/nitro
/feedback feedback/feature requests

lament kindle

i just want to ask, is discord-rpc is available on mobile? i don't really think if it was possible, but i just want to make sure

lament kindle
brazen sapphire
const DiscordRPC = require('discord-rpc')
const client = new DiscordRPC.Client({ transport: 'ipc'})
require('dotenv').config();

(async () => {
    client.on('ready', async () => {
        await client.setActivity({
            buttons: [{label: 'DISCORD SERVER', url: 'URL'}],
            details: 'Listening to chill music',
            largeImageKey: 'rpc_icon',
            largeImageText: 'Music'
        }).catch(err => console.log(err))

        console.log('Rich presence enabled.')
    })

    await client.login({ clientId: process.env.applicationID}).catch(console.error)
})``` Is there a reason why this doesn't do anything

Is it outdated?

async function isn't running

nimble yarrow

client.login() doesnt need to be awaited

so that whole async function is useless

brazen sapphire

Ty, that worked

summer garnet

How to set up Discord RP with a button?

in vscode

_cat_NANI

chrome dew

Wth is this code

Never saw that

WoW, complex for nothing..

dreamy jungle

Why did they remove the RPC docs from the discord.js website?

smoky scroll
dreamy jungle
dreamy jungle

Is there an external website or a fork of it?

rugged nebula

I tried using archive.org, but it looks like the # in the url breaks everything in the archive because they try to url encode it

edgy lintel

<@&839912195994812420>

zinc matrix
nimble yarrow
zinc matrix

Tagging mod

nimble yarrow
zinc matrix

Oh jee sorry, hope you find something to make your day better.

quick jungle

I was asking is rpc deprecated?

as there isn't any update since 2021 (maybe)

anyways

nimble yarrow

there wasnt a need for an update

quick jungle

my application is showing null idkw

quick jungle
quick jungle

want to change the name of my rpc

currently it shows the name of app made in dc dev portal

but I want to change it as I wan't

nimble yarrow

You cant change it

quick jungle

I thought client.application.name = "My new name" might work

quick jungle

now I know

ok thanks

left fjord

Since it's showing the name of the app from dev portal... just change the name of the app on the dev portal?
Though true. You cannot change it from your code directly and definitely not via an assignment

supple torrent

Hey, is the doc for RPC down?

It redirects me to the welcome page

left fjord

for now, yes

supple torrent

The RPC clients seems to be ignoring the redirectUri that I add during the login.

import RPC from 'discord-rpc'
import 'dotenv/config'

const rpcLoginOptions = {
    clientId: process.env.CLIENT_ID,
    scopes: ['rpc'],
    redirectUri: "https://discord.com/"
}

const client = new RPC.Client({ transport: 'ipc' });

client.login(rpcLoginOptions).catch(console.error);

Get this error:

left fjord

do you get that error if you don't pass the uri at all?

crystal aurora

Is there way to check if there are unread messages?

left fjord

don't think so

crystal aurora

Sadge

left fjord

did you set the url in application options?

supple torrent
left fjord

for dapi

not for discord-rpc

supple torrent
left fjord

redirectUri is for oauth

the way that works is that you pass the uri, and if it matches the uri you set as allowed in the app options on discord's website, they allow the oauth to continue

but you don't really need oauth for rpc

supple torrent

But I'm trying to get the voicesettings don't I need it for that?

pastel trench

Ah yeah sorry I misunderstood

left fjord

where does it say that you need oauth authentication for that

supple torrent

After accepting the popup on discord.

left fjord

? show

supple torrent

It throws me that error.

left fjord

ok, sethttp://localhost as redirect uri in the app settings

and try then

supple torrent

Same.

It says missing not invalid :/

It seems like it's ignoring it. And where can I set it up on the website?

left fjord

so you didn't set it on website, but passed as option

don't pass anything as option, but set that on website

supple torrent

Oh

Okay wait

left fjord
supple torrent

With no options : body: { redirect_uri: [ 'Not a well formed URL.' ] }

http://localhost

pastel trench

You should pass the same Uri you specified in the site

supple torrent

With or w/o the option I get 'Not well formed URL.'

Oh

I'm a step further now

pastel trench

now that I think about it, I think you also need the client secret, not sure I'm wrong tho

But for the things you mentioned I think you need it

supple torrent

'invalid_client' the next error. Is that the client_id is invalid?

left fjord

is it id of the app?

supple torrent

Yeah

left fjord

or yours by any chance

supple torrent

Well I assumed it was the application id you get from the website

Do I need to setup something on the client before I run the service?

pastel trench

Yeah I just checked my old RPC code and you actually need the client secret

left fjord

how come that i don't

might be because i don't actually pass any scopes

supple torrent

aha

That's maybe why

pastel trench
left fjord

so yeah, don't pass scopes, don't pass uri

left fjord

should work™️

supple torrent

Tried with password

pastel trench

If you only need to set a status you don't need scopes neither redirect Uri or anything, just the client id. If you're really sure you need other scopes you should add clientSecret (or client_secret idk) as the secret you get in the main page of your application in the Dev portal

left fjord

it's js, so camelCase, discord-rpc translates

supple torrent

I actually want to listen to when I mute myself

And unmute

Don't I need rpc for that?

left fjord

well, you would be using RPC anyway, with auth or not

supple torrent

I thought I needed auth for anything related to my account

Or is auth only to perform any actions?

left fjord

try with rpc.voice.read scope

but then you need to set the clientSecret and uri

supple torrent

It's working now.

Should I use a client.subscribe or client.addEventlistener ?

left fjord

iirc if you don't subscribe, nothing will emit

supple torrent

Does it was to be wrapped around the client.on('ready') ?

Wait let me test before asking stupid quesitons.

supple torrent
supple torrent

Aha thx

Oh to listen to voice state you need to get the channel_id?

supple torrent

I got it! 😄

I'm amazed how this works good.

const client = new RPC.Client({ transport: 'ipc' });

client.on('ready', async () => {
    client.subscribe('VOICE_SETTINGS_UPDATE');
    client.addListener('VOICE_SETTINGS_UPDATE', (payload) => {
        client.setVoiceSettings({ deaf: !payload.deaf });
        console.log('Is Muted', payload.deaf)
    })
});

client.login(rpcLoginOptions).catch(console.error);

prime sonnet

no clue

nimble yarrow

rpc doesnt work in a browser lol

latent junco

what does discord rpc do

smoky scroll
latent junco
prime sonnet
nimble yarrow
prime sonnet
nimble yarrow

again, wdym
why do you think it should work with a browser

prime sonnet

Thinkeng

smoky scroll
left fjord

it technically can work from browser via websocket, but you need special stuff for websocket to work

but since you can't make the websocket work, you effectively cannot use it from browser

prime sonnet
left fjord

whitelisting

prime sonnet

sorry but i am not getting it

left fjord

you need to be whitelisted to use it

which just doesn't happen

prime sonnet
nimble yarrow

no, thats the thing kekw

prime sonnet

alot

prime sonnet
smoky scroll
prime sonnet

oh so no updates from discord's side

nimble yarrow

I hope you realize that thats not the whole code

supple torrent

And it's a loop which you should not use.

This will spam your deaf status on discord

past sundial
//Variables
const rpc = require("discord-rpc");
const { clientId } = require('./config.json');
rpc.register(clientId);
const client = new rpc.Client({
  transport: 'ipc'
})
const scopes = ['messages.read'];
//Variables

//Ready event
client.on('ready', () => {
  console.log('RPC Loaded!');
  client.request('SET_ACTIVITY', {
    pid: process.pid,
    activity: {
      details: 'hmm',
      state: 'hmm',
      assets: {
        small_image: 'hmm',
        small_text: 'hmm',
        large_image: 'hmm',
        large_text: 'hmm'
      },
      buttons: [
        {
          label: 'Invite Shadow Bot!',
          url: 'https://discord.com/api/oauth2/authorize?client_id=940748261441028116&permissions=1644971949559&scope=bot%20applications.commands'
        },
      ]
    }
  })
});
//Ready event

//Client login
client.login({ clientId, scopes }).catch(e => {
  console.error(`[Error]:\n`, e)
})
//Client login

I'm trying to make an rpc
Do we need to put the app id or client token in clientId? I tried putting both but didn't work.
It always says Could not connect in console

Pls help

nimble yarrow

application id

djs 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.

past sundial
nimble yarrow

then you wouldnt have the error

past sundial

Is something wrong in my code?

nimble yarrow

show the full error

past sundial
nimble yarrow

so you didnt pass all checks

you cant use it on replit

past sundial

Huh!? Why?

nimble yarrow

• Is your code running on the same machine as the Discord app?

rpc connects to your local discord client

without that, no connection

past sundial

What should i use then?

nimble yarrow

wdym, you have to host it on the same machine where you use discord

past sundial
nimble yarrow

you cant use it on mobile either

past sundial

Uh...

nimble yarrow

and replit is still not local, replit is cloud based

past sundial
nimble yarrow

then you wont be able to use rpc

past sundial

Bruh ☠️

woeful kettle
keen grove

Discord can run on a raspberry pi ?

nimble yarrow

sure?

keen grove

Oh that must be new then, because I didn't find any discord package for armhf processors

nimble yarrow

oh

keen grove

I have a raspberry and I remember very well that I couldn't do that, so I was using the browser version. But maybe it has changed

nimble yarrow

there seem to be ways to get discord on a rasp

keen grove

(dpkg would throw an error like this package is for amd64 and not armhf)

Oh ?

nimble yarrow
keen grove

Oh.. I didn't know about that

nimble yarrow

no, its not, now stop

deft bear

How can I detect when I lose connection to Discord? The docs are down so no idea pepesad

pastel trench

RPC = Remote Procedure Call actually

(or Rich Presence Client for someone else)

Well, now you know thinKappa

nimble yarrow

Well, I highly suggest to read the rules again.
This is a support channel and not a shitpost channel.

lime needle

Can anyone help me?

node js is not working for me

smoky scroll
deft bear

I tried a try catch as this runs every 15 seconds:

        rpc.setActivity({ ...type });

but the catch was not triggered

chrome dew

Because you didn’t awaited it

Better to use .catch() if you don’t solve the promise (if it returns a promise)

sour tangle

what happend to the rpc docs?

nimble yarrow

reallyFckingPoof

sour tangle
nimble yarrow

nope

deft bear
chrome dew Because you didn’t awaited it

ok I tried awaiting it and putting it in a try catch

        try {
            // Check if the user is currently watching something and if not, run on a timeout.
            console.log(`${formatDate()} | ${chalk.red.bold.underline('Trakt:')} Not Playing.`);
            await rpc.clearActivity();
        } catch {
            console.log('lost connection to discord');
        }

the catch was not triggered, also tried put a .catch() and still, its not catching

I am really confused as to why though, surely you cant run an rpc.clearActivity() without discord

nimble yarrow

the client should automatically get terminated when it loses connection to discord

deft bear

Thats what I would think, but it just continues to log 'not playing'

I just started the script while Discord was closed, and then closed it after it ran:

nimble yarrow

where does it log closed discord now

deft bear

i wrote that

just to show when I closed it

nimble yarrow

remove your try/catch es and it should crash the app when it loses connection?

all of them

deft bear
deft bear

SOLVED

wooden crescent
deft bear **SOLVED**

If u dont mind me asking, how did u achieve that? Running into the same problem for quite a while now and docs hv vanished 🤡

deft bear

No idea if there is a better way, but we have no docs and next to no support for discord-rpc. and this method works fine for what I want 🙂

cobalt dome

Hello greetings, I have a concern about the "npm i discord-rpc-electron" I am trying to implement it but I get a module error, where should it point to?

nimble yarrow
nimble yarrow

thats discord-rpc and not discord-rpc-electron

deft bear
ornate needle

so there is a calender app called cron. i want to add rich presence to it myself. can i do that?

quaint sable

probably

depends if it supports extensions

or if u could find a way to detect if its running or not

ornate needle

its not open source

so i cant go into the code and add the files

quaint sable

well then im not sure

ornate needle

rip so i need the code then right

quaint sable

not really

it really depends on what u need to do with the rich presence

minor umbra

djs Archived to focus issues on #986520997006032896 and kept read-only to facilitate in-app search (CTRL+F) for solutions to problems that have already been asked.
Please tag your posts accordingly