#archive-rpc-help

21942 messages · Page 15 of 22

iron yew

(node:3152) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'name' of null

console.log('Logged in as', client.application.name); on this line

sacred ore

yea

just delete that

iron yew

Authed for user Mac

worked

now i need to make the details etc

sacred ore

yeeyee

iron yew

tyy

sacred ore

sure thats fine

iron yew

ty

sacred ore

its mostly from the example from the lib anyways so

iron yew

did u define DiscordRPC as like const DiscordRPC = require("discord-rpc")

sacred ore

yes

iron yew

yeah cause i get an err if i run that code
const rpc = new DiscordRPC.Client({ transport: 'ipc' });

DiscordRPC is not defined

sacred ore

in your code that would be RPC.Client btw

cuz i defined DiscordRPC as the lib, but you defined RPC as the lib

iron yew

no what im doing is im trying to just run ur code as plain

i removed the one i used for temp

sacred ore

let me see what you have currently

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

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


async function setActivity() {
  if (!rpc) {
    return;
  }

  rpc.setActivity({
    details: 'test',
    state: 'test',
    largeImageKey: 'large_image',
    largeImageText: 'lol',
  });
}

rpc.on('ready', () => {
  setActivity();
  client.log('success', 'RPC', 'CONNECTED!')

  setInterval(() => {
    setActivity();
  }, 15e3);
});

rpc.login({ clientId }).catch(e => { Client.log('error', 'RPC_ERR', e) });

(node:11000) UnhandledPromiseRejectionWarning: ReferenceError: Client is not defined on the last line there

sacred ore

console.log for you

client.log is my bots logging system

iron yew

im so dumb facepalm

yeah i realised it rn.. its so late and im almost falling asleep haha

hmm it said success RPC CONNECTED!

but i dont see the game

sacred ore

cuz vsc extension is in the way

disable it

iron yew

i dont even have it added, if i turn off the setting which says

Display current running game as status

would still show?

sacred ore

No thats not what i mean

in visual studio code

iron yew

ohhhh

1s

sacred ore

you have an extension

yeeye

iron yew

done

ou

looking noice

sacred ore

lmfao

iron yew

but the image didnt work LOL

sacred ore

ur using my client id

thats why

iron yew

wait really

sacred ore

yes

change client ids

to urs

lmfao

iron yew

OH YEAH LOL

I THOUGHT I CHANGED IT ROFL

signal locust

LMFAO

iron yew

there we go

iron yew

wait so i would need to keep vsc open all the time for it to be running?

sacred ore

i mean you could run it in pm2

iron yew

cant u run vsc in background

i mean im really messing with this and honestly its cool xd

sacred ore

just keep vsc open then

iron yew

yeah

i appreciate you alot man haha

u helped me so much xD

sacred ore

i went thru this shit when i tried to make mine tbh

iron yew
setInterval(() => {
    setActivity();
  }, 15e3);
});

this would refresh it every 15s?

sacred ore

yes, you dont need that technically, but ye

iron yew

can we dm cuz i wanna say smth but its not related to this

sacred ore

ye

signal locust
const RPC = require("discord-rpc");

const clientId = '800150138562543646';
const client = new RPC.Client({ transport: 'websocket' });
const scopes = ['rpc', 'rpc.api', 'messages.read'];

client.on('ready', () => {
    console.log('Logged in as', client.application.name);
    console.log('Authed for user', client.user.username);
})
    /*rpc.setActivity({
        details: 'kekw',
        state: 'testing',
        largeImageKey: '2',
        largeImageText: 'yep, this is a test'
      });*/

client.login({ clientId, scopes})

Error: (node:6616) UnhandledPromiseRejectionWarning: Error: connection closed

Ok I changed a few things and

Error:

error RPC_ERR Error: connection closed
    at WebSocketTransport.<anonymous> (C:\Users\user\Desktop\DTest\RPC\node_modules\discord-rpc\src\client.js:118:16)
    at Object.onceWrapper (events.js:422:26)
    at WebSocketTransport.emit (events.js:315:20)
    at WebSocketTransport.onClose (C:\Users\user\Desktop\DTest\RPC\node_modules\discord-rpc\src\transports\websocket.js:67:12)
    at WebSocket.onError (C:\Users\user\Desktop\DTest\RPC\node_modules\ws\lib\event-target.js:140:16)
    at WebSocket.emit (events.js:315:20)
    at ClientRequest.<anonymous> (C:\Users\user\Desktop\DTest\RPC\node_modules\ws\lib\websocket.js:579:15)
    at ClientRequest.emit (events.js:315:20)
    at Socket.socketErrorListener (_http_client.js:469:9)
    at Socket.emit (events.js:315:20)

Code:

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

const clientId = '800150138562543646';
const client = new RPC.Client({ transport: 'websocket' });
const scopes = ['rpc', 'rpc.api', 'messages.read'];

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

client.login({ clientId, scopes }).catch(e => { console.log('error', 'RPC_ERR', e) })
sacred ore

change websocket to ipc

where tf are people getting code that uses websocket?

signal locust

in the npm package example

im using browser

sacred ore

you cant

its whitelisted

signal locust

oof

sacred ore

but ig that example hasnt been updated

signal locust

thanks

sacred ore

rip

grim patio

var rpc = require("discord-rpc")
const client = new rpc.Client({ transport: 'ipc' })
client.on('ready', () => {
client.request('SET_ACTIVITY', {
pid: process.pid,
activity : {
details : "NeonCraft Minecraft Server",
assets : {
large_image : "nc",
large_text : "NeonCraft" // THIS WILL SHOW AS "Playing <Status>" from the outisde
},
buttons : [{label : "Join Now!" , url : ".gg/Zg9nTQ9y6h"},{label : "Info",url : ".gg/Zg9nTQ9y6h"}]
}
})
})
client.login({ clientId: '799980464357507102' }).catch(console.error);

help

error RPC_ERR Error: Could not connect
    at Socket.onerror (C:\Users\ChopChoP\Downloads\Custom Discord RPC\node_modules\discord-rpc\src\transports\ipc.js:32:16)
    at Object.onceWrapper (events.js:422:26)
    at Socket.emit (events.js:315:20)
    at emitErrorNT (internal/streams/destroy.js:106:8)
    at emitErrorCloseNT (internal/streams/destroy.js:74:3)
    at processTicksAndRejections (internal/process/task_queues.js:80:21)``` Error
tender musk

Djs RPC is for users or bots ?

vocal beacon

yk how some games set a status on your discord? this is for games that want to do that

tender musk

So I want to have custom RPC

for that ?

vocal beacon

well discord-rpc is the library that sets that custom status like "Playing <insert game here>"

tender musk

yeah

But if I want a custom status

Like

Playing dbd

etc

how do I do ?

vocal beacon

look at the docs

tender musk

Except 1 example

vocal beacon

hold up i think i can find some

tender musk

Okay

vocal beacon

...oh wait they don't have any lol

tender musk

oof

vocal beacon

they should really work on that tbh but you can pretty much sus out most of the functionality from that one example

tender musk

I wish there was any docs

tender musk
vocal beacon
tender musk

Yeah I saw

vocal beacon

this seems to be the code block in question:

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

i mean you can guess how to do it from there

although i did wish they had docs

sacred ore
tender musk Yeah I saw

status cant be custom, it will always say Playing ${application name}, all you can change is the sub text

details is shown first, state is shown second

idle cliff

Hey, has anyone ever used SET_USER_VOICE_SETTINGS to set user pan Object for spacial audio ? I've been trying to do that and the server seems to get my Pan object correctly according to it's response, but the audio doesn't change.
Any hints pls ?

terse shadow

Is ~80 MB of RAM usage for one RPC runtime normal?

sacred ore

prolly shouldnt tho, cuz my bot is doing rpc and being a bot, and its using abt 40

timber owl

is rpc bannable

left fjord

waitWhat

sacred ore
surreal hare

the example doesn't work and only gives me the following error


> discord-rpc@3.1.4 example /home/Pajsen/RPC
> electron example/main.js

Error: Could not connect
    at Socket.onerror (/Pajsen/RPC/src/transports/ipc.js:32:16)
    at Object.onceWrapper (events.js:291:20)
    at Socket.emit (events.js:203:13)
    at emitErrorNT (internal/streams/destroy.js:91:8)
    at emitErrorAndCloseNT (internal/streams/destroy.js:59:3)
    at processTicksAndRejections (internal/process/task_queues.js:77:11)
[12703:0118/083940.119640:ERROR:buffer_manager.cc(488)] [.DisplayCompositor]GL ERROR :GL_INVALID_OPERATION : glBufferData: <- error from previous GL command


any idea why?

my network is working as it should

sacred ore

thats an electron issue with gpu stuff, so just removing the electron part that you prolly wont use anyways will fix it

surreal hare

but my RPC doesn't update

even when I try the desktop app

@sacred ore

sacred ore

Like i said, the error youre getting ISNT an issue with the lib

its an issue with electron

which is what the example uses to make the little window that pops up

surreal hare

how do I fix it?

surreal hare
sacred ore

did you input your clients token

and also, is this running on your pc or on a vps

surreal hare

I changed the client ID and its running on my PC

@sacred ore

sacred ore

show the code

surreal hare
'use strict';

/* eslint-disable no-console */

const DiscordRPC = require('../');



// Set this to your Client ID.
const clientId = 'MYREALID';

// Only needed if you want to use spectate, join, or ask to join
DiscordRPC.register(clientId);

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

async function setActivity() {
  if (!rpc) {
    return;
  }


  // You'll need to have snek_large and snek_small assets uploaded to
  // https://discord.com/developers/applications/<application_id>/rich-presence/assets
  rpc.setActivity({
    details: `booped 1 times`,
    state: 'in slither party',
    startTimestamp,
    largeImageKey: 'snek_large',
    largeImageText: 'tea is delicious',
    smallImageKey: 'snek_small',
    smallImageText: 'i am my own pillows',
    instance: false,
  });
}

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

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

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

it's the example code without electron

sacred ore

so, is clientId your clients id, or its token

cuz its needs the id

surreal hare

It's client id I use

sacred ore

show it ( its not private btw )

surreal hare

747353451314544701

thats it

sacred ore

did u get this from github? or from npm?

wait nvm

do you actually have the pictures that are listed in your rich presence

snek_large and snek_small

surreal hare

yes

@sacred ore

surreal hare
surreal hare

@sacred ore

carmine mica

@surreal hare you can't use RPC from wsl

olive orbit

Wondering how to use the NoRequireDiscord? Or if that's outdated, how do I allow the application to run even if Discord isn't open?

Thanks!

carmine mica

@olive orbit norequirediscord in the official sdk starts a discord client inside your program

I don't have the capacity to do that

olive orbit

I see

So there isn't a way of just ignoring if Discord isn't open?

carmine mica

not sure what you mean

olive orbit

As in, at the moment, if I try to run my program, it'll say Error: Could not connect - I want it to connect if the Discord application is open, but if it's not open, ignore it and run the program anyway

carmine mica

add an error event handler?

that's not specific to rpc

that's just how eventemitter works in nodejs

olive orbit

I've tried catch but regardless of that it isn't working

carmine mica

client.on('error', () => {})

olive orbit
carmine mica

🤷

I'm not gonna give you a tutorial on how to handle errors in node

surreal hare

@carmine mica WSL?

sacred ore

were you trying to use that , or are you actually on linux

it seems like its WSL cuz gpu issues like that seem to occur when it cant find a display

like in WSL

grand star
(node:36764) UnhandledPromiseRejectionWarning: Error: connection closed
    at WebSocketTransport.<anonymous> (C:\Users\zaras\Documents\GitHub\SnailFM-Application\node_modules\discord-rpc\src\client.js:118:16)
    at Object.onceWrapper (events.js:282:20)
    at WebSocketTransport.emit (events.js:194:13)
    at WebSocketTransport.onClose (C:\Users\zaras\Documents\GitHub\SnailFM-Application\node_modules\discord-rpc\src\transports\websocket.js:67:12)
    at WebSocket.onClose (C:\Users\zaras\Documents\GitHub\SnailFM-Application\node_modules\ws\lib\event-target.js:136:16)
    at WebSocket.emit (events.js:194:13)
    at WebSocket.emitClose (C:\Users\zaras\Documents\GitHub\SnailFM-Application\node_modules\ws\lib\websocket.js:198:10)
    at Socket.socketOnClose (C:\Users\zaras\Documents\GitHub\SnailFM-Application\node_modules\ws\lib\websocket.js:886:15)
    at Socket.emit (events.js:194:13)
    at TCP.<anonymous> (net.js:593:12)
(node:36764) 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:36764) [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.

aa?

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

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

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

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

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

electron app

this code is in main.js

It seems I am missing something?

I just used the example 😂

const RPC = require("discord-rpc");
``` these things are at top too
rotund oasis

You don't need to require it twice

Although that won't fix anything

grand star

Alright; removed the double require.
So; whats the problem?

rotund oasis

I haven't used rpc so idk

grand star

-=-

Anyone..?

surreal hare
grand star

Why is the connection closed? Everything is defined correctly, this is stupid.

(node:36812) UnhandledPromiseRejectionWarning: Error: connection closed
    at WebSocketTransport.<anonymous> (C:\Users\zaras\Documents\GitHub\SnailFM-Application\node_modules\discord-rpc\src\client.js:118:16)
    at Object.onceWrapper (events.js:282:20)
    at WebSocketTransport.emit (events.js:194:13)
    at WebSocketTransport.onClose (C:\Users\zaras\Documents\GitHub\SnailFM-Application\node_modules\discord-rpc\src\transports\websocket.js:67:12)
    at WebSocket.onClose (C:\Users\zaras\Documents\GitHub\SnailFM-Application\node_modules\ws\lib\event-target.js:136:16)
    at WebSocket.emit (events.js:194:13)
    at WebSocket.emitClose (C:\Users\zaras\Documents\GitHub\SnailFM-Application\node_modules\ws\lib\websocket.js:198:10)
    at Socket.socketOnClose (C:\Users\zaras\Documents\GitHub\SnailFM-Application\node_modules\ws\lib\websocket.js:886:15)
    at Socket.emit (events.js:194:13)
    at TCP.<anonymous> (net.js:593:12)
(node:36812) 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:36812) [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.
const clientId = '574097225337012225';
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 });

lol; everything is perfect and I still get errors

smoky scroll

@grand star im pretty sure its ur wifi connection

grand star

wtf?

😂

I dont think so

its a local connection

not over the air

grand star

Coded it myself; it works now

gleaming cove

What is discord-rpc?

grand star

smh

smoky scroll

what is discord rpc?

grand star

oh my god

i swear

look a tthe docs

when you play a game

a status pops up

thats discord-rpc

also use google

that can help

(99.9% of the time)

smoky scroll

ok ok calm down

Just say Rich Presence @grand star

grand star

wht do you think rp stands for

😂

karmic jolt

except that it doesnt

rpc means "remote procedural calls", rich presence is only a part of what rpc can do

smoky scroll

ohhh @karmic jolt
Thank you for explaining

grand star

lmao

Sorry for false information 🙏

Should of faced check that.

I thought it was something about remote procedure calls.

smoky scroll

i have an issue
(node:6748) UnhandledPromiseRejectionWarning: Error: RPC_CONNECTION_TIMEOUT

little ermine

I'm trying to get RPC working from a Chrome Extension. Everything else is working, I have the packing set up (with rollup) etc. but discord-rpc doesn't work

I'm getting this error:

DOMException: Failed to construct 'WebSocket': The subprotocol '[object Object]' is invalid

at this line (it's in the browser.js file):

const n = this.ws = new o(`ws://${this.hostAndPort}/?v=1&client_id=${this.client.clientId}`,{
        origin: this.client.options.origin
});

Why the error occurs is pretty obvious I guess. o is window.WebSocket (i think... the file is minified) and window.WebSocket doesn't take an object with options but a list of subprotocols. If I just remove the origin header, the ws connection gets closed instantly (just as the discord rpc docs say)

my whole code here:

const rpc = require("discord-rpc/browser");

chrome.browserAction.onClicked.addListener(function (tab) {
    const clientId = "...";

    const client = new rpc.Client({ transport: "websocket" });
    const scopes = ["rpc", "rpc.api", "messages.read"];

    client.on("ready", () => {
        console.log(client.user.username);
    });
    client.login({ clientId, scopes }).catch(console.error);
});

Anyone an idea how to fix this? I tried using the not browser version (it uses ws instead of window.WebSocket so it should be possible to set the Origin header but I get some problems because of the electron dependency)

@carmine mica i'll just ping you because i think this is a library problem and not something i fucked up. not sure though ...

little ermine

.
it does not work in a "normal browser" (not in the chrome extension context) either, just tried, same error

sacred ore
little ermine

@sacred ore I might have misunderstood something. I thought using websockets was just a different way of communicating with the discord application? Is that wrong?
So, I can only use discord rpc with the "ipc" transport?

sacred ore

Yes you can only use discord rpc with the ipc transport, websocket will never work for people who aren't whitelisted to use it

And ipc will only work if you're running the application on the same computer that discord is running on

little ermine

Okay, thanks for clarifying that.
The application is running on the same computer but I guess I can't use IPC from a chrome extension. Thanks anyway :)

sacred ore

I mean it can probably be done, but if the chrome extension is coded to use websocket then probably not

little ermine
sacred ore

Ripppp

Sorry bout ur luck

olive orbit

and you can't add an EventListener on the RPC object

Anyone know how I can catch the error or simply allow use of the application with or without a connection?

sacred ore

how do you think you do, rpc.on('ready')?

and literally, handling errors is as simple as adding a catch

drifting mortar

@sacred ore so

how this can produce this :

UnhandledPromiseRejectionWarning: Error: Could not connect
at Socket.onerror

it's not a catch problem

sacred ore

is it running on the same pc as discord is

or on a server

drifting mortar

pc

i dev on my pc and discord is open or not on my pc

i handled the error correctly, i can go in my main() without any problem but it display an socket error and idk why

it should not try to connect if discord is close

sacred ore

so does it work when discord is open?

drifting mortar

yes

and i want to start my script even if discord is not opened but without this socket error

sacred ore

if u catch the error the code should just be able to continue

you shouldnt have to call main from inside the catch

iron yew

How did you manage to add buttons to your rpc? @sacred ore

i tried and i failed to do so

sacred ore
buttons: [ { label: " ", url: " " } ]```
iron yew

i thought i was wrong but

sacred ore

are you on master

iron yew

whats master

sacred ore

the master branch of discord-rpc

iron yew

uhh how do i know that

sacred ore

npm i discordjs/RPC

iron yew

i use discord-rpc

iron yew
sacred ore

what error

iron yew

failed to install or smth

sacred ore

send the actual error

iron yew

dont know what that even means honestly

@sacred ore ^

sacred ore

do u not have git installed on ur computer?

iron yew

ah no i dont

sacred ore

you can just install it from here and put it in node_modules

iron yew

like download that file?

sacred ore

yea download the repo and put it in node_modules

iron yew

so would it just be
const DiscordRPC = require("discord-rpc"); still?

sacred ore

yes

everythings the same, and you can use buttons

iron yew

oh so this is better?

sacred ore

its more updated

iron yew

ahh

sacred ore

the only bad thing about install master branches is you dont fully know that its stable

but for the most part , master has been stable for me so

iron yew

oh

ty

hollow totem

How do I enable Buttons (ask to join) ?
And where can I find the complete list of options that can be in the options object of setActivity() ?

sacred ore

heres a full list

use secrets for ask to join

hollow totem

And what's the instance option ?

sacred ore

dunno exactly , check discord dev documentation

smoky scroll

i need help
Error: RPC_CONNECTION_TIMEOUT
when i starting index.js

sacred ore
smoky scroll

sometimes

sacred ore

that just means you tried to connect to many times

smoky scroll

im refreshed discord, it now works

thx mate

im clicking buttons but its not redirecting me

sacred ore

they only work for other people, you will not be able to click them

they work for me for example

smoky scroll

oh

sacred ore
smoky scroll

yes

sacred ore

alr, well they work

smoky scroll

👍 thanks

shell leaf

my rich presence isnt showing up

const BaseEvent = require('../utils/structures/BaseEvent');

module.exports = class ReadyEvent extends BaseEvent {
    constructor() {
        super('ready');
    }

    async run(client) {
        client = require('discord-rich-presence')('784581764105633803');

        client.updatePresence({
            state: 'slithering',
            details: '🐍',
            startTimestamp: Date.now(),
            endTimestamp: Date.now() + 1337,
            largeImageKey: 'tooltip_large',
            smallImageKey: 'tooltip',
            instance: true,
        });
    }
}
dense forum
Error: connection closed
    at IPCTransport.<anonymous> (C:\Deskstop\AUB BOTS\Hideaki-Beta\node_modules\discord-rpc\src\client.js:118:16)
    at Object.onceWrapper (events.js:422:26)
    at IPCTransport.emit (events.js:315:20)
    at C:\Deskstop\AUB BOTS\Hideaki-Beta\node_modules\discord-rpc\src\transports\ipc.js:137:18
    at decode (C:\Deskstop\AUB BOTS\Hideaki-Beta\node_modules\discord-rpc\src\transports\ipc.js:92:5)
    at Socket.<anonymous> (C:\Deskstop\AUB BOTS\Hideaki-Beta\node_modules\discord-rpc\src\transports\ipc.js:120:7)
    at Socket.emit (events.js:315:20)
    at emitReadable_ (_stream_readable.js:569:12)
    at processTicksAndRejections (internal/process/task_queues.js:79:21)```
mental urchin
dense forum

wait i am using ipc ig

mental urchin

Yeah, you are (didn't read the full error)... lmao try using websockets instead of ipc then?

mental urchin
dense forum

rpc.login(config.Client_Id).catch(console.error);?

i am new to rpc

mental urchin

Yeah, okay you need to do:
.login({ clientId: <ClientID> });

dense forum

thanks

dense forum
   rpc
    .setActivity({
      details: config.Rich_Presence.details,
      state: config.Rich_Presence.state,
      largeImageKey: config.Rich_Presence.file_bannername,
      largeImageText: config.Rich_Presence.bannername,
      smallImageKey: config.Rich_Presence.file_username,
      smallImageText: config.Rich_Presence.username,
      instance: false,
      partySize: 0,
      partyMax: config.Rich_Presence.maxpartysize,
      startTimestamp: d1,
      endTimestamp: d2,
    })``` nothing visible on the bots profile

why?

velvet wave

is it possible to set the image as a url?

karmic jolt

no

rancid fossil

how can i do my Rich Presence Visualizer for my bot in the statues

clear cipher

u cant

smoky scroll
dense forum

oh

iron yew

I used the rpc master version and the buttons shows up but when i click it, nothing happens.

I even use someone elses code and it didnt work so is it smth with the npm?

@ me if u reply

karmic jolt

you can't click your own buttons

iron yew

Oh?

iron yew

what does the instance thing do in the rpc?

pliant spade

yo why aint the status showing on my bot

here's the code

client.user.setActivity("Message", {type: "PLAYING"});

loud gulch

help me iam new to rpc do i put my id or bot id and it will auth it auto for me

?

and do i need to require it ?

acoustic breach
const DiscordRPC = require('discord-rpc')

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

rpc.on('ready', () => {
    console.log('ready')
    console.log(rpc.user.username)
    rpc.setActivity({
        details: 'abc',
        state: 'def',
        startTimestamp: new Date(),
        instance: false
    }).then(console.log)
})

rpc.login({ clientId: '657637495797841952' })```
is there any reason you can see why this isn't working? i get no errors, it ready's it console.logs the username, and the promise for setActivity returns an activity object, but it doesnt set my presence
smoky scroll
acoustic breach

my status just never gets set

smoky scroll

Can you try running your RPC again?

acoustic breach

just did rn

nothing

smoky scroll

hm-

acoustic breach

wh

it works for u

thats so weird

smoky scroll

I'm not sure how to help you with this one-

loud gulch

hi how to use buttons

smoky scroll

Buttons? Its very simple

loud gulch

Iam new

to rpc

smoky scroll

What dose the RPC code your using look like?

loud gulch
   const DiscordRPC = require('discord-rpc')

    const rpc = new DiscordRPC.Client({ transport: 'ipc' })
    const clientId = '788864503428546600';
const scopes = ['rpc', 'rpc.api', 'messages.read'];
    rpc.on('ready', () => {
        console.log('ready')
        console.log(rpc.user.username)
        rpc.setActivity({
            state: `Used In ${client.guilds.cache.size} Servers`,
            buttons:"Invite",
            instance: false
        }).then(console.log)
    })
    rpc.login({ clientId: '789183229710172170' });```

@smoky scroll

smoky scroll

Are you using this for your user account, or are you trying to use this for a bot account?

loud gulch

my account

it can't be used on bot account

smoky scroll

Yeah ik im just wondering how your RPC is getting the amt of servers your bot is in-

acoustic breach

how isnt this working aaa a

smoky scroll

But the buttons should look something like this

buttons: [{
                    label: rpc.buttons.primary.buttonLabelText,
                    url: rpc.buttons.primary.buttonRedirectUrl
                },
                {
                    label: rpc.buttons.secondary.buttonLabelText,
                    url: rpc.buttons.secondary.buttonRedirectUrl
                }
            ]
loud gulch

iam discord js and discord-rpc

thanks

smoky scroll
smoky scroll
loud gulch

does the buttons seems ? @smoky scroll

it doesn't seem to me

smoky scroll

You have to put the label & URL
It would look like this without the config

buttons: [{
                    label: "Invite",
                    url: "https://discord.com/oauth2/authorize?client_id=INSERT_CLIENT_ID_HERE&scope=bot&permissions=0"
                },
                {
                    label: rpc.buttons.secondary.buttonLabelText,
                    url: rpc.buttons.secondary.buttonRedirectUrl
                }
            ]
loud gulch

i did

smoky scroll

Erm-
What dose the code look like now?

acoustic breach

ok figured it out

cuz i had an actual game running

smoky scroll

oop- lol

acoustic breach

is there a way to change that? so if a game is running it still works

smoky scroll

Not that I know of

you would have to start the RPC first

acoustic breach

got it

smoky scroll

that is the only way that I have found works

subtle forge

what is rate limit? i want to know what count i can change status in 1 minute?

karmic jolt

it updates every 15 seconds, but discord handles that for you

subtle forge

um

so i can

change every 5 seconds

but discord change it after 15

yes?

karmic jolt

yea

subtle forge

ok

but when

i have posted to api

2 presences

he have any cache?

or discord will update with last posted presence my rpc

karmic jolt

¯_(ツ)_/¯ probably the latest

subtle forge

oh no

but anyway thanks for help 🙂

Error: connection closed

ok? repaired

lol

river edge
left fjord

no, bots cannot have rich presence

river edge

That was i think, but that code confused me

left fjord

what the code does is run the bot, and uses data from the bot to display on rpc

which would be displayed on your account, assuming you run that at your pc

river edge

Ah!

Ok

iron yew

What does instance do?

fathom lion

(for future use) integer representing a boolean for if the player is in an instance (an in-progress match)
So nothing? Or maybe it does something these days and the rpc docs are out of date

loud gulch

hi why does the buttons doesn't seems to me

here is my code ```javascript
const DiscordRPC = require('discord-rpc')

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

const scopes = ['rpc', 'rpc.api', 'messages.read'];
rpc.on('ready', () => {
console.log('ready')
console.log(rpc.user.username)
rpc.setActivity({
state: Used In ${client.guilds.cache.size} Servers,
buttons: [{
label: "Invite",
url: "https://discord.com/oauth2/authorize?client_id=INSERT_CLIENT_ID_HERE&scope=bot&permissions=0"
},
{
label: "support",
url: "google.com"
}
],
instance: false
}).then(console.log)
})
rpc.login({ clientId: '788864503428546600' });```

hi

is there is anyone ?

sacred ore
smoky scroll

Did anyone ever put their rpc on a server with a custom client?

sacred ore
smoky scroll

Yea

velvet wave

maybe he is saying server, as in hosting, with a custom discord client. which to me sounds a lot like a bot.

how to add a url to the rpc?

smoky scroll

rpc cool

loud gulch

What's the discord-rpc master ?

I used npm i discord-rpc

smoky scroll
sacred ore what does this even mean

rpc communicates with your discord client on the same machine
I head its possible to run it on a vps with a custom client to accept and display the rpc

smoky scroll

does this work on MacOS?

loud gulch

and require it as discordjs/rpc?

@smoky scroll

loud gulch

ok

but does i need to delete the first ?

sacred ore
loud gulch

it still showing nothing @smoky scroll its showing rpc but without buttons

loud gulch

i don't know i do as he told me

it gives me errorwhile installing

sacred ore
loud gulch

where

sacred ore

It's basically the same thing that be told you to do , except it will always work

node_modules

Put it in that folder

loud gulch

inside discord-rpc folder ?

it's working thanks

how do i set largeimage?

sacred ore
subtle gull

How to fix this, Error: Could not connect
code:
``const client = require('discord-rich-presence')('');

client.updatePresence({
state: 'e',
details: 'e',
startTimestamp: Date.now(),
endTimestamp: Date.now() + 1337,
largeImageKey: '',
smallImageKey: '',
instance: true,
});``

smoky scroll

how to solve the error 😦

    at Socket.onerror (/app/node_modules/discord-rpc/src/transports/ipc.js:32:16)
    at Object.onceWrapper (events.js:286:20)
    at Socket.emit (events.js:198:13)
    at emitErrorNT (internal/streams/destroy.js:91:8)
    at emitErrorAndCloseNT (internal/streams/destroy.js:59:3)
    at process._tickCallback (internal/process/next_tick.js:63:19)```

```var rpc = require("discord-rpc")
const client = new rpc.Client({ transport: 'ipc' })
client.on('ready', () => {
client.request('SET_ACTIVITY', {
pid: process.pid,
activity : {
details : "Hello test !!",
assets : {
large_image : "disk_neon",
large_text : "PUBG" // THIS WILL SHOW AS "Playing <Status>" from the outisde
},
buttons : [{label : "mayb" , url : "https://google.com"},{label : "mayb2",url : "https://youtube.com"}]
}
})
})
client.login({ clientId : "803859542961029170" }).catch(console.error);```
smoky scroll

umm i was running that time on glitch editor now i tried on my pc :/
i typed the start command node index.js no errors showing still my ID not having ric presence ;-;

shell stirrup

hey, wanted to confirm, we can't change the blurple color in rpc right

smoky scroll

@shell stirrup umm u have any idea that why my rpc isn't showing up thinkPika

shell stirrup

🤔 errors?

smoky scroll

runs perfectly on my cmd but i can't see the status

oh worked ! plushed_flushed

ehh idk why that time

it didn't worked

can rpc be run on vps???

shell stirrup

no, because it will try to connect with your discord client and you won't have a discord client on vps (maybe)

not sure about what I said above but I think it won't work on vps

smoky scroll

how to use this in rpc

.sendJoinRequest(user)
Request to join the game the user is playing```
sacred ore
smoky scroll
sudden compass
sacred ore
sudden compass

yes

sacred ore
turbid oliveBOT

If you want to add buttons to your RPC , make sure you are on the master branch of discordjs/rpc. this can be installed using npm i discordjs/rpc.
Then inside your setActivity call, you can use buttons: [ { label: " ", url: " " }, { label: " ", url: " "} ], you can have a maximum of 2 buttons
You wil not be able to press these buttons on your own account, so dont freak out when something doesnt pop up when you click it

sudden compass

thank you

smoky scroll
azure minnow

I have a question. There is a way to use Discord-rpc without a client ? Like use a user token or something like that to put my JavaScript script on a vps ?

sacred ore

No

azure minnow

wow that's radical 😆 lmao

azure minnow
sacred ore No

and there is a way to add a rich presence to a user with discordjs ?

sacred ore

only to yourself

look at mine

azure minnow

yes but you have discord-rpc on your pc ?

or on a vps ?

sacred ore

on my pc, cuz u have to

azure minnow

ok so for exemple

i want to run on a vps a discordjs script with my token on it so

"the script" is connected to my account

can i add a rich presence from that ?

sacred ore

No, rpc only works if discord is open on the same machine, so it wont work on a vps

azure minnow

ok and if i run discordjs connected to an account and i run rpc ?

sacred ore

it only works if DISCORD ( the application discord ), is open on the same machine as the rpc code

vivid flume

when it connects to Discord it connects to the client instance not the account

i think websockets may be different but that's how it works with ipc

left fjord

p sure it's discord app that you connect to anyway

vivid flume

yeah discord app/client

it's also possible to connect to multiple instances of the client on the same pc with ipc, just not sure if it's possible with discord-rpc

left fjord

don't stop the app? (deleted)

jolly chasm
smoky scroll

What is the difference between ipc and websocket

sacred ore

theres many things, but just know ur not allowed to use websocket

left fjord

*need to be whitelisted

and only in the context of discord's rich presence.

smoky scroll

e?

smoky scroll

Why it say connection closed?

const RPC = require('discord-rpc')

const clientId = "726287877897584673";
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 });
left fjord

cause you're using websocket instead of ipc

slow pine

Someone's saying that i'm self-botting.
Is RPC considered selfbotting?

karmic jolt

no

azure minnow
sacred ore

i mean yea, but youll have to figure out how to do it yourself

azure minnow

So there is no "Discord client" working without a screen

But Can i add a desktop to my Ubuntu server, use rdp launch Discord login, run my rpc and log off ?

azure minnow
left fjord

this is best way to get your account banned

also note that it's not "be logged in on the same pc". this itself has absolutely nothing to do with rpc whatsoever

the fact why you need to do that, is because the app runs a "server" to which rpc app connects and uses it to display rich presence (which doesn't really give a crap about which account is currently logged in)

so even if you won't get banned for using custom client, the custom client doesn't even have anything rpc related.

visual fog

Would it be possible to create an rpc with a spectate button for an online game

spring dune

Sure, if it's your game / you can edit the source code

peak pier

Why is my RPC not showing up on my profile?

restive oracle

How do I use this?

Like how does one run it?

left fjord

like any other js code

restive oracle

uh

dont know how too

lmao

left fjord

then brush up on js basics

and how to use node.js

restive oracle

bruh

left fjord

no, no bruh

we aren't here to teach you complete basics

restive oracle

ok?ASpeepoclownball

dawn canopy

Can i fetch number of members from a guild in discord-rpc?

left fjord

rpc doesn't really have much to do with guilds 🤔

there is a command to get all guilds user is in, but from what i can tell you can't get much anyway, since guild objects you get are partial. both members and member_count are sent only on GUILD_CREATE, so are completely inaccessible rpc-wise, and approximate_member_count has this as description:

approximate number of members in this guild, returned from the GET /guilds/<id> endpoint when with_counts is true
which makes me believe you cannot do that from rpc at all

junior robin

!rps

crystal lance

can someone clarify to me the use case for an RPC connection

azure minnow

Can i "update" the activity ?

dusk crag

pepe

sacred ore

well, one of them at least

lost berry

how do i add button in the rpc?

@sacred ore can you help please?

left fjord

?buttons

turbid oliveBOT

If you want to add buttons to your RPC , make sure you are on the master branch of discordjs/rpc. this can be installed using npm i discordjs/rpc.
Then inside your setActivity call, you can use buttons: [ { label: " ", url: " " }, { label: " ", url: " "} ], you can have a maximum of 2 buttons
You wil not be able to press these buttons on your own account, so dont freak out when something doesnt pop up when you click it

lost berry

i did

not working

left fjord

that is truly sad

have you thought about saying so?

and describing the issue?

lost berry
buttons: [{ label: '', url: '' }],

i added that but it not working

left fjord

tag says [{ label: '', url: '' }], not [{ label: '', '' }]

lost berry

yes i meant that

lost berry

what about the timer?

left fjord

use startTimestamp

lost berry

it's not working

left fjord

?dnw

turbid oliveBOT

Against popular belief "does not work" is not sufficient information to provide to receive help.
What's the expected (wanted) behaviour, what's the actual (unwanted) behaviour? Do you get any errors? What's your relevant code that might be causing the issue?

lost berry
const startTimestamp = new Date();
left fjord

maybe some more code?

lost berry
left fjord

why are you doing that instead of using actual methods?

smoky scroll

I have discord-rpc question

what does this error mean? ```const timeout = setTimeout(() => reject(new Error('RPC_CONNECTION_TIMEOUT')), 10e3);
^

Error: RPC_CONNECTION_TIMEOUT
at Timeout._onTimeout (C:\Users\Blaž\Documents\Discord\rpc\node_modules\discord-rpc\src\client.js:107:47)```

silk leaf
smoky scroll
delicate flint

its rpc throwing an error because the connection timed out

silk leaf

Depends what you want to do

o yah Discord\rpc\node_modules\discord-rpc\src\client.js:107:47)

smoky scroll
silk leaf
smoky scroll
dawn canopy

i don't really understand master brank ehh

sacred ore

the npm version doesnt have buttons as of yet

so you download it from github

verbal jewel

would someone mind briefly explaining what rpc does / what you'd use it for?

left fjord

this is rich presence

uses discord's rpc

verbal jewel

Is it for the bot itself or members?

left fjord

bots cannot have rich presence

verbal jewel

so it can set a rich presence for members of a server?

left fjord

only for you

if you run the rpc app at the same pc you have discord app running

verbal jewel

ohhh ok

thx

smoky scroll

Well yes

U can tehnically run rpc on a phone

sly topaz

?buttons

turbid oliveBOT

If you want to add buttons to your RPC , make sure you are on the master branch of discordjs/rpc. this can be installed using npm i discordjs/rpc.
Then inside your setActivity call, you can use buttons: [ { label: " ", url: " " }, { label: " ", url: " "} ], you can have a maximum of 2 buttons
You wil not be able to press these buttons on your own account, so dont freak out when something doesnt pop up when you click it

sacred ore

it doesnt work with the mobile app

smoky scroll

Well :yikes: then

smoky scroll

I am trying to add the line Used in X servers and getting an error 😦
My code start

const client = new rpc.Client({ transport: 'ipc' })
client.on('ready', () => {
client.request('SET_ACTIVITY', {
pid: process.pid,
activity : {
state: `Used In ${client.guilds.cache.size} Servers`,``` 
Error :-
```TypeError: Cannot read property 'cache' of undefined
    at RPCClient.<anonymous> (D:\Custom_Discord_RPC\Custom Discord RPC\index.js:7:33)
    at RPCClient.emit (events.js:315:20)
    at RPCClient.login (D:\Custom_Discord_RPC\Custom Discord RPC\node_modules\discord-rpc\src\client.js:146:12)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)```
sacred ore
smoky scroll
sacred ore

i literally just told you how

smoky scroll

but if you somehow got the actual client, then you couldthinkPika how can i get?

DogHeadTurnTiltThinking

help pls cat_shy

sacred ore

is the rpc client in the same file as your bot ? are they event on the same machine

smoky scroll
sacred ore

im sure you could use oauth to do it , but thats a little too much hastle

smoky scroll

ig i can do one thing like make just an ready event of bot and insert rpc in it

in my pc

will it work?

any idea

or the ?tryitout command huh

sacred ore

what i used to do is run an express sever and have the bot call the server every number of minutes to update the stats

we cant really help with that here, but if you can figure that out, then u should be set

smoky scroll
terse shadow

client.application is null, is this intended?

dawn canopy
sacred ore

yea intelisense doesnt really exist on it LMFAO

i had to figure out how to do buttons on my own to be able to make that tag

dawn canopy

Oooooof xd

sacred ore

( even tho i learned later on that someone apparently posted the answer a week earlier in the chat and i didnt know oof )

dawn canopy

shrug

river edge

Then you can use data from your bot

left fjord

that woks only if your bot is not sharded, mind you

sly topaz

?buttons

turbid oliveBOT

If you want to add buttons to your RPC , make sure you are on the master branch of discordjs/rpc. this can be installed using npm i discordjs/rpc.
Then inside your setActivity call, you can use buttons: [ { label: " ", url: " " }, { label: " ", url: " "} ], you can have a maximum of 2 buttons
You wil not be able to press these buttons on your own account, so dont freak out when something doesnt pop up when you click it

upbeat ridge

who want a discord rpc code

sly topaz

uhh me?

devout gust

does anyone know how to set a custom status for your bot?
each time I do it with any method it spits errors
especially the TYPE bit
like TYPE: "LISTENING" or TYPE: "WATCHING"

left fjord

bots cannot have custom status

craggy boughBOT
smoky scroll

?help

turbid oliveBOT
smoky scroll

?config

?help config

turbid oliveBOT
smoky scroll

Can someone tell how to clear activity?

?button

?buttons

turbid oliveBOT

If you want to add buttons to your RPC , make sure you are on the master branch of discordjs/rpc. this can be installed using npm i discordjs/rpc.
Then inside your setActivity call, you can use buttons: [ { label: " ", url: " " }, { label: " ", url: " "} ], you can have a maximum of 2 buttons
You wil not be able to press these buttons on your own account, so dont freak out when something doesnt pop up when you click it

smoky scroll

?example

turbid oliveBOT
const Discord = require('discord.js');
const client = new Discord.Client();

client.on('ready', () => {
  console.log(`Logged in as ${client.user.tag}!`);
});

client.on('message', msg => {
  if (msg.content === 'ping') {
    msg.channel.send('pong');
  }
});

client.login('token');
smoky scroll

?rpc

turbid oliveBOT
smoky scroll

Can someone give me a better example?

The GitHub Repo Example sucks ;-;

steep valve

@smoky scroll what you need

smoky scroll

I just need a good example for discord rpc

Or u can tell me how can I update the activity

steep valve

Like the status of the bot

smoky scroll

Of user

steep valve

Hold on before we get into that I noticed the bot did something wrong

smoky scroll

Yea I can wait

steep valve

"const Discord = require('discord.js');
const client = new Discord.Client();

client.on('ready', () => {
console.log(Logged in as ${client.user.tag}!);
});

client.on('message', msg => {
if (msg.content === 'ping') {
msg.channel.send('pong');
}
});

client.login('config.token');
"

That's much more better

You use that in the index so if you share your index with anybody they won't get your token to mess with your bot

karmic jolt

that's not rpc..

steep valve

I know it's not but it's a better way of putting it

smoky scroll
steep valve

It's much more better so if you share your index with people they won't have access to your bot token which then they will steal your bot

smoky scroll

Yea yea

A good example?

Hello?

sacred ore

what he was getting at is that this is not the chat for non-rpc related things

rain ermine

any of you guys know how to add button to discord rpc?

rpc.on("ready", () =>{
    rpc.setActivity({
        state : "Coding by IEB#4646 | IEBot",
        details : "Coding",
        largeImageKey : "iebot",
        largeImageText : "IEBot",
        buttons : [{label : "Youtube" , url : "https://www.youtube.com"},{label : "Website",url : "https://i"}]
    })
    console.log("Activated.")
});

buttons dont appear

other things do

please help :<

if you are feeling your self too late to help you are not dm me and tell how to fix if you know

or just @rain ermine

umm @sacred ore is it rude to ask you like this?

sacred ore

a lil bit, but i got u

?buttons

turbid oliveBOT

If you want to add buttons to your RPC , make sure you are on the master branch of discordjs/rpc. this can be installed using npm i discordjs/rpc.
Then inside your setActivity call, you can use buttons: [ { label: " ", url: " " }, { label: " ", url: " "} ], you can have a maximum of 2 buttons
You wil not be able to press these buttons on your own account, so dont freak out when something doesnt pop up when you click it

rain ermine

sorry :( and thanks

sacred ore

see the first line of that tag

rain ermine

i installed it like npm i discord-rpc

is it wrong?

rain ermine
sacred ore

yea you have to use npm i discordjs/rpc

rain ermine

soo what should i change in the code

sacred ore

nothing, literally just install discord rpc like i showed

and it should work

rain ermine

it errored

when i tried

should i uninstall discord-rpc first?

it errors @sacred ore

sacred ore

whats the error

rain ermine

while installin

g

there is lots of errors

i dont know

@sacred ore are you there

sacred ore

that means you dont have git in ur path

you need to install git to install from master branch

rain ermine

how

xD

little lodge

would i be able to add time to my rpc

inland igloo

ERROR in ./index.js
Module build failed (from ./node_modules/discord-rpc/src/index.js):
LoaderRunnerError: Module 'path/to/discord-rpc' is not a loader (must have normal or pitch function)

Getting this error with webpack 😦

inland igloo

nvm ^^ it won't work anyways cause client would be running on node v8

wind plinth

Can you use rpc on browser?

Also- im pretty sure this is a mistake

tame tinsel
wind plinth
rain ermine

Hey does anyone know how to add buttons in rpc

?buttons

turbid oliveBOT

If you want to add buttons to your RPC , make sure you are on the master branch of discordjs/rpc. this can be installed using npm i discordjs/rpc.
Then inside your setActivity call, you can use buttons: [ { label: " ", url: " " }, { label: " ", url: " "} ], you can have a maximum of 2 buttons
You wil not be able to press these buttons on your own account, so dont freak out when something doesnt pop up when you click it

rain ermine

it doesnt work

left fjord

Unfortunate

spring dune

If you want to add buttons to your RPC , make sure you are on the master branch of discordjs/rpc.

left fjord

How do you even know it's the issue

They don't say anything

raven saffron

hey can someone help me

I keep getting "Error: 401" when I try to start my rpc

hellooooo

"get help here"

my white wrinkly ass

lean rover

Show your code

raven saffron

does it need clientSecret

I got it

I added the clientsecret

left fjord

"get help here", but you forgot about the fact that it's completely voluntary help; that not everyone uses rpc, and that you have given absolutely no details whatsoever.

terse shadow

I've tried everything, but Client#application always seems to be null no matter what I do. Is this intended or am I doing something wrong?

sacred ore
terse shadow

oh, what else are the options I can log in with?

sacred ore

im pretty sure you can login with your bot token, lemme check rq

you cannot rip, the other parameter you can put is accessToken, im assuming it means an oauth one

accessToken is the only one that provides application

terse shadow

does that mean we can implement discord rpc from websites via oauth?

sacred ore

no , remember that rpc has to be used on the computer that your discord client is open on

terse shadow

hmm, what's the accessToken for then?

sacred ore

wait no im stupid

the code does the accessToken flow for you

it should provide you with the application

terse shadow

I tried, but there don't seem to be any docs for where to get an accessToken, and I've tried even making a different app on discord developers but I've never had client.application to not be null

sacred ore

yea accessToken you dont need to worry about actually i read the code wrong, but it should be working idky

its being null

everything that is set in the authorize is null

terse shadow

i tried stepping through the code, client.application stays null at the authenticate call from login (src/client.js:246-ish), but client.user gets a value and works properly, it's just client.application that stays null throughout the entire process

sacred ore

well

i got client.application to not be null

it was weird, idky why it doesnt work

terse shadow

do you login using a clientId?

sacred ore

yes

terse shadow

'cause my brain is too tired from school to think about this lmao

I give up

i'll just fix it when rpc docs are better

sacred ore

actually nvm i didnt get it oof

idk what the fuck is goin on

terse shadow

i blame the docs lol

nowhere in the docs does it say how/where to get an accessToken

sacred ore

well

like i said

accessToken is provided

i mislead you ealier

lmfao

accessToken is provided by the oauth flow it goes through when you provide either client id or client secret

terse shadow

well yeah, but it only goes through the authorize flow if you don't provide an accessToken on login

if i'm reading this code correctly you have the option of either calling login() with a clientId or an accessToken, but it doesn't say where to get an accessToken in the code (expected). The thing is, it doesn't say where to get an accessToken in the docs either, which is unexpected

sacred ore

accessToken is an exchange of an oauth code for a discord bearer token

so if you provided an access token, it would be from doing your own oauth exchange

terse shadow

yeah that would be nice

does accessToken allow bearer tokens?

sacred ore

it IS a bearer token

terse shadow

oh, didn't know that lol

sacred ore

heres the code for it

  async authorize({ scopes, clientSecret, rpcToken, redirectUri } = {}) {
    if (clientSecret && rpcToken === true) {
      const body = await this.fetch('POST', '/oauth2/token/rpc', {
        data: new URLSearchParams({
          client_id: this.clientId,
          client_secret: clientSecret,
        }),
      });
      rpcToken = body.rpc_token;
    }

    const { code } = await this.request('AUTHORIZE', {
      scopes,
      client_id: this.clientId,
      rpc_token: rpcToken,
    });

    const response = await this.fetch('POST', '/oauth2/token', {
      data: new URLSearchParams({
        client_id: this.clientId,
        client_secret: clientSecret,
        code,
        grant_type: 'authorization_code',
        redirect_uri: redirectUri,
      }),
    });

    return response.access_token;
  }```
terse shadow

yeah i saw that

sacred ore

thaat response.access_token is a bearer token

terse shadow

so theoretically you can set someone's RPC from a website via oauth?

sacred ore

No

because it uses IPC,

websocket is a whitelisted transport

terse shadow

awww

smoky scroll

Hi i try to use buttons but buttons are not working

if i click nothing happens

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

client.on('ready', () => {
  console.log('Authed for user', client.user.username);
  client.setActivity({
    details:'Festiva Gelişmekte Olan Müzik Botu',
    state:'Butona TIkla Davet et',
    largeImageKey:'large',
    buttons:[
      {
        label:'Sunucuna Ekle',
        url:'http://invite.festiva.me/'
      }
    ]
  })
});

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

code

karmic jolt

you cant click your own buttons

smoky scroll
sacred ore

?buttons

turbid oliveBOT

If you want to add buttons to your RPC , make sure you are on the master branch of discordjs/rpc. this can be installed using npm i discordjs/rpc.
Then inside your setActivity call, you can use buttons: [ { label: " ", url: " " }, { label: " ", url: " "} ], you can have a maximum of 2 buttons
You wil not be able to press these buttons on your own account, so dont freak out when something doesnt pop up when you click it

sacred ore

which is why i put this at the end^ 🤣

toxic basin

Hi who can help me with rpc fast?

spring dune

protip: show code

wind plinth
sacred ore

Idk check it

left fjord

it doesn't break whole code

so it definitely isn't any priority

lunar escarp

what exactly is the djs rpc im looking at the documentation and it doesnt really explain

left fjord

this is rich presence

lunar escarp

ooooooh

so it rich presence i see

thx

left fjord

well, it uses rpc to set you a rich presence

lunar escarp

ye

willow minnow

Can we use rpc to change the person's username

smoky scroll

wdym @willow minnow

left fjord

Pretty sure they mean what they said

smoky scroll
nocturne trail

Do you need Python to install the package discord-rpc? The console is going to tell me, that I have to install Python to use the RPC Client

old fable

no

?rpc

turbid oliveBOT
wind plinth
willow minnow
tawny orchid

Would your discord acc get banned if you used djs rpc to set stuff in your activity?

sacred ore

thats the point of rpc.

well, one of them

but no you wont get banned

tawny orchid

kk ty

worn rock

Isn't it technically a self bot?

tawny orchid

thats what i thought

worn rock

hmm

karmic jolt

it's not

worn rock

ok, what is the def of a self-bot?

karmic jolt

well, doing bot stuff on a user account

and rpc does not belong into that category

worn rock

"Automating normal user accounts outside of the OAuth2/bot API is forbidden"

You're automating the activity and status of a user account

sacred ore

I dont know if you realize, but rpc performs an ouath request

soo

it is within that scope

karmic jolt

why would rpc exist if you weren't allowed to use it?

tawny orchid

Well i mean using RPC is the same as you going on, lets say fortnite, and having that appear on your pressence thing

worn rock

still logs onto a user account tho

karmic jolt

it doesn't log onto your account, it uses the rpc server from the discord application

candid ibex
left fjord

discord app literally runs a server to which apps connect to, allowing apps to pass data to display on rich presence

no one is using a user token, no one is using gateway, no one is doing anything against tos.

tropic sluice

Trying to install discord-rpc via npm and this happens any idea why?

The .git file it references 404s

left fjord

github.com/djs?

what is that supposed to be

tropic sluice

It links to the github for discord.js

so i assumed i should ask here

left fjord

which isn't on djs, mind you

but on discordjs

tropic sluice

right

but i'm just trying to install it and it errors

left fjord
tropic sluice

hmm

maybe it's on my end then

left fjord

no clue why is your git trying to do djs instead of discordjs

tropic sluice

yeah me neither

is there a way to manually change the link or

install w/o using npm?

left fjord

try doing npm i discordjs/rpc

tropic sluice

Nevermind, figured it out, for some reason it was referencing github.com/djs in the package.json

Thanks for the help

azure holly
smoky scroll

what is discord-rpc, i should ask

weary harness

?rpc

turbid oliveBOT
smoky scroll

ok

weary harness

it's rich presence kinda looks like this:

smoky scroll

ah nice

nocturne trail

I cannot install discord-rpc

it says I need to instakk python

ping me for answer

karmic jolt

then install python?

sacred ore

?build-tools

turbid oliveBOT

Run npm i windows-build-tools --production --vs2015 --add-python-to-PATH --global as admin, and restart terminal.
Restarting machine can also be required.

sacred ore

@nocturne trail ^

wraith lava

rpc down for npm version: 0.0.0

laissemoi

wraith lava
amber verge
C:\Users\Sambit Kayal\Documents\Custom Discord RPC\node_modules\discord-rpc\src\client.js:118
        reject(new Error('connection closed'));
               ^

Error: connection closed
    at IPCTransport.<anonymous> (C:\Users\Sambit Kayal\Documents\Custom Discord RPC\node_modules←[4mdiscord-rpc←[24m\src\client.js:118:16)
←[90m    at Object.onceWrapper (node:events:483:26)←[39m
←[90m    at IPCTransport.emit (node:events:376:20)←[39m
    at C:\Users\Sambit Kayal\Documents\Custom Discord RPC\node_modules←[4mdiscord-rpc←[24m\src\transports\ipc.js:137:18
    at decode (C:\Users\Sambit Kayal\Documents\Custom Discord RPC\node_modules←[4mdiscord-rpc←[24m\src\transports\ipc.js:92:5)
    at Socket.<anonymous> (C:\Users\Sambit Kayal\Documents\Custom Discord RPC\nodemodules←[4mdiscord-rpc←[24m\src\transports\ipc.js:120:7)
←[90m    at Socket.emit (node:events:376:20)←[39m
←[90m    at emitReadable (node:internal/streams/readable:565:12)←[39m
←[90m    at processTicksAndRejections (node:internal/process/task_queues:79:21)←[39m

I am getting this error

nocturne trail
ivory valley

dead chat xD

raven ember

?softban 728169193148514324 shitposting

turbid oliveBOT

Successfully softbanned GoldPine17#0069

craggy boughBOT
sacred ore

why is the version just now changing lol

the last real commit was like 2 months ago

left fjord

so you say that it should stay outdated until next commit happens?

sacred ore

No, but i get why its like that now lol

pure raft

Hi, i want to add a small image but it don't work

spring dune

Add how?
And doesn't work how?

pure raft

I just did it

spring dune

mk

pure raft

Another question. I want to do a ask button. If i accept they can join my channel

With a party when they can with who i am

spring dune

iirc party features only work for whitelisted devs

pure raft

Ok

And for a timer

Like the time i'm connected

spring dune

define startTime for an upcounting timer
define endTime for a countdown

pure raft

?

I don't know how to put it

spring dune

in the setActivity function, define startTimestamp with a Date.

pure raft

Uh

Sorry i'm lost

I'm french

spring dune

In your RPC application, you set the activity, correct?

It gives you this:

Where do you set that

Now see how you've set all other variables in that object?

Do it the same way, and set it's value to the time you wish.
In your case, a new date will do.

pure raft

I put it in activity ?

Or in assets

spring dune

Activity

karmic jolt

why are you using client.request anyway, there's a setActivity() method

spring dune

He's most likely copypasted it kek, given he doesn't understand what he has

pure raft

Yup

It's that

Don't work

spring dune

Set it to a Date.

pure raft

Nop

Don't work

spring dune

Do you know what a Date is?

pure raft

Sorry lol

I put date

Lol

Like that ?

spring dune

Nah

I recommend you learn Javascript before you venture onward with this, check #resources ^^

lunar escarp
const scopes = ['rpc','rpc.api','messages.read'];
const client = new Discord.Client();
const rpc = new RPC.Client({ transport: 'ipc' })
rpc.on("ready", () => {
    // rpc.setActivity({
    //     details: 'test',
    //     startTimestamp: new Date(),
    //     largeImageKey: 'icon',
    //     largeImageText: 'test'
    // });
});
rpc.login({clientId, scopes})```
sacred ore

and what error did you say u got

specifically

lunar escarp

this one: js Error: OAuth2 Authorization Error: Unknown Error at RPCClient._onRpcMessage (D:\Visual Studio Code\Dustins-Discord.js-Bot\node_modules\discord-rpc\src\client.js:185:19) at IPCTransport.emit (node:events:376:20) at D:\Visual Studio Code\Dustins-Discord.js-Bot\node_modules\discord-rpc\src\transports\ipc.js:138:18 at decode (D:\Visual Studio Code\Dustins-Discord.js-Bot\node_modules\discord-rpc\src\transports\ipc.js:92:5) at Socket.<anonymous> (D:\Visual Studio Code\Dustins-Discord.js-Bot\node_modules\discord-rpc\src\transports\ipc.js:120:7) at Socket.emit (node:events:376:20) at emitReadable_ (node:internal/streams/readable:572:12) at processTicksAndRejections (node:internal/process/task_queues:79:21) { code: 5000, data: { code: 5000, message: 'OAuth2 Authorization Error: Unknown Error' } }

sacred ore

Um

what tf

thats new

to me at least

lunar escarp

apparently my code is commiting arsen

if even you dont know

closest i got is when i remove rpi.api

from scopes

sacred ore

what result did that yield

lunar escarp
Error: 400
    at D:\Visual Studio Code\Dustins-Discord.js-Bot\node_modules\discord-rpc\src\client.js:64:21
    at processTicksAndRejections (node:internal/process/task_queues:93:5)
    at async RPCClient.authorize (D:\Visual Studio Code\Dustins-Discord.js-Bot\node_modules\discord-rpc\src\client.js:225:22)
    at async RPCClient.login (D:\Visual Studio Code\Dustins-Discord.js-Bot\node_modules\discord-rpc\src\client.js:150:21) {
  body: { redirect_uri: [ 'Not a well formed URL.' ] }
}```
sacred ore

try completely removing scopes all together

lunar escarp

k

i think this would give me a timeout

ok its not giving me a timeout thats good

now let me un comment the set activity

sacred ore

you dont have to pass scopes so

should work

u prolly just passed a bad scope

lunar escarp

now its not setting activity aniblobsweat

sacred ore

ys it is

i see it

lunar escarp

is that for me?

sacred ore

yes

it doesnt set it for ur bot lol

lunar escarp

hmmm i wish it set it for the bot

sacred ore

the person whos discord is logged in

you cant

sadly

lunar escarp

darn ok

i can work with this

thx for your help even if i cant see it

i just wish it would quit giving me this timeout error

lunar escarp

how do i get the button to redirect to a url

sacred ore

read the bottom part of this tag

?buttons

frick

yuu is still down forgot

well

u cant press ur own buttons

lunar escarp

ooooh

sacred ore

ur button is working

tho

yeye

lunar escarp

sweet

unreal ginkgo

guys I was wondering if I can display an icon for the current game activity instead of empty box with a question mark , I know you have to use rpc and discord js maybe ?
the thing is Im not finding a good documentation can some one help?

smoky scroll

@unreal ginkgo

narrow slate

How do I make my bot have a custom presence? My code says SetPresence does not exist.

karmic jolt

rpc is for users, not for bots

narrow slate

Yeah but like this

jade kettle
narrow slate

Oh right <client> do I put bot there since my bot only supports bot.test123.test123

jade kettle

what you mean by that?

narrow slate

Right so, When I am coding my bot instead of client.user.setActivity I have to put bot.user.setActivity.

Is there a way of making it change to client.