#archive-rpc-help

21942 messages · Page 9 of 22

smoky scroll

i keep getting this error :

TypeError: rpc.SetActivity is not a function
wanton spoke

most javascript libs are camelCased including this one

use setActivity

smoky scroll

OO

it works thanks

arctic eagle

Hey, I have a slight problem. Here is my error:

TypeError: Cannot read property 'fetchAssets' of null```

and here is my code: 

```js
function init () {
  rpc.login({ clientId }).catch(console.error)

  rpc.on('ready', function ready() {
    rpc.application.fetchAssets().then(function doIt (assets) {
      assets.forEach(asset => {
        console.log(asset.name + asset.type)
      })
    })
  })
}```

Everything RPC related works fine, but I cannot fetch the application's assets.

arctic eagle

Come on <@&265426791538229258> help me

fresh crag

Do ppl even still have these roles

arctic eagle

Yeah like one person

Oh wait nvm

They used to

Not anymore

fresh crag

@arctic eagle

/**

* Authenticate

* @param {string} accessToken access token

* @returns {Promise}

* @private

*/

  authenticate(accessToken) {

    return this.request('AUTHENTICATE', { access_token: accessToken })

      .then(({ application, user }) => {

        this.accessToken = accessToken;

        this.application = application;

        this.user = user;

        this.emit('ready');

        return this;

      });

  }
arctic eagle

what

fresh crag

That's the only point where it gets defined to smthng

arctic eagle

oh

smoky scroll

When i run the rpc example it gives this error:


> electron example/main.js


npm ERR! code ELIFECYCLE

npm ERR! errno 1

npm ERR! discord-rpc@3.0.0 example: `electron example/main.js`

npm ERR! Exit status 1

npm ERR! 

npm ERR! Failed at the discord-rpc@3.0.0 example script.

npm ERR! This is probably not a problem with npm. There is likely additional logging output above.


npm ERR! A complete log of this run can be found in:

npm ERR!     /tmp/npm-cache/8.11.4/_logs/2018-09-06T10_25_48_898Z-debug.log```
fresh crag

@smoky scroll did u npm i

smoky scroll

yes

smoky scroll

This isn't RPC related.
Use the following link to generate an invite for your bot: https://discordapp.com/oauth2/authorize?client_id=CLIENT_ID&scope=bot&permissions=0 CLIENT_ID
Change the permissions number to a permission bitfield you want, but it doesn't mean it'll come with those permissions, as people can disable them.
Please move to #archive-offtopic for other questions.

thick forge

ok thanks, sorry I didn't really know where to ask it!

smoky scroll

how make this epsled?

<@&265426791538229258> please write

arctic eagle

Define the start timestamp instead of the end timestamp

smoky scroll

Can the web version of the api support Rich Presence?

nvm

The Docs are a wonderful haven of info.

smoky scroll

eeyup, nvm

fresh crag

@smoky scroll why would you @ everyone u selfish cunt

smoky scroll

sorry

turbid oliveBOT
lone totem

Is RPC example still working? When I run npm run example the script appears to work, but I do not gain any rich presence in discord

It just gives the generic "Playing Electron for xyz"

smoky scroll

what is discord-rpc?

?rpc

turbid oliveBOT

stands for rich presence client

smoky scroll

?discord-rpc

?docs discord-rpc

fresh crag

@smoky scroll read channel topic

smoky scroll

oh

rich presence

fresh crag

@lone totem i will have a look into it
even tho differening on my time i might only be able to view it on saturday

lone totem

@fresh crag thanks

that was a useless ping, sorry

fresh crag

@lone totem Okay i will actually have a look into it rn

seems fine for me

lone totem

Could it be something with osx? @fresh crag

arctic eagle

Try restarting Discord

lone totem

I did multiple times

My VScode rich presence was screwing with it somehow

craggy boughBOT
fresh crag

@smoky scroll not discordjs rpc related

smoky scroll

oof i forgot sorry

didnt see the channel

fresh crag

Thats why bot is sending d.js rpc github updates

smoky scroll

aight

reef brook

hi guys
How can i use Authorization URL in my website
?

smoky scroll
dapper island

Hello. Got an unusual circumstance

I'm working with DiscordRPC within electron and I am getting a transport undefined error.
However the transport is clearly defined
const richPres = new DiscordRpc.Client({ transport: 'ipc' });

lone totem

I'm having a weird issue with the example. I transferred the files to a different directory to test them with my code.
It all runs fine, except for the renderer.js file

So the html displays and it looks fine, but the snake isn't interactable

fresh crag

@lone totem how did u open the html

lone totem

Same way the example has it. Defined npm start as electron main.js

The html shows though, just the snake doesnt count up/react on click

tender cosmos

oooo

also same

rich fjord

@dapper island were u able to dodge issue #41? cuz i have the same problem

dapper island

I created a workaround

rich fjord

how

dapper island

Instead of loading it in a script within electron

I have the renderer call the JS in the webpage

rich fjord

oof

lmc

@dapper island fine i guess i'll wait for actual bug fix

craggy boughBOT
smoky scroll

Hi i try discord RPC but if i connected, i am a mistake :
Error: OAuth2 Error: invalid_request: Missing redirect URI.
how fixed this mistake ?

my code

  const {Client} = require('discord-rpc');
  const client = new Client({ transport: 'ipc' });

client.on('ready', async () => {
  console.log(client.user);
});

client.login({
  clientId: clientId,
  scopes: ['rpc', 'rpc.api', 'messages.read'],
  clientSecret,
}).catch(console.error);
smoky scroll

Help me pls ?

heavy wolf

How to set image ?

I have a code but don't work

smoky scroll

Send the code

fresh crag

@smoky scroll you cant use the messages.read scope without a restrict url

smoky scroll

@fresh crag i delete messages.read but always error

{ code: 5000,
     message: 'OAuth2 Error: invalid_scope: unknown error' }
fresh crag

@smoky scroll just leave the scopes part away then

smoky scroll

yes but after i want user spectate a game with discord rpc, style osu

fresh crag

what scopes are u using rn

smoky scroll

I dont know so i test

fresh crag

With wich ones do u test

smoky scroll

just with me, i create a game with nodeJs client and i try add extension discord rpc on discord for join and spectate a game

fresh crag

@smoky scroll What is in the Scopes variable rn

scopes: [....]

smoky scroll

scopes: ['rpc', 'rpc.api'],

just delete messages.read

fresh crag

Error code

5000

5000OAuth2 Errorsent when a standard OAuth2 error occurred; check the data object for the OAuth 2 error information

U defined clientSecret right

smoky scroll

clientSecret is define

fresh crag

Can u try without it

If it doesn't work add it back and make sure it's right

smoky scroll

it's fine

brittle panther

was directed here

not sure if this is really a lib question, but here goes anyways

this image (what i see) shows 5 hours elapsed, but it should only be like 30 seconds

{ top: 'Node E-4 D',
bot: 'none',
large: 'none',
small: 'none',
timestamp: '1537142492124' }

i do divide the timestamp by 1000 to make it in seconds. also i think that other people != me see this showing up correctly, but i myself dont. how to fix this problem?

on mobile and other peoples' clients it shows up fine

smoky scroll

FUCK

brittle panther

?

carmine mica

@brittle panther you don't get presence updates for yourself

lone totem

Is not updating presence for the user a limitation of rpc? Or something else?

lone totem

I found my issue with the renderer.js

Something about

webFrame.setZoomLevelLimits(1, 1);```
was killing it

replacing it with this fixes it. No idea why the example doesn't break with the same code

webFrame.setVisualZoomLevelLimits(1, 1);
webFrame.setLayoutZoomLevelLimits(1, 1);
brittle panther

@carmine mica but it worked at first when i was coding it; only after using it for a few days did it become like this

fresh crag

@brittle panther seems like discord bug

brittle panther

oof

plucky cargo

So umm how can i catch if the user closed Discord? (completely) or does that not work?

Or how can i "automatically" reconnect to the presence if you restart Discord?

brittle panther

if u get that error about unhandledpromiserejection i think that means they closed discord

smoky scroll

Noob question : what scopes is used for ? I don't understand how they work

plucky cargo

As i know it basically tells Discord "I want to access this and that from the user"

smoky scroll

oh ok thanks

plucky dirge

how create passport npm, oauth2

smoky scroll
trail haven

uhhh

brisk gull

can someone explain me what discord rpc is and a use case?

fresh crag

@brisk gull channel topic

brisk gull

Nah, I already looked at it, and I don't get it

plucky cargo

@brisk gull Rich Presence is a way to show what you are playing in Discord, it also allows for cool features like spectating, joining their Party etc, you can see a lot of examples like League Of Legends, Fortnite and many more

fresh crag

Remote Procedure Call (RPC) is a protocol that one program can use to request a service from a program located in another computer on a network without having to understand the network's details. A procedure call is also sometimes known as a function call or a subroutine call. RPC uses the client-server model.

plucky cargo

Any way to properly catch if Discord was closed? Or would i just run the .login function in an interval?

(to automatically reconnect)

drowsy coral

hey, is there a way to turn off rpc without closing app?

plucky cargo

You could clear the presence with .clearActivity() or you destroy the RPC with .destroy()

drowsy coral

theres a clearActivity() ?

plucky cargo

yep

drowsy coral

ooh

carmine mica

@plucky cargo good question

it looks like I only handle closing during login

can you open an issue on the github

plucky cargo

K

craggy boughBOT
drowsy coral

uh { code: 4000, message: 'No Client ID Specified' }

smoky scroll

look at pin

drowsy coral

oh thanks

still getting the same error though

smoky scroll

whatd you do

drowsy coral

changed
rpc.login(clientID).catch(console.error) to rpc.login({ clientID }).catch(console.error)

smoky scroll

clientID ThinkFish

clientId

drowsy coral

oh

thanks so much

smoky scroll

👍

cobalt wadi

Expected output: Starts the rich presence
Output: err
Error( s): js { code: 4000, message: 'No Client ID Specified' }

Code (config.json): json { "richpres": { "clientId": "censored", "noConsolePrompt": "false" } }
Code: (rpc.js): ```js
const DiscordRPC = require("discord-rpc");
const config = require('../config')

const ClientId = config.richpres.clientId;

DiscordRPC.register(ClientId);

const rpc = new DiscordRPC.Client({ transport: 'ipc' });

module.exports = rpc;```

Code (main.js): ```js
const rpc = require('./rpc')
const config = require('../config')
const ClientId = config.richpres.clientId

rpc.login({ ClientId }).catch(console.error);

//I wanted to keep this small, so i reduced it to the code that i think matters instead of having 200 lines of code```

This should, start the rich presence as everything is defined.

smoky scroll

ClientId

could literally read a line before your post for the answer

cobalt wadi

Ive read it over multiple times

smoky scroll

clientId

ClientId

carmine mica

lowercase c

cobalt wadi

😕 GWworkshopAkaShrug Thanks. If i may, when was it updated to that? As it was working fine just yesterday.

carmine mica

3.0.0

2 months ago

cobalt wadi

Hmm, i wonder why i didnt get the error before today.

drowsy coral

i think i might be blind. i cant find setActivity in the docs

carmine mica

you're not blind

drowsy coral

oh

craggy boughBOT
storm sable

Error: Could not connect

const ClientID = ('secret');
const rpc = new DiscordRPC.Client({ transport: 'ipc' });
const startTimestamp = new Date();

rpc.on('ready', () => {
    console.log("Loading... RPC is ready");
    setTimeout(() => {
        console.log(`testing`)
    rpc.setActivity({
        state: `test`,
        details: `test`,
        
        startTimestamp,
        
        largeImageKey: `ae_large`,
        largeImageText: `опа`,
        });
    }, 2000);
}, 5000)```
storm sable

What i need to do?

drowsy coral

u dont have login

storm sable

rpc.login({clientId: ClientID}).catch(console.error);

Same err

drowsy coral

rename your var ClientID to clientId

then have { clientId } for your options

also why does your setactivity have a , 2000 as the end

storm sable

Same err

Whatever i change

const clientId = "id"
const rpc = new DiscordRPC.Client({ transport: "ipc" })

const setActivity = () => {

if (!rpc)
    return;

rpc.setActivity({
    details: "test",
    state: "test",
    startTimestamp: new Date(),
    largeImageKey: "ae_large",
    largeImageText: "ona",
    instance: false,
});

rpc.on("ready", () => {
    console.log("Loading... RPC is ready")
    setActivity()
    setInterval(setActivity(), 5000)
})
}
rpc.login({ clientId }).catch(console.error)
            ^

ReferenceError: DicsordRPC is not defined```

Whats wrong?

carmine mica

man go away

storm sable

@carmine mica woah I just asking: what i doing wrong and what i need to change.

carmine mica

can you even read your own code

ffs

we're not here to teach you how "discord" is spelled

solid oracle

i played around with discord rpc a bit and stumbled upon the following error: ReferenceError: URLSearchParams is not defined. Source code is mostly copied from the example (https://discord.js.org/#/docs/rpc/master/general/welcome). URLSearchParams appears only to be available in a browser, while i want to run it in node.

carmine mica

URLSearchParams is a global in node

iirc >= 10

solid oracle

oh that might be a mistake. ty ill try that

yeah im still on v8

node v8.9.1 not v8 the engine

solid oracle

thanks, that worked :)

craggy boughBOT
craggy boughBOT
storm sable

(node:9212) UnhandledPromiseRejectionWarning: Error: OAuth2 Error: invalid_request: Missing redirect URI.

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

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

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

  rpcclient.selectVoiceChannel('%%%');
});

rpcclient.login({ clientId, scopes });```
carmine mica

@storm sable specify a redirect uri

storm sable

how?

fresh crag

Your using scopes wich need a redirect uri

warm geyser

I suppose the ID here is the application ID?

smoky scroll

Client ID

cobalt wadi

Is it possible to use the rpc library to construct a rich presence bit by bit?

const rpc = require('./rpc')
const readline = require('readline')
const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
    prompt: 'Would you like to set the state or details? '
})

rl.on('line', (line) =>{
    if(line == 'details') {
        rl.question('What would you like the details to be? ', answer =>{
            rpc.setActivity({ details: answer });
            console.log(`Updated your details to ${answer}`)
        })
    } else if(line == 'state') {
        rl.question('What would you like the details to be? ', answer =>{
            rpc.setActivity({ state: answer });
            console.log(`Updated your state to ${answer}`)
        })
    }
})```

I get the errror ```js
(node:9032) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'write' of null
    at IPCTransport.send (C:\censored\censored\censored\rpc2\node_modules\discord-rpc\src\transports\IPC.js:151:17)
    at Promise (C:\censored\censored\censored\rpc2\node_modules\discord-rpc\src\Client.js:152:22)
    at new Promise (<anonymous>)
    at RPCClient.request (C:\censored\censored\censored\rpc2\node_modules\discord-rpc\src\Client.js:150:12)
    at RPCClient.setActivity (C:\censored\censored\censored\rpc2\node_modules\discord-rpc\src\Client.js:509:17)
    at rl.question.answer (C:\censored\censored\censored\rpc2\main.js:42:17)
    at Interface._onLine (readline.js:285:5)
    at Interface._line (readline.js:640:8)
    at Interface._ttyWrite (readline.js:920:14)
    at ReadStream.onkeypress (readline.js:165:10)
(node:9032) 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: 3)```
smoky scroll

You could probably try a workaroundish method which would be all inputs set to null and updating them after an input by e.g. changing a variable and updating the presence

fresh crag

@cobalt wadi u need to use new RPCClient

Just requiring wont work

cobalt wadi

I have a fike for that

file*

fresh crag

How does it look

cobalt wadi
const DiscordRPC = require('discord-rpc')

const rpc = new DiscordRPC.Client({ transport: 'IPC' });

module.exports = rpc;```
fresh crag

Are you sure the client is ready @cobalt wadi

cobalt wadi

Yes

yesterday i forgot to have it log in.

craggy boughBOT
craggy boughBOT
unique bolt

is there a way to keep an RPC app running?

unique bolt

like without having an app or a site active from the client

smoky scroll

to make my rpc app(i'm using the example) to like log in into my acc i put my id or an id of an app i make on discordapp.com/developers

smoky scroll

How to get RPC?

opal sand
const DiscordRPC = require("discord-rpc");
const ClientID = 495983680859275264;

DiscordRPC.register(String(ClientID));
const RPC = new DiscordRPC.Client({transport: "ipc"});

RPC.on("ready", () => {
    console.log("ready");
    RPC.setActivity({
        details: "Details",
        state: "state",
        largeImageKey: "aura",
        largeImageText: "Large Image Text",
        smallImageKey: "profile",
        smallImageText: "Small Image Text",
        instance: false
    });
});

RPC.login(String(ClientID)).catch(console.error);``````bash
{ code: 4000, message: 'No Client ID Specified' }```
smoky scroll

check pins in this channel

opal sand

oh thx

smoky scroll

you're also likely to have issues with your id since you're not declaring it as a string. js doesn't support integers as large as discord snowflakes.

smoky scroll

How to get rpc?

carmine mica

@smoky scroll you gotta go to your local walmart

ask for doug

he'll take you into the back

go down the steps on the left

there you will find the rpc

smoky scroll

I don't understanding you

carmine mica

lol

smoky scroll

I haven't local walmart and what's it?

What the doug?

fresh crag

Reqd the channel description or use google

smoky scroll

?rpc

turbid oliveBOT

stands for rich presence client

smoky scroll

?rpc-help

craggy boughBOT
craggy boughBOT
smoky scroll
const clientId = '187406016902594560';
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 });```
Error: ```(node:910) UnhandledPromiseRejectionWarning: #<ErrorEvent>

(node:910) 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:910) [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.```
If I remove the `const RPC = require("discord-rpc");` the error dissapeares but it will say RPC isn't definied...
carmine mica

@smoky scroll use ipc not websocket

smoky scroll

did but now it says cant connect(i checked if the id is correct and it was and i did this with another code)

carmine mica

@smoky scroll is your discord client open?

smoky scroll

yes

const clientId = "ID"
const rpc = new DiscordRPC.Client({ transport: "ipc" })

const setActivity = () => {

rpc.setActivity({
    details: "aaaa",
    state: "aaaa",
    startTimestamp: new Date(),
    largeImageKey: "fbig",
    largeImageText: "Grinding defaults",
    instance: false,
});

rpc.on("ready", () => {
    console.log("Done")
    setActivity()
    setInterval(setActivity(), 5000)
})
}
rpc.login({ clientId }).catch(console.error)
 

            ```

@carmine mica ^ code

carmine mica

your set interval is wrong

as a side note

smoky scroll

ok but why it can't connect?

carmine mica

¯_(ツ)_/¯

are you on ubuntu 16.04

smoky scroll

nope

carmine mica

to be sure

you're running the rpc on the same computer that your client is on right

smoky scroll

@carmine mica ^

carmine mica

@smoky scroll it has to be on the same computer that your discord client is on

smoky scroll

ok ty

distant hearth

?rpc-help

?help

turbid oliveBOT
distant hearth

?rpc

turbid oliveBOT

stands for rich presence client

distant hearth

?rpc help

?help commands

turbid oliveBOT
distant hearth

?help rpc

turbid oliveBOT
sterile halo

?help npm

turbid oliveBOT
sterile halo

npm discord.js

?npm discord.js

turbid oliveBOT
sterile halo

?npm install npm@2.15.0

turbid oliveBOT

@sterile halo, Yukikaze couldn't find the requested information. Maybe look for something that actually exists the next time!

sterile halo

:))

?npm openldapjs

turbid oliveBOT
fresh crag
clear grotto

?npm discord.js

turbid oliveBOT
clear grotto

?npm I discord.ns

turbid oliveBOT

@clear grotto, Yukikaze couldn't find the requested information. Maybe look for something that actually exists the next time!

clear grotto

?npm I discord.js

turbid oliveBOT

@clear grotto, Yukikaze couldn't find the requested information. Maybe look for something that actually exists the next time!

novel oar

whats going on?

worldly iris

what discord rpc could help me in websites ?

plucky cargo

???

craggy boughBOT
craggy boughBOT
craggy boughBOT
wicked radish

node.js shows that discord-rpc module is not found even if I have it installed 😛

I can't tag the Dev role :(

carmine mica

AntsInEyes

wicked radish

Oh @carmine mica you're the main guy!

Maybe I know what can cause it

Wait a second for a pic

carmine mica

@wicked radish i don't see anything wrong

wicked radish

Weird

Bigger and better pic ^

carmine mica

oh you did -g

remove the -g

wicked radish

But I want it globally

carmine mica

that's not how it works

you can't require global modules

wicked radish

I can lol

carmine mica

no you can't

wicked radish

It works for other modules

carmine mica

no it doesn't

wicked radish

Buh, I'll try it without the -g but I can bet it'll not help

carmine mica

MarioFP

wicked radish

XD I am a dumbo

It worked, thx sneky!

carmine mica

:+1:

wicked radish

YouDidIt

wicked radish

@carmine mica Hey

Does the 'discord-rich-presence' library support image description?

carmine mica

yeah

wicked radish

How?

It's not mentioned in the documentation

@carmine mica

carmine mica

shrug

wicked radish

XD

It's not there

carmine mica

that's an example

not documentation

wicked radish

And where is the documentation if it isn't there? 😛

It isn't on GitHub either

wicked radish

@carmine mica

Sorry for tagging ya so much but I have the deadline for my project today lol

carmine mica

smallImageText

largeImageText

wicked radish

Thanks

You should include it publicly for other people too

orchid vector
const DiscordRPC = require("discord-rpc")
DiscordRPC.register("498930677484486656")
const rpc = new DiscordRPC.Client({transport: "ipc"})

let mainWindow;

rpc.on("ready", () => {

  rpc.setActivity({
       details: "Working with Electron",
       state: "Some random app tests?",
       startTimestamp,
       largeImageKey: "javascript-electron-logo-s",
       smallImageKey: "github",
       largeImageText: "Ye learing it",
       smallImageText: "Odar.xyz",
       instance: false
     })
})
rpc.login("498930677484486656").catch(console.error)

{ code: 4000, message: 'No Client ID Specified' }

smoky scroll

check pins in this channel

orchid vector

what opetions are therre

smoky scroll

literally what the pin says

orchid vector

secret?

client.login({ clientId: '1234567', clientSecret: 'abcdef123' })

smoky scroll

sure, at least for clientId, sicne thats where the option moved to

orchid vector

kk

thx

smoky scroll

thats not what it is, can you also keep irrelevant posts out of the channel

small mortar

how do i add the "elapsed {time}" to rpc

carmine mica

@small mortar add a start timestamp

torpid tundra

Hey I've never talked here but I immediately found what I was looking for because it's in the channel description

Wait maybe I did talk here awhile ago

but anyways

thanks for the useful discord GWfroggyPepoThumb

smoky scroll

alright

I wanna try this

I cant find the SDK

brisk crag

How to download and install discord.js on my PC

celest crypt

It is literally right on the discord.js page..
npm install discord.js

@brisk crag also this channel is for Discord Rich Presence

remote yoke

Hmm, I'm trying to get rich presence game invites to work, but the invite says the game isn't detected. I'm using Electron and the IPC transport. Any ideas how I can fix this?

smoky scroll

are there no typings for discord-rpc?

woah

don't do this to me

looks at any

smoky scroll

how does the example work? 🤔

it doesn't work when I run npm run example

worldly iris

what is RPC ?

i dont know any thing about it

fresh crag

@smoky scroll run npm i before

@worldly iris read channel topic

worldly iris

ok

but what can it help me ?

fresh crag

It can set your presence

worldly iris

bot dashboard or something

OH

i get it now

fresh crag
smoky scroll

@fresh crag lol....what why would you think I am stupid enough to not run that

fresh crag

At the methods

smoky scroll

🤔

worldly iris

RichPresenceClient

smoky scroll

that isnt what rpc stands for

lel btw it worked. Was problem with wsl

fresh crag

@worldly iris
RemoteProcedureCalls

smoky scroll

anyways, thanks

worldly iris

@fresh crag oh thx

short thunder

Role Play Chat

smoky scroll

ewwie

left folio

wow

ivory gate

RichyPresenceCat meow

smoky scroll

Can we please keep this shitposting outside of this channel, thanks.

craggy boughBOT
craggy boughBOT
smoky scroll

how do I install RPC i've literally read the thingy and can't get it to download

smoky scroll

like where tf do I find my assets/plugin folder

smoky scroll

Hi there. There is a code that adds this to your pfp and you can change it anytime you want. It's working for my friend but not for me.

Any Idea why please? I need one.

fresh crag

@smoky scroll show whats not working

smoky scroll

@fresh crag IT worked

Thanks!

smoky scroll

its possible to run rich presence without discordapp installed?

like in phone

rocky trellis

no rich presence is PC only

craggy boughBOT
craggy boughBOT
covert raven

I am currently having problems when I Authorize my app:

ReferenceError: URLSearchParams is not defined

My code is:

const userID = '473680755944456192';
const scopes = ['rpc', 'rpc.api', 'messages.read'];
const RPC = require('discord-rpc');
const Client = new RPC.Client({ transport: 'ipc' });

Client.login({ clientId: userID, scopes })
.catch(error => {
    console.error(error);
});```

oh

seems to work on Node v10

forget everything I just said

static token

Hey quick noob question, I'm not sure if this fits here though...
Would it be possible to read what game someone is playing or what they're doing and do something? For example something like:

    give.role
    } (just an example)```
heavy wolf

Work on my pc but on my phone I have that GWqlabsThonkery

smoky scroll

update your node version

heavy wolf

ok

remote yoke

lets you use rich presence join/spectate invites with the discord launcher

i'm using this with discord.js as a way to avoid any native module dependencies

carmine mica

neat

smoky scroll

@heavy wolf App Phone?

heavy wolf

Yes

craggy oyster

Any1 knows why i get

Uncaught (in promise) TypeError: Cannot read property 'write' of null
at IPCTransport.send (D:!veznan\veznan.source\node_modules\discord-rpc\src\transports\IPC.js:151)
    at Promise (D:!veznan\veznan.source\node_modules\discord-rpc\src\Client.js:152)
    at new Promise (<anonymous>)
    at RPCClient.request (D:!veznan\veznan.source\node_modules\discord-rpc\src\Client.js:150)
    at RPCClient.setActivity (D:!veznan\veznan.source\node_modules\discord-rpc\src\Client.js:515)
    at post (rpc.js:45)
    at HTMLAnchorElement.onclick (richpresence.html:44)``` (on my electron app)

const { Client } = require('discord-rpc');
const rpc = new Client({ transport: 'ipc' });

async function post() {
  const form    = document.getElementById("frm1");
  const res     = document.getElementById('res');

  if (!rpc) return res.innerHTML = `<h3 style="margin-bottom: -10px;">Response</h3><br /><pre style="color: red">Error: invalid RPC client</pre>`;
  if (!form['appId'].value || form['appId'].value.length <= 15 || form['appId'].value.length > 20) {
    return res.innerHTML = `<h3 style="margin-bottom: -10px;">Response</h3><br /><pre style="color: red">Error: invalid appId</pre>`;
  }

  let start     = form['startTimestamp'].checked ? new Date() : undefined;
  let structure = {
    start,
    state           : form['state'].value && form['state'].value.length >= 1 ? form['state'].value.slice(0, 50) : undefined,
    details         : form['details'].value && form['details'].value.length >= 1 ? form['state'].value.slice(0, 50) : undefined,
    instance        : false,
    largeImageKey   : form['largeImageKey'].value  && form['largeImageKey'].value.length >= 1  ? form['largeImageKey'].value.slice(0, 50)  : undefined,
    smallImageKey   : form['smallImageKey'].value  && form['smallImageKey'].value.length >= 1  ? form['smallImageKey'].value.slice(0, 50)  : undefined,
    largeImageText  : form['largeImageText'].value && form['largeImageText'].value.length >= 1 ? form['largeImageText'].value.slice(0, 50) : undefined,
    smallImageText  : form['smallImageText'].value && form['largeImageText'].value.length >= 1 ? form['largeImageText'].value.slice(0, 50) : undefined
  };

  rpc.setActivity(structure);
  return res.innerHTML = `<h3 style="margin-bottom: -10px;">Response</h3><br /><pre style="color: green">Your presence has been updated</pre>`;
}``` this is `rpc.js`
remote yoke

@craggy oyster you have to call login on the rpc client

craggy oyster

aahh

forgot about that

remote yoke

scopes aren't required for electron

craggy oyster

i added rpc.login({ appId }).catch((err) => { return res.innerHTML = <h3 style="margin-bottom: -10px;">Response</h3><br /><pre style="color: red">${err}</pre>; }); and i still get the same thing though

under setActivity, should it be above?

oh

i think

ok i forgot ready event

now it odenst erorr

but my presence is also not updated

maybe its cuz i try to do it iwth a button

and i have nothin about rpc in my main file

craggy oyster

@remote yoke would u know why

remote yoke

setActivity() also returns a promise

catch that and log the error

it's picky about what values you can set, so it might be a validation error

craggy oyster

okay

it didnt return anything, i tried setActivity(structure).catch(console.error)

remote yoke

you're waiting until the ready event callback to invoke setActivity()?

craggy oyster

i am

  Client.on('ready', () => {
    Client.setActivity(structure).catch(console.error)
  });```

but ill try to change some stuff

remote yoke

use rpc, not Client

craggy oyster

okay so rename Client to rpc

remote yoke

you want to use the instance of Client which you created

const rpc = new Client({ transport: 'ipc' });
craggy oyster

i already cahnged that part

to just const discordrpc = ...

i think its jsut the btn

carmine mica

hello

craggy oyster

Hello snek

It's somenthing with my button i think

yes it is!

It works fine if i do it in my main file

carmine mica

you can't start calling stuff before you're logged in

craggy oyster

So you cant put like a field with client id in it in a form?

craggy boughBOT
craggy boughBOT
silent inlet

hi ! Can we use the RichPresence to made a join request on form/discord? I've currently a bot, with it we moderate 2 discord servers and game realms (21). I would like create an automated process for recruiting new mods. I'm currently looking at RPC which can be really cool to open/close positions painless.

Then, i would like know if this kind of usage is possible and if it's against any discord rule.

carmine mica

if you can do it with the exposed api its probably fine

craggy boughBOT
tacit falcon

im having trouble installing this module can someone assist me please?

npm ERR! Error while executing:
npm ERR! undefined ls-remote -h -t ssh://git@github.com/discordjs/rpc.git
npm ERR!
npm ERR! undefined
npm ERR! No git binary found in $PATH
npm ERR!
npm ERR! Failed using git.
npm ERR! Please check if you have git installed and in your PATH.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\conne\AppData\Roaming\npm-cache\_logs\2018-10-31T19_55_16_414Z-debug.log```
carmine mica

install for windows

tacit falcon

already done that

smoky scroll

and added it to your environmental variables?

tacit falcon

?

carmine mica

then you're on your own

not a problem with this library

rose ether

?help

turbid oliveBOT
rose ether

?util

?Util

?npm

turbid oliveBOT

@rose ether, what would you like to search for?

Type cancel to cancel the command.

rose ether

cancel

turbid oliveBOT

The command has been cancelled.

smoky scroll

oh

that was hours ago

craggy boughBOT
craggy boughBOT
frail tiger

Lel

plucky cargo

rip

unreal bloom

Ola este servidor fala portugues?

rpc br?

smoky scroll

@unreal bloom nao

tawny nova

are there any typings for the library

carmine mica

@tawny nova no

tawny nova

fun

arctic eagle

I'll work on some when I get home later today

edit: i forgot

chilly elm

How do I detect if the client is closed, so I know to reconnect?

plucky cargo

I opened an issue once but for now I just catch if set activity fails for 10 times then I just run a login loop until connected

quaint sapphire

What is the difference between the IPC Transport and the WebSocket Transport?

opal sand

How can I check if an RPC client is logged in or not?

Specifically, I'm building an electron system tray app with two options for presence for two different games, but when I click the an option after having clicked the other one, the presence does not change. I'm suspecting that I'd have to do <RPCClient>.destroy()if the client is logged in before doing <RPCClient>.login() for the other presence.

const contextMenu = Menu.buildFromTemplate([{
        label: "None",
        type: "radio",
        click: () => RPC.destroy()
    }, {
        label: "Presence",
        submenu: [{
            label: "Ball Blast",
            type: "radio",
            click: () => {
                register("509134492212920320");
                RPC.destroy();
                RPC.login({ clientId: "509134492212920320" }).catch(console.error);
            }
        }, {
            label: "Captivator",
            type: "radio",
            click: () => {
                register("510261009647140864");
                RPC.destroy();
                RPC.login({ clientId: "510261009647140864" }).catch(console.error);
            }
        }]
    }, { role: "quit" }]);```

But, doing that returns this: bash (node:10831) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'write' of null

fresh crag

@quaint sapphire its 2 diffrent transport metods u can read abaut them online

quaint sapphire

@fresh crag I looked at the API docs and I didnt see anything about it. I looked for a while. Would you mind just telling me?

fresh crag

IPC - Inter-process communication
In computer science, inter-process communication or interprocess communication (IPC) refers specifically to the mechanisms an operating system provides to allow the processes to manage shared data. Typically, applications can use IPC, categorized as clients and servers, where the client requests data and the server responds to client requests.

So node.js talks to the Discord Client trough Windows

Websocket is over network so nodejs makes an webrequest to discord ( for whitelisted applications only )
@quaint sapphire

quaint sapphire

So is there any advantage to getting whitelisted to use a Websocket? @fresh crag

fresh crag

Yes

quaint sapphire

What are they

carmine mica

@quaint sapphire using a websocket is only needed if you're a website

the other thing that whitelisting does is give you access to additional rpc scopes

by default you can only do no-scope rich presence

quaint sapphire

Okay, thanks.

vapid nexus

Sorry, I didn't understand what this was meant for.

What is rpc? What do people use it for?

smoky scroll

check channel topic

vapid nexus

I have

The docs don't make it clear what this is.

And there's nothing in the example github page that would tell you either.

steady sparrow
cobalt wadi

Is there any reason this should be giving me a Invalid client id? Code: ```js
const Discord = require('discord-rpc')

const rpc = new Discord.Client({ transport: 'ipc' })

let ID = 'ID'

rpc.connect({ clientId: ID }).catch(console.error)```

ID has been replaced with the applications actual client id btw

arctic eagle

try rpc.login({ clientId: ID })

cobalt wadi

oh..

Right

Too used to eris

novel oar

how do you know if ```For now, RPC is in a private beta, which means that only apps that have signed up and been approved can access it.

im in it^

??

arctic eagle

If you signed up and received an email, which you didn't most likely. Rich Presence is still allowed, but the features like joining lobbies and stuff are in a private beta @novel oar

tawny nova

@arctic eagle THANK

craggy boughBOT
fallen condor

If you haven't signed up and been approved, you can't use it.

I'm not sure, I've never even tried, I'm just going off of what I've seen, maybe try google or something.

arctic eagle

@white shard give me the code you use at rpc.login, including the id (IDs aren't sensitive)

carmine mica

@smoky scroll call setActivity after you login

e.g. in the ready event

boreal stream
    if(id == '') {
        document.getElementById("ifMissed").innerHTML = "You have missing fields."
    } else if (state == ''){
        document.getElementById("ifMissed").innerHTML = "You have missing fields."
    } else if(details == '') {
        document.getElementById("ifMissed").innerHTML = "You have missing fields."
    } else if(large == '') {
        document.getElementById("ifMissed").innerHTML = "You have missing fields."
    } else if(small == '') {
        document.getElementById("ifMissed").innerHTML = "You have missing fields."
// ===
if ([id, state, details, large, small].includes('')) document.getElementById("ifMissed").innerHTML = "You have missing fields."```

wouldnt it be rpc.setActivity?

remote yoke

@carmine mica do you know of any common reasons why some users would fail to login using IPC? some windows users are failing to connect to the discord rpc pipe

carmine mica

@remote yoke i bet there's an actual error

remote yoke

i log the caught error and it's just an empty object 😬

carmine mica

sounds unlikely

remote yoke

hmm, might be because i'm logging to the renderer from the main process

carmine mica

¯_(ツ)_/¯

remote yoke

darn, thanks for your help anyway. going to search the web for a bit to see what i can find

urban ice

is there any method to deploy rpc on heroku server so can make it always running? It runs on terminal but doesnt on heroku with same code

arctic eagle

No, because you have to have Discord running on the same machine the RPC is connecting from. @urban ice

urban ice

okayy

thanks

smoky scroll

could someone give me a link to a guide on RPC

arctic eagle

There is no officially recognized guide

craggy boughBOT
analog tulip

@warm radish

How does a normal person use it then?

warm radish

read the channel topic for documentation and examples

analog tulip

?

That is for bots

smoky scroll

No it is not

we'll say it again: bots cannot use rich presence

analog tulip

I can use it for this account?

carmine mica

wow what a shitty api

arctic eagle

the whole reason the discord-rpc package exists is to make the discord rpc api easier to use while still providing all of the features. That isn't easy-rich-presence, that's limited-rich-presence.

carmine mica
brazen rivet

Do I have to submit a request for RPC access, or will it be automatically reviewed & I have to just wait?

likewise, will I never receive an access token(and thus not be fully authenticated) without RPC access, or is that just for authentication bypassing?

spare saffron

Quick question, How does rpc work exactly?

plush pumice

discord client opens a port

applications connects to that port and sends information on what to display

basically

arctic eagle

actually, pretty much completely.

urban ice

is there any instruction for getting RPC on bot?

plush pumice

bots and rpc are completely unrelated

also it's not possible for a bot to use rpc

urban ice

yesss I think so but

how can these bots have their own rpc

smoky scroll

that's not rich presence, that's just regular poor people presence

urban ice

hmmm dont know whats difference

oh

thank you

urban ice

ty it works

smoky scroll

How i can download Discord RPC Client?

storm sable

Check links in the title of this channel

smoky scroll

what is an RPC Client...
can anyone tell me please?!
i didn't get it actually when i searched google 😅

boreal stream

Really?

rpc seems fairly simple to google lol

smoky scroll

._.

Bruh.

boreal stream

Basically it just emulates the part of discord that means you get stuff like 'In fornite game with 20 players with 5 mins left'

That rich presence tile

and

smoky scroll

O thanks 😄

hot dust

Hello developers

If the discord application client id is public to everyone

Does that make any issues ?

and which is better to let it private or not ?

carmine mica

@hot dust it doesn't make issues

anywhere you need actual privacy, there is the client secret

young frigate

i

spare saffron

how does rpc work?

arctic eagle

Discord is installed on a PC, it listens on a port. You send data to that port and discord responds by setting the user's playing status to what you sent, as long as it is in the correct format. If another program is already sending data to the port, your program is ignored until that program is finished.

@spare saffron

smoky scroll

?softban 475640480294764575 ads

turbid oliveBOT

Successfully softbanned MOSTEER_ 17#1398

spare saffron

oof

left fjord

holy fuck

i hit emoji limit

NotLikeMiya

time to try on alt biggerLUL

omfg i'm dumb

i saved gif as a png fp

btw, for what is emoji.managed property?

torpid sentinel

ayy

lone garden

is there something like an idiots guide for rpc?

fresh crag

@lone garden its complex but hasnt that many features

An guide isnt really worth it

arctic eagle

rpc is not very complex

scenic crag

I managed to get rpc working locally, but not on the web. Is there a process for being able to use rpc on the web?

carmine mica

@scenic crag you need to be verified by discord

arctic eagle

Most rpc features are in beta

private

lone garden

Thanks got it working not nearly as configurable as I had hoped.

nimble crane

not configurable? it has full api coverage of rich presence for discord (i think), but ok

scenic crag

Who does one email/msg to get verified by discord?

arctic eagle

@scenic crag first you will want to use the features of rpc that you normally have to be approved for since you are the owner of the app. you can also add other accounts (with a verified email) to your app's whitelist to use these features. once you know the features you want to use are working with your application, you can most likely contact discord support. their email is not that hard to find.

then again, there is still no guarantee that you will be approved.

nimble crane

chances are you'll only get approved if you are a game dev (but not always) that made a cool game

left fjord

(Or quite popular)

twin flower

?help

turbid oliveBOT
twin flower

?npm

turbid oliveBOT

@twin flower, what would you like to search for?

Type cancel to cancel the command.

twin flower

yes

turbid oliveBOT
craggy boughBOT
smoky scroll
    at Socket.onerror (C:\Users\user\Desktop\asfg\node_modules\discord-rpc\src\transports\IPC.js:32:16)```
smoky scroll

?docs owner id

turbid oliveBOT
smoky scroll

Snowflake

?Snowflake

?serverinfo

turbid oliveBOT
smoky scroll

?info

?whois

?whois @smoky scroll

?info @smoky scroll

left fjord
static token

Someone just posted a great RPC guide in the discordapp subreddit

sharp stratus

?rpc

!rpc

😦

storm sable

@Pete#7391 if u need info about rpc - check topic of channel

madThoonk

twin flower

?help

turbid oliveBOT
twin flower

?tag

turbid oliveBOT

When you beg me so much I just can't not help you~
Check ?help tag for more information.

Hmph, you probably wanted to use ?tag show or something!

twin flower

?tag show

turbid oliveBOT

@twin flower, what tag would you like to see?

Type cancel to cancel the command.

twin flower

cancel

turbid oliveBOT

The command has been cancelled.

twin flower

?help tag

turbid oliveBOT
carmine mica

stop

twin flower

why ?

?tag show Test

?help

turbid oliveBOT
twin flower

?channel

turbid oliveBOT
turbid oliveBOT

Successfully kicked utku.js#3706

wintry dagger

@mint dew ping from dead channel

mint dew
cyan violet

what is the app ID?

this doesn't work...

smoky scroll

application ID

cobalt wadi

Is it possible to force the client to just disconnect so i can have it reconnect to a different developer application?

arctic eagle

call client.destroy() and create a new client

cobalt wadi

so like...

// Declare client, at top of file
let client = new Discord.Client({ transport: 'ipc' }) // Define client

// In the refreshclient function
client.destroy() // Destroy the client
client = new Discord.Client({ transport: 'ipc' }) // Make a new client
client.login({ clientId }).catch(console.error()) // Login, catch any errors
update() // My custom update function``` Or ```js
// Have the client declared already

// In the refreshclient function
client.destroy() // Destroy the client
client.login({ clientId }).catch(console.error()) // login with the client id, log any errors.
update() // My custom update function```?
carmine mica

I've never tested reusing clients

it should work in theory

arctic eagle

you can always, like, try the code you're typing @cobalt wadi

lost wind

So I have 2 instances of discord presences (using discord-rich-presence, but different app ID) running, but the newer one doesn't replace the previous one when activated.

lost wind

Anyone else do this?

arctic eagle

Discord's RPC documentation clearly states that something already connected via RPC holds priority until it disconnects. You would need a way to disconnect from RPC with the first app before you connect with the second one. A way to communicate between the apps would work.

@lost wind

lost wind

Hm...

smoky scroll

hello, MemberUpdate no longer works ? 😦

hard hatch

Huh? What do you mean?

@carmine mica you cannot re-use the client, we've found out the hard way... the connectPromise is never reset, thus the same is returned on other login attempts (say, after waiting a bit from it not connecting), which requires a full new Client or a manual connectPromise set to null before calling login again

carmine mica

@hard hatch sounds like a bug

open an issue

hard hatch

Will do

Although it should be an easy thing to pr?

carmine mica

yeah make a pr if you want

craggy boughBOT
hard hatch

@carmine mica so... call .destroy on close in the connect promise? calling that would throw cause socket is already dead tho...

native osprey

how can i let my bot leave a cancerous guild ?

upper galleon

what is RPC?

oof

okay

hollow dune
arctic eagle

no, it's intentional.

midnight osprey

No, that's how you spell the word "by"

smoky scroll

@native osprey find the Guild and do Guild#leave

?docs Guild#leave

turbid oliveBOT
native osprey

Already did it LMAO

smoky scroll

Although channel topic

left fjord

Also rpc != d.js

carmine mica

did you know you can use break outside of loops

@candid coyote eval a: { break a; }

candid coyoteBOT

@carmine mica

undefined
hard hatch

@carmine mica I think I got what you meant, you want to make the client require to be destroyed before it's reused. Issue is, it'll call this.transport.close, which will try to send a packet to a dead socket, thus erroring (cannot read property write of null or something)

surreal kestrel

i run client on vsc, what should i do next?

how can i apply rpc to visual studio code ?

smoky scroll

Download an extension for it.

surreal kestrel

this one?

smoky scroll

Nah i think it's by "noel"

Discord presence or something

surreal kestrel

:v oh

smoky scroll

Yes

surreal kestrel

where is URLSearchParams Thonk

hard hatch

Outdated vscode?

carmine mica

@surreal kestrel you need a later version of node

knotty trout
smoky scroll

@knotty trout Those user flags are not accessible to bot users: you need an oauth2 application.

knotty trout

oooh

ok thank you

chilly elm

Is it possible to set streaming with RPC? If so, please give example

hard hatch

You cannot afaik. Streaming is set by Discord when you're streaming to Twitch (and only works with twitch urls)

arctic eagle

Well Twitch uses RPC to show that someone is streaming. They use it via their API. They have their own (verified) discord app just like anyone else does. If you did set streaming from your own app, you probably wouldn't be able to get it verified, but you could use it. Just without buttons and stuff to click to watch.

And no custom status/colour

@chilly elm

chilly elm

@arctic eagle So I would not be able to use the purple status icon?

craggy boughBOT
craggy boughBOT
coral viper

https://i.imgur.com/AoafOme.png how big is the chance of me getting this verified so i can add a join button to my site?
I expect small but it would be awesome

arctic eagle

They wouldn't verify you for that

They would verify you if you had a game that let people join other peoples' games, or interact with others in general. Telling someone to join your website (aka something that only you would use and wouldn't be useful to the public) will never get verified.

fresh crag

@coral viper what would the join button do

coral viper

Just a clickable link, was worth trying

smoky scroll

hello

is there any way to get the list of discord application assets?

hard hatch

@coral viper afaik now anyone can add the buttons as long as you do it properly (we implemented it in our vscode extension)

coral viper

@hard hatch mind pming me your code? It doesnt seem to show up for me

hard hatch

Src/structures/activity I think

You need... A party, a join secret

coral viper

yeah i have those strangely enough

oh it works but im getting "is not detected" or something and im not receiving the event

coral viper

hope this isn't seen as "api abuse" though

ornate drift

welp

im having tons of problem with this part of my code

rpc.login({clientId: gameCache[new Number(placeId)].clientId || "client id in here" }).catch(console.error);

The problem is. if it runs the second time. rpc doesnt show

and i get this error

    at setActivity (/Users/nahh/Downloads/rblxRP-master/index.js:98:64)
    at Timeout.setInterval [as _onTimeout] (/Users/nahh/Downloads/rblxRP-master/index.js:125:4)
    at ontimeout (timers.js:427:11)
    at tryOnTimeout (timers.js:289:5)
    at listOnTimeout (timers.js:252:5)
    at Timer.processTimers (timers.js:212:10)
(node:12711) 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:12711) [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.```
carmine mica

@ornate drift new Number(...) returns a number object

are you looking for Number.parseInt()

ornate drift

no

carmine mica

also assuming gameCache[the numberified id] doesn't exist

you couldn't read clientId off it

ornate drift

It reads clientID when run into console

but not into rpc.login

carmine mica

@ornate drift the error is coming from gameCache[new Number(placeId)].clientId

which isn't part of my rpc codebase

so i can only offer guesses

¯_(ツ)_/¯

ornate drift

Okay thanks

carmine mica

wait actually

looking at that stack trace

@ornate drift index.js line 98

ornate drift

yep

thats the line

the rpc.login line

carmine mica

you're calling login inside an interval?

ornate drift

yes

carmine mica

don't?

ornate drift

any chances of changing rpc output when interval removed?

carmine mica

@ornate drift you can call setActivity multiple times

ornate drift

okay

carmine mica

you should only have one rpc instance running

and seriously stop using new Number

i can tell you now you'll never need to use new Number in your entire life long career as a js dev

ornate drift

okay thanks

smoky scroll
smoky scroll

nvm solved it

polar cave

Do we have the option to use anything but 'Playing' as an ActivityType now?

carmine mica

no

polar cave

god damnit

@smoky scroll May I inquire about this status app?

smoky scroll

sure

lol

polar cave

ooooo

i like

Had a friend ask me yesterday if this was possible, I said certainly but I'm not making it. I've got other things to make

lmao

Could you DM me details?

smoky scroll

yeah, i haven't built a binary tho yet

polar cave

sweet

Do you have a repo?

storm sable
polar cave

maybe

aSpookyDance

smoky scroll

no repo either yet, but soon, and we probs should move to #archive-offtopic, but rn i haz headake, so imma run the build and go slep

wispy dagger

@smoky scroll I remember reading somewhere that having "exclusive" rpc on "public" accounts is against tos, just something to consider lol

smoky scroll

thats not what i'm doing

brittle panther

i asked this a few months ago and got the answer "RPC doesn't update on your own computer," which might be right, but i'd like another opinion. i currently have an rpc application using the time elapsed feature:

however, the time elapsed shows up on my computer wrong (says there, 4:48:20)

but if u check from another machine, others' accounts, etc

shows up right:

is there way to fix this ffor my own computer?

because if i play games like league or something, it definitely does show up properly on my own computer

smoky scroll

That's a old bug that's just because discord can't parse timestamp s

brittle panther

Oof, any fixes?

smoky scroll

?softban @smoky scroll weird shitposting spam in multiple channels

turbid oliveBOT

Successfully softbanned 󠂪 󠂪 󠂪 󠂪 󠂪 󠂪 󠂪 󠂪 󠂪#4105

thorn nova

Why does RPCClient#user has a question mark before User? What does that mean?

left fjord

<?something> basically means, that this property can return that something (in this case User), or be undefined.
As an example you can take GuildMember.nickname

thorn nova

Oh

smoky scroll

can i use rpc on bots

inland wing

no

smoky scroll

var colors = require('colors');
console.log("Loading...".underline.green)
const RPC = require("discord-rpc");
const client = new RPC.Client({ transport: 'ipc' });
client.login({ clientId: '' }).catch(console.error)
client.once('ready', () => {
let presence = {
startTimestamp: new Date(1000)
};
client.setActivity(presence).catch(console.error)
console.log('loaded');
});

this wont work

clientId = he id of my discordapp developers application

smoky scroll

@smoky scroll did you forget to hide your client secret in main.js?

I know this was a while ago

smoky scroll

meh

ill reset it mmLol

craggy boughBOT
lost wind

How do I handle this promise when Discord is not found to be running on the computer?

lost wind

Do I need to put catch block everytime I call updatePresence?

arctic eagle

No, you don't try {} catch {} promises

Add .catch to the end of the call every time you call updatePresence

scarlet token

like this?

im learning js, thanks xDD

actually i dont need the error log for now

smoky scroll

.catch is only for promises.

silver ivy

?docs oauth

turbid oliveBOT
lost wind

So I have a function that is updating RichPresence...using catch gives me an error "catch on undefined"

lost wind

Here is what I am doing:

function updateDiscordRPC() {
  rpcClient.updatePresence({
      //Stuff
  });
}
updateDiscordRPC().catch();
arctic eagle

I would recommend using .catch inside of the updateDiscordRPC function, on rpcClient.updatePresence

lost wind

@arctic eagle When I do that, it gives me an error.

wraith crow

Hello guys 😄 I'm having a Transport is not a constructor issue (React CRA + Electron). Looks like the prob is the module being transpiled. Does anyone know how to prevent it? (without ejecting cra)

arctic eagle

Anything other than that? A stacktrace maybe?

lost wind

@arctic eagle

When using catch on rpcClient.updatePresence

shadow rapids

index.js line 54 and 196 @lost wind

lost wind

Have you checked the previous messages?

Those are the affected lines

shadow rapids

try to catch the ```JS
rpcClient.updatePresence({
//Stuff
}).catch();

lost wind

Yeah, doing that brings that error.

Without the catch, it works but gives me the unhandled promise error which I am trying to remove.

shadow rapids

But what error?

lost wind

Cannot read property 'catch' of undefined

shadow rapids

then remove the catch's

lost wind

Then how do I remove this warning every time Discord is not on?

Someone suggested to use catch, but that gives me the undefined error I mentioned previously

shadow rapids

i am going to test if i also get this

lost wind

Thanks

calm dragon

@lost wind you could put process.on(`unhandledRejection`, (reason, promise) => {}); somewhere, but that also affects all other unhandled rejections so idk if it's really too great

lost wind

@calm dragon Yeah, I knew about that, but I wanted a fine-tuned solution. Oh well, I guess I will just stick to that.

Anyways, I have another question: Is it possible to check if another app is broadcasting rich presence?

carmine mica

@lost wind you need to actually return the promise

you don't return anything from updateDiscordRPC

lost wind

Example?

carmine mica
function updateDiscordRPC() {
  return rpcClient.updatePresence({
      //Stuff
  });
}
updateDiscordRPC().catch(() => {});

if you don't return anything from updateDiscordRPC it will obviously be undefined

lost wind

Alright

carmine mica

and there's no such thing as undefined.catch()

lost wind

i see

Any thoughts on my other question?

Since the new RPC revisions on Discord will only show the first connected app

viral solstice

can anyone help me

i download rich presence and it open in WINRAR

left fjord

Not sure since when you are supposed to open .jar files as archives tho..

silver ivy

winrar supports jar files

try reinstalling winrar and u will see the supported file types

left fjord

What

Ofc it supports, why not, but you know, in general, .jar aren't archives with same purpose as .zip or .rar
Generally, you are supposed to run .jar files.

But ok, never had this particular archive

arctic eagle

@viral solstice this is uh JavaScript my dude gl

craggy boughBOT
craggy boughBOT
bleak zenith

Is there a guide on RPC? I was reading the docs on the discord api docs and it looked like it only worked with SDK. How can i as a user set my own RPC

smoky scroll

heya can anyone help why its not working

left fjord

Not working how

elfin rune

error? paste it

scarlet aspen

You can't use discord rpc on glitch

As there's no discord client running

hot sluice

iv never done this so could someone help me set this up

const clientId = '187406016902594560';
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 });```

im looking at the example but i dont know what to fill in the variables with besides my client id

scopes and 'websocket'

hot sluice

how do u set up rich presence settings

like the large and small images, etc

craggy boughBOT
chilly elm

I know you can set a custom playing with RPC, but can you set streaming?

subtle pond

Hey guys so, I need help I already installed discord.js and i am starting with discord.js, I made the default bot , when I run it, finds a error importing the module

const Discord = require('discord.js');

and its giving me all this errors

when i install it

silver ivy

it's only a warning

unless when you encountered a weird error in your bot

subtle pond

when i run

Linha = Line

and its a sintax error

It says that is a compile error from microsoft JScript

silver ivy

use nodejs

ohh shit...did u just used wscript?

subtle pond

I have been using discord.py, but the docs are kind of fucked and i prefer discord.js

@silver ivy Im new at java script xD

silver ivy

?resources

turbid oliveBOT
silver ivy

time to read

OMEGAlul

subtle pond

yeah, Im using the CodeCademy tot

silver ivy

you need to read those

subtle pond

but, so how to use nodejs?

I already installed it obv

silver ivy

command prompt

open the folder of your script
enter cmd at the location bar
press enter
node <script>

subtle pond

that cmd thing I know xD

fuck me xD

silver ivy

u really need to learn node

subtle pond

xD

silver ivy

just read

or other alternatives

subtle pond

?resources

turbid oliveBOT
subtle pond

I started it with node and it gave me all those errors

silver ivy

at least you already know how to use node

?ask

subtle pond

yeah xD

turbid oliveBOT

Don't ask if you can ask a question, just ask it! If someone knows the answer, they'll do their best to help.

subtle pond

?ask node

silver ivy

someone will answer you if you ask at the correct channel

quartz wren

Does anyone have a ticket system?

opal sand
craggy boughBOT
smoky scroll

how to make the teeth, eg how to type in! prefix & and then the user who entered it

quiet agate
const RPC = require('discord-rich-presence')(client.user.id);
    RPC.updatePresence({
    largeImageText: client.user.username,
    state: "▼ UPTIME ▼",
    startTimestamp: Date.now()+1337, //<-- returns 00:00
    largeImageKey: 'slothy',
    smallImageKey: 'sloth',
    instance: true,
    })```
novel oar
ReferenceError: window is not defined```
old fable

@novel oar define window

novel oar

wtf

all i did was 👇

const RPC = require('discord-rich-presence/browser')('id');
    RPC.updatePresence({
    largeImageText: 'Fallenthetaco',
    state: "Working On Music",
    startTimestamp: Date.now()+1337,
    largeImageKey: 'tacos',
    smallImageKey: 'js',
    instance: true,
    })```
old fable

what line is the error on

novel oar