#development
1 messages ยท Page 1292 of 1
@opal plank when you click forgot password it goes to the discord blog
because it makes the page look better
its not const
@obtuse jolt I don't like your easter egg lol
hours, minutes and seconds is set but days not
it makes it look like a dodgy site lmfao
@faint prism lmfao
-10 points for putting unecessary stuff just to increase size
.___.
you make me receive brain damage
i asked cuz i thought you had a good reason
there is literally no good reason for it
@obtuse jolt Why do you reply with code 200 but the JSON contains something like 403?
bad design but okay
@faint prism where?
bruh moment https://cdn.yxridev.com/u/Tlf1gisU.png
how is this better in any way
wut are yall talking about
@faint prism where?
@obtuse jolt https://i.imgur.com/naPwwZQ.gif
๐ณ
its an error though
How about just a "Login" link straight to Discord login?
It's an api response that doesn't reply with the right status code lol
._____________.
@faint prism because it would make me need to add error code handling if i did it with http codes
.________.
It's an api response that doesn't reply with the right status code lol
^^^^^^^^^^^^^^
it works does it not?

Dunno, I don't trust it with any tokens ๐
neither do i tbh
i might just change it to err8932u892379857324598 so you will stop complaining
specially when you show this little commitment
๐ฉ that's not how 02auth works
i dont even wanna know where/how you storing our oath tokens
its stored client side
Store them in a map ๐
inb4 XSRF vulnerable
and api tokens are stored on our database
which is the bit i dont trust
api tokens have nothing to do with discord
Store the token in a cookie
there is literally no affiliation between the two
uhh
const Discord = require("discord.js");
const client = new Discord.Client();
const { prefix } = require('../config.json');
const colors = require('../colors.json')
module.exports = {
name: 'say',
description: 'say',
usage: 'say',
cooldown: 1,
guildOnly: true,
async execute(message, args) {
var obj = message.content.split(" ");
var title = obj[1];
if(!title) return message.channel.send("Please Set a Title")
console.log(title);
var colorpaleet = obj[2]
if(!colorpaleet) return message.channel.send("Please Set a Color for the Embed")
console.log(colorpaleet);
var saymessage = obj.slice(3).join(' ')
console.log(saymessage);
if(!saymessage) return message.channel.send("Please Set a Description for the Embed")
var sayembed = new Discord.MessageEmbed()
.setTitle(`${title}`)
.setColor(`${colors.colorpaleet}`)
.setDescription(`${saymessage}`)
message.channel.send(sayembed);
}};
no state parameter
nope
;-;
Wow
@cinder sandal i want to make it easy
AND you should be checking if it actually exists before just doing it
what if i put Pepega as the second param?
you gonna try setColor('PEPEGA') ?
@opal plank for the 1k time am dum
@cinder sandal no
hey
why is my message.react reacting to the wrong message?
client.once("ready", () => {
console.log("Ready for action!");
});
client.on("message", (message) => {
if (!message.member.roles.cache.has(config["announcer-role"]) || !message.content.startsWith("!") || message.author.bot) return;
const args = message.content.slice(1).trim().split(' ');
const command = args.shift().toLowerCase();
if (command == "announce") {
var announcement = "";
for (const word in args) {
announcement = announcement + args[word] + " ";
const message = announcement
}
webhookClient.send(announcement)
message.react('๐');```
i want to choose colors from json file
look:
@opal plank how i check for it
make array and has it
errwin
do you know the answer?
yikes the login page is php
@earnest phoenix php is good
no, it isn't
it isn't
lol it is, of course
im not using nodejs for my website
you don't have to lol
no-one that can help.?
how do i get my bot to grab the last image link or attachment sent in chat
there are other web frameworks that exist
php is a language for older web development
@opal plank ur using typescript
of course
thats a lot of ORs 
there's absolutely zero reason to use php over something like asp.net core in 2020
drogon is also extremely powerful and performant from what i heard (cpp)
channel.send({embed: {color: "YELLOW", description: `Goodbye, ${member}! Please take care of yourself and have a continued great day! Thanks for being apart of this server!`}});
How can I make a Footer and Timestamp in this embed?
php is not something that has to be used all the time. tbh vue.js, react.js, gatesby.js, asp.net, are like the top frameworks right now
else if
else if
else if
else if
else if
else if
else if
else if
(ejs) anyone know how to fix include is not a function
channel.send({embed: {color: "YELLOW", description: `Goodbye, ${member}! Please take care of yourself and have a continued great day! Thanks for being apart of this server!`}});How can I make a Footer and Timestamp in this embed?
anyone help me?
slow down endph, we will get to you
and i havent seen much
svelte > *
@autumn aspen .setFooter("message:
hi
HeLp mEeEEe
@autumn aspen use MessageEmbed
@cinder sandal no bad
it can add a footer
dont use Builders
ejs, is weird, i think you have to do something like ```js
<%- include('path') -%>
and an timestamp
send it raw like he's doing
oh wow isnt that something https://cdn.yxridev.com/u/LYulO9Xg.png
yea ejs is just wack
@obtuse jolt your login is still XSRF vulnerable
anyone can bait and steal data if they wanted to lol
they all accomplish the exact same thing, but look at the delay in using EmbedBuilders
lol
saying that isnt gonna help me a lot
yes it is
does anyone know why my bot is reacting to the wrong message?
you can do research on it
client.once("ready", () => {
console.log("Ready for action!");
});
client.on("message", (message) => {
if (!message.member.roles.cache.has(config["announcer-role"]) || !message.content.startsWith("!") || message.author.bot) return;
const args = message.content.slice(1).trim().split(' ');
const command = args.shift().toLowerCase();
if (command == "announce") {
var announcement = "";
for (const word in args) {
announcement = announcement + args[word] + " ";
const message = announcement
}
webhookClient.send(announcement)
message.react('๐');
}
}).
client.login(config.token);```
0auth has a whole article about it that's like the first result on google
its not
does anyone know why my bot is reacting to the wrong message?
@eternal osprey does it react to the bot's message? or to the author one?
probably because your using ORs statements, instead of ANDs
it actually reacts to the command call instead of the webhook sent message.
yeah
to the one the webhook sends
its not
@obtuse jolt
wow you gonna attack a dashboard to change a guilds prefix
thats like a death sentence for me
that's
that's not how that works lol
the vuln exists client side
the attacker can use the token
so if its client side how is this my problem
(ejs) why is include not a function
and gain access to the user's information
message.react reacts to the author message normally
i tried to do announcement.react
and even defining let message = announcement
express would be a better idea to use instead of php 
nothing worked
with a .then it would react to the bot's message
(ejs) why is include not a function
@misty sigil Keck ew
.then.message.react?
A CSRF attack specifically targets state-changing requests to initiate an action instead of getting user data because the attacker has no way to see the response to the forged request. For the most basic cases the state parameter should be a nonce, used to correlate the request with the response received from the authentication.
nonce
@earnest phoenix i would give up if i were you, they clearly dont care about privacy or how good it is
lol

wait till they discover GDPR
lol
and possible huge legal problems
yikes thats not fun
probably going on the same tangent as i was yesterday with a user unironically recommending n++ over vsc for a begginer
so .then{
//code
}```
SpooThew
ewwwww n++ sucks
@eternal osprey .then(code)
message.react('emoji')
}```
use notepad instead 
n++ trash
@cinder sandal a.send("poopy").then(message => message.react("poo")
owh okay.
oofers
then ception
i mean thats a easy fix
message.react is not a function
webhookClient.send(announcement).then(message => {
message.react('๐')
})```
super broad
why are you using message as the predicate's name? isn't message already defined in your event?
that will obfuscate but shouldnt be an issue
iirc it targets the local before the outside scope
unless he needs to call message from outside the scope
but he's targeting the returned promise value
so it should be fine
mhm, but isn't that bad practice to do that
it is
there isnt one, that is not returning a message i dont think
i think webhooks have their own thing
lemme check rq
webhooks can't react
Can I use grep to change all instances of a word in a file?
probably
client.on("message", async (message) => {
if (!message.member.roles.cache.has(config["announcer-role"]) || !message.content.startsWith("!") || message.author.bot) return;
const args = message.content.slice(1).trim().split(' ');
const command = args.shift().toLowerCase();
if (command == "announce") {
var announcement = "";
for (const word in args) {
announcement = announcement + args[word] + " ";
}
webhookClient.send(announcement).then(message => {
react('๐')
})
}```
it's sending the message
var
but not reacting to it
oowh webhooks can't react?
yeah it does.
why tf does it return an array
but it's not working.
@eternal osprey i am still suffering from that reaction too lol
it actually has 2 methods cry
one returns array
the other just a message
if he set [split] to true
oh
its returning an array
var can be good in some cases
but shouldn't always be used, especial in es6, when we have let
^^
client.on('guildMemberAdd', member => {
const channel = member.guild.channels.cache.find(channel => channel.name === `system-messages`);
if (!channel) return;
const lxeembed = new discord.MessageEmbed()
.setColor("RED")
.setDescription(`Welcome to "**A S B**", ${member}! Please before chatting read the welcome and rules first in [#762015415600808018](/guild/264445053596991498/channel/762015415600808018/), thanks!`)
.setFooter("Time Joined", message.guild.iconURL())
.setTimestamp()
channel.send(lxeembed);
});
Why does it say message is not defined on message.guil.iconURL()?
Anyone know what the regex is for discord server invites, keeping in mind you can use discord.gg/invitecode and discordapp.com/invite/somecode
idk it worked either way.
var makes the variable to be defined through out the entire file, and i believe it ignores outer scopes, where as let doesn't, it defines the variable in the current scope it is in. someone please fact check me
idk it worked either way.
@eternal osprey dude can u see what my problem is whats wrong?
@autumn aspen no
@earnest phoenix type n.tag regex in #265156322012561408
@earnest phoenix https://regex101.com/r/cKeC9A/1
Regex101 allows you to create, debug, test and have your expressions explained for PHP, PCRE, Python, Golang and JavaScript. The website also features a community where you can share useful expressions.

just like R.Danny i got a couple useful tags

oofers
and a lot of them are stolen from R.Danny too, sooo....
there was a good one in DAPI but someone edited it with a trash one
i take a lot of the useful stuff from dapi
those tags are hella handy when developing
but ehhm. I still cannot get my code working.
You need an adult process, stop abusing children
call the cps
Call the task manager
memes
pull the plug
@quartz kindle abusing children and processes are good though
ngl i kinda wanna and dont wanna do it
its just completely and utterly pointless what im doing
look at the amount of times the process is dying
those gaps is the bot legit dying
im just separating the load onto different child processes with IPC
that has no prupose whatsoever other than to see how big of a mess i can make out of this
hahahah
how can you completely end a while loop? like with intervals you can do clearInterval()
break it
You break it by a false statement for the while
or just literally use break
what's the motive behind using a while loop in the first place though
there aren't really use cases for it in modern development
There is but it's not without serious checks
let test = false;
while (test === false) {
if(user.id === ui) break;
break test = true;
}``` this would keep emitting till test was true right? even if user.id === ui
let me see
no hero
remove break test=true;
that's not valid but the rest would be
๐
But if this could be done better, try to optimize.
if i use break, would it emit the rest of the code below it?
or is it like return
optimize speed
or your bot will crash if it got lot of request from modules like ffmpeg module
Break is like return
ok
like return only
let test = false;
while (test === false) {
if(user.id === ui) break;
test = true;
}``` so like this?
} catch (err) {
data.log(err)
}
break;
No
no no no
while (1 == 1) {
if(user.id === ui) break;
// Do something till user-id === ui
}
That'd be easier/more efficient
if you're not going to define a while statement
and just want the loop for looping
What is the objective?
To confirm user-exists?
or
that's a heavy operation though, ids are strings in djs, there's probably a better way around this
Uh no not necessarily
to check if 2 different people who r reacting are in the db
on the string-type
Okay then do a for-loop through user-list length
and do your check there, and return value
on completion
fastest way
yh but thats not the only thing, its gonna check if they're in the db, if not add them to it with elo of 250 and check if 2 users have the same/similar elo
lmao while (1 == 1) { ... how about while(true) genius
That'd be easier/more efficient
Numerals parse faster than bool
Don't play
I run code complexity tests do it yourself
This is JS
remember
js bench it^
Hi guys! Could anyone help me understand why this is throwing a Typerror? Both of these files reside in the same directory, and I'm using node.js with Babel
//----------------Paginator.js----------------------
export default class Paginator {
constructor(dataArray){
this.dataArray = dataArray;
}
//(...)
}
//----------------SearchMessage.js------------------
import {Paginator} from './Paginator.js'
export default class SearchMessage(){
//(...)
async sendSearchResults(searchSet){
//(...)
const paginator = new Paginator(searchSet);
}
}```
when SearchMessage is instantiated in another file, (as searchMessage), searchMessage.sendSearchResults throws a typerror `UnhandledPromisRejectionWarning: TypeError: _Paginator.Paginator is not a constructor` which implies that when i call `new Paginator(searchSet);`, it's not a constructor.
Few issues
you're not awaiting anything
so an async use is pointless
and the class-setup is wrong.
use of constructors may need revision! ๐
perhaps with defining of a super
ayoo
{a: {b:{c:foo}}}
from foo being a function
is it possible to , aka
this.this
to escape to a scope
bad example
Otherwise globalizing this is not do-able
rather than in
So deeply nested you want to call a scope called way-ahead
?
You'd do it via call-backs
if the function is inside c, i assume without binding it prior you cant access a within c
Thanks for the headsup about async, but there's some unwritten code there involving discord messages that actually does require awaiting. That particular function might actually not need to be, I'll check in a sec.
But thank you! I think I can solve that issue now.
C needs reference to A's this
hmm i see
Usually with JS or other languages
figured
welp, thats one reason i use arrow functions
And we can do windows.function = a
and we can forever call it, but yeah callbacks/etc get that job done. ๐
i mean, fair
iirc functions() {} can call this on parent
while arrow functions call this on the param
I really like for complexity reasons array functions
Imagine this
functionlist {
"testerfunc": () => {
},
"doggo": () =>{
}
}
You can call that with functionlist["testerfunc"] or functionlist.testerfunc()
in JS
This allows iteration out the ass
๐
Was scrolling through my friend's botum command handler and found this. How is this a valid JS object even though it's JSON?
module.exports.args = {"Name":"A name for your pet}
hey guys
```js
```
yeah
const Discord = require("discord.js");
const config = require("./config.json");
const client = new Discord.Client();
const webhookClient = new Discord.WebhookClient(config.webhookID, config.webhookToken);
client.once("ready", () => {
console.log("Ready for action!");
});
client.on("message", async (message) => {
if (message.member.roles.cache.has(config["announcer-role"]) || !message.content.startsWith("!")){
const args = message.content.slice(1).trim().split(' ');
const command = args.shift().toLowerCase();
if (command == "announce") {
var announcement = "";
for (const word in args) {
announcement = announcement + args[word] + " ";
}
console.log(announcement)
webhookClient.send(announcement)
await message.react('๐');
}
}
})
client.login(config.token);```
though i usually prefer not assigning it as a property
rather just a getter/ish function
my bot still reacts to the wrong message
keep forgetting
i've always wondered whether node is so bad with mem management just because js objects are internally just fancy dictionaries
@eternal osprey because the message variable is the message te user sent
i know
but for s ure based on use you may need another method/style over another
you're doing message.react
why are you for looping over every word?
{
function getName(name) { return this.name}
getname: (name) => {return this}
}
was that example meant for me?
nope
anyone else that could help me?
hmmm
i told you
what did you tell me
webhookClient.send(announcement)
await message.react('๐');
the reason why i told you to await it wasnt for that
you read half of what i said and then just went with it
did i explain that it returns a Promise<Message >
im fairly certain you addeed async cuz i told you so
hi i got a programming question(the code snippet in javascript)
now i have an object named files, and it has several objects in it, like folders and what not, so i built a way to "ls" which basically shows all the keys of the 'directory' u searched
now all I get is a string like "local/C" and i show all they keys of files.local.C
but now i want to delete parts within the object.. any idea of how to do this?
the problem i face right now is how i find the file equivalent of the string is
function stringToFile(m){var x=files;
if(!m||m==""){return(files)}
m=m.split('/');m.forEach(a=>{if(x[a]){x=x[a]}})
if(x==files){return(0)}return(x)
}
but it only returns an equivalent of what i want and not the actual thing. example, let's say var x is 2, and var y = x, making y=0 doesn't change x
is there any way I can have the actual object location to delete(and for security reasons, no, using eval is out of the option)
what you are doing there is comepletely uncessary
well nothing is dr philosophy
either then on the send() or await it while assigning its returned value somewhere
i tried to .then it
but it gave me lots of problems
like....?
let me show you. Wait a min.
lol
don't celebrate too early
I did last night and hated my self for brain derping in a midst of a code problem
i need to drink a bit today
thought I could on 4 hours of sleep/4 talls in
need to get productive af later on
Hell yeah I feel that
might aswell start now and get thru the night coding
console.log(announcement)
webhookClient.send(announcement).then(message => {
message.react('๐')
})``` this is what i have
look at the error:
Hell yeah
need to learn a bit more of child process
I'm ahead of you on that one, my day's settled
and see how it works more indepth
JS stuff?
lemme give you a hands down example of what im doing
Word I do a lot of high-end JS stuff
(node:3960) UnhandledPromiseRejectionWarning: TypeError: message.react is not a function
or wait
this is the error
this is me taking a library to its limits
its NOT meant to handle this many channels are all
oh...
hell yeah good to hear
uh... long story short, if i have a function searching through an object, can i return the actual part of the object itself? since i want to delete(specificPartOfObject)
this place makes me stresfully...
why is message.react not a function?
You're initating the object/class
what i ended up doing is initiating dozes of Chat's with that constructor and assigning them globally into an object for easilly accessibility
though the ratelimits is handled per process not per chat conenction
each Chat handles its own websocket connection
that allows you to connect to twitch's IRC with multiple instances
You're initating the object/class
@unique patio there's a context why i want something that seems so vague.. lemme explain the context again
which is what i though at first, hey, why not just create dozens of connections and send them each what they need to do
huh?
its basically sharding what im doing
Yeah rate limit is per process
for an api/irc that doesnt have sharding
(aka connection)
though it doesnt work like that in this lib
under bot API
it handles the channels connected globally
not per Chat
whenever you join a chat, it gets added to its global ratelimit handler for some reason
so i now have to change what i did to spawn a new process and use it there
hence why i need to use IPC or spawn child processes
so i can split the workload of the channels onto each instance
rather than having one single instance handling all global ratelimits
but im still unsure about how child process works, ive done IPC quite a lot in the past, but they werent dynamically spawned
i'll need to figure out a way to dyanmically spawn and assign them as variable
Oh
master => slave kind of thing
having the slave only connect to channel and re-emit all process to master, where it all gets handled
but the connection is done only on slaves
so yeah, thats the gist of what im doing
anyone can help me with this? what can cause this? i see this a lot of times in the Bot also i see sometimes the bot just dissconnect and i need to restart the whole bot service.
don't console it

uhhm guys
for no reason whatsoever other than to just see how far i can take the library
Ahhh you could probably assign a global handler for such
}
console.log(announcement)
webhookClient.send(announcement).then(message => {
message.react('๐')
})
}``` message.react isn't a function.
indeed
why is that?
@opal plank i told you to shard your bot days ago
master => slave kind of thing
@opal plank MAiN/sUb!!!!!!!!!!!
Not so much a concern it's added bonus
so im going to have to use pipes to send cache events onto the main process too
in JS most processes with caching can handle both ways
@proven lantern its not Discord you cucko
(new data or existing)
Twitch does not have sharding
twitch right

Oh yuck
im making my own cluster for it
So you just handle the data your way
indeed
@eternal osprey code913: because the message variable is the message the user sent
@slender thistle Slave => master 
shard by making more twitch accounts
I haven't played with twitch much but if rate limits are eating at you
thats not how it works
@boreal iron what

try applying too an enqueue/dequeue system
that's bs
it's a couple lines of code
@proven lantern sen?
i have another problem.
Baka Erwin 
that was of a while ago.
not bensen
its all handled internally by the lib(i already reported to them that their librbary does NOT like a ton of channels)
@unique patio
@proven lantern from ?
And that went very well
usa?
so rather than patching the lib with a contribution(which is what i shoudl do), im just splitting its capabilities into different node processes

@proven lantern ok
โค๏ธ
@slender thistle Slave => master :angeryBOI:
@opal plank MaStER SuB
so, there's an already created object called files(which also can have objects in it), and basically i want to make a function in which I can delete a part of this object with taking in a string
i have an ls version which shows all the keys in a specific part of the files object because i have made a function like this below:
if(!m||m==""){return(files)}
m=m.split('/');m.forEach(a=>{if(x[a]){x=x[a]}})
if(x==files){return(0)}return(x)
}```
the thing is, it only returns an equivalent of the specific part of the object, so you can see all the keys in that part of the object, but you cannot delete that part of the object(for obvious reasons)
is there a way to take a string input(like "local/C") and pass in the actual part of the function files.local.c?

im just doing the worst possible thing i could in this situation to learn more about child processes

:l forget it yes
No shame in that really multi node's don't slow you down any
it's read once if setup and your projects are addon to that support
to summarize that, 1,000+ instances 0% each til use.
node would have covered all instances with what it needs to run
so it's really the limitations of node + your code
๐
thats the thing i need to check
i need the processes to keep alive
since they are basically listeners with emitters
@viscid gale if the object contains strings, then no because strings are always passed by copy, never by reference
you'd need to return the parent object that contains the string
im gonan give it a try soon
just finishing wacthing a series and then i'll play with child processes
@quartz kindle uh.. ok let's say my object files is
local:{
C:{
Desktop:{"eg.txt":{running:0,receiver:"",data:"This is some text"}},
Documents:{},
Downloads:{},
System:{}
},
console:{hide:1,running:1,receiver:""},
map:{hide:1,running:1,receiver:""},
info:{hide:1,data:{ip:"",username:"",connected:[{ip:"",access:1}]}}
},remote:{}
}```
keep alive is constant heart-beat checks
okay THATS something i wasnt aware of
doesnt child processes already handle that?
No that's client <> server
server sends a hey, you alive
you as client say yes I am
and that's a keep-alive.
wait im confused now
and basically, I can use my stringToFile function i mentioned above, then just Object.keys(stringToFile(userInputtedString)) and I get a result
the library already handles acks and heart beats with the server
i would just need to spawn a new instance with IPC hooked
thats about it
imagine this for example
Yeah theoretically.
like if I put "local/C" as the string, the return would be Desktop,Documents,Downloads,System
const newNode = spawn('node slave.js');
newNode.on('event', function ...)
slave.js internally handles all binding processes from the liba nd re-emits them onto strout()
stdout.emit('event', event from lib);
wouldnt that work?
but i can't use the same concept to delete because.. what i get from my stringToFile function isn't the actual object(meaning i can't delete(x) and have it work) it's just a copy
of course the syntax is completely borked
i gotta look into it more deeply
but thats just the theory im going to be applying in this case
initiate a node with the bare minimum requirements for the slave process
You could just require each server.js
and re-emit events
or main.js
@viscid gale if you get local/c you can delete result.desktop or result.desktop["eg.txt"] but you cant delete result itself
to boot them and have each instance handle itself
so it doesn't affect main service
i already do that somewhat
heres example
hat for loop handles the amount of created chats i do
that*
Should be simple enough, but the idea of objects and calling new, is that we can call hundreds of these objects and they all work on their own terms.
๐
so i just change a variable with the quantity of Chats i want
rather than using Chats(which i proved doesnt work, and that i indeed need different instances due to how the lib works)
i'd be spawning dynamic instances with the amount of max instances i set
@viscid gale if you get local/c you can delete result.desktop or result.desktop["eg.txt"] but you cant delete result itself
@quartz kindle right i wanna find a way to delete result a part of the file through a function(and no not eval)
require a basic script.js that contains the bare minimum info. Then simply use stdout to re-emit
thats the bit i dont know hwo to do
i'd need to use it in the args,. no?
Yeah
@viscid gale the only way is to get the parent object, or to do some prototype shenanigans
Call-backs
for spawning the process i would need the arguments for starting that process, and then getting the arguments called to uniquely identify it
prototype shenanigans?
sounds fun, what u mean?
for processing
i was assuming something like
node slave.js args=name
im fairly certain i can fetch args=name from within the process
to dynamically assign it
you'd need to turn your object into a class @viscid gale
Uhhhh that I'm not fully sure on for args in that regards
I assume it's passed to super
constructor
when you send args t hat way
callback should work too tbh
It's a must^
it passes the callback onto the child
You have getmethods
to pull such
and communicate
imagine this, you have userlist class
You need reference as you add objects/etc
sometimes you need an extension to pull such
call-backs/etc are the norms
Calling a global identifier to your entire class is aok too
Say you need API search in all classes, you can define that and call it as you need without a call-back
but if such was privatized, you'd call it back/etc.
function deleteFile(string) {
let obj = files;
let array = string.split("/");
for(let index in array) {
if(index === array.length -1) {
delete obj[array[index]]
} else {
obj = obj[array[index]]
}
}
}
deleteFile("local/c/desktop/eg.txt")
something like that lol
just for logging purposes
SpoOonFeD???!!!!
what if i dont want everything outputted on the same channel of the ipc pipe?
Okay
what if i want str.out('unique idenfitier', (data))
how can i access the name of that unique identifier onto the child?
where is the callback execute when you spawn the process?
how can i emit the events from within the child dynamically?
there are a couple questions i still have for this
tim im gonna try and see if it works
You'd make logger global
and pass-through its identifier
so for example
on all bots!
ServerLog(botidentifier, logmessage);
You scope however you see fits to serverlog
and then pass on each client log, its own Identifier and its msg.
๐
i guess that would work too
Oh it's a must
i was thinking of passing the identifier on an IPC pipe
If you want to log all clients
just for shits n giggles
You need a global logger to handle
image this for example
or it gets messy
this will be a big snippet, gimme a 1min
No worries
These are good questions and stuff I got stuck on
๐
so you def good
@quartz kindle it didn't work
local:{
C:{
Desktop:{"eg.txt":{running:0,receiver:"",data:"This is some text"}},
Documents:{},
Downloads:{},
System:{}
},
console:{hide:1,running:1,receiver:""},
map:{hide:1,running:1,receiver:""},
info:{hide:1,data:{ip:"",username:"",connected:[{ip:"",access:1}]}}
},remote:{}
};
function deleteFile(string) {
let obj = files;
let array = string.split("/");
for(let index in array) {
if(index === array.length -1) {
delete obj[array[index]]
} else {
obj = obj[array[index]]
}
}
}
deleteFile("local")```
walk me thru ur logic cuz it ain't working rn
oh @opal plank
That should make more sense, so when you create a child, pass your logger off to them
//main.js
let amountOfProcesses = 10;
let map = new Map();
for (let i = 0; i < amoutnOfProcesses; i++) {
let process = spawn(`node slave.js args=process${i}`, () => {process.strout.on(`process${i}`, callback)});
map.set(`process${i}`, {})
}
//slave.js
library.on(message => strout.emit(`${super.args}`, message))
to use. or have them use one from their class.
I mean you could do it cleaner than that
if all folders in the "mothers" server
are to be read for start js files.
thats why i set slave.js
Well yo u can do some approved eval to get your solution/parsing done f ast.
even on the requires.
MaIN SUb !212!
But for efficiency, cause you are only calling process once per-define
@viscid gale so apparently array indexes are strings and not numbers lmao... make it == instead of ===
and its not awaited, you could actually insert the process in map.set
thanks js
are they making message.reply() for the new quote feature thing cause 
You'd do what your doing for length property in your for-loops as to not call properties to the array (each time you loop)
Objects be easier to deal in
For complexity reasons
indeed
lists/objects can deal out faster
changing objects rather than re-setting the map
Map is bad
get()=>modify
The real truth
is it though?
Yup
i just use it as an index
If you can ALWAYS for iteration through these issues
and write the code manually
๐
holyyy, thanks @quartz kindle
There's issues with these things that low-key go unseen
now walk me thru the logic
For instance did you know, looping through a changing list
can cause issues on splice
to do it backwards?
the logic is very simple
Loop backwards vs forward to fix
so i'm having an issue with better-sqlite3
havent happened to me yet, so not rlly
you split the string into an array, then loop over the array
in the loop you check if the current item is the last item of the array
Well the power itself for these features came from default iterations
if its the last item, delete it
for is foreach
otherwise add it to the temporary object and continue
as it is any other loop
while is for
make sense? for is the lowest end
of t hat loop
the only reason i enjoy maps is that you are basically assigning an index for it
You want fast processing it's done by making that for the best you can
All arays come indexed.
rather than making an object containing each index as a property, maps works well for that
hmm thanks, i'll think on it tim
So in JS,
var value = [1, 2, 3 ,4];
var len = value.length;
for (i= 0; i < len; i++) {
//
}
thats what i do a lot, yeah
when i start my bot i get an error:
better_sqlite3.node is bot a valid Wiin32 application.
This is on windows- i transferd my bot to windows from a linux system and i now get this error please help
yeah, thats why i said Set() is also an option
pushing the object onto a Set() for me is equally as decent as a map
btw @quartz kindle how does changing obj change files
cuz i tried doing something like that but it only was a copy.. like, woah, im gonna sit back and look for something KEY i missed
because all objects in javascript are passed by reference, not by copy
interesting
i'llgrab a couple more drinks and then satrt coding, ty for all the info @unique patio , i truly do appreciate it
thanks a lot

but all primitives (strings and numbers) are passed by copy
so if you have obj = {a: 10}
if you pass obj, its a reference, because its an object
if you pass obj.a its a copy, because its a number
yup
but thanks dudeeeeee
when i start my bot i get an error:
better_sqlite3.node is bot a valid Wiin32 application.This is on windows- i transferd my bot to windows from a linux system and i now get this error please help
@white drum
you cant transfer node modules between machines
you have to reinstall all packages
oh
well i loose all my database?
that will reinstall everything from your package.json
where is your database stored?
i didn't make one..
quick.db makes one for you
oh
you need to find where is it
will it be in the better-sqlite3 folder?
no
if its inside the node_modules, you need to copy it and paste it there after the reinstall
usually its in the same folder as your bot
oh yea i see it in my bot folder
you probably dont have build tools installed
open powershell as admin and run npm install -g windows-build-tools
because windows is bad
unix!
@unique patio its under process, for reference
i can indeed spawn the process and call the arguments to define the name of it
leviathan will you be my twitch slave
0w0
i mean i don't even use twitch but i am gonna check out what twitch is now
hmm seems like here but more streaming than texting focused
OVH seems to constantly have network problems for me
While Xig has said it works fine for them for 3 years
If I try to reboot my bot when it has network problems, it does bot even connect
And the other person's bot on the same VPS has troubles opperating during this time too
I'm SSHed into the VPS right now
The bot hasn't reconnected since I rebooted it
And often it takes a long time for the VPS to even register my ^C presses
im using ovh for 4 years and never had issues with network/uptime or anything related so it can be a problem with your configuration maybe?
same as roki. been using them for over 2 years myself and never had an issue
Java Question:
With Nashorn being removed, what is a better replacement for it?
graalvm?
@red hollow I wouldn't be able to check the configs
As I am sharing the VPS with somebody else and not the person paying
But really, I'm down to "94% uptime"
But the bot isn't even responding
Even just logging into the SSH
I enter the password and it freezes for a minute or two before letting me in
๐ค
(When the bot and network are down, that is.
Works fine when bot and network are working)
i have no clue
Even when I am in
There is visible lag before showing the shell prompt
i've had similar "lag" while my vps was out of mem
I guess I can check that out
But wouldn't terminating the bot fix that?
Because it is not doing so
idk tbh
i've also had network lags when my bot was memleaking in tcp socket memory (cat /proc/net/sockstat)
yeah this is not the issue im p sure, 947 seems to be fine
I'll have to see if it's a memory issue when I get a chance then
(Don't have a chance rn)
also check
nethogs
@quartz kindle i didnt know about that, thanks for letting me know about this thing, seems to be useful
Sorry for the late reply
But it seems I am having trouble running nethogs
Yea, no luck, after restarting SSH
Du du du du du
Maybe it will respond one day?
what does htop say
@quartz kindle Nethogs is not installed, I do not have the sudo password
@topaz fjord Lemme check
htop is not working, gave me a black screen
It normally works
Ok It's up
And then here is my bot if I scroll down
so uh basically
your bot is fucking the shit out if the cpu
either something is wrong with the code or the vps isnt strong enough
There are two bots
My bot and the other person's
one of them is killing the vps
How do I figure out which one?
run one at a time
Can't do that
Don't have access to the other person's bot
then turn off yours and see if anything changes
Rebooting my bot does not fix the problem from my experience
The issue just comes and goes as it pleases
if your bot is the one being run under everyos, then its not the problem
the bot being run under k9 is using a shit ton of cpu
if the other one is a music bot with volume control then I'm not surprised
I think it's a minecraft bot
I could be wrong
I don't think I will have luck there :/
Since they are paying for it
And I am basically leaching off of it for free
nothing much you can do then, besides getting your own vps
^
@quartz kindle Don't have a credit card
what about debit card / paypal
If only I could physically pay at a local store :/
Too young for paypal
I guess I can try to ask Tterrag about it
But I don't think that will go well
well, from the looks of it, even his stuff should be lagging af
he might want to get a better machine
@topaz fjord I thought it was an MC bot for some reason :/
i could be a minecraft server
bruh
those java commands are familiar
I mean a bot that interfaces with MC
Not actual MC
but doing ps along with the pid
what is the best way to store data for a medium sized bot? sql?
None of them have data
Hey, I am creating a leveling system for my bot that would give you a role every time you reach a milestone level (level 5, 10, 15, etc) and I am having trouble adding the roles.
Code:
const xpToNextLevel = 5 * Math.pow(userStats.level, 2) +50 * userStats.level + 100;
if (userStats.xp >= xpToNextLevel) {
userStats.level++;
if(userStats.level >= 5) {
message.member.addRole(level5);}
The top part works great but I am pretty sure the issue is in the last 2 lines
Everything is defined properly and I setup a console log and got an alt to level 5 and it sent the message but gave the error message.member.addRole is not a function.










