#development
1 messages · Page 25 of 1
Sadly I had already two GPU cards with malfunction until ASUS finally sent a new one
before I got banned in windows community the guys told me that it's def a broken gpu
I bought a new one and never had that happen to me again
for free? 0_0
wait are u in windows community?
oh so you're saying I could've gotten by gpu for free 💀
btw are you?
Dude if a product has a malfunction I’m gonna send the shit directly to the manufacturer
Instead of returning it to the seller
bruh
There are only a few big companies issuing warranty requests only via third party companies
Most of em providing customer support and care themselves
wish I knew that
you didn't know how warranty works?
Issues with particular areas or apps on the screen can be caused by GPU damage, or drivers, or other reasons. However with physical damage you’re far more likely to have… more noticeable effects than that
like smoke smell
Somebody probably fucked up their OpenGL/Vulkan shit 
I’ve had my pc for more than 3 years, only things I’ve needed to replace are my SSD that randomly fucking died and my network card
So overall the repairs I’ve done to this pc in the last 3 years probably total to about $90-120
Which is really good considering this was my first ever build
True it’s actually hard to figure out
Have you fixed it?
If it’s with a certain app it’s more likely than not that it’s a driver issue
I did several benchmark tests and only one could consistently show the issue before the screen freezes with a really colorful image
The current one? No.
It’s there for a very long time already
My go to thing for display issues is just doing a quick check to make sure my drivers are up to date
After closing RDP and restarting the machine the issue is gone
Interesting
Like I said before RDP seems to cause this
For a long time already
So let’s get rid of the last Windows VMs I guess

Porting stuff over to Ubuntu
oh no he’s using a bloat OS oh noooo
I have this event handler and I am currently getting this error
Conversion of type '{ name: "ready"; description: string; once: true; run(client: Client<true>): void; }' to type 'EventPayload<keyof ClientEvents | keyof RestEvents>' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
Types of property 'run' are incompatible.
Type '(client: Client<true>) => void' is not comparable to type '(args_0: UnionToType) => void'.
Types of parameters 'client' and 'args_0' are incompatible.
Type 'UnionToType' is missing the following properties from type 'Client<true>': actions, presence, _eval, _validateOptions, and 45 more.ts(2352)
when I did some testing and removed the Client<true> annotation and now I get the issue Property 'user' doesn’t appear on type 'UnionToType.
How would i solve this type issue for my event handler?
you should send the code.
the event handler code.
nvm, i am dumb.
@winter tapir alright, try UnionToType[K] instead of [UnionToType]
works ty!
My bot is already published for months and you can vote, but since yesterday (14.08) is there and I can no longer Liken comments. If I like the Like disappears after refreshing the page the Like again
Does anyone know why?
Replying to comments is buggy atm iirc, might also affect liking comments
The message you see will always be there
As the developers don’t seem to be able to hide the message after the verification process or after X days of the submission
Oh ok. Thx
can anyone help me
Not with this amount of context
State your issue, provide relative evidence (e.g code and errors) and those who can answer will
so i have a search command and i was wondering how i can make it for the search command turn into a whole number instead of decimals
let cash = Math.random() * (20 - 75 + 1) + 75
;
The thing is Math.random() innately returns anything between 0-1
so you will get decimals
If you wanna get rid of it, you can round it though
or use Math.floor()
what does the mathfloor do
Just dm them
no
ah okay okay
Nekomaki#0001
Ty
misty
?
it gives me this
That means you aren't returning a number
NaN = Not a Number
Are you parsing anything per chance?
whats parsing
e.g taking "1" -> 1
it parses a string to a int if possible
so smth like parseInt would be used
Yes
Please
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
please
putting it in a bin makes it easier to read
i did it how do i send it
Once you put it in the bin press CTRL + S and then copy the new link in the search bar
and send it here
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
okie there
whys that
you misunderstood what I said
let cash = Math.floor(Math.random) * (20 - 75 + 1) + 75
you wanna floor the entire thing
this is what you are currently doing
what you wanna do is
let cash = Math.floor(Math.random() * (20 - 75 + 1) + 75)
Although tbh I wouldn't use that method of generating your cash
Unless you always want it to be a number less than 80
Also, your at risk of a corrupted "DB"
JSON files have a low consistent read/write allowance
so you can easily corrupt your json files
making the data in them useless
I'd still use Math.floor and Math.random but I would change it up a bit
mhm it just went back to giving me decimals now
So for example, if you wanted a number between 1 - 20
you'd do
Math.floor(Math.random() * 20) + 1
also store user ids instead of their tag
Well no
a user's tag can change at any moment
or does it have to be 1
Lets think about it like this
Math.random() gives a pseudo random number between 0-1
So us doing Math.floor(Math.random() * 50) will give us number between 50 and 0
Math.floor(Math.random() * 50) + 1 would be 1-50
But you also gotta think that you are essentially just adding to the result of what Math.floor returns as well, so doing what you did Math.floor(Math.random() * 50) + 20, is the same as asking for it to be as high as 70 (Assuming, I am thinking about this correctly that is)
so the best option would be to do Math.floor(Math.random() * 50) + 1
Well, not necessarily
It really depends on what you want
if you want them to get as low as 1 sure
although the chance for that is also rather low
i want them to get atleast some (cash-
I will be honest with you I haven't use the Math stuff a lot as I suck at math
Either way, it depends on what you want
You can always play around with it until you get the ideal result
yeah thats why i use a test bot
What I do is open a dev tools console on the browser and mess with the math stuff
:p
ahh okay
thanks for your time.
i will go to sleep and do some experimenting tomorrow thanks.
mk
const express = require('express');
const app = express();
app.get('/', (req, res) => {
res.sendFile(`/index.html`)
});
app.get('/projects', (req, res) => {
res.sendFile(`/projects.html`)
});
// Start the server
const PORT = parseInt(process.env.PORT) || 8080;
app.listen(PORT, () => {
console.log(`Listening on port ${PORT}`)
});
module.exports = app;
Error: ENOENT: no such file or directory, stat '/index.html'
btw it does the same when its /views/index.html
try ../index.html or ./index.html
i haven't done js is a while so if im wrong i apologise
ill try
TypeError: path must be absolute or specify root to res.sendFile
hold on
stack overflow
oh shit
works
i love stack overflox
Nice. Well done 
im very skilled when it comes to googling stuff
my website has no css at all
i actually need a new website
It doesn't it just shows up file when downloaded nothing is there inside a jpg file
Did now it shows only document file and not preview what's the problem?
And when downloading it , it's just a blank image
If someone knows help me
I'm lost af
Or Minecraft pai sucks a lot
They cant just provide with url of skin.
They provide with baseurl which you need to encode and get the image it's not even that the baseurl gives out url for skin
if its less than a kb
then its likely wrongly converted
you need to encode it
likely base64 encoded
It's 300bytes
then I highly doubt it's valid data
See it was base64 link i converted it to image but image is less then kb so what to do?
It is what Minecraft api gives

hey guys,how would i create an endpoint that would be able to receive data from an interaction?
Basically, i need to create an endpoint server that will be able to receive the interaction data, so it's readable for other bots as well
You just have to listen for webhooks coming from discord which need to be responded accurately
huh how would i do that
Creating a webserver and the code which is listening and receiving the webhook
Like listening for topgg webhooks
Or any other webhooks
I know, i've never worked with djs webhooks tho
Once you enter your endpoint you will not receive the interactionCreate event anymore
iirc
Inside my interaction event, can't i just send the interaction data to my endpoint?
Yes you can
Well, i can then make my other bot read that endpoint to get the interaction data.
I mean you actually know the token and webhook ID you have to respond to
or would there be any other way to do this:
But you would probably defer any interaction to give your endpoint enough time to respond as the 3s limit still is present
I basically have 3 buttons. One play button, stop and pause. I have 3 different music bots. They need to be able to respond to these buttons.
The buttons are being sent by bot#1, but how would i make bot#2 and bot#3 respond to it as well?
Either through an internal endpoint dealing with the request in the backend or via IPC between those bots
I was thinking about an endpoint to push the interaction data to #2, #3. But there might be an easier approach?
Up to you
What's ipc?
Inter process communication
Are those three bots running on the same machine?
Literally a socket connection between all those bots sending and receiving data
Or somehow just an endpoint receiving your interaction and pushing the data to the two other bots
There are a ton of days how to do it
same vps yeah
what's the easiest approach to make these bots connect to the same buttons?
What’s actually the reason of having 3 different bots requiring to receive the data of a pressed button of another bot?

I have 3 different music bots
A music bot cannot join 3 different voice channels at the same time ofc
so i want to check if a channel is occupied by discord bot #1, #2 then gets into the game and joins the vc!
However, I will need the interaction data of bot #1, the buttons that are being sent
This is being sent by bot #1
Not sure what to say which is the easiest… that depends on your skills of course
But a simple node-ipc package for all three bots, a socket connection between them and emitting an event when a button was pressed might be the cleanest solution
I've had a quick research and found that redis works with ipc
however, I have no clue how I would open such socket connection between the bots
A nodejs module for local and remote Inter Process Communication (IPC), Neural Networking, and able to facilitate machine learning.. Latest version: 11.1.0, last published: 5 months ago. Start using node-ipc in your project by running npm i node-ipc. There are 365 other projects in the npm registry using node-ipc.
this one might work as well \0/
DO NOT USE THE LATEST VERSION
I mean I dunno what you’re familiar with
❓
I am not familiar with this ipc shit
If you don't know, peacenotwar is legit a malware.
like nothing at wall
you can also create a local webserver on all three bots sending the data around you need
and node-ipc use it.
so by installing, you are essentiially install a malware that only russian user can get
That might be the easiest lol! I will setup the webserver in my ready event.
Should i then import the webserver from my ready event to my interactioncreate event and just send the data to the webserver?
if you REALLY need to use node-ipc, use version 10.1.0
I can't ofc create the webbserver in the event itself as it otherwise will create multiple
I think i'll pass as it's not really something i've used before. Thank you for all the concern and help tho hayper ❤️
No problem, stay safe.
WITH-LOVE-FROM-AMERICA.txt
lmao
The author of that peace bull shit lib is in the top 5 of the dumbest people I have ever seen
no its malware that only non-russians can get
"This code serves as a non-destructive example of why controlling your node modules is important. It also serves as a non-violent protest against Russia's aggression that threatens the world right now. This module will add a message of peace on your users' desktops, and it will only do it if it does not already exist just to be polite."
“Love from America”…
Americans couldn’t be happier to sell their weps to Ukrainian and Russian hands under the hood
I gotta love my ass off
yeah lol
Any conflict is what the biggest nations selling weps makes them happy - a lot
Funny enough people including that sort of bullshit in their projects
ahhhh smart
huh wait
my brain is melting from my dumb ass logic
look
If we sent the interaction data to an endpoint*
we could make the bots read that interaction data and do things ofc.
However, i imagine if there are multiple interaction data's at the same time>?
It would just overwrite
interactions dont come at once
unless you're referring to like a row of 5 buttons
then yes, thats included in the raw data
I have 3 bots. This is sent by bot #1.
yes, all these components are returned in the interaction data
i think
either that or only the pressed one
Imagine if a user clicked the play button and bot #1 is ocupied, bot 2 will then read the data and play. But imagine if both bots are active and playing, and a user clicks the stop button... how the fuck would the bots know which one to stop?
This is a dilemma fellow discord users
thats something you'd need to track internally
perhaps a handler?
maybe assign a unique id to each music session? then add that to the custom id by for example pause_sessionid_userid
is how I'd solve that
And forward that to the endpoint?
yes, the raw data has the custom id in it
so you can tell from which session that button press came from, then pause or stop from it accordingly
If it was one bot it would be easy ofc, but these are 3 different music bots lmao
The interaction data comes a long with the message ID and bot (client) ID etc
You can 100% identify where to take an action
this though
this is only sent by bot #1
So it would always have the same message id and same client id (of bot #1)
so the case could be, the music is being played by bot 3, but the controls are on bot 1
am still for associating a session id to a bot playing music, then having that session id in the custom id
thats also how I made per-session interactions possible, even after a restart
Owh wait that's actually fucking smart
or wait
how would i set custom ids if this message above is only being sent once?
You always know which user pressed the button and with which bots he’s in a channel
Tf your system sounds weird to me

or does the bot who plays the music change sometimes?
Let me explain my system, one sec
then just change the Id of the bot whos playing within your session
no need to change the custom id
These buttons are being sent once by bot number #1. If you click the play button, bot #1 will join and play music for your silly ass. After that, if another user wants to listen to some music to forget his problems, he could click the play button as well and bot #2 would join, and so on.
Imagine all 3 bots are playing.
what if a user clicks the stop button, how would the code know which bot to stop?
yeah then honestly
I feel like he has one bot being controlled by the buttons but 3 different clients which can join channels to serve for example 3 channels at the same time
Yeah from a playlist
then check what bot is with the user in a channel
Yeah that's what i've got.
But only one bot is the master controlling the clients
So one master and two slaves serving the music
sounds like it
Which are responding on the buttons from the master
best way there would prob check which of the slave bots are in the voice channel of the user interacting
I could indeed do this:
-Upon the play interaction, check which bot is in a channel. Imagine bot #3 is in a channel, number 4 would join
-Then read the interactions from the endpoint, and check the vc the member is in to see if the bot is also in there```
Yeah
You always know which user pressed the button and with which bots he’s in a channel
I see!
He knows which slave is in his channel or the master
Wait a damn minute lmao
So sending the request to all theee bots and if the client ID is not the one the user is in the channel with then return
instead of creating a dumb ass endpoint, can't we just check the interaction.member and see with which bot he's in? In each file i could put a check.
If the client ID is the one the user is in the channel with, react
so just to further understand:
no bots playing music. User presses play on master bot, bot 1 joins
a second user wants to play music, presses play on master bot, bot 2 joins since 1 is used
user 1 wants to skip, presses skip button, the master bot checks which bot is in the channel, get the bot and skip music there
yeah!
yeah that can easily be done, shouldn't be hard
maybe associate a bot with a user id
Since you know all three client IDs of your bots you can do that
that could allow multiple bots playing in the channel
which doesnt make sense
but would save a bit of debugging headache later
Then sending the data to your bot forcing him to play the music or whatever button got pressed
ye
using an endpoint? Yeah i could prob do that
cat

But that means i will have to create 3 different endpoints for the bots. Or else, 3 different categories within the one endpoint
Because cats are superior. And we know 
Yeah two sorry
If the client is not inside the channel with the master only then the master will send the data to its slave client
stop all of them
or use the stack model
With the data the slave should serve
HOW THE HELL is this done
or just send a menu
how is this possible
"Which bot to stop?"
fetch the invite from discord
has all the details
you can fetch the invite, how? I thought the only way is to log it on inviteCreate
wtf
wtf
I would love to make it automatic, with less user interaction as some people are retarded tbh
My gosh…
bro no Istg yall told me that not long ago
maybe ditch the idea of making 3 bots joining the same vc then
I never said they had to join the same vc
doesnt need authorization
is there an endpoint for this in discord.js?
Aurel explained it better than me lmao

cry
probably
plain/text you lied mam
manually write the request like a chad
jk sorry
i'm so crigne
this is not css


Jail is jail you criminal
I actually heard using raw api is better since u can do everything exactly how u want it
granular control
discord.js is just an abstraction layer
rather an unpopular opinion tho
btw thanks Fake and Aurel! I will try it out and let you guys know if i've got any results
it abstracted away those control over parameters and endpoints
but again you are not making a discord anime girl real time
so just use it
wait no way so don't tell me I can even make an invite tracker with client.fetchInvite???
I can fetch all invites, filter the specific one byID and then get that invite my user tag
omgomgomg
Tf it looks like English but you seem to speak a different language
anyone has a regex for filtering the code out from an invite link or am I just too lazy?
bruh
I would send him a picture of realistic pacman
💀
Those rare moments making this channel funny instead of confusing

hey guys...
a bit of a dumb question
I've created an express server named dataserver in my ready event...
What regex?
how would i export it to my interactioncreate event lmao
i tried to import it in my module.exports but it doesn't work
Hi guys!
what do you need help with
are they from the same runtime process
yeah
you can emit events
they are
Did you lie before?
using EventEmitter

What
same process: use EmitEvent
different process: use a ws or http
Three separated processes or one?
EmitEvent?
They are 3 different bot folders running on the same machine, so like.. 3 bots hosted on 1 machine
Okay so three independent processes running
yeah
what's presenceCount?
use message send
like how different processes communicate with each other
the amount of user who joined with that invite that are still in the server?
or set up a server for each bot with a predetermined address
then write the address to a file
so other bots and read it and pick it up
I don't think you guys understand what i am trying to do
i know
Either IPC or simply your familiar solution creating an endpoint on both slaves
three bots on three different processes tryna communicate with each other, right?
No
I have one variable named dataserver , it's an express server. it's in my ready event of my bot. I want to send this variable over to my interactioncreate event so i can work with the posts to dataserver
A master controlling itself and two slave clients
just send the http endpoint
what is this, 1800s?
Guys whahaha no
Tf
just. send. the. endpoint
basically you set up a data server, itself already has an http endpoint
I have declared the variable dataserver in my ready event
how can i use that avriable outside the ready event file
just send regular http request
Imagine i have 2 different files
no
client object
assign them to the client object
client.dataServer = ...
Your two slaves both have a webserver running and your master sends a request to the one who has to take action
i give up
Yes but it's about one folder right now
Both using localhost and a different port
Guys my god wait
This is one bot okay.
Imagine i have a variable created in ready.js that's called ugly.
Ok I’m creepy now ik
How do i export that ugly variable to my interactionCreate.js
Forgive me sayuri
so i can then do, console.log(ugly) in my InteractionCreate.js
As parameter
In your event handler
Or bind it to the client
Or some other var which is available in the event
@eternal osprey
when the client is ready
client.on('ready', (client, ...) => {
client.dataServer = ...
});
then when you wanna use it in another event
client.on('event', whatever => {
// consume data
})
in other words, you need an event handler / register
for that, refer to discord.js guides
essentially you export those events as functions
then in another file that register those events, the client will be attached to it and executed at due time
so you can consume those parameters as if they were there
And in the second thingy,. i have to call dataServer right?
here's what i did
ignore the music player
the last line is basically binding the client object as the first parameter of an event callback
then you can consume it like this
client.dataServer
you must attach the server as a property of the client
You can’t do something like const func = (client.dataserver) => …
That’s not how function args work
pass only the client
then consume the dataServer prop inside functions body
else you might wanna learn how object destructuring works
no imports; you can use it inside func body as the reference of data server is inside client object as a property
I see
- syntax error
did you even study how javascript is written
or are you making a new programming language?

now, with the onMemberJoined event can I somehow fetch just the invite code the user used?
Nooooooo
WAIT WOT
As we explained the last time already
YOU CAN'T
You can ONLY listen to the event
i forgot the entire conversation
Discord does not provide such information, so basically no
And count it
ok u count it but how do you know which invite they used again
But once you miss one event you’re fucked
By fetching em continuously
Getting which invite is used can produce a lot of false positives, since there's no way to get it accurately, so I would recommend not implementing such thing
And listening to the event
And there already are many invite manager bots, so why bother?
It’s not like we already told him that like days/weeks ago
It’s not possible or let’s say accurate
Well it's Bae so what do we expect

why does the ?? op break my vps syntax highlight 💀
Tf ask the theme author why it does that
Or the dude who wrote the syntax highlighting parser
it's the default pterodactyl 2.0 theme
?? Operator doesn’t exist for so long already
Dunno just a few years I would guess
Does anyone know a good doc that shows how to send data to an express server?
I am trying to find things on the internet but they are confusing to me
Depends on which language you’re speaking about
u listen to an endpoint and then do a post request I think
Well yeah i quite know
i have gathered some things together but it doesn't work
can u send the code?
js
and the .get property?
just do smth like

const express = require("express");
const bodyParser = require("body-parser");
const router = express.Router();
const app = express();
app.use(bodyParser.urlencoded({ extended: false }));
app.use(bodyParser.json());
router.post(‘/handle’,(request,response) => {
console.log(request.body);
});
app.use("/", router);
make sure you npm install --save body-parser or whatever you're using too
client.dataserver.get("/data", (req,res)=>{
res.json( interaction );
})```This returns me:
TypeError: Do not know how to serialize a BigInt
wait for event,
fetch the invites again
find the ones that have +1
If the computer doesn't know, how should i 😭
nah i dont like to read
what is client defined as
const express = require('express')
const bodyParser = require('body-parser');
const cors = require('cors');
const app = express();
const port = 3000;
app.use(cors());
app.use(bodyParser.urlencoded({ extended: false }));
app.use(bodyParser.json());
app.get('/', (req, res) => {
res.send('main page')
});
app.listen(port, () => console.log(`All music bots listening on port ${port}!`));
client.dataserver = app```
The body-parser implementation is included by default in the newer versions of Express, so installing it not needed
only way I found is to listen to the guildMemberAdd evevent and check EVERY invite for uses increase
Use a screen reader then
quite stupid imo
ah nice, haven't used express in a while
not adding the invite tracker then
text to speech tells me to use a screenreader
it's gonna increase my ram usage even more than it already is
yeah so you're handling get reqs
And this is in the interactioncreate event
mhmm
your screenreader told me to use text to speech
have you got an app.post?
tts says your screenreader told me to use text to speech
yeah it's under the get:
client.dataserver.post("/data", (req,res)=>{
console.log(req.body)
})```
crazy, it's telling me to call your phone now
Each tutorial and doc i have seen told me to do these things
ok add the router first
TypeError: Do not know how to serialize a BigInt```still hits me with this
const router = express.Router();
and change client.dataserver.post to router.post
That isn;t needed
as i am using the cors package
😭
You're passing an object that contains a bigint, Express tries to serialize the values but JSON does not have a way to represent bigints, so you have to convert it to something else
The interaction data you send probably contains a permission bigint
I am sending the normal interaction data from the interactionCreate event
does that contain a bigInt?
Yes
Yeah the permissions
Convert it to a string for example
As Voltrex said JSON stringyfing can’t represent a bigint value
.toString() would that work?
can't you just x = String(x)
You can pass a replacer function to the JSON.stringify() method to convert the bigints to a string for example
The permissions bigints need to be converted to strings, yes
That’s probably the easiest solution
This is really hot
jasondb
Why the fuck is it saying object object, i am literally only passing a stringified interaction
I took the part Since Tim isn’t here atm
For example:
JSON.stringify(
interaction,
(_, value) => typeof value === 'bigint'
? value.toString()
: value
);
Uhh bigint is it’s own type?
Yes
yeah you're stringifying an object
stringify({}) -> [object Object]
i see, yeah that's dumb
express still confused me.
So for some reason, the get method posts my data to my webserver
and the post reads?
Errr Wut
This worked but it's going to be unusable by all the \ marks.
👀 Huh?
client.dataserver.get("/data", (req,res)=>{
res.json(JSON.stringify(
interaction,
(_, value) => typeof value === 'bigint'
? value.toString()
: value
));
})```This is a .get method, but sends data to my webserver?
I ain’t see shit on mobile wtf
The res.json() method responds back to the GET request, so that's why that data is shown
Owhhh i see!
The \ you see are escaping your quotes
Since the entire thing is a string
Already wrapped in quotes
So parsing it back to json would remove the quotes right?
Quotes inside quotes need to be escaped
and make it a usable json again?
Yes
I see, awesome, thanks!
So now we have this.
It posts the data to the webserver
how would i pull the /data contents from the webserver now?
What exactly do you mean by that?
Well you simply respond with the stringyfied object to the get request
You just need to get the response
You must be requesting this <url>/data endpoint somewhere
client.dataserver.get("/data", (req,res)=>{
res.json(JSON.stringify(
interaction,
(_, value) => typeof value === 'bigint'
? value.toString()
: value
));
})
client.dataserver.post("/data", (req,res)=>{
})```If the .get is doing all the work, what the fuck is the .post data for?
Now get the response …json() it and you got your object again
Because right now it seems like the .get is sending the data.
post is for posting data to the server
Well i am posting data to my webserver, using the .get?
you're sending a get req to the server with the information you want
like to be seen here
get(“/data”) is just the listener for GET requests on that endpoint
You must be calling that endpoint somewhere
But the post is empty, the webserver is empty. I am then calling the .get, and then it displays the data out of nowhere.
huhhhh\
(req,res) is short for (request, response)
bro a ghost is controlling my webserver
yeah i know
yeah so the response is what is "sending the data"
The get request listener MUST be placed in your slave clients, the post request must be send to the slave endpoint once an interaction happens
well you aren't making any post requests
Because you don’t post anything in your event
I’m gonna send you an example in a few seconds
you're sending the JSON response
Once the Pc has booted up
if you comment out res.json(...) it won't "send" anything
client.dataserver.post("/data", (req,res)=>{
res.json(JSON.stringify(
interaction,
(_, value) => typeof value === 'bigint'
? value.toString()
: value
));
})
client.dataserver.get("/data", (req,res)=>{
console.log(req)
})```this for example doesn't post
but isn't the post supposed to fucking post
it supposed to handle a POST request
yeah see
because you're now handling a POST request
not a get request
and you're sending a get request
Ok once again you don’t need a post request listener
No?
and theres nothing in there but a console log
So a get could do anything
i see
change them back
and do res.json({ bruh: true})
that's what it will respond with
Inside your interaction event you curl your two endpoint in simpe words and pass the data to it
Sorry was meant to say GET request listener
Inside your interaction event you send this POST request to your two bot slave endpoints
And for both you create a POST request listener
I did remove the post like you told me and it works too
Since both are starting a webserver you have to use two different ports for em
i am so dumb
So the res.json basically displays everything you want lmao
here's a better explanation
GET is saying "I want the data in request, I am waiting for a response which should contain my data"
POST is saying "Do something with the data in request. I am waiting for a reponse which will tell me if you did it or not"
so i am in fact not sending any data to the webserver, only returning them data i want to see?
you're only sending the request
Tf are you doing
In the /get read the data
Bro i am confused
I thought you wanna send the interaction data to your two other clients?
Yes
So both need to listen for post requests your master does
Ok then both slave clients are running that express server listening for post requests and your master just sends a post request using, http, node-fetch or undici lib for example
It actually sends two post requests
One to the first machine, one to the second machine
I've actually setup that express server on the masters client
Since both Webservers running locally require different ports
No that’s nonsense
The master does not need to listen for anything
So wait, i need to do a post request to the webserver on the masters end, and then read the data using a get requests on the slave's end?
Since he gets the interaction
Yeah, so he should send the data over to the others, using the webserver
No
NOT BY USING A WEBSERVER
you simply send a http post request
It doesn’t need a webserver
You can use the inbuilt http lib or undici of nodejs
To simply send that post request to your Webservers on your slave clients
Or node-fetch
Whatever you like
With the interaction data as content
(body)
So you are telling me i should create a webserver on each one of my slaves?
I did, yes
Okay wait i will try it out
Can’t be hard to figure out
The two slaves need a letter box to receive a letter but the master doesn’t need one to send a letter
He just needs the trigger to send his letter
Which is your interaction aka when an user presses your button
-> POST request to your other two clients
Those are listening for requests waiting to do something the master says
So the post request is an event that listens to posts made to the webserver of the slaves?
OOOwh wow
server.post() creates a listener on that path for post requests
It doesn’t send one
I literally asked you what you are familiar with and you said express 
That has been close enough to be as confusing as a discussion with Bae

Okay i see
But like, js client.dataserver.post("/musicbot2", (req,res)=>{ console.log(res) })this is now setup to one of my slaves
and now i just do a post request to the webserver/musicbot2 path using http?
The path can be the same for both slaves
You app listen() requires to use two different ports
Since both Webservers are running on the same machine
yup
And can’t occupy the same ports
I see, as it's using different ports so different data
client.dataserver.post("/data", (req,res)=>{
console.log(res)
})```i must wrap this in an interval right
to continuously check for posts being done
Owh sorry
Ffs I can’t start my PC
Bullshit
PSU doing strange sounds
Well fuck this I’m going to sleep the rest of the day
hit it with a bat
put it on your christmas tree
Most important thing in a PC
lmao
Damn imagine a christmas tree with a 1080Ti
it would tip over and fall down
var XMLHttpRequest = require('xhr2');
let xhr = new XMLHttpRequest();
xhr.open("POST", "https://localhost:3000/data");
xhr.onreadystatechange = function () {
if (xhr.readyState === 4) {
}};
let data = JSON.stringify(
interaction,
(_, value) => typeof value === 'bigint'
? value.toString()
: value
)
console.log(data)
xhr.send(data);
```Okay i have set this in the masters file.
In the slave's file i've got this setup: js client.dataserver.post("/data", (req,res)=>{ console.log(req) })
It doesn't long anything tho. Nor does it send anything to the localhost url
It doesn't need to be secure now?
i am just using this for testing
later on i will use the ports of my vps to start the servers
You can’t just use the secure protocol out of nowhere
There has to be a valid cert, a validation with the cert server an handshake going on etc.
So use non-secure http protocol
http://localhost:3000/data
Fuck auto correct
Also please the http lib, node-fetch or the ugly kid undici
Even axios is better than what I see

I've used this but still no data displayed
Are all 3 clients on your local machine NOW?
i am only use 1 master and 1 slave to test
and yeah
var XMLHttpRequest = require('xhr2');
let xhr = new XMLHttpRequest();
xhr.open("POST", "http://localhost:3000/data");
xhr.onreadystatechange = function () {
if (xhr.readyState === 4) {
}};
let data = JSON.stringify(
interaction,
(_, value) => typeof value === 'bigint'
? value.toString()
: value
)
console.log(data)
xhr.send(data);```This in the master
That’s being executed inside your interaction event?
ready event:
const express = require('express')
const bodyParser = require('body-parser');
const cors = require('cors');
const router = express.Router();
const app = express();
const port = 3000;
app.use(cors());
app.use(bodyParser.urlencoded({ extended: false }));
app.use(bodyParser.json());
app.get('/', (req, res) => {
res.send('main page')
});
app.listen(port, () => console.log(`Bot #2 listening on port ${port}!`));
client.dataserver = app``` and ```js
this on the interactioncreate event
client.dataserver.post("/data", (req,res)=>{
console.log(req)
})```on the slave's end
Yeah
That 2nd part is inside the interactioncreate event, that might be the issue
yeah
You're using a get event and sending a post request
No
it's due to the event being in my interactioncreate
nvm
its still not working lol
The post listener will be created using his client.dataserver
Where is the code now?
wth is going on?
I had moved it outside the event, however it's not the problem
because after my xhr2 send, i am checking the localhost/data and it's not displaying anything as well
It can’t be inside the interaction event
Please use an appropriate lib
As I said
So you are telling me it's cuz of the library?
I will switch then
😭

how can i stop cors from stopping me?
okay, removing it
this on the interactioncreate event
client.dataserver.post("/data", (req,res)=>{
console.log(req)
})
this is in another event? 👀
Yeah told him to move it out already
oh okay
Yeah that's not a concern for now
right now i am concerned on why this bitch of a code doesn't send the data to my endpoint
It is since the event is never been called
oowh
Correct since it’s listening to a post request
Not to a get request
Works
Now back to your master
Use a fucking appropriate LIB
Huh
Or I will scream
curl -X POST http://localhost:3000/data in your local terminal/command prompt
if you want to check that specific endpoint
Opening that endpoint in your browser literally sends a GET request to it which is the default request method
I see!
Yup i understand now
Is it okay if that piece of code is in the ready event?
Or wouldn't it work as well
client.dataserver.post("/data", (req,res)=>{
console.log(req)
})```
ideally that would be outside of any event.
Yes it’s okay to create the listener once the client is ready
I see
if you want to wait until the client is ready you would have a ready check in the event itself.
Since you need ready client to perform an action
ideally you would send a response if the client isnt ready.
client.dataserver.post("/data", (req,res)=>{
console.log(req)
})```this is indeed returning me the req data
to display the sent data, i would need to use req.body right?
You want the body you sent from your master, yeah
req.body returns me {}
😭
Did you actually send something g?
xhr is sending: js {"type":3,"id":"1008744142978945054","applicationId":"1003343920484339733","channelId":"1007793153773940816","guildId":"996722689010061322","user":"345138133429649408","member":"345138133429649408","version":1,"appPermissions":"4398046511103","memberPermissions":"1071698660929","locale":"en-US","guildLocale":"en-US","message":"1008741523346694235","customId":"play","componentType":2,"deferred":false,"ephemeral":null,"replied":false,"webhook":{"id":"1003343920484339733"}}
yeah
Tf you’re still using xml
let data = JSON.stringify(
interaction,
(_, value) => typeof value === 'bigint'
? value.toString()
: value
)
console.log(data)
xhr.send(data);```
wait
waiut
wait
I swear if you don’t change that I will punch you
josn.Stringify is not a thing we could use
Now
Whahahha bro let me fix this first
console.log(xhr.status);
console.log(xhr.responseText); returns me 0
and blank lol
you know what , i am changing to axios but i bet for 10$ it's going to be the same
xhr wont have a response, you are not sending a response.
If you have to use a lib then at least node-fetch
axios is so much easier ngl (than xhr2)
I wonder express doesn’t respond with a 200 on success automatically
I TOLD YOU THAT 15 MINS BEFORE
sssh
Beware that Axios is mostly bloat, at least use something like Undici
It can be as bloat as it wants, it just needs to work whahaha
Node-fetch only uses imports
unless i use an older client
FakE I'm going to remove CJS completely because you said that, you must use ESM!
The first one is the req.body logged
the blue one is the real interaction response that's being sent by axios
I thought it might have been a problem due to that it's a string, so i used JSON.parse, but it returned me that it cannot return value b ack to primitive object
Yeah you see
{"type":3,"id":"1008746829501964398","applicationId":"1003343920484339733","channelId":"1007793153773940816","guildId":"996722689010061322","user":"345138133429649408","member":"345138133429649408","version":1,"appPermissions":"4398046511103","memberPermissions":"1071698660929","locale":"en-US","guildLocale":"en-US","message":"1008746821281136702","customId":"play","componentType":2,"deferred":false,"ephemeral":null,"replied":false,"webhook":{"id":"1003343920484339733"}}:''```this is the full string, it just didn't scroll with output lol
Tho how can i parse it back to json
well in the post listener add json() as method to the request parameter
how would i add a method
you can, using app = express.jons
If so then use it
if your bodyparser/express.json is setup then the only reason it would give you a string is if the content type isnt being set in the request
Is it possible to get HWID from a system in a chrome extension? If so please link the api
It's text inside an object
I dont think i did
const response = await axios.post("http://localhost:3000/data", {
headers: {
'Content-Type': 'application/json',
},
data
}) ```even after setting the content type
it still gives me the initial stringified result
let data = JSON.stringify(
interaction,
(_, value) => typeof value === 'bigint'
? value.toString()
: value
)```
Is there really no way to re-parse it back to json
I do it all the time on express.
That’s looks accurate for me
console.log(JSON.parse(req.body.data))```forgot to parse it back to json
now it works
guys, it's been a rollercoaster of emotions today
axios already parse it for you though-
but i wold love to thank everyone for helping me
yeah
no, it returns me: {data, headers}
data only contains the string
But it works, so that's a good think
you hear that, i am smarter than bae

You also ignored what I wanted to know






