#archive-rpc-help

21942 messages · Page 10 of 22

novel oar

i cant tell

old fable

who uses that

novel oar

doesnt seem to save

old fable

ah ok

its fine

novel oar

ye

old fable

i have no clue

novel oar

xD

left fjord

hastebin tends to die

?hastebin

turbid oliveBOT
thorn nova

I'm still somewhat of a noob at Discord Rich Presence... so bear with me plz; how would I incorporate a "join" button to my rich presence? I'd just like it to open a link in the default browser.

thorn nova

Also, what's the difference between RPCClient#connect() and RPCClient#login()

left fjord

as far as i understand, rpcclient.connect connects to the rpc (well, that's what docs say) and rpcclient.login logs app in. it also calls .connect itself if needed

hallow badger

Hmm - so I seem to be confused. Setting up djs-rpc in nodejs on electron. I have imported Discord like this:

import * as discord from 'discord-rpc';

And then followed the rich presence example to get things running. When I start the app, I get the error:

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

Clint id is being passed in and is set.

Also does there happen to be a d.ts file for djs-rpc floating around?

hallow badger

Found the issue...

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

Was what the demo had,

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

worked.

sage grove

So I thought it time to delve into RPC but am I right in suggesting that you still need a whitelisted app to be able to use it? Running into invalid origin errors using the sample code in the docs.

hallow badger

What are you doing in the RPC?

To just display game state and message no whitelist required

To do joining and spectating yes. You need to invite people to the app manually for testing, and when done go through the submission process to get the app unlocked so anybody can use it.

left fjord

@hallow badger Interestingly, those 2 lines ( { clientId } and { clientId: clientId }) are practically same.

hallow badger

@left fjord I figured out why 😂. I misspelled the variable. I wrote cleintId.

sage grove

Yeah I'm just doing statuses

But invalid origin is a thing

hallow badger

Do me a favor and copy line for line the rich presence demo

And fill in your app details

smoky scroll

Don't assist @smoky scroll, he won't listen to your help.

hallow badger

?

chilly elm

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

lunar schooner

it says

Invalid origin

What should i do now?

left fjord

definitely start with bit more context

craggy boughBOT
left fjord

there is asset limit per app, and I'm not sure if you can add assets using api

dire fox

does anyone can help-me ?

when i clear the chat

the bot

doesn't say the message " Chat limpo por .. "

plush pumice
dire fox

fuc u

is it ok ?

civic sedge
dire fox

s o r r y

brazen siren

Hi, is anybody know how works the createLobby function?
i can't make this one works :/ still dunno why
please help m_m

craggy boughBOT
thorn nova
C:\snapshot\Users\SinisterCyborg\Downloads\HammerRPC-master\node_modules\discord-rpc\src\transports\WebSocket.js:25
    );
    ^
SyntaxError: Unexpected token )
    at Object.exports.runInThisContext (vm.js:73:16)
    at Module._compile (module.js:543:28)
    at Module._compile (evalmachine.<anonymous>:0:0)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.require (module.js:498:17)
    at Module.require (evalmachine.<anonymous>:0:0)
    at require (internal/module.js:20:19)```
raw willow

thats a syntax error

elfin rune
smoky scroll

NSFW chanal

now

tribal sun
ebon sage

why am i getting Object {code: 4000, message: "No Client ID Specified"}
i've tried as an int
a string
still nada

(yes i've tried it as a string)

inland wing

login takes an object

ebon sage

on stable

not master

inland wing

there's only one rpc version

ebon sage

wai

oh

it didn't use to

ablobshake

ebon sage

why isn't this working

rpc.setActivity({
                ...
                timestamps: {
                    start: startMS,
                    end: endMS
                },
})```
new Date(startMS): Fri Feb 15 2019 21:47:50 GMT+0000 (Greenwich Mean Time) {}
endMS: 1550269036485.952
new Date(endMS): Fri Feb 15 2019 22:17:16 GMT+0000 (Greenwich Mean Time) {}```

i've tried converting it to int (parseInt)

smoky scroll

@fossil pilot ```JS
rpc.getGuilds().then(guilds => {
for (let index = 0; index < guilds.length; index++) {
const element = guilds[index];
console.log(element.name)
}
})

I put this on the ready listener

but it's saying Error: Not authenticated or invalid scope

same into the login callback

fossil pilot

I dunno, I don't use rpc, wait for someone to answer

smoky scroll

while authorizing i get back a code

but idk where i am supposed to use it

i mean it may be the auth2 code

glad pike

Hey guys Im having a quick question:
I developed a tool for RPC with Discord.js ( https://go.astrogd.eu/rpc Redirects to Github)
But strangely if I use the tool and set my Activity with RPC, My Status vanishes after some time and I need to trigger the setActivity again.
Is this a bug, or do I need to constantly set the Activity every like 2 Minutes or so?

cobalt wadi

Hello, when trying to login i keep getting this error code: { code: 4000, message: 'Invalid Client ID' }, the client id was taken directly from the applications general site, and the code is: rpc.login({ clientId }).catch(console.error) // Log in and catch any errors`

I have tried with two different codes, one of which i know for sure worked earlier this year, and that app has not been touched/deleted.

hallow badger

So running into this error with node...

npm WARN discord-rpc@3.0.1 requires a peer of register-scheme

when I try to do npm install, it fails saying register-scheme is missing

but I can't seem to install register-scheme

What is more, register-scheme is not listed as a dep on npmjs.com

Error: Unresolved node modules: register-scheme

hallow badger

It does show it in the package.json. Discord rpc runs fine without installing this dep - is this something that should be removed?

"peerDependencies": {
    "register-scheme": "github:devsnek/node-register-scheme"
  },
hallow badger

Ok so I managed to get it fixed, you need to call
npm install -g --production windows-build-tools
npm install register-scheme@github:devsnek/node-register-scheme
npm install

and everything works as expected

random spindle

What are the largeImageKey, smallImageKey, and smallImageText?

Nvm figured it out

long stream
root@dbotszhost-1:/home/hbot# npm i discord-rich-presence
npm ERR! path git
npm ERR! code ENOENT
npm ERR! errno ENOENT
npm ERR! syscall spawn git
npm ERR! enoent Error while executing:
npm ERR! enoent undefined ls-remote -h -t ssh://git@github.com/discordjs/rpc.git
npm ERR! enoent
npm ERR! enoent
npm ERR! enoent spawn git ENOENT
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2019-02-22T13_13_02_313Z-debug.log

why?

why i cant install this it makes no sense

next sapphire

Send the log

On my root it is working properly

royal hawk

you should have git installed

thorn nova

How do I go about adding "Ask to Join" to my rich presence?

rocky olive

Hello, is it possible to add rich presence to my bot ? I tried playing around with client.user.setPresence({}) but it did not seem to work properly (all it shows is the "Watching <string>" instead of the full rich presence tab that I was expecting. Would I have to create a different app, or is it possible ?

shadow rapids

Bots cant have Rich Presence

rocky olive

Alright, thanks 😃

craggy boughBOT
craggy boughBOT
left fjord

same as for supporting IE6
just why
especially when chrome likes to update itself in bg

arctic eagle

@carmine mica The trailing comma here is still against pretty much all coding practices, and you should aspire to make this code to work with as many environments as possible. Fixing this mistake would cause no loss to you, so why not just merge the PR? The only reason I see for the trailing comma is for cleaner git diffs, but that is rarely the case and isn't done consistently throughout the project.

south wren

How to find asset id?

Or can i use asset by name?

arctic eagle

@left fjord unlike IE6, Electron 2 is still commonly in use by many people. Also, Electron 2 was released on May 2nd, 2018. IE6 was released on August 27th, 2001. It is not the same at all.

The git diff to fix the problem is only +1 -1, so why is there a problem? It's not like the project is going out of its way for compatibility fixing this, it's just blatantly disallowing people using slightly older versions of Chrome from using it.

smoky scroll

\\

royal hawk

Whole thing is just one , god...

torpid elm

does anyone know how to modify presence of user ? (playing at <>, since <>, etc...)

arctic eagle

that's what this library is meant to do. check out the example in the channel description

torpid elm

why is the corresponding Discord user in the example app ?

arctic eagle

It's not. Are you talking about the ID? Replace that with your application's client ID, it needs it to provide the name of the application and select images

torpid elm

But who is affected by the program ?

arctic eagle

Whoever is running the program on their device. This code needs to be executed on the user's device. That's why its most common use is in electron apps. You will likely need to bundle node with your application, and that's just what electron does.

torpid elm

okay ...

craggy boughBOT
craggy boughBOT
eager apex

What isbrpc ?

smoky scroll

read the channel topic

lunar schooner

how will i make invites

smoky scroll

@lunar schooner message.channel.createInvite()

shell fjord

Excuse me, I have a question about discord-rich-presence:
https://www.npmjs.com/package/discord-rich-presence this one to be exact.
I'm pretty new to JS and I've kept searching for a way on how I might solve this. My problem is that I do not know, how I can reference the discord rpc to my JS (which is a chrome extension). What I want to do is: Get values from my chrome extension (done already!) and then display them in the RPC. I've downloaded the node module and have a folder with discord-rpc and a folder with "ws" for websocket I guess, but there are about 20JS files. How can I reference these to my chrome extension so that my main code can use the updatePresence() function?

shell fjord

anyone x-x?

boreal stream

do you have npm?

shell fjord

yes

I've got the package as well @boreal stream

It is also in my node modules

Now the question is how do I import this to my project? Since its a google extension, do I have to add every single .js file to the manifest.json maybe?

hard hatch

i..don't think you can use discord RPC in an extension

since it needs the client app

boreal stream

Yea it probably depends on node Looks like theres a browser version of discord-rpc no clue if rich-presence uses it

shell fjord

oof did I code this for nothing now aaaaaaaaaa

I thought I might run it in the extension

dapper yarrow

someone help me ?

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.

crisp yacht

im a bit confused rn.

const RPC = require('discord-rpc');
const clientId = 'CLIENTIDHERE';
const clientSecret = 'CLIENTSECRETHERE';
const redirectUri = 'REDIRECTURIHERE';
const scopes = ['rpc', 'rpc.api', 'messages.read'];

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

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

  console.log(await client.getVoiceSettings());
});

// Log in to RPC with client id
client.login({ clientId, clientSecret, redirectUri, scopes })
    .catch(console.error);

it doesnt auth properly and gives me the error invalid_client when it tries to exchange the code for an access token in the client#authorize

carmine mica

then its probably invalid

crisp yacht

if i remove the clientSecret it works fine

smoky scroll

it's possible to use discord.js rpc in browser addons?

left fjord

not like someone was answered to that like 10 messages above

craggy boughBOT
ornate orchid
const find = require('find-process');
var fs = require('fs');

console.log('LOG: Connecting to Discord Servers...')

const client = require('discord-rich-presence')('123');

console.log('✓ LOG: Connected to Discord Servers.\n')


var old_time = new Date();

function update () {
find('name', 'EXE#1', true)
  .then(function (list) {
      
    if (!list.length) {
        
      console.log('LOG: EXE#1 is not running!');
      process.exit(0);
      
    } else {
        
      console.log('✓ LOG: EXE#1 is running.');
        find('name', 'Discord', true)
            .then(function (list) {
            if (!list.length) {
            console.log('LOG: Discord is not running!');
            } else {
            console.log('✓ LOG: Discord is running.');
            
            }
            })
    }
  })
  
    var new_time = old_time;
    client.updatePresence({
        details: 'Loaded!',
        state: `Loaded!`,
        startTimestamp : new_time,
        largeImageKey: 'big_logo',

        instance: false,
      });
}
    setInterval(() => {

        update();
},15000);

im trying to achive when EXE#1 is isn't running nodejs project will close, then if EXE#1 is running its will continue to check if EXE#2 file is running if not it will run loop till EXE#2 is found, only then show RPC client.updatePresence.

pliant dove

I got no error now

but it doesnt work

tame tinsel

add **.catch(err => console.log(err); ** on the end of console.log(await client.getVoiceSettings());

subtle knoll

how i can retry connect to discord with you lib this work but its not very beautiful :

rpc.login({ clientId: clientId }).catch((error) => {
    var interval = setInterval(() => {
            rpc = new DiscordRPC.Client({ transport: 'ipc' });
            rpc.on('ready', () => {
                console.log('Authed for user', rpc.user.username);
                rpc.setActivity({
                    details: "In menu",
                    largeImageKey: "icon",
                    largeImageText: "Counter-Strike Global Offensive",
                    instance: false,
                    startTimestamp: new Date()
                })
                ready = true
                clearInterval(interval)
            });

            rpc.login({ clientId: clientId }).catch(() => { })
            rpc.connect()
    }, 3000)
})```
stiff cairn

Code is not supposed to be "beautiful"

and even less if you use javascript

subtle knoll

I dont think is a good way to retry using DiscordRPC.Client

crisp yacht

just make the thing a seperate function plus the ready event doesnt need to be repeated

just do rpc.login again

plucky cargo

I am trying to get "Ask To Join" to work but everytime i invite the channel or smth it says the game has ended ```JS
const scopes = [ 'rpc', 'rpc.api' ];
RPC.register(clientId);

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

client.on('ready', async () => {
client.setActivity({
state: 'Watching',
details: 'Something',
endTimestamp: new Date(),
largeImageKey: 'bestKey',
smallImageKey: 'play',
partyId: '7123498',
partySize: 1,
partyMax: 6,
joinSecret: 'MTIzNDV8MTIzNDV8MTMyNDU4',
matchSecret: 'MTIzNDV8MTIzNDV8MTMyNFF4'
});
client.subscribe('ACTIVITY_JOIN', function(stuff) {
console.log(stuff);
});
client.subscribe('ACTIVITY_JOIN_REQUEST', function(stuff) {
console.log(stuff);
});
var lobby = await client.createLobby(2, 6);
});

// Log in to RPC with client id
client.login({ clientId });``` (Ignore the test code)

left fjord

well

end timestamp is literally exactly same millisecond as when running code

plucky cargo

I know

Or is that the problem

?

left fjord

🤔

plucky cargo

pls say no

left fjord

it literally ends millisecond after that code being run

its... logic...

plucky cargo

Welp was testing out stuff so GWqlabsThisIsFine

Doesn't solve the problem anyways

subtle knoll
rpc.login({ clientId: clientId }).catch((error) => {
    setInterval(() => {
        rpc.login({ clientId: clientId }).catch(console.log)
    }, 3000)
})```
this don't work 😐 
error:```
Error: Could not connect
    at Socket.onerror (H:\dev\csgodiscord rpc\node_modules\discord-rpc\src\transports\IPC.js:32:16)
    at Object.onceWrapper (events.js:315:30)
    at emitOne (events.js:116:13)
    at Socket.emit (events.js:211:7)
    at emitErrorNT (internal/streams/destroy.js:64:8)
    at _combinedTickCallback (internal/process/next_tick.js:138:11)
    at process._tickCallback (internal/process/next_tick.js:180:9)```

when I open discord while this work

left fjord

wait, so you first launch rpc then discord?

subtle knoll

yes

left fjord

tried differently?

subtle knoll

i want to start my program and then if i open discord rpc connect to discord

left fjord

but you know that it connects to existing, and running discord client, right?

subtle knoll

huuun
that's why

icy python

whats the rpc thing?

i dont understand what it is

left fjord

that's rpc

basically

icy python

ohhhhhh

ok

i thought i could sneak in and bring in some cool features for my bot but i dont think i want this

thank u @left fjord have a good day!!

left fjord

nor you can

u2

icy python

oh

so it shows EVERYTHING im doing?

left fjord

uhm

icy python

i dont think id like that lmao

left fjord

wha

i mean, bots can't have rich presence

smoky scroll

oh man

i wish

@left meteor help

left meteorBOT
smoky scroll

@gleaming linden help

gleaming lindenBOT

@smoky scroll :: I've sent you a DM with the command list.

left fjord
plucky rapids

can anyone give me code example with rpc?

i want to get started in it

left fjord

cough channel description exists cough

plucky rapids

ok :>

nvm

xd

blissful yew

Can you give your bot a RPC status with this?

smoky scroll

no

cobalt wadi

Hi i am wondering if you can make a web app display a rich presence for someone. Is this possible?

crude pollen

how to get the application picture url in rich presence if you have the id?

plucky cargo

Is there a list of available commands? Because i can not find commands like "CONNECT_TO_LOBBY" on the official docs

turbid oliveBOT
subtle marlin

for presence can I set reset the timestamp when a variable is changed?

I've tried everything

haven't been successful

dry garden

yeah, you can

pretty sure u just change the timestamp in the setactivity

craggy boughBOT
craggy boughBOT
sand junco

I keep getting a could not connect error

spring ibex

im getting _closeMessage: 'Invalid Origin', message from trying to login

pastel sphinx

you use discord's web version?

real holly

Yup, i'm just bad.

You can ignore me.

totally didn't have status turned off

smoky scroll

is it possible to sent a message through the rpc?

cuz i want to make an interface where people can see the messages of a specific channel and also sent messages to that channel

the reading messages already works

feel free to tag me when you reply to me ❤

nocturne marlin

Anyone know if it's possible to update rich presence from a web app?

maiden frost

sure

just run a node server and have the webapp make requests to it

or do some server side rendering and package it together

nocturne marlin

The node server would need to be localhost though, right?

maiden frost

doesn't have to be

but usually requests are made from the same machine

nocturne marlin

Hmm... Having trouble understanding how my server would communicate with a clients localhost

A request from the users browser to my server will not trigger communication w/ the users discord client

I was contemplating somehow using OAuth, but I couldn't really tell how to use the rpc oauth perms. Either I'm not searching right or documentation was unclear

Likely the former

maiden frost

oh yeah duh, i forgot, the way i usually see it work is the server is distributed which is what actually "runs" the "game"

i have seen people do that with browser extensions

so you would have to run the "game" and then the browser extension makes requests to the local server or something

nocturne marlin

I've seen a browser extension which works together with a ran application (extension tells the app what youtube video is being watch, for example, and the app updates rpc)

maiden frost

right

if you were looking for a more streamlined experience you could probably make an electron app for it tho

nocturne marlin

In this case it's a webapp, so the "game" runs in the browser. I don't think it's feasible to have each player run a local application

Ehh that's outside the scope of our goals for the foreseeable future. But yes, that would enable us to use rich presence pretty easily...

maiden frost

yeah only because you said webapp, which is basically what electron was made for lol

sharp dagger

How do I clear the rich presence if I want to apply a new rich presence

const clientId = '565161122798370816';

DiscordRPC.register(clientId);

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

if(rpc.application) {
  rpc.destroy()
}

async function setActivity() {    
  rpc.setActivity({
    details: `Idle`,
    state: 'on Dot Browser',
    startTimestamp,
    largeImageKey: 'dot-large',
    largeImageText: `Idle`,
    instance: false,
  });
}

rpc.on('ready', () => {
  setActivity();
});

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

this is my code

and all I want to do is

        rpc.setActivity({
          details: `Browsing ${hostname}`,
          state: 'on Dot Browser',
          startTimestamp,
          largeImageKey: 'dot-large',
          largeImageText: `Browsing ${hostname}`,
          instance: false,
        });```

change the text to that

sharp dagger

pls someone

pine crater

Hey @sharp dagger, I was about to start working on RPC too.

sharp dagger

yeah

pine crater

I wish someone would help you, lol

sharp dagger

lol

pine crater

Remember me?

sharp dagger

No..?

past anvil

@sharp dagger i'm pretty sure that just using rpc.setActivity() will replace the old text with the new text

idk if this is what you want but you can use a loop to check a condition then change the activity like so:

const clientId = '565161122798370816';

DiscordRPC.register(clientId);

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

if(rpc.application) {
    rpc.destroy()
}

async function setActivity() {
    var details; 
    while(true) {
    
    if(condition) {
        details = "Idle";
    } else {
        details = "Browsing ${hostname}"
    }
    
    rpc.setActivity({
        details: details,
        state: 'on Dot Browser',
        startTimestamp,
        largeImageKey: 'dot-large',
        largeImageText: details,
        instance: false,
        });
    }
}

rpc.on('ready', () => {
    setActivity();
});

rpc.login({ clientId }).catch(console.error);
smoky scroll

?

i dont now

help

sharp dagger

that isn't rich presence

sharp dagger

@smoky scroll

craggy boughBOT
south gale

caveBob

meguFace

remote yoke

is it possible to know whether an app is whitelisted for RPC over websockets?

gritty harness

hey guys 👋🏻

me and a friend are currently trying to get rpc working in our game, but we can't quite get the events to trigger when pressing the "Ask to Join" button

and I got a few questions about lobbies. What do they do exactly?

gritty harness

oh wait, I think it was just his code being super dumb...

smoky scroll

madThoonk

smoky scroll

?softban 553332834194948121 shitposting/memeing in support channels

turbid oliveBOT

Successfully softbanned orrin#0626

jolly crag

What is RPC?

fresh crag

Read the Channel Topic ?

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.

Basically your node,js app can communicate with the Discord App

pastel sphinx

Not only nodejs app thonkening

fresh crag

Well good luck using discord.js in a C# app

pastel sphinx

Well, I talk about the whole RPC rn, he asked what RPC is, not help for d.js RPC

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

    console.log(client)

    client.subscribe('NOTIFICATION_CREATE', TestFunction)

});

(node:2560) UnhandledPromiseRejectionWarning: Error: Not authenticated or invalid scope
    at RPCClient._onRpcMessage (G:\DreamingBot Drive\DiscordChroma-v2\node_modules\discord-rpc\src\Client.js:171:19)
    at IPCTransport.emit (events.js:189:13)
    at decode (G:\DreamingBot Drive\DiscordChroma-v2\node_modules\discord-rpc\src\transports\IPC.js:134:18)
    at decode (G:\DreamingBot Drive\DiscordChroma-v2\node_modules\discord-rpc\src\transports\IPC.js:92:5)
    at Socket.socket.on (G:\DreamingBot Drive\DiscordChroma-v2\node_modules\discord-rpc\src\transports\IPC.js:120:7)
    at Socket.emit (events.js:189:13)
    at emitReadable_ (_stream_readable.js:535:12)
    at process._tickCallback (internal/process/next_tick.js:63:19)
(node:2560) 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:2560) [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.

how do i get authenticated or is it invaild scope?

lapis imp

tag me if you can help

severe rose

Is there anyway to fetch a discord rpc image url ?

pastel sphinx

Using a bot?

severe rose

@pastel sphinx correct

pastel sphinx

<User>.presence.game returns an Game

?docs Game

turbid oliveBOT
pastel sphinx

Then you just get the assets property

timber knoll

Does RPC rely on Node, or can I just run it in a browser? I'm creating a little bot that runs in Chrome so that I don't have to use my RPi for everything Thqnkqng

smoky scroll

🤔

pastel sphinx

The RPC needs access to the Discord app to connect to it, i don't think a browser let's you access it

odd trellis

hey. Is the activity property of message supported?

severe drift

Hello, Im using the example on github, which works perfectly fine. But when packaged into an electron app it is able to login but doesnt get to the ready event, any idea what could cause this

smoky scroll

How do you setup a richpresence??!

severe drift

consider looking at the documentation

there's an example right there

smoky scroll

ive looked

it confuses me

smoky scroll

why is there an error

const DiscordRPC = require("discord-rpc");

const clientId = '180984871685062656';

// only needed for discord allowing spectate, join, ask to join
DiscordRPC.register(clientId);

const rpc = new DiscordRPC.Client();
const startTimestamp = new Date();

    rpc.setActivity({
        details: "test",
        state: 'in slither party',
        startTimestamp,
        largeImageKey: 'snek_large',
        largeImageText: 'tea is delicious',
        smallImageKey: 'snek_small',
        smallImageText: 'i am my own pillows',
        instance: false,
    })
}

rpc.on('ready', () => {
    setActivity();

    // activity can only be set every 15 seconds
    setInterval(() => {
        setActivity();
    }, 15e3);
});

rpc.login({ clientId }).catch(console.error);
smoky scroll
leaden glacier

how can i put a image in the presence of the bot?

pastel sphinx

bots don't have access to RPC

sharp pawn

@smoky scroll use your own client ID

smoky scroll

@sharp pawn I Have but stll it doesnt work!

pastel sphinx

Isn't the client ID the one of the app you create on discordapp.com? Think_Hyper

smoky scroll

In discord API yes

undone flume

I cannot figure out how to use Discord RPC's Ask to Join thing. The docs aren't very helpful.

I already tried a few things like
client.sendJoinInvite(client.user) and

  id: '281134216115257344',
  username: 'some user',
  discriminator: '0849',
  avatar: '615a4a48507386799ff66f1b773c71cd'
})```
but i get errors like: 
Error: Invalid command: SEND_ACTIVITY_JOIN_REQUEST 
Error: no join request for that user

how do i get this to work?
undone flume

anyone?

craggy boughBOT
vestal sonnet

how to use discord rpc please

for set a presence to my bot

inland wing

Bots can't use rpc

vestal sonnet

😢

not even for a presence even if I change the ask to join

@inland wing

inland wing

Bots can have presences but not rpc

vestal sonnet

how do we please ?

@inland wing

inland wing

what

woven bluff

Connection is done through the Discord Application it just wont work

undone flume

discord rpc seems to have very little support

eager mural

Yeah because basically no one uses it

inland wing

And the people who do use it are often halfway decent anyway

past anvil

its more for people who make games and programs and want to link it to discord

craggy oyster

@smoky scroll It seems to be with 3.0.1, i tried my code with "discord-rpc": "^3.0.0-beta.10", and it worked perfectly fine, but with "discord-rpc": "^3.0.1", it didn't

smoky scroll

thx

It still doesnt work

craggy oyster

Hm

What are your code

Did you run yarn add discord-rpc@3.0.0-beta.10 or npm i discord-rpc@3.0.0-beta.10?

Running via the VScode console wont work btw

supple imp

hi... got question - is it possible to get user's mute/deafened states with RPC? I currently have working notifications when user gets new message but i don't know how to get those 2 states... I've tried with getVoiceSettings but i am only getting [Function: getVoiceSettings] in console...
The only way to check if user has changed his state is to subscribe to VOICE_SETTINGS_UPDATE event but that doesn't show actual mute/deafened status...

my code looks like this:

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

const clientId = 'client ID here';
const scopes = ['identify', 'rpc', 'rpc.api', 'rpc.notifications.read'];

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

client.on('ready', () => {

    console.log('Authed for user', client.user.username);

    client.subscribe('NOTIFICATION_CREATE', () => {
        console.log('New notification received');
    });

    client.subscribe('VOICE_SETTINGS_UPDATE', () => {
        console.log('Voice settings changed');
    });

});

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

@supple imp getting [Function: someName] means that you tried using function as a property. Like console.log(Math.random) instead of console.log(Math.random())

supple imp

probably last question - how do I resolve Promise? I've tried everything and it's either not showing me the result at all or it logs Promise { <pending> }...

If i somehow manage to resolve it, it logs whatever I write in resolve and not the actual state FeelsBadMan

supple imp

nevermind - i've found the solution - now I just need to get one line from the output instead of every single setting FIXED

eager mural

?promise

supple imp

can I get user speaking status with discord-rpc? ex. if I join vc:

clientRPC.subscribe('VOICE_CHANNEL_SELECT', async () => {
        console.log('Connected to voice channel');
    });```
I want to get user speaking status like with https://discordapp.com/developers/docs/topics/rpc#speakingstartspeakingstop
random spindle

Is there a way to set the rpc image from a url?

left fjord

if there would, there would be no point in having limited assets amount

smoky scroll

Does anyone know how to get a bot rich presence to change every 10 seconds? I’m using discord.js library

inland wing

bots cant use rpc

turbid oliveBOT

Successfully softbanned sasha#5644

gusty epoch
npm ERR! code ENOGIT
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.

Any idea why ?

i can install other modules

scarlet aspen

do you have git installed and is the executable in your PATH (environment variable)

basically what the last line says

gusty epoch

yes i have

warm radish

errors don't lie

ruby plank

how would i set up a RPC of my bot. i searched the Internet and it said nothing

scarlet aspen

you cant

ruby plank

Y?

scarlet aspen

idk if i got you correctly tho

so you want your bot to use this?

ruby plank

Wdym

left fjord

bots cannot have richPresence

ruby plank

but can they have a Custom games thing

left fjord

it's literally text

ruby plank

yea that what i mean

left fjord

nothing more

ruby plank

how does one set that up

left fjord
ruby plank

ok

glass wave
glass wave

^^ The same issue happens when running the example from github.

native frost

Please ping me if you're gonna reply, easier. thanks

native frost

Still "No client id specified" error

@scarlet aspen

scarlet aspen

no you you need a clientId property in your object

native frost

Elaborate?

left fjord

options is this object, not a property of an object

narrow cairn

yee

leaden kelp

I was wondering if the clearActivity removes the presence from the user. I'm currently using a different rpc client and just wanted to see if that's the case before I switch and test

instead of just showing "Playing X"

inland wing

yes

@leaden kelp

leaden kelp

thx

sullen mantle

For some reason I get "WebSocket is not a constructor" when using new Discord.Client({ transport: 'websocket' }); and "Transport is not a constructor" when using new Discord.Client({ transport: 'ipc' });
I'm using latest TypeScript and Electron v4.2.0, also Node v10

smoky scroll

Thonk

civic sedge

did you read the docs?

smoky scroll

yeah, but not work >(

sullen mantle

OKAAAAAY wtf

I think Webpack might be the problem

I just tested a simple js file that I started using node and it could set the RPC without any problems

sullen mantle

And another lul. I basically copied the source into my project and it works. Using it as a dependency though does not. lul

The only difference is, I rewrote it in TypeScript

hidden linden

is there djs rpc guide?

(please ping me on reply)

old fable

channel title

*topic

hidden linden

guide that explains

old fable
leaden kelp

The RPC client emits an error when it can't initially communicate to the Discord client (via ipc) which is good, but relaunching Discord it doesn't emit any errors when it's failing to communicate to the Discord client.

Nevermind this is issue #42

is there any work being done on this?

urban star

So, I wrote a very fake rich presence for Fortnite, but when I start it, I get these errors:

C:\Users\Axorian\Desktop\RPC>node .
(node:1848) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'write' of null
{ code: 4000, message: 'No Client ID Specified' }```

The ID is the exact ID from the Developer Portal and the code I have is:
```js
const DiscordRPC = require("discord-rpc")
const clientId = "582791418418954265";
DiscordRPC.register(clientId);

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

const start = new Date();

rpc.setActivity({
    details: "Battle Royale - In Lobby",
    state: "In A Squad",
    startTimestamp: start,
    partySize: 1,
    partyMax: 4,
    joinSecret: "thisisjustatestsecret",
    largeImageKey: "fortnite",
    smallImageKey: "tier",
    smallImageText: "Tier 45"
});

rpc.login(clientId).catch(console.error);```

I am not sure what i'm doing wrong...

Okay, now I just get the No Client ID Specified error.

I think I fixed it by using; rpc.login({ clientId: clientId }); which I found from the GitHub issues.

left fjord

you can also do rpc.login({clientId}) since { something: something } is equal to { something }

if you can't see the difference between this and your original code, login() takes object with client id inside.

@urban star

urban star

Ah, thanks. 😄

soft palm

Bots can't use rpc

smoky scroll

ive asked that so many times and never got a definitive answer

clear sigil

where can I get help about downloading "discord-rich-presence". npm i discord-rich-presence gives an error

left fjord

have you tried looking on channel topic?

clear sigil

where can I ask that

left fjord

have you tried looking on channel topic?

...and reading it?

clear sigil

just say the channel that I should ask help

left fjord

read

the

topic

please

clear sigil

whatever

craggy boughBOT
craggy boughBOT
sly wren

so discord rpc question in general: when a user authorizes an app to connect to their local discord client via rpc, do they set permissions on what it can do?

I'm looking through the docs discord has on this and am intrigued by the prospect of third party apps gaining authorisation to access your discord whereupon they can just read all your DMs

ah nevermind, found the scopes thingumy which controls access permissions

silver pecan

bh

n

n

plucky cargo

Are Join Requests still working with this library? Or do i need to move to the SDK for it to work? (If so did anyone get the SDK to work with node.js?)

carmine mica

@plucky cargo they should work fine

plucky cargo

Is there an example app using it? I tried it but was unable to do it ugh

probably too dumb lol

Welp gonna take a look at it later and report back

left fjord

i mean, there is example linked in channel's topic

plucky cargo

But its not using the join stuff as i remember

plucky cargo

I am unable to client.connectToLobby() When i pass the partyId & Join Secret, Discord "crashes"

inland wing

I'm looking at the docs and I don't see that client.connectToLobby exists

plucky cargo

yeah thats the thing

djs docs doesn't have it even tho it exists

discordapp's docs doesn't have it either

inland wing

well if djs doesn't have it, you can't use it Thinkeng

using djs that is

plucky cargo

Then why does it exist in the file in the first place

If i could i would use the SDK as its up to date but i need it in JS / a way to communicate with it

left fjord

any way to subscribe to MESSAGE_CREATE without getting 4006?

have messages.read in scopes, passing client secret to login (i yhink so at least), using client.subscribe() in ready event, yet all i get after authorization is 4006 for subscribe

ashen rampart

Is there a way to make someone join a discord using RPC?

I've seen it done but idk how

old fable

nope

oblique gorge

iirc you can have links in your rpc?

i think

if so just put an invite in there

unborn stream

UnhandledPromiseRejectionWarning: Error: OAuth2 Error: invalid_request: Missing "redirect_uri" in request. someone help me

old fable

add a redirect url you goof

unborn stream

whats a redirect url

old fable

goodness

unborn stream

yeah ikr

old fable

its on your application page

unborn stream

found it

what do i put there

left fjord

?oauth

turbid oliveBOT

Using the Discord API for authentication and data in your application: https://discordjs.guide/oauth2/

ℹ oauth2 is not a library functionality, you will have to implement this yourself based on discords documentation

unborn stream

so i will have a website running in the background whenever my rpc client is online?

smoky scroll

How I can make the bot mention all from my server, but not @cyan skyr yone,mentioning all like

@fir st

@t wo

@th ree

languid grail

Hello

const RPC = ("discord-rpc")
const clientId = 'ID'
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')
})
client.login({ clientId, scopes })
const client = new RPC.Client({ transport: 'websocket' })6:45 PM
                            ^
TypeError: RPC.Client is not a constructor

what am I doing wrong?

scarlet aspen

you're assigning a string to RPC

and string#Client is not a thing

languid grail

Sorry

scarlet aspen

probably meant to assign require('discord-rpc') to it

languid grail

....

But

(node:8497) UnhandledPromiseRejectionWarning: #<ErrorEvent>6:49 PM
(node:8497) 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)6:49 PM
(node:8497) [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.
gleaming temple

discord rpc program is completely broken today

it works client-side but won't show up on the web client or for anybody who isn't me

is discord rp being weird atm

not even EasyRP works

tried on 2 accounts with 2 separate applications

is nobody else having issues with rich presence because this is driving me insane

old fable

probs an api thing

gleaming temple

you don't need a discord developer application license to use custom rich presence now right

scarlet aspen

no

gleaming temple

apps made without a developer application license should work?

hmmm

smoky scroll

Thonk yes it should unless discord changes something without that anyone noticed it

gleaming temple

this is the only person i've found with my same issue

and it's almost 2 years old

and no real definitive solution that i haven't tried

smoky scroll
  1. thats old
  2. spotify already has its own RP
  3. discord is sometimes very weird on showing status
    eg: everyone see that you "playing visual studio code" but you see "listening to spotify"
gleaming temple

that's not the official spotify implementation

it's from before that existed

it's a custom application just like mine

and i know discord can be weird about it but it's never just flat-out refused to show my rich presence

for days

smoky scroll

yeah same maybe discord changes something for this you could ask in the official discord-api discord if they know something there but i think its just a Client issue/discord api doesnt send the update to other users

gleaming temple

alright i'll try the discord api discord, thanks for the suggestion

craggy boughBOT
craggy boughBOT
cloud tendon

i am new to this, but, will discord-rpc work with bots ?

smoky scroll

no

feral oriole

i have a command to show me in how many guilds my bot are , and i want to make to show the names of the guilds

but i don`t know how

someone to help me?

i need it faster

turbid oliveBOT
high summit

?docs Collection#map

turbid oliveBOT
high summit

@feral oriole

left fjord

@high summit nice, but next time, look if you are in appropiate channel, please feelsOKman

high summit

Yeah I was helping someone @left fjord

languid grail

Hey. How do i fix this?

(node:13478) UnhandledPromiseRejectionWarning: Error: Could not connect
const { Client } = require('discord-rpc');
const client = new Client({ transport: 'ipc' });
client.login(ID)
sterile ridge

Ты ж запускал батник и клиент на одной машине, да?

languid grail

@sterile ridge эмм.....

Забыл

scarlet aspen

What

languid grail

@scarlet aspen ?

manic plinth

?docs

turbid oliveBOT

@manic plinth, what would you like to search?

Type cancel to cancel the command.

manic plinth

cancel

turbid oliveBOT

The command has been cancelled.

smoky scroll

?help

turbid oliveBOT
native frost

?stats

turbid oliveBOT
native frost

Uptime 18h Thonk it just rebooted

scarlet aspen
native frost

o i didnt notice

oblique agate

Anyone know how to solve the net.createConnection is not a function issue

coarse violet

whats rpc for?

left fjord
honest rapids

hello currently I would like to make a musical bot for favors I pass the codes to stop jumping and start the music thanks

ruby lance

@honest rapids Please don't channelhop and keep the questions in #archive-rpc-help rpc related

crude pollen
3|animesoul  |     at Socket.onerror (/home/gibigbig/animesoul/app/node_modules/discord-rich-presence/node_modules/discord-rpc/src/transports/ipc.js:32:16)
3|animesoul  |     at emitOne (events.js:116:13)
3|animesoul  |     at Socket.emit (events.js:211:7)
3|animesoul  |     at emitErrorNT (internal/streams/destroy.js:64:8)
3|animesoul  |     at _combinedTickCallback (internal/process/next_tick.js:138:11)
3|animesoul  |     at process._tickCallback (internal/process/next_tick.js:180:9)
3|animesoul  | (node:29277) 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)
3|animesoul  | (node:29277) [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.
  rpc = require('discord-rich-presence')('530197265902731264');

    rpc.updatePresence({
      state: 'slithering',
      details: '🐍',
      startTimestamp: Date.now(),
      endTimestamp: Date.now() + 1337,
      largeImageKey: 'pres',
      //smallImageKey: 'snek_small',
      instance: true,
    });

any idea why its not working?

smoky scroll

hi guys, how to start to use RPC?

smoky scroll

im getting this error

nimble kiln

Does Discord RPC works directly on browser using this lib?

smoky scroll

can i put 2 token in one const?
if yes how?

left fjord

please do not cross post

you were already answered

fair rapids

hey! how do apps like spotify set the assets images in the rpc?
its always the current artist, no way that could fit in the max 150 uploadable assets, right?

lost wind

@fair rapids: As far as I know, only Spotify has that proprietary functionality (as well as the progress bars for songs)

fair rapids

aw

oblique agate

Yea hence why Spotify appears even when you have game activity display disabled

solar thicket

This module is confusing me..

What I have to do, if I have an existing bot with Discord.js and want to have more options for RPC?

inland wing

Bots can't use rpc

solar thicket

Oh wow - I was thinking that it's an extension of the existing presence status RIP

naive sonnet

Is there a way with discordjs - discord-rpc to get what voice channel I'm in and a list of all the users in that channel? I found in the api that it's possible to get it, however is it possible with discord.js?

ruby lance

You could get all members in your current voice channel via bot, after that you just have to setup a rpc and push the informations you want to display inside of the field.
So, it would work.
But I don't know if thats against the ToS in any way

dense magnet

#<CloseEvent>

ive made the application, and thats the correct id

smoky scroll
silver oyster

Is possible to display the users from a server on a RPC?

old fable
clear meteor

Is there a way to catch disconnect?

craggy boughBOT
silver oyster

Is possible to display the users from a server on a RPC?

trim umbra

yea

ruby lance

Not just with DJS-RPC

Setup a Discord.js bot that gets what you need, then display it with djsrpc

ruby lance
elfin bramble

Can an RPC client be reused after getting destroyed? It keeps logging Cannot read property 'write' of null whenever I try to use it after rpc.destroy()

silver oyster

@ruby lance how if you dont mind me asking?

I was thinking to use the data of the rpc client, which is a bot

but dunno how xD

ruby lance

Discord.js-rpc != Discord.js

silver oyster

ik.

ruby lance

Good

pastel sphinx

You can't have RPC with bots.

molten cedar

ZoomEyes

old fable

blobpin Bots are not able to use a custom/rich presence. This is completely out of the hands of Discord.js and in those of Discord itself. Will it ever be supported? no Ask Discord.

glossy fulcrum
molten cedar

thats pretty gay

ngl

fair rapids

hey! how do i set a "listening" status with discord-rpc?

smoky scroll

google it

fair rapids

@smoky scroll

= the question still stands

smoky scroll

google it more

sure u can find it somewhere

fair rapids

well that is incredibly unhelpful

why is this category called support center if im just told to google it? i havent found anything btw.

smoky scroll

noone uses rpc :c

fair rapids

why does this channel exist

smoky scroll

idk, but not many people use it

fair rapids

impossible, apparently. >:

left fjord

iirc you can't

last time i tried it was forced to be 'playing'

cloud tendon

isn't rpc not for bots ?

but the bot gets rpc when streaming twitch ?

left fjord

no it does not

smoky scroll

So I'm making my first RPC and I'm wondering how I would include the "Ask to join" button

cloud tendon
left fjord

what is the point of this screen?>

cloud tendon

it has got purple rpc thingy

left fjord

no no

that is not rpc

cloud tendon

i am stupid

xddd

left fjord

happens :p

fair rapids

hey, how to i make my rpc client just keep trying to connect if it fails? it currently just throws a promise exception when it fails to connect (because discord is closed) and stops trying.

( @left fjord )

clear junco

@fair rapids You can do .catch().then(Promise.resolve); to catch the exception. This should fix the Promise exception too. Afterwards, I'm not sure, I'm currently coding an RPC, and haven't thought of that yet. But, I think that should work. Once and if I do get to that I'll let you know if I find a solution.

fair rapids

Great, thanks! don't forget me please

narrow zinc

Hello, I'm creating a chat room game in javascript (node.js as a backend and javascript webgl as a front end in the web browser ) i got the log in with discord working using passport, but i cannot get the rpc working from the browser

ruby lance

Yeah, that isn't possible

You could create the whole thing as an Electron.js app

But web servers aren't able to connect to a users rich presence

narrow zinc

Ok, im jus curious about the line in the npm page
'In browser you can import/require it as discord-rich-presence/browser'

craggy boughBOT
vapid raptor

what is rpc to be used for?

smoky pivot

@vapid raptor look in channel description

vapid raptor

yeah, i see links

smoky pivot
vapid raptor

i see an example

i was there

and dont know what it does by the example

smoky pivot

It's the rich presence

You know how some games have like join / spectate features linked with Discord right?

vapid raptor

no

i didnt knew that

lethal whale

As an example

vapid raptor

i only know discord have the feature to see what you are playing

and be able to open the game

lethal whale

All this extra data comes from RPC

smoky pivot

Yeah, it basically gives better information for applicaitons

It's in closed beta though afaik

vapid raptor

soo the bot will be able to have his rich presence changed?

if i use djs rpc ?

smoky pivot

No, that's not it. It's about providing additional details to "Playing a game"

Let's just take an example, the devs of a game could integrate their API with the Discord RPC. For example if someone is playing CSGO you could make a rich presence that the user is playing (x) map for (y) long time with (z) score

lethal whale

It's not so much for a bot as for an end-user

Something with an RPC component is running on their machine and interacting with the Discord client running on the same machine.

Correct me if I'm wrong here.

vapid raptor

soo is like info that you send to discord from your pc and the discord display it?

lethal whale

Yes

However, you need a valid client ID for this and Discord is currently not giving them out to random people (closed beta)

pastel sphinx

Afaik, the client ID is only here to "enable" the Spectate and Join buttons

any application can have an RPC with infos about things like what map you play on, how many time you played etc, but only whitelisted apps for now will make your profile have the "Spectate" and "Join" button clickable instead of greyed out

left fjord

Client ID is to be able to use proper app on discord's side

digital lichen

What is djs-rpc for?

smoky scroll
old fable

read the pins

silver oyster

Can you display data from the bot to the RP?

golden shuttle

"only basic status message afaik"

clear junco

Bots can have a presence (as I like to call it). Which is just the title (under the name), like "!help" or "serving 238 servers". But no rich presence.

frozen cradle

I have a problem..
It's not with the RichPresence but with the Bot's game activity

I have try to make the activity change every 30 seconds, the code is right (without error)

client.on('ready', () => {
    let activityTypes = ['PLAYING','STREAMING','LISTENING','WATCHING']
    let activityText = [`${client.guilds.size} serveurs`,`${client.channels.size} channels`,'Poloin The Boss' ,'Mange tes morts']

    let randomType = activityTypes[Math.floor((Math.random()*activityTypes.length))]
    let randomActivity = activityText[Math.floor((Math.random()*activityText.length))]

setInterval(async ()=>{
    await client.user.setActivity(randomActivity, { type: randomType })
}, 30000)
})

But, he change just when the bot disconnect and reconnect..

Some one know why ?

proud sparrow

Because your doing it inside your client.on('ready' ) event

frozen cradle

Oh ! Yes I'm stupid, but I need to put it on what event ?

@proud sparrow

proud sparrow

Well, The simplest way would be to create a command

frozen cradle

I execute the command when the bot was ready and i say to the command to do my code ?

wind dirge

how would I install a npm package without all the peer deps

--no-optional doesn't work

wrong channel

👀

noble valley

nvm.

noble valley
noble valley

I am not asking for much, just that I'm able to see that example lol. After downloading that github page and doing npm install to install electron.js. I'm encountering error message in some src folder saying "..." operator isn't understood by the compiler

digital lichen

this?

noble valley

yeah I can't run example

@digital lichen

can you run that and show me the output?

digital lichen

wait

so you want me to install it and show you the output is it @noble valley

?

noble valley

if possible, yes please. I ran into an error

digital lichen

let me try

give me one sec

previously, it dropped an error, but that was because I w2asn't in the directory :P

noble valley

rip thanks for trying 😃

oh

craggy boughBOT
smoky scroll

Is there a way to edit rpc assets within the bot or similar?

native frost

Bots cant have rpc

left fjord

that was not even close to the question

@smoky scroll no, i don't think there's an endpoint for managing assets, but i may be wrong

old fable

you can datamine the endpoint and make raw api requests blobuwu

sudden tusk

Hi !
I noticed that a lot of methods are missing in the documentation website, the one who's in charge of it should update it !
e.g. : RPCClient#getRelationships doesn't appear on the website (https://discord.js.org/#/docs/rpc/master/class/RPCClient?scrollTo=getRelationships), although it's used here : (https://github.com/discordjs/RPC/blob/3444ac24d2f0d5f52f59207a8759d928207df0ad/test/rp.js#L45) and implemented here : (https://github.com/discordjs/RPC/blob/3444ac24d2f0d5f52f59207a8759d928207df0ad/src/client.js#L630)

plucky cargo

There are lots of things missing, like parties etc are in the code but aren't mentioned anywhere

smoky scroll

I'm getting { code: 4000, message: 'Invalid Client ID' } even though the client id I supply is the one on the developer portal, http://prntscr.com/ohq8pk why is that?

sudden tusk

I think you should send a screenshot of your code, it'll be more useful

boreal vector

^

smoky scroll

Sorry:

const DiscordRPC = require('discord-rpc');
const rpc = new DiscordRPC.Client({
    transport: 'ipc'
});
rpc.on('ready', () => {
    console.log(`Starting with clientId ${ClientId}`);
    updateActivity();
    setInterval(() => {
        updateActivity();
    }, 10e3);
});
rpc.login({ clientId: 'the id' }).catch(console.error);

It never does the ready event, just prints out that error

from the rpc.login({...

unborn stream

what is Presence.instance?

unborn stream

SOMEONE HELP MEEEEE rpc.getGuilds(); returns UnhandledPromiseRejectionWarning: Error: Not authenticated or invalid scope

scopes: const scopes = ['rpc', 'rpc.api', 'messages.read', 'email', 'guilds', 'rpc.notifications.read'];

noble valley

I hope someone will be able to help me. I have a generic RPC login through 'discord-rpc' library and I am getting error on 'ipc':

const express = require('express');
const RPC = require("discord-rpc");
const scopes = ['rpc', 'rpc.api'];

const client = new RPC.Client({ transport: 'ipc' });
client.login({ clientId: process.env.CLIENT_ID, scopes })
.catch(e => {
  console.error("=======================unable to login RPC");
  console.error(e);
  console.error("=======================unable to login RPC");
});

(edit: put scopes. same result)

unborn stream

in this channel, no one gets help

smoky scroll

I don't think anyone knows how to use it, probably due to the lack of documentation - I'm struggling to even use the library at all...

unborn stream

@noble valley try adding scopes

noble valley

I added scopes, but it didn't help. I feel like it may be because the project is hosted in the web, may be?

sudden tusk

I'm not an expert but I can try to help
@noble valley

  1. Maybe you should do : client.login ({clientId : process.env.CLIENT_ID, scopes : scopes})
    @unborn stream
  2. It seems you're not authentificated, can you send us a screenshot of code where you log in ?
unborn stream
const scopes = ['rpc', 'rpc.api', 'messages.read', 'email', 'guilds', 'rpc.notifications.read'];

rpc.on('ready', async () => {

    console.log('- Activated -');
    rpc.setActivity({
        details: `Hello random stranger!`,
        state: 'This is RPC.',
        largeImageKey: 'croc_surprised',
        largeImageText: 'This actually works',
        smallImageKey: 'moo_moo',
        smallImageText: 'Here is a pixel art cow.',
        instance: false,
    });
    setTimeout(async function() {
        var guilds = await rpc.getGuilds();
        console.log(guilds);
    }, 1000);

});

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

but the rpc works, just the guilds part fails, should i still do that?

sudden tusk

Honestly, I think you should because the client#login method take and object as a parameter
Maybe It won't solve the .getGuilds() issue, but it'll avoid others 😉

unborn stream

still same error

sudden tusk

Ok, well I'm gonna search on source code ...

sudden tusk

Didn't find something revelant ...
You can pass your timeout as a parameter of getGuilds() ...

Um...

sudden tusk

Maybe try to add your clientSecret to client#login method

unborn stream

how would i do that?

sudden tusk

({clientId : * , clientSecret : *})
Your client secret can be found on the developer portal

unborn stream

ok ill try that

unborn stream

nope didnt work

sudden tusk

I try my best to figure it out, but I'm not on of the devs so it's hard ^^
Do you have more details on the error message ?

unborn stream
(node:4940) UnhandledPromiseRejectionWarning: Error: Not authenticated or invalid scope
    at RPCClient._onRpcMessage (C:\Users\user\folder\node_modules\discord-rpc\src\client.js:171:19)
    at IPCTransport.emit (events.js:188:13)
    at decode (C:\Users\user\folder\node_modules\discord-rpc\src\transports\ipc.js:134:18)
    at decode (C:\Users\user\folder\node_modules\discord-rpc\src\transports\ipc.js:92:5)
    at Socket.socket.on (C:\Users\user\folder\node_modules\discord-rpc\src\transports\ipc.js:120:7)
    at Socket.emit (events.js:188:13)
    at emitReadable_ (_stream_readable.js:539:12)
    at processTicksAndRejections (internal/process/next_tick.js:76:17)
(node:4940) 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:4940) [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.

left fjord

@glossy fulcrum

glossy fulcrum

?softban @smoky scroll ads

turbid oliveBOT

Successfully softbanned ! ByK44N#0123

abstract plume

Good night,
It would have some code or command in lowdb. What causes the bot to import the data saved to the channel in discord?

<@&265426791538229258>

bronze sorrel

<@&265426791538229258> LOL XD

hexed python

OOF

just installed the rpc

turbid oliveBOT
hexed python

wtf

turbid oliveBOT
hexed python

omg

ez

so i just copied the example without the electron part

the setactivity works perfectly but selecttextchannel doesnt

weary zinc

Hey, do you mind if I ask?

hexed python

idk if it needs an o2auth authorization for this

weary zinc

Do you need to enable your game activity in order for it to work?

cause I've tried this before, didn't work for me

hexed python

idk 😂

weary zinc

well.. do you have game activity enabled right now?

hexed python

look at my profile thats ok

weary zinc

I meant if you turned this on

hexed python

of course it is

as its displayed

the presence is ok

i wanted to try another available method that could be easy to setup

selecttextchannel seemed perfect i just need to check if it has been changed on my discord client

and actually it doesnt work

lone totem

Is it bad practice to expose my discord rich presence client id?

weary zinc

Your bot's ID?

Don't expose any Client Secrets if that's what you mean

Client ID as in 575108662457139201

Is okay I believe, since anyone with Dev Mode enabled can get your bot account's ID

lone totem

Okay, thanks for the confirmation

Rewriting something and realised I had pushed it to github

The bot's id, that is

weary zinc

Yeah, just don't expose client secrets / tokens

Client ID is okay afaik

lone totem

Yeah, the reason I'm rewriting it is so I don't have to expose my API keys 😃

Which is a huge pita

weary zinc

could just put them in a .json or .env then require them and not include that .json or .env file in the repo

lone totem

That's how it is now

but I don't want to force users to create their own api key for ease of use

So I am making an API gateway so my electron app just hits that instead of the real api

weary zinc

Oh?

Could you elaborate a bit? I'm not too familiar with this whole djs-rpc thing Lol

lone totem

So the djs-rpc thing is fine, but the information I'm updating it with needs to be pulled from the bungie api

So I am making a server that the app pings and that returns the data so I don't expose my bungie api key

weary zinc

Ah, okay

lone totem
weary zinc

So basically linking a console platform to discord's rpc?

lone totem

Yeah basically

Because destiny doesn't have rpc, so I am making ti myself

weary zinc

afaik discord supports XBox as an rpc

lone totem

hmmm, I'll have to look into that...

I started this like a year ago when destiny 2 came out, but I think I just want to get this working 100% before I start looking at more complex rpc options

because the bungie api can let me hit pc/xbox/ps4 without any hassle

weary zinc

that's cool

lone totem

Thanks 😃

weary zinc

I'm currently writing a detailed documentation for my API, which is a pain in the ass cause I have extended versions and simplified versions

You can hmu when you finish your RPC, I'm really interested in the final product

lone totem

Will do!

writing documentation is definitely not my strong suit haha

weary zinc

Documentation is a pain if it's long

lone totem

Yeah

I've looked at some of the docs the devs I work with write, and jesus I could never do that

weary zinc

I can't say shit to be honest, D.js is long af

lone totem

like 50 pages of just tech jargon

weary zinc

Cause we're gonna get warned most likely

hexed python

so i just copied the example without the electron part
the setactivity works perfectly but selecttextchannel doesnt

after a few investigation it requires scopes or o2auth auth

stone cargo

hey

who know make bot confetti

left fjord

a what

stone cargo

Who helps me create a music bot?

left fjord

?rule4

turbid oliveBOT

When asking for help, make sure to provide as much detail as possible. Simply saying, "it's broke yo", or "how 2 make music bot" certainly won't get either of us anywhere.

left fjord

and that is not a channel for help with music bots

stone cargo

ok

hexed python

in the console the first line is the data payload before encoding and the second is the error returned

note that it works if i dont specify the scopes and it doesnt with any of them

idk what to do the payload corresponds exactly to the docs

the most wtf is that on my discord client theres no scope error they display correctly

stone cargo

anyone

hexed python

........

boreal vector

@hexed python show error then

weary zinc

afaik

hexed python

@boreal vector you dont know scrolling

boreal vector

You dont know how to read

Wrong scope

left fjord

1 per 3 people here have issue with that

(i mean, invalid scope)

hexed python

@left fjord you mean im not the only who this is happening to ?

if then have you any idea of how to fix it ?

theres nothing about that on google

left fjord

no, had similiar issue a while back, nad just gave up

it's here in this channel

hexed python

ah

actually im giving up too maybe discord should acknowledge this

The query which returns the error is AUTHORIZE to the localhost IPC (or rpc idk) server

So basically if I uninstall and install back Discord it could work Thonk

hexed python

finally fixed this just by inputing my own clientid @left fjord

left fjord

thonk

hexed python

just created my own app and provided its clientid

😂

left fjord

you know something for that?

hexed python

@left fjord idk

actually im getting this for my selectvoicechannel 😂

left fjord

PepeHands

hexed python

since i put rpc rpc.api and messages.read as in the example

maybe im gonna switch back to discord default

so that it would work idk

im gonna try some other methods

before

nothing works

🤦

still doesnt work

whoever has made discord rpc come 😭

lets try to add the client secret

¯_(ツ)_/¯

doesnt work anymore...

OMG

FOUND THE BUG

rllly

no fake

here it is undefined so it cannot authenticate afterwards

oof

so now we got the right url its unauthorized

fixed

yes

YES

EVERYTHINGS OK

@left fjord

😂

just fixed the lib

i can access the guilds

left fjord

OwO

hexed python

want me to tell the fixes ?

basically i changed only one thing

there were two problems from the example

  1. the redirect uri is required so in the example it should be provided and you should add 127.0.0.1 as default also
  1. the client secret is required too (else you get 401)
  1. (optional) the scope error that happened to uwuwu too idk what it was due to but it has been fixed by providing my own app client id
hexed python

Theres an error also

force does no longer exist

hexed python

Theres also a method missing

/**
   * Get the voice channel the user is currently in. Returns null if the user is not connected to a voice channel.
   * @returns {Promise}
   */
  getSelectedVoiceChannel() {
    return this.request(RPCCommands.GET_SELECTED_VOICE_CHANNEL)
  }```just made it
sudden tusk

@hexed python you should contribute on github !
It would be helpful !
Also, the website is out of date (generated in 2018) but the source code (see channel's decription) is better updated 😉

hexed python

@sudden tusk well I just posted it here so that the lib maker will be able to acknowledge these issues and gaps, and let'em make fix it better

sudden tusk

Yep true ^^
Quick question : how did you handle the unhandledPromiseRejectionError : not authenticated or invalid scopes ?

left fjord

you know, that whole monologue from ala most likely fixes that

and everything below

sudden tusk

I didn't notice their monologue was that long lmao
Ty i_couldnt_finish_the_project

Ala89, officially named most useful guy of the day 😂

hexed python

😂 lel

smoky scroll
waxen trail
left fjord

iirc you should use login instead of connect

smoky scroll

oh wait

waxen trail

^ client.connect doesn't take any arguments

smoky scroll

goddamit

thanks everyone lol

feels stupid rn tbh

weary zinc

It happens to the best of us

obsidian mirage

does anyone know what to set as large image?

as protocol i mean

i saw this for spotify spotify:034c9a257d1d8088357b74aa1c52da2b52296877

hexed python

@obsidian mirage its not a protocol

u need to pass the name of your image as defined in your app's params

as defined in your app's params

unreal meteor

Hello

smoky scroll

Hello, Can i get help please ?

smoky scroll

code block please

smoky scroll

Are you trying to run RP on some 3rd party service? @smoky scroll

smoky scroll

Yes, Can you use google translate i don't understand English :x @smoky scroll

English > French

No, I can't

weary zinc

I mean, you can translate it to french lol (Speaking to ODIS)

smoky scroll

To use RP you need to run the script with Discord client being opened on your PC

I activate the RP client bot but even with glitch or third console sa do not want to connect me. I have already tested everything, I even send an email to the team discord piur kind of situation, He said to me:
`
Hello Tim,

Sorry for the wait !

After turning to my team, it seems that the only solution is to go through a computer.
I know you do not have a computer, but it seems to be the only way. :(

Please excuse me for not being able to meet your expectations.
However, if you have other questions, I remain at your disposal!

Regards,
Benjamin
`
I ask a friend to make the same mistake as me

Not to sound bad, but I didn't understand anything

Is google translate

frosty heart

@smoky scroll

type it in french

smoky scroll

that just means you NEED to have a desktop to run RPC.

smoky scroll

tutrouvespas

deft mica

@smoky scroll Même si je suis en galère aussi parce qu'ils parlent tous anglais (😭) je peux peut-être t'aider ?

smoky scroll

Ouais, Tu peu aller en privé ? @deft mica

english only please

left fjord

it's not gonna be

you have to run that on pc with discord, running rpc on glitch will not work

hidden linden

And he also has some undefined variables

smoky scroll

Rpc works cuz discordapp makea a custom proxy server for it

craggy boughBOT
hexed python

Well brand new problem

const { code } = await this.request('AUTHORIZE', {
      scopes,
      client_id: this.clientId,
      rpc_token: rpcToken,
      redirect_uri: redirectUri,
    });``` here the rpc server replies that redirect_uri is not defined whereas it is totally

totally unable to authenticate with scopes

I used to make it work

hexed python

they dont even talk about the redirect uri param

hexed python

the source of the problem is from discord...

ptb

i think

oh maybe i fixed it

ye fixed

oof

once again the lib is outdated

sudden tusk

@hexed python
(Sorry for tag ^^)
How did you do to fix it ?

hexed python

I don't really know 😂 I fixed it on my improved version of the rpc but not on the normal version

One thing is sure : redirect uri has nothing to do here

I was comparing what my discord client was receiving and what my rpc client was sending, comparing it to the Discord client's rpc code and it started working at this moment

You know every rpc emits or incoming pings are logged in the console of your discord client

sudden tusk

Ok thanks ^^

noble sky

Any ideas on why setActivity may not be working:

  client.setActivity({
    ...activity,
    startTimestamp,
    endTimestamp,
  }).catch(console.log(activity, startTimestamp, endTimestamp));

will log:

Updating now...
Green Day Coming Clean 13.626000404358 94.813003540039 playing
{
  details: 'Coming Clean',
  state: 'Green Day',
  largeImageKey: 'tigitunes_jpg'
} 2019-08-08T22:45:28.071Z 2019-08-08T22:47:02.885Z

Just to clarify, it does login fine.

hexed python

@noble sky there seem to be no error here

Just log the error

Catch callback first param

slim pike

?

sudden tusk

@noble sky
If I've understood,
activity is an object which equals to

{
   details:'Coming Clean',
   state:'Green Day',
   largeImageKey:'tigitunes_jpg'
}```
Am I right ?
Then startTimestamp and endTimestamp have to be inside activity object
(According to doc example, which is old)
noble sky

Ah okay, thank you @sudden tusk. I will see if I can fix that.

smoky scroll

:OwO:

keen flax

lol what’s the thing about only being able to set rpc every 15 sec

left fjord

it's called rate limit

keen flax

Oh

left fjord

exists for a reason

keen flax

lol