#development

1 messages ยท Page 1292 of 1

peak osprey
#

how do i define this shit

earnest phoenix
#

?

#

are you copypasting code again

obtuse jolt
#

@opal plank when you click forgot password it goes to the discord blog

opal plank
#

but why?

obtuse jolt
#

because it makes the page look better

peak osprey
#

its not const

faint prism
#

@obtuse jolt I don't like your easter egg lol

boreal iron
#

hours, minutes and seconds is set but days not

digital ibex
#

it makes it look like a dodgy site lmfao

obtuse jolt
#

@faint prism lmfao

opal plank
#

-10 points for putting unecessary stuff just to increase size

earnest phoenix
#

.___.

obtuse jolt
#

you make me receive brain damage

opal plank
#

i asked cuz i thought you had a good reason

obtuse jolt
#

there is literally no good reason for it

opal plank
#

then why put it?

obtuse jolt
#

because i can

#

it looks weird now

faint prism
#

@obtuse jolt Why do you reply with code 200 but the JSON contains something like 403?

opal plank
#

bad design but okay

obtuse jolt
#

@faint prism where?

#

how is this better in any way

earnest phoenix
#

wut are yall talking about

placid iron
#

Idk

#

Why have a login page anyway

#

Just have a login button in your header

faint prism
obtuse jolt
#

its a panel

#

i was going to make it not need a login

digital ibex
#

๐Ÿ˜ณ

opal plank
#

its an error though

obtuse jolt
#

but it makes it harder on me

#

to make

boreal iron
#

How about just a "Login" link straight to Discord login?

faint prism
#

It's an api response that doesn't reply with the right status code lol

earnest phoenix
#

._____________.

obtuse jolt
#

@faint prism because it would make me need to add error code handling if i did it with http codes

earnest phoenix
#

.________.

opal plank
#

It's an api response that doesn't reply with the right status code lol
^^^^^^^^^^^^^^

obtuse jolt
#

it works does it not?

opal plank
faint prism
#

Dunno, I don't trust it with any tokens ๐Ÿ˜›

opal plank
#

neither do i tbh

obtuse jolt
#

i might just change it to err8932u892379857324598 so you will stop complaining

opal plank
#

specially when you show this little commitment

placid iron
#

๐Ÿ˜ฉ that's not how 02auth works

opal plank
#

i dont even wanna know where/how you storing our oath tokens

obtuse jolt
#

its stored client side

placid iron
#

Store them in a map ๐Ÿ‘

earnest phoenix
#

inb4 XSRF vulnerable

obtuse jolt
#

and api tokens are stored on our database

opal plank
#

which is the bit i dont trust

placid iron
#

Wait no

#

I have big brain

obtuse jolt
#

api tokens have nothing to do with discord

placid iron
#

Store the token in a cookie

obtuse jolt
#

there is literally no affiliation between the two

cobalt spruce
#

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);
        
        }};
earnest phoenix
#

yikes the login page is php

#

and it's XSRF vulnerable

cobalt spruce
earnest phoenix
#

no state parameter

cobalt spruce
#

@earnest phoenix

#

can u help

earnest phoenix
#

nope

cobalt spruce
#

;-;

frozen jungle
#

Wow

cinder sandal
#

you can use hex codes

#

instead of GREEN etc.

cobalt spruce
#

@cinder sandal i want to make it easy

opal plank
#

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') ?

cobalt spruce
#

@opal plank for the 1k time am dum

cinder sandal
#

setColor('green')

#

this works

opal plank
#

upperCase()

#

not sure if lowercase works

cobalt spruce
#

@cinder sandal no

eternal osprey
#

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('๐Ÿ˜„');```
cobalt spruce
#

i want to choose colors from json file

eternal osprey
#

look:

cobalt spruce
#

@opal plank how i check for it

opal plank
eternal osprey
opal plank
#

make array and has it

eternal osprey
#

errwin

opal plank
eternal osprey
#

do you know the answer?

opal plank
#

asi though

#

i dont think it actually does UpperCase() by itself

obtuse jolt
#

yikes the login page is php
@earnest phoenix php is good

faint prism
#

no, it isn't

earnest phoenix
#

it isn't

boreal iron
#

lol it is, of course

obtuse jolt
#

im not using nodejs for my website

earnest phoenix
#

you don't have to lol

eternal osprey
#

no-one that can help.?

worthy glacier
#

how do i get my bot to grab the last image link or attachment sent in chat

earnest phoenix
#

there are other web frameworks that exist

#

php is a language for older web development

cobalt spruce
#

@opal plank ur using typescript

opal plank
#

of course

vernal rivet
#

thats a lot of ORs dogekek

earnest phoenix
#

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)

autumn aspen
#
 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?

vernal rivet
#

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

cinder sandal
#

else if
else if
else if
else if
else if
else if
else if
else if

pure lion
#

(ejs) anyone know how to fix include is not a function

autumn aspen
#
 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?

opal plank
#

angular > vue and react

#

from what ive seen

vernal rivet
#

slow down endph, we will get to you

opal plank
#

and i havent seen much

vernal rivet
#

i like vue.js

quartz kindle
#

svelte > *

eternal osprey
#

@autumn aspen .setFooter("message:

calm python
#

hi

pure lion
#

HeLp mEeEEe

cinder sandal
#

@autumn aspen use MessageEmbed

autumn aspen
#

@autumn aspen use MessageEmbed
@cinder sandal hm maybe

#

ok

opal plank
#

@cinder sandal no bad

cinder sandal
#

it can add a footer

opal plank
#

dont use Builders

vernal rivet
#

ejs, is weird, i think you have to do something like ```js
<%- include('path') -%>

cinder sandal
#

and an timestamp

opal plank
#

send it raw like he's doing

pure lion
#

@vernal rivet I did that

#

Still throwing

obtuse jolt
vernal rivet
#

yea ejs is just wack

earnest phoenix
#

@obtuse jolt your login is still XSRF vulnerable

#

anyone can bait and steal data if they wanted to lol

opal plank
#

they all accomplish the exact same thing, but look at the delay in using EmbedBuilders

vernal rivet
#

lol

obtuse jolt
#

saying that isnt gonna help me a lot

earnest phoenix
#

yes it is

eternal osprey
#

does anyone know why my bot is reacting to the wrong message?

earnest phoenix
#

you can do research on it

eternal osprey
#
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);```
earnest phoenix
#

0auth has a whole article about it that's like the first result on google

obtuse jolt
#

its not

cinder sandal
#

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?

eternal osprey
#

look:

#

i have a !announce message command

vernal rivet
#

probably because your using ORs statements, instead of ANDs

eternal osprey
#

it actually reacts to the command call instead of the webhook sent message.

#

yeah

#

to the one the webhook sends

earnest phoenix
obtuse jolt
#

wow you gonna attack a dashboard to change a guilds prefix

#

thats like a death sentence for me

earnest phoenix
#

that's

#

that's not how that works lol

#

the vuln exists client side

#

the attacker can use the token

obtuse jolt
#

so if its client side how is this my problem

misty sigil
#

(ejs) why is include not a function

earnest phoenix
#

and gain access to the user's information

cinder sandal
#

message.react reacts to the author message normally

opal plank
#

cry legit showing you an exploit and rather than fixing you just ignoring

#

damn dude

eternal osprey
#

i tried to do announcement.react

opal plank
#

i sure as hell wont bother checking ur stuff

#

legit

eternal osprey
#

and even defining let message = announcement

vernal rivet
#

express would be a better idea to use instead of php shrug

eternal osprey
#

nothing worked

cinder sandal
#

with a .then it would react to the bot's message

opal plank
#

actually

#

holdup

pure lion
#

(ejs) why is include not a function
@misty sigil Keck ew

eternal osprey
#

.then.message.react?

earnest phoenix
#

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.

cinder sandal
#

no

#

then is not used like that

misty sigil
#

nonce

opal plank
#

@earnest phoenix i would give up if i were you, they clearly dont care about privacy or how good it is

earnest phoenix
#

lol

opal plank
earnest phoenix
#

wait till they discover GDPR

vernal rivet
#

lol

earnest phoenix
#

and possible huge legal problems

misty sigil
#

yikes thats not fun

opal plank
#

probably going on the same tangent as i was yesterday with a user unironically recommending n++ over vsc for a begginer

eternal osprey
#
so .then{
//code

}```
pure lion
#

SpooThew

vernal rivet
#

ewwwww n++ sucks

pure lion
#

@eternal osprey .then(code)

cinder sandal
#
message.react('emoji')
}```
vernal rivet
#

use notepad instead dogekek

cinder sandal
#

n++ trash

pure lion
#

@cinder sandal a.send("poopy").then(message => message.react("poo")

eternal osprey
#

owh okay.

opal plank
#

rather than using then

#

why not async?

pure lion
#

Yeah I agree

#

Async better

opal plank
#

his code already async iirc

#

actually, it aint

#

just checked

#

use then, then

vernal rivet
#

oofers

opal plank
#

then ception

vernal rivet
#

i mean thats a easy fix

eternal osprey
#

message.react is not a function

#
 webhookClient.send(announcement).then(message => {
      message.react('๐Ÿ˜„')
      })```
opaque eagle
#

super broad

vernal rivet
#

why are you using message as the predicate's name? isn't message already defined in your event?

pure lion
opal plank
#

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

vernal rivet
#

mhm, but isn't that bad practice to do that

opal plank
#

it is

eternal osprey
#

yeah i will fix that.

#

but what is the problem then?

opal plank
#

there isnt one, that is not returning a message i dont think

#

i think webhooks have their own thing

#

lemme check rq

vernal rivet
#

what does the code look like right now?

#

shrug at least give us something to go off of

earnest phoenix
#

webhooks can't react

opal plank
#

returns an array

pure lion
#

Can I use grep to change all instances of a word in a file?

opal plank
#

not a message

#

that sounds off af tbh

#

can you send multiple webhooks at once?

vernal rivet
#

probably

eternal osprey
#
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

opal plank
#

var

eternal osprey
#

but not reacting to it

opal plank
#

im fairly certain i told ya not to use vars multiple times

eternal osprey
#

oowh webhooks can't react?

opal plank
#

it can

#

it returns a message

eternal osprey
#

yeah it does.

earnest phoenix
#

why tf does it return an array

eternal osprey
#

but it's not working.

sly dawn
#

@eternal osprey i am still suffering from that reaction too lol

opal plank
#

it actually has 2 methods cry

#

one returns array

#

the other just a message

#

if he set [split] to true

earnest phoenix
#

oh

opal plank
#

its returning an array

vernal rivet
#

var can be good in some cases shrug but shouldn't always be used, especial in es6, when we have let

opal plank
#

^^

autumn aspen
#
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()?

sly dawn
#

i am aware, my bot reacts to my message and not to its own

#

any solution?

earnest phoenix
opal plank
#

@eternal osprey whby did u make ur code async?

eternal osprey
#

idk it worked either way.

vernal rivet
#

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

autumn aspen
#

idk it worked either way.
@eternal osprey dude can u see what my problem is whats wrong?

eternal osprey
#

@autumn aspen no

opal plank
boreal iron
sly dawn
opal plank
#

just like R.Danny i got a couple useful tags

sly dawn
vernal rivet
#

oofers

opal plank
#

and a lot of them are stolen from R.Danny too, sooo....

earnest phoenix
#

there was a good one in DAPI but someone edited it with a trash one

opal plank
#

i take a lot of the useful stuff from dapi

#

those tags are hella handy when developing

eternal osprey
#

but ehhm. I still cannot get my code working.

opal plank
#

i should be coding tbh

#

struggling a bit with child processes

quartz kindle
#

You need an adult process, stop abusing children

earnest phoenix
#

call the cps

quartz kindle
#

Call the task manager

faint prism
#

memes

earnest phoenix
#

pull the plug

opal plank
#

@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

eternal osprey
#

still on this shitty ass problem

pure lion
#

Lol

#

Captain hook

earnest phoenix
#

hahahah

#

how can you completely end a while loop? like with intervals you can do clearInterval()

#

break it

unique patio
#

You break it by a false statement for the while

earnest phoenix
#

or just literally use break

unique patio
#

while(looping) {
if (stop) looping = false;
}

#

or you can use breaks/etc.

#

Yup!

earnest phoenix
#

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

unique patio
#

There is but it's not without serious checks

terse glade
#

so

earnest phoenix
#
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
terse glade
#

let me see

unique patio
#

no hero

terse glade
unique patio
#

remove break test=true;

#

that's not valid but the rest would be

#

๐Ÿ™‚

#

But if this could be done better, try to optimize.

earnest phoenix
#

if i use break, would it emit the rest of the code below it?

#

or is it like return

terse glade
#

optimize speed

#

or your bot will crash if it got lot of request from modules like ffmpeg module

unique patio
#

no it doesn't

#

Break will end it then and there

quartz kindle
#

Break is like return

earnest phoenix
#

ok

terse glade
#

like return only

unique patio
#

continue will skip current itteration

#

break is without a return ess

earnest phoenix
#
let test = false;
while (test === false) {
if(user.id === ui) break;
test = true;
}``` so like this?
terse glade
#

} catch (err) {
data.log(err)
}
break;

unique patio
#

No

terse glade
#

no no no

unique patio
#
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

earnest phoenix
#

yh but i dont want to keep doing something till user.id === ui

unique patio
#

and just want the loop for looping

#

What is the objective?

#

To confirm user-exists?

#

or

earnest phoenix
#

that's a heavy operation though, ids are strings in djs, there's probably a better way around this

unique patio
#

Uh no not necessarily

earnest phoenix
#

to check if 2 different people who r reacting are in the db

unique patio
#

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

earnest phoenix
#

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

boreal iron
#

lmao while (1 == 1) { ... how about while(true) genius

unique patio
#

Well genius you know what true to 1 == 1 is in bytes?

#

hmmmm

boreal iron
#

That'd be easier/more efficient

unique patio
#

Numerals parse faster than bool

#

Don't play

#

I run code complexity tests do it yourself

#

This is JS

#

remember

#

js bench it^

magic bough
#

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.
unique patio
#

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

opal plank
#

actually

#

that brings a question

unique patio
#

ayoo

opal plank
#

{a: {b:{c:foo}}}

#

from foo being a function

#

is it possible to , aka

#

this.this

#

to escape to a scope

unique patio
#

this.this?

#

You can pass this along

opal plank
#

bad example

unique patio
#

to use it deep in the scope

#

๐Ÿ™‚

opal plank
#

but i mean to escape the scope

#

go up

unique patio
#

Otherwise globalizing this is not do-able

opal plank
#

rather than in

unique patio
#

So deeply nested you want to call a scope called way-ahead

#

?

#

You'd do it via call-backs

opal plank
#

if the function is inside c, i assume without binding it prior you cant access a within c

unique patio
#

and passing it along

#

No not without a call-back

magic bough
#

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.

unique patio
#

C needs reference to A's this

opal plank
#

hmm i see

unique patio
#

Usually with JS or other languages

opal plank
#

figured

unique patio
#

We do a defined setup in a global-scope class

#

JS uses window. global.

#

you know

opal plank
#

welp, thats one reason i use arrow functions

unique patio
#

And we can do windows.function = a

#

and we can forever call it, but yeah callbacks/etc get that job done. ๐Ÿ™‚

opal plank
#

i mean, fair

#

iirc functions() {} can call this on parent

#

while arrow functions call this on the param

unique patio
#

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

#

๐Ÿ™‚

earnest phoenix
#

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}
eternal osprey
#

hey guys

faint prism
#

```js
```

opal plank
#

yeah

eternal osprey
#
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);```
opal plank
#

though i usually prefer not assigning it as a property

#

rather just a getter/ish function

eternal osprey
#

my bot still reacts to the wrong message

unique patio
#

keep forgetting

earnest phoenix
#

i've always wondered whether node is so bad with mem management just because js objects are internally just fancy dictionaries

unique patio
#

Fair enough

#

I would suggest trialing

eternal osprey
earnest phoenix
#

@eternal osprey because the message variable is the message te user sent

eternal osprey
#

i know

unique patio
#

but for s ure based on use you may need another method/style over another

earnest phoenix
#

you're doing message.react

faint prism
#

why are you for looping over every word?

opal plank
#
{
function getName(name) { return this.name}
getname: (name) => {return this}
}

eternal osprey
#

how do i set it to react to the

#

announcement message.

opal plank
#

actually

#

im fairly certain i fucked up that example

eternal osprey
#

was that example meant for me?

opal plank
#

nope

eternal osprey
#

anyone else that could help me?

unique patio
#

hmmm

opal plank
#

i told you

eternal osprey
#

what did you tell me

opal plank
#
    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 >

eternal osprey
#

i didn't even noticed that you said something

#

i awaited it myself.

opal plank
#

im fairly certain you addeed async cuz i told you so

eternal osprey
#

first i did.

#

then i deleted it

#

and went my own way.

viscid gale
#

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)

opal plank
#

what you are doing there is comepletely uncessary

viscid gale
#

well nothing is dr philosophy

opal plank
#

either then on the send() or await it while assigning its returned value somewhere

eternal osprey
#

i tried to .then it

viscid gale
#

oh..

#

sry

eternal osprey
#

but it gave me lots of problems

opal plank
#

like....?

eternal osprey
#

let me show you. Wait a min.

opal plank
#

mmm okay

#

lemme grab more booze

#

i feel like its gonna be one of those

unique patio
#

lol

#

don't celebrate too early

#

I did last night and hated my self for brain derping in a midst of a code problem

opal plank
#

i need to drink a bit today

unique patio
#

thought I could on 4 hours of sleep/4 talls in

opal plank
#

need to get productive af later on

unique patio
#

Hell yeah I feel that

opal plank
#

might aswell start now and get thru the night coding

eternal osprey
#
  console.log(announcement)
    webhookClient.send(announcement).then(message => {
      message.react('๐Ÿ˜„')
      })``` this is what i have
#

look at the error:

unique patio
#

Hell yeah

opal plank
#

need to learn a bit more of child process

unique patio
#

I'm ahead of you on that one, my day's settled

opal plank
#

and see how it works more indepth

unique patio
#

JS stuff?

opal plank
#

yup

#

otherwise imma have to do my own IPC pipes

unique patio
#

Uhhh with query selector?

#

or

eternal osprey
#

nevermind i got no error

#

but it's still not reacting.

opal plank
#

lemme give you a hands down example of what im doing

unique patio
#

Word I do a lot of high-end JS stuff

opal plank
eternal osprey
#

(node:3960) UnhandledPromiseRejectionWarning: TypeError: message.react is not a function

#

or wait

#

this is the error

opal plank
#

this is me taking a library to its limits

#

its NOT meant to handle this many channels are all

earnest phoenix
#

oh...

unique patio
#

hell yeah good to hear

opal plank
#

so heres what i did

viscid gale
#

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)

opal plank
#

this is the constructor

#

right?

earnest phoenix
#

this place makes me stresfully...

eternal osprey
#

why is message.react not a function?

unique patio
#

You're initating the object/class

opal plank
#

what i ended up doing is initiating dozes of Chat's with that constructor and assigning them globally into an object for easilly accessibility

unique patio
#

which would possibly contain a constructor

#

it depends really on the object

#

๐Ÿ™‚

opal plank
#

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

viscid gale
#

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

opal plank
#

which is what i though at first, hey, why not just create dozens of connections and send them each what they need to do

unique patio
#

huh?

opal plank
#

its basically sharding what im doing

unique patio
#

Yeah rate limit is per process

opal plank
#

for an api/irc that doesnt have sharding

unique patio
#

(aka connection)

opal plank
#

though it doesnt work like that in this lib

unique patio
#

under bot API

opal plank
#

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

unique patio
#

Oh

opal plank
#

master => slave kind of thing

unique patio
#

Yeah don't let mom handle that process

#

๐Ÿ˜‰

opal plank
#

having the slave only connect to channel and re-emit all process to master, where it all gets handled

unique patio
#

She's there to make sure you all get along

#

lmfao

opal plank
#

but the connection is done only on slaves

halcyon pecan
opal plank
#

so yeah, thats the gist of what im doing

halcyon pecan
#

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.

earnest phoenix
#

don't console it

opal plank
#

basically sharding something that isnt sharded

earnest phoenix
eternal osprey
#

uhhm guys

opal plank
#

for no reason whatsoever other than to just see how far i can take the library

unique patio
#

Ahhh you could probably assign a global handler for such

eternal osprey
#
     
    }
    console.log(announcement)
    webhookClient.send(announcement).then(message => {
      message.react('๐Ÿ˜„')
      })
   
  }``` message.react isn't a function.
opal plank
#

indeed

eternal osprey
#

why is that?

opal plank
#

the issue is

#

im doing caching aswell

proven lantern
#

@opal plank i told you to shard your bot days ago

slender thistle
#

master => slave kind of thing
@opal plank MAiN/sUb!!!!!!!!!!!

unique patio
#

Not so much a concern it's added bonus

opal plank
#

so im going to have to use pipes to send cache events onto the main process too

unique patio
#

in JS most processes with caching can handle both ways

opal plank
#

@proven lantern its not Discord you cucko

unique patio
#

(new data or existing)

opal plank
#

Twitch does not have sharding

proven lantern
#

twitch right

opal plank
unique patio
#

Oh yuck

opal plank
#

im making my own cluster for it

unique patio
#

So you just handle the data your way

opal plank
#

indeed

boreal iron
#

@eternal osprey code913: because the message variable is the message the user sent

opal plank
#

@slender thistle Slave => master angeryBOI

proven lantern
#

shard by making more twitch accounts

unique patio
#

I haven't played with twitch much but if rate limits are eating at you

proven lantern
#

ez

#

pz

opal plank
#

thats not how it works

eternal osprey
#

@boreal iron what

opal plank
unique patio
#

try applying too an enqueue/dequeue system

eternal osprey
#

that's bs

unique patio
#

it's a couple lines of code

eager tusk
#

@proven lantern sen?

eternal osprey
#

i have another problem.

slender thistle
#

Baka Erwin angeryBOYE

eternal osprey
#

that was of a while ago.

proven lantern
#

not bensen

opal plank
#

its all handled internally by the lib(i already reported to them that their librbary does NOT like a ton of channels)

#

@unique patio

eager tusk
#

@proven lantern from ?

slender thistle
#

And that went very well

proven lantern
#

usa?

opal plank
#

so rather than patching the lib with a contribution(which is what i shoudl do), im just splitting its capabilities into different node processes

eager tusk
#

@proven lantern ok

opal plank
#

and hooking them all up with IPC

#

@slender thistle

#

why u call me baka

slender thistle
#

โค๏ธ

thick gull
#

@slender thistle Slave => master :angeryBOI:
@opal plank MaStER SuB

viscid gale
#

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?
thick gull
opal plank
#

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

viscid gale
#

:l forget it yes

opal plank
#

learning a new thing every time

#

time for more booze, brb

unique patio
#

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

#

๐Ÿ˜„

opal plank
#

thats the thing i need to check

#

i need the processes to keep alive

#

since they are basically listeners with emitters

unique patio
#

Just heat-beat it

#

ping/pong

quartz kindle
#

@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

opal plank
#

im gonan give it a try soon

#

just finishing wacthing a series and then i'll play with child processes

unique patio
#

For full on keep-alive you just need to keep process-active

#

;
)

opal plank
#

i though as long as there no strerr it wouldnt end

unique patio
#

Nah

#

Your network can sleep on you guy

viscid gale
#

@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:{}
}```
unique patio
#

keep alive is constant heart-beat checks

opal plank
#

okay THATS something i wasnt aware of

unique patio
#

to situate the beat

#

and say we're both online working together.

opal plank
#

doesnt child processes already handle that?

unique patio
#

No that's client <> server

#

server sends a hey, you alive

#

you as client say yes I am

#

and that's a keep-alive.

opal plank
#

wait im confused now

viscid gale
#

and basically, I can use my stringToFile function i mentioned above, then just Object.keys(stringToFile(userInputtedString)) and I get a result

opal plank
#

the library already handles acks and heart beats with the server

unique patio
#

It should

#

Yes

opal plank
#

i would just need to spawn a new instance with IPC hooked

#

thats about it

#

imagine this for example

unique patio
#

Yeah theoretically.

viscid gale
#

like if I put "local/C" as the string, the return would be Desktop,Documents,Downloads,System

opal plank
#

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?

viscid gale
#

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

opal plank
#

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

unique patio
#

You could just require each server.js

opal plank
#

and re-emit events

unique patio
#

or main.js

opal plank
#

yeah and then function on it

#

based on the amount

quartz kindle
#

@viscid gale if you get local/c you can delete result.desktop or result.desktop["eg.txt"] but you cant delete result itself

unique patio
#

to boot them and have each instance handle itself

#

so it doesn't affect main service

opal plank
#

i already do that somewhat

#

heres example

#

hat for loop handles the amount of created chats i do

#

that*

unique patio
#

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.

#

๐Ÿ™‚

opal plank
#

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

unique patio
#

Yup

#

But some issues, your instances may need dynamic

#

setup

viscid gale
#

@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)

unique patio
#

Like unique user/pass; token/etc.

#

or instance identifier.

opal plank
#

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?

unique patio
#

Yeah

quartz kindle
#

@viscid gale the only way is to get the parent object, or to do some prototype shenanigans

unique patio
#

Call-backs

opal plank
#

for spawning the process i would need the arguments for starting that process, and then getting the arguments called to uniquely identify it

unique patio
#

(usually passed in args)

#

and sent back

viscid gale
#

prototype shenanigans?

unique patio
#

to send data from one class/etc

#

back to another

viscid gale
#

sounds fun, what u mean?

unique patio
#

for processing

opal plank
#

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

quartz kindle
#

you'd need to turn your object into a class @viscid gale

unique patio
#

Uhhhh that I'm not fully sure on for args in that regards

#

I assume it's passed to super

#

constructor

quartz kindle
#

but anyway, just make a function that gets the parent object

#

for example

unique patio
#

when you send args t hat way

opal plank
#

callback should work too tbh

unique patio
#

It's a must^

opal plank
#

it passes the callback onto the child

unique patio
#

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.

opal plank
#

thats the thing im concerned

#

imagine this

quartz kindle
#
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

opal plank
#

just for logging purposes

slender thistle
#

SpoOonFeD???!!!!

opal plank
#

what if i dont want everything outputted on the same channel of the ipc pipe?

unique patio
#

Okay

opal plank
#

what if i want str.out('unique idenfitier', (data))

unique patio
#

You'd make a logger module

#

to specify the differences

opal plank
#

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

viscid gale
#

tim im gonna try and see if it works

unique patio
#

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.

#

๐Ÿ™‚

opal plank
#

i guess that would work too

unique patio
#

Oh it's a must

opal plank
#

i was thinking of passing the identifier on an IPC pipe

unique patio
#

If you want to log all clients

opal plank
#

just for shits n giggles

unique patio
#

You need a global logger to handle

opal plank
#

image this for example

unique patio
#

or it gets messy

opal plank
#

this will be a big snippet, gimme a 1min

unique patio
#

No worries

#

These are good questions and stuff I got stuck on

#

๐Ÿ˜„

#

so you def good

viscid gale
#

@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
unique patio
#

That should make more sense, so when you create a child, pass your logger off to them

opal plank
#
//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))
unique patio
#

to use. or have them use one from their class.

opal plank
#

this is a basic idea of what i had

#

check the snippet

#

just fixed it

unique patio
#

yeah

#

was gonna say let me read now

#

lol

opal plank
#

there we go, take a look

#

it should get the point across

unique patio
#

I mean you could do it cleaner than that

#

if all folders in the "mothers" server

#

are to be read for start js files.

opal plank
#

thats why i set slave.js

unique patio
#

Well yo u can do some approved eval to get your solution/parsing done f ast.

#

even on the requires.

thick gull
#

MaIN SUb !212!

unique patio
#

But for efficiency, cause you are only calling process once per-define

quartz kindle
#

@viscid gale so apparently array indexes are strings and not numbers lmao... make it == instead of ===

unique patio
#

and its not awaited, you could actually insert the process in map.set

quartz kindle
#

thanks js

opal plank
#

i should actually set it on an object tbh

#

for easy modification

thick gull
#

are they making message.reply() for the new quote feature thing cause blobpain

unique patio
#

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

opal plank
#

indeed

unique patio
#

lists/objects can deal out faster

opal plank
#

changing objects rather than re-setting the map

unique patio
#

Map is bad

opal plank
#

get()=>modify

unique patio
#

The real truth

opal plank
#

is it though?

unique patio
#

Yup

opal plank
#

i just use it as an index

unique patio
#

If you can ALWAYS for iteration through these issues

#

and write the code manually

#

๐Ÿ™‚

viscid gale
#

holyyy, thanks @quartz kindle

unique patio
#

There's issues with these things that low-key go unseen

viscid gale
#

now walk me thru the logic

unique patio
#

For instance did you know, looping through a changing list

#

can cause issues on splice

#

to do it backwards?

quartz kindle
#

the logic is very simple

unique patio
#

Loop backwards vs forward to fix

white drum
#

so i'm having an issue with better-sqlite3

opal plank
#

havent happened to me yet, so not rlly

quartz kindle
#

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

unique patio
#

Well the power itself for these features came from default iterations

quartz kindle
#

if its the last item, delete it

unique patio
#

for is foreach

quartz kindle
#

otherwise add it to the temporary object and continue

unique patio
#

as it is any other loop

#

while is for

#

make sense? for is the lowest end

#

of t hat loop

opal plank
#

the only reason i enjoy maps is that you are basically assigning an index for it

unique patio
#

You want fast processing it's done by making that for the best you can

#

All arays come indexed.

opal plank
#

rather than making an object containing each index as a property, maps works well for that

viscid gale
#

hmm thanks, i'll think on it tim

opal plank
#

Set() is also a decent option

#

since they are unique

unique patio
#

So in JS,

var value = [1, 2, 3 ,4];

var len = value.length;

for (i= 0; i < len; i++) {
//
}

opal plank
#

thats what i do a lot, yeah

unique patio
#

indexed by default but we can search it fast

#

if it's an object

white drum
#

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

opal plank
#

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

viscid gale
#

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

quartz kindle
#

because all objects in javascript are passed by reference, not by copy

viscid gale
#

interesting

opal plank
#

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

quartz kindle
#

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

viscid gale
#

OOOHHHHHHHHHHHH

#

way to go js

quartz kindle
#

yup

viscid gale
#

but thanks dudeeeeee

white drum
#

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

quartz kindle
#

you cant transfer node modules between machines

#

you have to reinstall all packages

white drum
#

oh

quartz kindle
#

delete your node_modules folder

#

and run npm install

white drum
#

well i loose all my database?

quartz kindle
#

that will reinstall everything from your package.json

#

where is your database stored?

white drum
#

i use quick.db

#

so

#

idk

quartz kindle
#

where is your database file?

#

like database.sqlite

#

or idk the name you gave it

white drum
#

i didn't make one..

quartz kindle
#

quick.db makes one for you

white drum
#

oh

quartz kindle
#

you need to find where is it

white drum
#

will it be in the better-sqlite3 folder?

thick gull
#

no

quartz kindle
#

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

thick gull
#

its stored as json.sqlite

white drum
#

oh yea i see it in my bot folder

thick gull
#

yours might be stored in some other file /shrug

#

i barely use quickdb

white drum
#

i never new that was there

#

lmao

quartz kindle
#

alright

#

so as long as you dont delete that file, your database is safe

white drum
#

aight

#

thx

#

lets try

#

what about the .git folder?

quartz kindle
#

thats for github integration

#

if you use git or github desktop

white drum
#

it says failed at integer@3.0.1 install script

#

and other things

quartz kindle
#

you probably dont have build tools installed

#

open powershell as admin and run npm install -g windows-build-tools

white drum
#

why is windows more of a pain compared to linux

#

lol

quartz kindle
#

because windows is bad

white drum
#

OH

#

now i've seen console

#

it makes more sence

sudden geyser
#

unix!

opal plank
#

i can indeed spawn the process and call the arguments to define the name of it

thick gull
#

nice console

#

now tell me how i can have one of those

alpine marsh
#

pfff

#

you dont know

#

take a look at this kid

pale vessel
#

leviathan will you be my twitch slave

viscid gale
#

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

slate oyster
#

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

red hollow
#

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?

oak cliff
#

same as roki. been using them for over 2 years myself and never had an issue

grizzled isle
#

Java Question:
With Nashorn being removed, what is a better replacement for it?

pale vessel
#

graalvm?

slate oyster
#

@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

#

I enter the password and it freezes for a minute or two before letting me in

red hollow
#

๐Ÿค”

slate oyster
#

(When the bot and network are down, that is.
Works fine when bot and network are working)

red hollow
#

i have no clue

slate oyster
red hollow
#

i've had similar "lag" while my vps was out of mem

slate oyster
#

I guess I can check that out
But wouldn't terminating the bot fix that?
Because it is not doing so

red hollow
#

idk tbh

#

i've also had network lags when my bot was memleaking in tcp socket memory (cat /proc/net/sockstat)

slate oyster
red hollow
#

yeah this is not the issue im p sure, 947 seems to be fine

slate oyster
#

I'll have to see if it's a memory issue when I get a chance then
(Don't have a chance rn)

quartz kindle
#

what does your top/htop look like?

#

also check nethogs

red hollow
#

also check nethogs
@quartz kindle i didnt know about that, thanks for letting me know about this thing, seems to be useful

slate oyster
#

Du du du du du
Maybe it will respond one day?

topaz fjord
#

what does htop say

slate oyster
#

@topaz fjord Lemme check

#

htop is not working, gave me a black screen
It normally works

topaz fjord
#

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

slate oyster
#

There are two bots
My bot and the other person's

topaz fjord
#

one of them is killing the vps

slate oyster
#

How do I figure out which one?

topaz fjord
#

run one at a time

slate oyster
#

Can't do that
Don't have access to the other person's bot

topaz fjord
#

then turn off yours and see if anything changes

slate oyster
#

Rebooting my bot does not fix the problem from my experience
The issue just comes and goes as it pleases

quartz kindle
#

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

slate oyster
#

I am everyos

#

K9 is owned by Tterrag, who pays for the VPS

topaz fjord
#

if the other one is a music bot with volume control then I'm not surprised

slate oyster
#

I think it's a minecraft bot
I could be wrong

quartz kindle
#

well then you'll have to take it up to them

#

makes sense

slate oyster
#

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

quartz kindle
#

nothing much you can do then, besides getting your own vps

topaz fjord
#

^

slate oyster
#

@quartz kindle Don't have a credit card

quartz kindle
#

what about debit card / paypal

slate oyster
#

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

quartz kindle
#

well, from the looks of it, even his stuff should be lagging af

#

he might want to get a better machine

topaz fjord
#

or bad code

#

@quartz kindle it's a music bot

#

no

#

I'm stupid

slate oyster
#

@topaz fjord I thought it was an MC bot for some reason :/

topaz fjord
#

misread

#

disregard

quartz kindle
#

i could be a minecraft server

topaz fjord
#

bruh

quartz kindle
#

those java commands are familiar

topaz fjord
#

on a 2 core vps

#

I mean I think there's a way to check what jar is being run

slate oyster
#

I mean a bot that interfaces with MC
Not actual MC

topaz fjord
#

but doing ps along with the pid

earnest phoenix
#

what is the best way to store data for a medium sized bot? sql?

slate oyster
earnest phoenix
#

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.

slate oyster
#

Thanks for helping me ya'll
I didn't realize it was the other person's bot