#development

1 messages · Page 2063 of 1

thorn spruce
#

But its less than my current system

lyric mountain
#

WAY less than 2471 bits

#

353 * 8 - 353 (actual used bits)

thorn spruce
#

a lots of

lyric mountain
#

u can make a function so most of the operation is abstracted

#

so u can just do, say, check_bit(bits, index) to return either true or false

thorn spruce
#

yep i means it already exist in php

lyric mountain
#

nice

thorn spruce
#

I'll try to implement this efficiently . Thanks you for your time and your help ! CB_happy

lyric mountain
#

yw, also regarding your initial question now you can simply use AND condition since you'll write just 6 times

thorn spruce
#

yep its obviously less than 353 times 😓

quartz kindle
#

according to the mysql docs, the BIT data type is basically like a varchar but for numbers, it can be specified with a size of 1-64

lyric mountain
#

it automatically resizes?

#

use bit then instead of bigint @thorn spruce

thorn spruce
#

okok

quartz kindle
#

they dont mention anything about how its handled internally, so i guess a BIT(1) will still use 8 bits of memory internally

#

and a BIT(64) will use 64 bits of memory

lyric mountain
#

BIT(60) will use 64 too right?

quartz kindle
#

most likely yes

#

it most likely sets a fixed int type depending on the bit size

#

like uint8 for 1-8

#

uint16 for 9-16

#

etc

lyric mountain
#

they could go an extra length and make an arbitrarly long uint field that's partitioned internally

#

like java's BigInteger

quartz kindle
#

yes but i doubt they do that

#

because that is also much slower

#

actually

#

apparently

#

they do that indeed

lyric mountain
#

so BIT(128) is valid?

quartz kindle
#

it says the limit is 64

lyric mountain
#

ah

#

u meant the byte rounding

quartz kindle
#

yeah

lyric mountain
#

wait (M + 7) / 8 means it'll always have 7 extra bits?

#

or does the 7 decreases the closer M is to 8?

thorn spruce
#

Index means the positions of the bit in the bits array? e.g :
index = 8

1000 0000

1 = the index

#

or its like in programming index-1

lyric mountain
#

it's exactly like dealing with an array, but it's stored the other way around

#

array[0] == (bits << 0) & 1

thorn spruce
#

so basically 1 means 7 in this example

lyric mountain
#

yes

thorn spruce
#

nice

lyric mountain
#

bits are always right to left

#

also if u ever need to check what bits are on u need to convert to binary first, because 128 as easy to visualize as 1000 0000

#

the computer doesn't need that tho, only humans

thorn spruce
#

yep I studied the basis of the binary but i never really use it when i was programming

lyric mountain
#

bitwise is probably the only practical application for such knowledge I can think of

thorn spruce
#

sometimes im using NOT for search bar

lyric mountain
#

idk if php supports, but u can now use the fancy bitwise ops (&=, |=, ^=, ~=, >>= and <<=)

thorn spruce
#

he don't sadge

lyric mountain
#

nhe

thorn spruce
#

only & | ^ ~ >> <<

#

mb

#

he support them

lyric mountain
#

ah

thorn spruce
#

idk why they are not with the bitwise operator

lyric mountain
#

they're technically accumulating operators

thorn spruce
#

yep they were with them

#

that's why i thought he do not supports them

#

and in facts its the same thing just you assign the result to a var ?

lyric mountain
#

bits >>= 2 is the same as bits = (bits >> 2)

thorn spruce
#

yep

stiff lynx
#

How can I get the channels of a channel category?

lyric mountain
#

I believe u need to filter where <channel>.parent.id === id

#

idk if discord sends what channels are inside a category

slender wagon
#

So i have a bunch of users of my app and i want to add another field to their accounts (MongoDB)
is there a automatic way? instead of manually doing it

lyric mountain
#

git is for source code not database structure

slender wagon
#

huh?

vivid fulcrum
#

they just added an accidental space between g and it

#

they didn't mean git

slender wagon
#

oh lmaoo

#

didn't notice

lyric mountain
#

well u can get-or-create the property

#

like, try to get, if it doesn't exists add it

slender wagon
#

is there a way to make slash commands to reply with an error as you're the only one who can see this

quartz kindle
#

use an ephemeral message

wheat mesa
#

Only problem with ephemeral messages is that you have to defer the interaction as ephemeral to get that to work iirc

#

Unless they fixed/changed that

quartz kindle
#

you cant directly reply with ephemeral?

wheat mesa
#

You can but if you need to defer then you have to choose to defer as ephemeral or not I believe

quartz kindle
#

ah

wheat mesa
#

Otherwise it’ll bug out and just go with whatever type the deferment was

#

So if you defer as ephemeral but send a normal message, it’ll send as ephemeral

#

Which idk if they’ve fixed or not, I just remember that being a pain in the ass when I was making bots

quartz kindle
#

rip

#

i still didnt do anything with slash commands

#

and the deadline is aproaching T_T

wheat mesa
#

I haven’t done anything on my main bot with interactions yet because I’m lazy

#

And it’s in under 100 servers and not growing, no reason for me to tend to it tbh

quartz kindle
#

its so stressful working on a bot that already has thousands of servers

#

im always afraid of breaking it and disappointing hundreds of people

wheat mesa
#

That’s what bug reports are for 😉

quartz kindle
#

btw, a question for you typescript addicts:
is there a better way to create a type guard for class properties other than this?

class A {
  b?: string
  hasB(): this is A & { b: NonNullable<A["b"]> } {
    return typeof this.b === "string";
  }
}
#

i wanted something more like this["b"] is NonNullable<this["b"]> but apparently it doesnt work

wheat mesa
#

Why not just return boolean and do the same thing

quartz kindle
#

because it doesnt work as a type guard then

wheat mesa
#

I’m too stupid to know what a type guard is

quartz kindle
#

basically this

#
const bla = this.b // bla is string | undefined
if(this.hasB()) {
  const something = this.b // something is string
}
wheat mesa
#

Yeah why not just make it a boolean then?

#

I’m probably misunderstanding

quartz kindle
#

because it doesnt work then, it wont narrow down the type of this.b

#

this.b would still be string | undefined

wheat mesa
#

Oh you’re saying for the compiler to know too

quartz kindle
#

yeah

wheat mesa
#

You could just typehint something and force cast it since you know it’s there

quartz kindle
#

yeah thats an alternative

quartz kindle
#

just sounds stoopid

#

its basically typecasting the entire class

wheat mesa
#

If it works for you then go for it

#

But I find that fighting the compiler over small things like this usually isn’t worth the effort, do a small check to guarantee it’s safe, then force cast

#

Or if you really want you could just go with if(this.b)

#

I think the compiler would narrow down the type at that point

ancient nova
#

who ponged?

wheat mesa
ancient nova
quartz kindle
wheat mesa
#

Imo if(this.b) is the way to go; using a method basically does the same thing in the compiler’s eyes

quartz kindle
slender wagon
#

wait so

quartz kindle
#

so im doing it to avoid if(a && b && c && d)

quartz kindle
#

and just do if(hasVars())

wheat mesa
#

Ah

#

Makes sense

quartz kindle
#

and also does some validation, like hasVars also checks if they are valid

slender wagon
#

oh reading the guide rn

#

doesn't seem like i need the defer

#

nvm

split hazel
#

how tf do os's store files with directories

#

with no hierarchy i can imagine how to implement that but directories?

wheat mesa
#

they call dora for the map to each file

quartz kindle
#

lmao

#

it depends on the file system on disk i guess

#

like ntfs uses the mft, fat uses fat

#

you want to make your own file system too?

split hazel
#

you already know im in it for making everything from scratch

#

using what someone else already made is boring

#

except for things that are not affiliated with your task or are very difficult to accomplish

#

SpeedyFS

#

SFS

#

STFS

#

speedy technology file system

quartz kindle
#

xD

#

well most file systems use something like nodes/inodes or whatever they call themselves, that hold information about what type of object it is

#

it can be a directory or other things

#

and this node then holds pointers to either other nodes, or to data blocks

#

plus a bunch of extra shit for redundancy and data protection

#

like journaling

split hazel
#

for now i'll just make a dos machine back in the day

slender wagon
#

do u guys set ratelimits on commands for each user?

quartz kindle
#

no

#

i set them per channel

slender wagon
#

oh

#

what if my commands only work on dms

#

they do

quartz kindle
#

each dm with a different user is a different channel

slender wagon
#

right

#

well that was helpful thanks

#

: )

quartz kindle
#

you dont really need to ratelimit dms tho

#

becuse the user is already rate limited by discord

#

so they will never be able to use more commands than discord allows

split hazel
#

is-busy npm library when you accidentally make an infinite loop: 💀

quartz kindle
slender wagon
#

my command is heavily using mongodb

slender wagon
quartz kindle
#

mongol dee bonk

slender wagon
quartz kindle
slender wagon
#

oh gotchya

quartz kindle
#

so 2 users using 5 commands in 5 seconds = 10 commands in 5 seconds your bot has to respond

#

which breaks the rate limit

slender wagon
#

indeed

split hazel
#
#

student programmers wanting to get a js certification realizing they have to pay £300 to enroll in a "charity" openjs foundation

#

actually no i think thats just to take the test

#

you have to pay more for a course too

slender wagon
#

self-taught is the way

#

is there a way i can implement an event and check if the discord pfp is still available

fathom sonnet
#

ammm how can i check with if(){} statement which one of these user has selected:

slender wagon
lyric mountain
#

hi age, I'm kuuhaku

slender wagon
fathom sonnet
#

anyone know solution?

fathom sonnet
sharp geyser
#

Ima assume you're using djs

#

if so you can use the createMessageComponentCollector

onyx summit
#

just wondering because I'm not up to date on slash commands and other stuff.
I'm trying to display a table, is a codeblock still the most appropiate way?

onyx summit
#

yeah, you dont know tables?

#
| heading | stuff | table |
| ------- | ----- | ----- |
| stuff   | fooo  | bar   |
| stuff   | fooo  | bar   |
| stuff   | fooo  | bar   |

stuff like this

boreal iron
#

A code block is the only way to realize this properly

#

But still will be horrible for mobile users to look at

#

At least if the table is wider than the screen size

wicked pivot
earnest phoenix
split hazel
#

ive ran out of shit to code

#

and im not in the right mindset to start working on a file system or update my database

#

so ima add paging to my os :o

#

not that kind of paging everyone calls it that swaps data between disk and memory

#

paging is a part of it tho

#

after i fix my os yet again

#

well im only having issues with crashes when scrolling the terminal

#

other than that its relatively stable other than random artifacts when playing my snake game

#

might actually push some shit to github

sharp geyser
wheat mesa
#

I wanna make a bot but I’ve also got no ideas for one

spark flint
#

a bot that gives bot ideas

wheat mesa
#

I had an idea that turned out to be too difficult to make so

sharp geyser
wheat mesa
#

The Auxcord thing

sharp geyser
#

Also if you wanna make a bot you can help me with the one im doing on the side

wheat mesa
#

Audio manipulation is difficult

sharp geyser
sharp geyser
wheat mesa
#

What lib

sharp geyser
#

detritus

wheat mesa
#

Ok deal

sharp geyser
#

obv

wheat mesa
#

Idk what you mean by global moderation though

wheat mesa
#

So would it be a bad idea to share info of user's ban reasons with other users for the sake of moderation? I'm not sure of discord's feelings about this sort of data

#

Would it be enough to have a publicly available ToS about what data we collect and what we do with it and a way to request data deletion?

lyric mountain
#

that's probably a gray area

sharp geyser
lyric mountain
#

like, it could lead to pre-judgement of people

sharp geyser
#

Like as in?

#

People make their assumption before the person even has the chance to interact with the community?

lyric mountain
#

yes

#

sometimes people can be pushed into being dicks if the environment is too toxic

solemn latch
#

that, and long term effects of user interaction.

Ie, many people do dumb stuff when they are young.
Some dumb mistake at 14 could affect a user in their 20's.

lyric mountain
#

also u can booli someone by banning without reason and putting a ridiculous reason

#

like, someone just joined -> "Banned for pedophily"

#

next server looks at the reason and thinks it's legit

sharp geyser
#

We are going to be mitigating that by requiring a message id(s) of their offensive behavior so people can't just fake a reason

solemn latch
#

So your ban logs wont include bans from VC, or dms?

sharp geyser
#

We have yet to determine that far ahead we are mostly trying to flesh out the smaller details

#

I feel like we won't though as it would be rather hard to track that sort of stuff unless we find an alternative method

lyric mountain
#

do this: allow only pre-defined ban reasons to be selected

#

and only show to other servers if it occurs more than, say, 5 times

sharp geyser
#

We were also thinking that

sharp geyser
lyric mountain
#

that way u reduce false-positives

sharp geyser
#

I was also thinking of an appeal system but idk how well that'd work

wheat mesa
#

Obviously users need a way to delete their data if requested

#

That’s a problem

worn crag
#

K

rocky hearth
#

What wud be the regex for, selecting everything before first dot.
FE, group.slice.ts should give only group

#

Basically I want text.split(".")[0], but in regex

earnest phoenix
#

/^([^.]+)/
One Google search away

rocky hearth
#

It didn't work, im trying to make vsc snippet

earnest phoenix
lyric mountain
#

In java it'd just be <text>.split(".", 1)

#

Oh wait, nvm, misread ur question

#

What u want is actually /^(.+?)\./

earnest phoenix
#

Nope

#

That will also contain the .

lyric mountain
#

That'll match anything until the first dot

#

No it won't

earnest phoenix
#

Until and including the dot

lyric mountain
#

Note the capture group

earnest phoenix
#

That is what they need

lyric mountain
#

Ur missing the capture group in my answer tho

earnest phoenix
#

Read their question again

#

Look the two regexes

lyric mountain
#

"match anything until the first dot"

earnest phoenix
#

Compare both regexes

lyric mountain
#

Mine doesn't include the dot

earnest phoenix
#

Which one only gives the first characters back without including the dot at all

#

Whatever

#

some people just don't want to understand

lyric mountain
#

Although I did forget ? there

lyric mountain
hybrid cargo
#

<string>.split(".")[0]

stop fighting guys 💀

rocky hearth
hybrid cargo
rocky hearth
#

${TM_FILENAME/^([^.]+)/}
I'm trying, but the snippet wont work.

hybrid cargo
#

uhh

sacred aurora
rocky hearth
#

What do I change here?

sacred aurora
#

<str>.match(regex)

#

[0]

hybrid cargo
#

They are trying to create a VScode snippet. Not implementing in their code

sacred aurora
#

ah my bad

#

i didn't see the previous message

hybrid cargo
sacred aurora
hybrid cargo
#

@rocky hearth you want the snippet to print just the file's name without the extension?

rocky hearth
#

not remove, but select

rocky hearth
hybrid cargo
#

oh okay

sacred aurora
rocky hearth
#

yes, remove everything after first dot, (dot included)

sacred aurora
#

/\..+/ this get everything after the first dot

sacred aurora
#

so it should be something like this?
${TM_FILENAME/\..+//}

#

i dunno

earnest phoenix
#

The typical XY problem

rocky hearth
sacred aurora
#

nice

rocky hearth
earnest phoenix
#

No. You asked about selecting everything before the first dot. Your actual goal was to get everything after the first dot to get removed. vsc snippets work only with the second apparently, which is the goal. You tried to alter what you want by thinking it would be the same, which is not the case.

rocky hearth
#

vsc snippets work only with the second
Oh, I wasn't aware of that.
By selecting I meant to keep only that part. My Bad

feral aspen
#
.addField('Attitude is now in', `${await bot.shard.fetchClientValues('guilds.cache.size').then(total => total.reduce((a, b) => a + b, 0)).toLocaleString()} Servers`, true)
``` https://cdn.hamoodihajjiri.com/odiu3Af5cq
Content Delivery Network
#

Should I make a parenthesis like (await ...).toLocaleString()?

near stratus
feral aspen
#

I'm not going to add an await, just adding parenthesis; before await and before .toLocaleString().

#
`${await bot.shard.fetchClientValues('guilds.cache.size').then(total => total.reduce((a, b) => a + b, 0)).toLocaleString()} Servers`
`${(await bot.shard.fetchClientValues('guilds.cache.size').then(total => total.reduce((a, b) => a + b, 0))).toLocaleString()} Servers`
earnest phoenix
#

You seem to be calling the toLocaleString() method on a promise, so I would recommend wrapping it in parentheses, yes

feral aspen
#

Like this, basically.

bright hornet
crystal wigeon
#

Hey, is there a way I can add more buttons to an embed that already has buttons?

#

MessageActionRow row

#

I’m assuming there should be only 1 action row?

#

Or can I append multiple

earnest phoenix
#

@crystal wigeon edit the message but pushing more objects into the array

sharp geyser
#

As far as I remember

crystal wigeon
#

how would i do that

#

after user clicks

sharp geyser
#

Wym by the first collector.size

#

Collector#size is a number

#

You can't send anything to it

crystal wigeon
#

they probably mean when someone interacts first

#

?

#

so my problem is i have 3 buttons and when someone clicks i need to edit the label on one of these buttons

sharp geyser
#

If they mean the first collected interaction they can do collected.first() to get the first one in the collection and do whatever they want with it

crystal wigeon
#

and these buttons are all ActionRowComponents cause its already sent in the embed

sharp geyser
#

I would help you but I don't know much about collecting button responses

bright hornet
#

Hmm

sharp geyser
#

You could probably get the button that's collected and maybe change it's data but you'd likely have to resend the buttons with different data by editing the message you want to change the buttons on

bright hornet
#

Alright thanks thanks

sharp geyser
#

You'd essentially be sending the same message just different button names

crystal wigeon
#

thats what im trying to do, but i also shouldn't be removing other buttons

sharp geyser
#

Wym

#

Just resend the buttons but with different names

bright hornet
#

that's sad that its only sending the message after the second value.content, i think there's no way sending it for the first collection

crystal wigeon
#

collection.first() will trigger for the first time

bright hornet
crystal wigeon
#

when someone reacts for first time

bright hornet
crystal wigeon
#

yeah

bright hornet
#

I tried it already

#

still sent the log after second collection

crystal wigeon
#

collection.first() should give you the first interaction

sharp geyser
#

I'm too tired to think of a solution for you sorry

crystal wigeon
#

just try it really slow

#

wait a few seconds after 1st interaction

bright hornet
sharp geyser
#

But the thing is collectors don't return the data until it's collected everything

crystal wigeon
#

yeah

bright hornet
#

Thats what im saying

crystal wigeon
#

that

sharp geyser
#

So you can't really do it unless you made your own collector which why do that

bright hornet
#

even i use collected.first() to send it to my first if else statement it still wait for the second collection

crystal wigeon
#

wait im doing something similar

#

lemme check what im doing

bright hornet
#

I just need to think about this logical

sharp geyser
#

Yea collectors just collect everything then send data

crystal wigeon
#

are you trying to use reactions?

#

reaction collector?

bright hornet
sharp geyser
#

I guess what you could try doing is not supply a limit and just stop it when it reaches 2 collected

crystal wigeon
#

you could try createMessageComponentCollector

sharp geyser
#

You might be able to as it will not wait until it's collected everything (iirc)

#

As there is no limit to collect

crystal wigeon
#

and then do whatever you want on first interaction and defer

bright hornet
#

i aint using interaction

#

i hate it

crystal wigeon
#

no no im not using interactions

#

its a channel.createMessageComponentCollector

bright hornet
#

is there defer on

crystal wigeon
#

you can use it

sharp geyser
#

You just told them to use the component collector

#

That's for buttons, select menus and modals

bright hornet
#

wat

crystal wigeon
#

yeah its a button interaction

#

my bad

bright hornet
#

ah

crystal wigeon
#

its fairly simple

bright hornet
#

got confused for a sec

sharp geyser
#

I'm confused are you using buttons Syfy?

bright hornet
#

nope

crystal wigeon
#

emote?

#

haha

bright hornet
#

createMessageCollector

sharp geyser
#

Huh

bright hornet
#

normal collector

sharp geyser
#

Ah okay

#

Makes sense

#

Well I'ma sleep sorry I wasn't able to help much but I feel if I tried I'd make the situation worse

bright hornet
#

Its alright, have a good sleep!

earnest phoenix
eternal osprey
#

Hey guys, why the fuck does my json keep telling me that there's an unexpected end of Input:

{"John":{"name":"John","type":"Accountant","promotion":"Best accountant","strength":[0],"popularity":[1],"finances":[0]}}```
#
if(!database["John"]) database["John"] = {
          name : [],
          type : [],
          promotion : [],
          popularity : [1],
          finances : [0],
        }
 fs.writeFile("./database.json", JSON.stringify(database), (err) => {
    if (err) console.log(err)
  });

eternal osprey
#

Then what's the issue lmao?

hybrid cargo
#

JSON.stringify() also works, idk what your error is

eternal osprey
#

I think it's my vsc

#

its corrupted

hybrid cargo
#

I- dont think that could be even a reason, are you sure that this code is the part that returns a error

eternal osprey
#

One sec

#
const ms = require("ms");
const n = require("../n.json");
const fs = require("fs");
const moment = require("moment");
let database= JSON.parse(fs.readFileSync("./database.json", "utf8"));

  if(!database["John"]){
    return;
  }
console.log(database)
}
hybrid cargo
#

send the error stack

ancient nova
#

it doesn't look as if anything here could cause an error

hybrid cargo
#

Yeah, unless the data saved in database.json is missing a syntax somewhere and JSON.parse is returning that error

#

It is hard to help without looking at the error stack

wheat mesa
#

It might be because you’re using json as a database. Concurrent writes fuck it up.

solemn latch
#

^ you'll want to write a db handler to prevent multiple writes at the same time.
You'll also probably want some error handling.

quartz kindle
# eternal osprey ```js if(!database["John"]) database["John"] = { name : [], ...

fs.writeFile is an async operation, it lets your js code continue running while the file is being written. if your js code gets to a point where it needs to write again while the previous writeFile did not complete yet, your code ends up writing to the same file more than once at the same time, which basically destroys it.

ancient nova
#

anyone got a VM KEKW

woeful pike
thorny flume
#
const EventEmitter = require('events')

class TheBrozyCluster extends EventEmitter {
  constructor(options = {}) {
    super()

    this.cluster = require('cluster')
    this.Utils = require('../../Utilits/Utilits/Utils')
    this.config = require('../config')

    this.worker = this.cluster.Worker
    this.id = options.id
    this.uptime = Date.now()
    this.name = {}
  }

  async spawn() {
    try {
      const name_cluster_1 = this.id === 1 ? 'Andrômeda' : '1',
        name_cluster_2 = this.id === 2 ? 'Hydra' : name_cluster_1,
        name_cluster_3 = this.id === 3 ? 'Lyra' : name_cluster_2,
        name_cluster_4 = this.id === 4 ? 'Pegasus' : name_cluster_3,
        name_cluster_5 = this.id === 5 ? 'Cetus' : name_cluster_4,
        name_cluster_6 = this.id === 6 ? 'Fornax' : name_cluster_5,
        name_cluster_7 = this.id === 7 ? 'Volans' : name_cluster_6,
        name_cluster_8 = this.id === 8 ? 'Lynx' : name_cluster_7,
        name_cluster_9 = this.id === 9 ? 'Draco' : name_cluster_8,
        name_cluster_10 = this.id === 10 ? 'Starburst' : name_cluster_9,
        name_cluster_11 = this.id === 11 ? 'Centaurus' : name_cluster_10,
        name_cluster_12 = this.id === 12 ? 'Eridanus' : name_cluster_11

      this.name = name_cluster_12

      this.worker = await this.cluster.fork({ id: this.id, cluster_count: this.config.clusterCount })

      this.Utils.logger('SUCCESS', `Cluster ${this.worker.id} (${this.name}) spawned with ${this.worker.process.pid} process pid`)

      await this.Utils.sleep(5000)
    } catch (error) {
      this.Utils.logger('ERROR', error.message)
    }
  }
}

module.exports = TheBrozyCluster

I created this cluster system, using node;cluster. And I wanted to know how to handle each cluster individually

quartz kindle
#

do you understand how the cluster module works? have you read guides about it?

#

the cluster module is a bit tricky to understand because it works very differently from the child_process module

#

for example, your code is missing the single most important thing in the cluster module: cluster.isPrimary, previously named isMaster in older versions

spark flint
#

finally moved to hetzner

thorny flume
#

I put it in another part of my code, this is a class, it's just to make everything simpler

thorny flume
quartz kindle
#

what do you have in your else block?

thorny flume
#

nothing, just if

quartz kindle
#

then you dont have anything running at all

thorny flume
#

I have, the bot is running on the primary cluster

quartz kindle
#

the isPrimary check is the most important thing in the cluster module, because its was tells your code what to run in the primary, and what to run in the children

#
if(cluster.isPrimary) {
  // everything here only runs if this is the primary. the primary should create forks
} else {
  // everything here only runs if this is not the primary, it should run the code that the forks should run
}
#

when you fork a cluster, it creates a new child process that runs the exact same js file all over again

thorny flume
quartz kindle
#

if you dont have any other code outside that if(isPrimary), then you forks are not running anything

thorny flume
#

hmmmm

quartz kindle
#

you run node index.js, which starts the script in primary mode

#

then inside the script you use cluster.fork()

#

that function will run node index.js again, but in worker mode, not primary

thorny flume
#

I understand, could I pass the bot client on worker clusters?

quartz kindle
#

no

#

the workers are entirely new processes, run from scratch, just like running a new node index.js

thorny flume
#

hm....

quartz kindle
#

inside the worker, inside a non-primary if block, you need to run your class and create a new client

#

for example ```js
if (cluster.isPrimary) {
console.log(Primary ${process.pid} is running);

// Fork workers.
for (let i = 0; i < numCPUs; i++) {
cluster.fork();
}

cluster.on('exit', (worker, code, signal) => {
console.log(worker ${worker.process.pid} died);
});
} else {
// this is the code that the workers will run
const client = new Client(...);
client.login(...);
}

#

this is the example that the official docs have

thorny flume
#

so i would create a client for each worker?

quartz kindle
#

yes

thorny flume
#

hm....

quartz kindle
#

just like you would do with child_process

#

or worker_threads

#

in fact, the cluster module is just a child_process.fork() that is able to share a port

#

so its only useful for running webservers

#

its not really useful for running bots, unless you want to also run a dashboard inside it, or something

thorny flume
#

but then, can I remove my client from the parent cluster or can I leave it in the parent cluster and child clusters?

thorny flume
quartz kindle
thorny flume
#

ok

#

I already understood how it would be

thorny flume
#

so?

quartz kindle
#

ideally you'd have only the clustering class on the primary, but sure you can also have a non-logged-in discord client

thorny flume
#

not connected?

quartz kindle
#

oh and by the way, this can be simplified: ```js
const name_cluster_1 = this.id === 1 ? 'Andrômeda' : '1',
name_cluster_2 = this.id === 2 ? 'Hydra' : name_cluster_1,
name_cluster_3 = this.id === 3 ? 'Lyra' : name_cluster_2,
name_cluster_4 = this.id === 4 ? 'Pegasus' : name_cluster_3,
name_cluster_5 = this.id === 5 ? 'Cetus' : name_cluster_4,
name_cluster_6 = this.id === 6 ? 'Fornax' : name_cluster_5,
name_cluster_7 = this.id === 7 ? 'Volans' : name_cluster_6,
name_cluster_8 = this.id === 8 ? 'Lynx' : name_cluster_7,
name_cluster_9 = this.id === 9 ? 'Draco' : name_cluster_8,
name_cluster_10 = this.id === 10 ? 'Starburst' : name_cluster_9,
name_cluster_11 = this.id === 11 ? 'Centaurus' : name_cluster_10,
name_cluster_12 = this.id === 12 ? 'Eridanus' : name_cluster_11

  this.name = name_cluster_12

tojs
this.name = [,"Andrômeda", "Hydra", "Lyra", "Pegasus", "Cetus", "Fornax", "Volans", "Lynx", "Draco", "Starburst", "Centaurus", "Eridanus"][this.id];

thorny flume
#

ok

thorny flume
quartz kindle
#

i dont know what your full code is, but you have super.login() so im assuming you have another class which extends Discord.Client

thorny flume
#

yes

quartz kindle
#

so you dont need that class in the primary

thorny flume
#

hm

#

ok

thorny flume
#

lol

quartz kindle
#

you can pass the names in the fork arguments, or you can get the name from the id you passed in the fork argument

#

this.cluster.fork({ id: this.id, cluster_count: this.config.clusterCount }) this should be available inside the workers as process.env.id and process.env.cluster_count

thorny flume
#

hmmm

#

ok

idle coral
#

I can't run my bot due to there being an end of output on my token run line, yet I didn't make any changes to this code line.

#

Full error;

SyntaxError: Unexpected end of input
/home/runner/Icey-Mail/index.js:309
client.login(process.env.token)
                               

SyntaxError: Unexpected end of input
#

Line:

client.login(process.env.token)
thorny flume
#

like, the cluster with id 1 comes secondary and the cluster with id 2 comes primary, and similarly with the others

#

This is normal ?

lyric mountain
idle coral
#

I'm using repl it. It's in a .env file

#

I'm dumb, not that dumb though.,

lyric mountain
#

check if your token doesn't end in " or '

#

nor has any of those characters inside it

idle coral
#

Does not.

lyric mountain
#

not the word "token", the actual token

#

no need to show me, just see if the token has quotations in it

idle coral
#

It calls the value

#

The key shouldn't be the token.

#

I've been using this same process for 3 years.

#

It's not any of that.

quartz kindle
#

somewhere along your code you have an extra ( or { that you never closed

idle coral
#

I know,

#

Oh.

#

I knew that. That's why I was confused.

#

So why wouldn't the console tell me where

quartz kindle
#

because it cant detect where

#

it can only detect it once it reaches the end of the code, and realizes something is missing

#

like the code "ends unexpectedly"

#

the program doesnt know what caused it, it just knows that it wasnt supposed to end there

#

one easy way to find out what's wrong is to copy and paste your entire code here

#

and auto-format it

#

it will be indented correctly into blocks, and you will be able to see which block was not closed

quartz kindle
lyric mountain
#

no structure would ever use the key

#

when I say "token" I mean the value (which is called token) not the actual written text

boreal iron
#

@quartz kindle there’s flexible networking for cloud servers too on Hetzner, if you don’t need an IPv4 or v6 or non of it (private network - vswitch connectivity)

#

Got released a few hours back

quartz kindle
boreal iron
#

It is as IPs are already an extra item on your bills for a few weeks/months

#

That doesn’t affect your current price, only if you remove the IPv4 option

#

Since IPv6 is for free

lyric mountain
#

extra item on your bills
dw, americans are already used to that

idle coral
#

I'm just going to rewrite the entire index.js.

lyric mountain
idle coral
#

It's outdated anyways.

#

From uh, from 2018..

lyric mountain
#

it's not a code issue I believe

idle coral
#

It was.

idle coral
#

As soon as I deleted everything and just added the login, everything was fine.

lyric mountain
#

then it's something else in your env that's wrecking the env json

#

like a random quote dangling in another field

quartz kindle
boreal iron
#

Yeah

quartz kindle
#

im currently paying for the 3.99 plan

quartz kindle
#

CX11

idle coral
#

I just said.

#

The bot works fine now.

#

Tim helped.

#

Tim said it was from some code line above, missing a [, {, or (.

boreal iron
#

And yeah the price should drop by 0,50€

quartz kindle
#

welp i rather keep it

boreal iron
#

Yeah I’m doing that, too but just wanted to mention it

#

The DNS servers without IPv4 would be fun

idle coral
#

What do I put in the requirement area to get a file within a folder?

#

Worded weirdly.

#

I keep getting this error, I do know why.

Error: Cannot find module './config/config.js'
Require stack:
- /home/runner/Icey-Mail/commands/Owner/eval.js
- /home/runner/Icey-Mail/index.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (/home/runner/Icey-Mail/commands/Owner/eval.js:4:21)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
#

This is how my files are setup.

#

How would I call conig.json?

#

Right now I have this, const { OwnerID } = require('./config/config.js')

quartz kindle
#

if the file is .json then require it as .json, not .js

#

also, if you're requiring it from eval.js then you need to use a relative path from that starting point

#

../../config/config.json

idle coral
#

Jesus christ.

#

Thanks Tim, I didn't even catch that.

spark flint
#

welcome back to i hate docker

woeful pike
#

another episode of "I'm probably using localhost to refer to the host machine inside a container"?

spark flint
#

i'm just following Outline's install steps

#

including their docker-compose.yml

woeful pike
#

you can't use 127.0.0.1:5432 for that 😭 wth

spark flint
#

i should probably change that then ig

slate hollow
#

hi! if i want to make my bot track the votes on a server its on , i need the bot to be on top.gg right? like approved and so else i dont have a token to authorize the bot to check on the votes of the server

woeful pike
#

which container is this? https-portal?

spark flint
#

i honestly have no idea

#

i suck ass at docker

woeful pike
#

are you just running docker-compose up -d?

spark flint
#

docker-compose run --rm outline yarn sequelize db:create --env=production-ssl-disabled

woeful pike
#

lol wtff

#

the standard way this is done, you need to create a shared network between them

networks:
  some-network:

services:
  outline:
    image: outlinewiki/outline
    env_file: ./docker.env
    networks:
      - some-network
    depends_on:
      - postgres
      - redis
      - storage

  postgres:
    image: postgres
    env_file: ./docker.env
    networks:
      - some-network
    # ...
#

or an easier option is to add network_mode: host to outline

#

but that won't work on a mac

spark flint
#

ah ok

#

i'm on an Ubuntu server

woeful pike
#

should be okay

spark flint
#

got a new dedi today pOg

woeful pike
#

poggies

quaint wasp
#

Nice

woeful pike
#

and then when you do the migration you need to reference postgres:5432 with the name of the service and not localhost

spark flint
#

wtf now i run it again and it suddenly exists

woeful pike
#

amazin

quaint wasp
#

Epik

spark flint
#

nah i give up with Outline i stg

timid geyser
#

right so uh

#

I booted my bot and commands dont work

#

don't tell me I have to rewrite it

#

again

eternal osprey
#

hey guys

#

how would i send a few messages after each other?

#

so: ```js
message.channel.send...
// wait 5s
message.channel.send...
// wait 5s
etc etc

#

Lidnsey your mom

#

@solemn latch

solemn latch
#

@hollow ocean no ads please

wheat mesa
lyric mountain
eternal osprey
#

hmmm i see

split hazel
#

let end = Date.now() + 5000;
while (Date.now() < end) {};

lyric mountain
#

plot twist: the world ends in exactly 4999 millis

quartz kindle
#

lmao²

quartz kindle
wheat mesa
#

(Also probably not the best idea to send multiple messages per command assuming it’s for that reason, but if you’re going to then I guess waiting 5 seconds is good)

earnest phoenix
#

Message Content intent is not enabled and a prefix is configured. This may cause limited functionality for prefix commands. If you want prefix commands,
pass an intents object with message_content set to True. If you don't need any prefix functionality, consider using InteractionBot instead. Alternatively, set prefix to disnake.ext.commands.when_mentioned to silence this warning.
client = commands.Bot(command_prefix=prefix, intents=intents, case_insensitive = True)
Traceback (most recent call last):

#

how to fix it

#

python

spark flint
#

enable message inents

earnest phoenix
#

where on dev portal?

#

Ok done thanks!

wheat field
#

I've had an issue recently with a bot currently private and in development getting banned by Discord. I've been unable to get in contact with the staff. Has anyone else had this happen and how did you resolve it?

lyric mountain
lyric mountain
#

Like if u spam is too much it will eventually be banned from interacting with it

#

Usually you'll see a ton of red flags before that happens

#

Like cloudflare bans, token resets, discord alert, etc

wheat field
#

Hmm. I was using Hikari which has rate limiting. Regardless, it was working fine for months until another user started testing it. Not sure why it started happening.

lyric mountain
#

Also if u break the ToS it might be banned without previous notice

bright hornet
#

Heya tim, do you have any idea on how should I send in collector.on('collect') when the first collection collected? Im having a max: 2 tho.

wheat field
earnest phoenix
sharp geyser
#

but djs doesn't stop the collector until everything has been collected

#

so .on('collect') won't fire until 2 has been collected if you set a max

earnest phoenix
#

The collect event of the collectors does not depend on the max option

#

Every time something is collected, the collect event will be emitted, so you can just set a count, increment on every call, and then call <Collector>.stop() on demand when the needed amount is reached

sharp geyser
#

yea

#

but if you do supply a max to the collector doesn't it wait until that amount has been collected for it to fire?

earnest phoenix
#

Nope

sharp geyser
#

this is me just confirming my thoughts on the matter

earnest phoenix
#

That's the end event you're talking about

sharp geyser
#

Ah

#

Got mixed up

ancient nova
#

hey I was thinking of putting a survey sort of and send the URL to it to the guilds owner when they kick my bot. Is that by any chance against ToS or anything of this sort? The survey is just to determine why they kicked the bot so I could possibly improve on it

wheat mesa
#

Assuming your bot has no mutual servers with said guild owner, you would not be able to DM them anyways

#

You could perhaps make a guild leave command that admins can use that sends an optional survey then leaves I guess

#

But overall there's not a whole ton you can do about it. If they want to kick it, it's gone and you wouldn't have a reliable way of contacting the owner afterwards

earnest phoenix
pallid zinc
#

Im trying to open a popup window by window.open()
then lets say i randomly created a number and saved it in a variable code now i want that code to be transferred from the popup window to the main window any idea how can we do that?

near stratus
#

you can remove the value after the event too

#

Or just create a function

function BroadcastMessage(m){
      localStorage.setItem('BROADCAST', JSON.stringify(m));
      localStorage.removeItem('BROADCAST');
}
#
window.onstorage = (storage) => {
    if(storage.key !== "BROADCAST"){ return }
    console.log(JSON.parse(storage.newValue))
}
winter pasture
#

Isn't there a BroadCastChannel API made just for that purpose?
https://developer.mozilla.org/en-US/docs/Web/API/BroadcastChannel

The BroadcastChannel interface represents a named channel that any browsing context of a given origin can subscribe to. It allows communication between different documents (in different windows, tabs, frames or iframes) of the same origin. Messages are broadcasted via a message event fired at all BroadcastChannel objects listening to the channel.

near stratus
#

broadcastchannel works between windows ?

#

didn't know that

winter pasture
#

it allows communication between different documents (in different windows, tabs, frames or iframes) of the same origin.
So it should according to the specs, but I have only used it for cross tab communication so can't say with 100% certainty that it would work

near stratus
#

For some reason it even connects from chrome tab to edge

#

IDK what's wrong but it's so cool

winter pasture
#

wait what mind_blown_wow
So your chrome broadcast gets received by edge too?

near stratus
#

yes

#

I think my edge broken

winter pasture
#

Lol

earnest phoenix
#

i have still this problem

#

and can't run prefix commands

pallid zinc
green kestrel
#

im after ideas for an animal for the mascot for D++, something cute is good but not an absolute requirement. also something no other big project is using so no elephants, dolphins, crabs etc.

if i can get agreement on whats best i may commission an artist to make the mascot real 😄

#

ping me suggestions

sick agate
green kestrel
#

yeah maybe

#

somone suggested a bee

#

instead of birb

#

lightweight, fast, organised

#

and can be made to look cute

sick agate
#

possible

sick agate
#

....

green kestrel
#

lmao

#

how are they lightweight, fast, or organised

#

besides lib isnt called libweeb

sick agate
#

lib web exploration bomber

#

now you can get libweeb

near stratus
pine nova
#

💀

earnest phoenix
#

i have still this problem
and can't run prefix commands

#

any1 can help me?

sick agate
earnest phoenix
#

what should i enable?

sick agate
#

did you manually enabled in the code

earnest phoenix
#

wdym

pine nova
#

ur message content intent is not enabled in the code

#

so u cant use prefix commands without message content intent

earnest phoenix
#

intents.message_content = True

paste this

pine nova
earnest phoenix
#

If you read his error message you can see he uses py

#

Thanks!! works

#

How to fix this

sick agate
#

the channel probably doesnt exist anymore

#

ignore it

earnest phoenix
#

It's like a thanks for inviting message

deep lantern
#

hey guyz. So if i want to show the bot's logo in an embed. What do i use?

earnest phoenix
#

in js?

#

or py?

#

@client.event
async def on_guild_join(guild):
joinchannel = guild.system_channel
embed=disnake.Embed(color=0x8400a8, title="Thanks for inviting me!")
await joinchannel.send(embed=embed, view=link())
client.warnings[guild.id] = {}

#

why does it not work

near stratus
near stratus
earnest phoenix
#

Nope only channels

#

like normal

deep lantern
near stratus
#

In the server settings
There's an option to set a channel as system channel
All system messages goes in that channel

#

that's what system_channel is

#

and in case there is no system channel it'll return NoneType

#

and you can't send message in NoneType

#

That's probably the error you're having

#

check if joinchannel exists before sending message

lyric mountain
#

nobody knows where the beaver starts or where the duck ends, the result code is at best alien, but for those who know how to deal with it's a neat animal

#

oh also platypuses got a poison barb, like c++'s segfault

near stratus
lyric mountain
#

also fills your requirement of something cute

earnest phoenix
#

on a normal channel

#

that is not system?

lyric mountain
#

not anymore

earnest phoenix
#

So can i do that sends in private the message to who invited it for thanks for inviting?

#

is it possible?

near stratus
near stratus
lyric mountain
#

know what, that's a quite good idea

#

didn't think about adding more scopes to bot invite

earnest phoenix
near stratus
earnest phoenix
#

Because a lot of bots have it

lyric mountain
#

you're not a lot of bots mmLol

near stratus
earnest phoenix
earnest phoenix
#

Last question XD How do i put that the bot if it dosen't have permissions it will say I need "Manage_messages ecc" permission

lyric mountain
#

well, you can send a dm

#

ah wait, u didn't mean send_messages

#

just make a permission check before executing a command

near stratus
#

why work hard

lyric mountain
#

EOP is pretty bad

earnest phoenix
#

May can you send the code string? Idk.. 🙂

near stratus
#

umm
I can't

lyric mountain
#

hahahaha no

near stratus
#

no spoonfeeding

#

just do something like this

try:
  # Try sending message
except:
  print("If something breaks")
spark flint
#

because what if something else breaks

near stratus
spark flint
#

because what is the bot is unable to make an action, unrelated to perms

#

yeah

earnest phoenix
#

So... :/

#

What should i do

spark flint
#

but always saying "You need MANAGE_MESSAGE permissions" when you catch an error is bad

#

for error handling

#

have error handling for each and every scenario

near stratus
#

if you don't have SEND_MESSAGE perm

lyric mountain
#

you send a dm

spark flint
#

yeah ^

#

catching ALL errors and just returning perm error each time is really bad practice

earnest phoenix
#

Can you send me the dm thing? please.

lyric mountain
near stratus
lyric mountain
#

for every command, there's a Permission declaration

lyric mountain
earnest phoenix
#

no no

#

not who invited

near stratus
earnest phoenix
#

it should dm "who did the command" and tell i don't have permission for that

#

that is what i'm asking

lyric mountain
#

yes

near stratus
#

then good

near stratus
lyric mountain
#

java

earnest phoenix
#

Can you help me with py?

#

like how :/

lyric mountain
#

not really, but the concepts are the only important part in my images

#

add a requires or whatever property to each command and put all required perms

earnest phoenix
#

@commands.has_permissions(administrator=True)

#

I put this

lyric mountain
#

before executing the command, check if all supplied permissions are allowed

#

if not, get the missing permissions and show an error message

lyric mountain
near stratus
lyric mountain
#

literally

earnest phoenix
#

example

#

I know they don't give permission

#

They only give specific perm

lyric mountain
#

it's not that they don't give, the straight decline if they see the words "administrator" and "permission" written in the same sentence

#

administrator is the only blacklisted permission in top.gg

#

as it should be, idk why discord even allows it

earnest phoenix
#

Where can i find the "Permissions names"? Like Manage_Server idk

near stratus
lyric mountain
#

try ctrl-clicking @commands, it should take u to the source code of it

#

or use that

near stratus
#

bitfields are weird

lyric mountain
#

who tf represents bitfields in hex

near stratus
#

discord

quartz kindle
#

a lot of people represent them in hex because its shorter but its confusing af

vocal trellis
#

someone experience with ejs and express?

pine nova
#

whats the problem?

earnest phoenix
#

What is the permission of the Warn/unwarn

#

Should i put Manage_messages or roles? IDK

#

Warn based on an command or an users message?

lyric mountain
#

for the user, I suggest either manage_messages or kick/ban depending whether u kick/ban after a certain amount of warns

earnest phoenix
novel belfry
#

can anyone help me in this
if(message.member.roles.cache.has('950054688680730654')){ message.channel.send('');
how to set more then 1 role in permissions

civic scroll
#

message.members.roles.add

novel belfry
#

and how to add

civic scroll
#

...

novel belfry
#

because I m new

civic scroll
#

read how a function in javascript works

#

and again

#

read the basics before heading to a boss fight

novel belfry
#

ok

civic scroll
novel belfry
#

thank u

earnest phoenix
#

@client.event
async def on_slash_command_error(interaction, error):
if isinstance(error, commands.MissingPermissions):
embed=disnake.Embed(color=0xb30000, title="Missing-Permission", description="You need "Perm" Permission")
await interaction.send(embed=embed)

That works for all commands, How can i made it for only 1 command Like For the ban command: Missing Ban Permission for the kick cmd: Missin kick permission ecc. How do i do it?

lyric mountain
#

or see if error doesn't contain the missing permission

stiff dust
#

hello guys my bot has 1K servers and 382K Members, And I use these intents:

'GUILDS',
'GUILD_MEMBERS',
'GUILD_BANS',
'GUILD_EMOJIS_AND_STICKERS',
'GUILD_VOICE_STATES',
'GUILD_MESSAGES'

I want to buy a VPS can someone help me how much Ram do I need? (Node JS) and also which one is better Windows or Linux

lyric mountain
#

your first question cannot be answered, it depends heavily on what you're doing and on your code

#

the second, linux, there're literally NO scenarios where you'd want windows over linux for servers

#

unless you refuse to learn a new OS and/or is heavily attached to windows

stiff dust
#

I have many events cause bot have log stuff

lyric mountain
#

be specific

stiff dust
#

Well I can't explain everything for you You

lyric mountain
#

do you have music features?

stiff dust
#

no

lyric mountain
#

why do u use voice_state intent then?

stiff dust
#

bot don't go to voice channels at all

stiff dust
lyric mountain
#

give me a brief description of your bot

stiff dust
#

well my bot is multi purpose bot with many futures most of them are basic but uesful for example auto thread media only youtube only channels and etc. it has giveaway system and also I have all of these events for logs

#

except these but has something like 100Commands (Anime Commands (kiss, hug ...), util commands (avatar, banner, server...) and also moderation commands to ban, kick, timeout members and ...)

lyric mountain
#

please tell me you have a single event listener and is redirecting to the respective files

stiff dust
#

well I have a loader and require my loader in index.js and then all of these events are just module exports

lyric mountain
#

ok, that's terrible

stiff dust
#

why?

lyric mountain
#

actually, I'll need to check whether d.js internally uses a single listener, but if it doesn't, that's a serious performance issue

stiff dust
#

(I Want to rewrite my bot soon, so If I have to change my event and command handlers please tell me)

lyric mountain
#

let's consider it does for now until Tim appears here to elaborate any further

#

so, do you do any image generation?

#

like custom profile or stuff?

stiff dust
#

ammm yes

#

I use canvas for wlc and goodbye image

lyric mountain
#

hm, my guess is at least 2GB at least then

stiff dust
lyric mountain
#

but it heavily depends on how many servers and how frequently images are generated

#

plus d.js is known to be a memory hog at times

stiff dust
lyric mountain
#

how many servers?

stiff dust
#

also I have image generation here 😄

#

brb soon

lyric mountain
#

hm not bad for 984 servers, maybe 1GB can suffice then

#

are u caching anything?

stiff dust
lyric mountain
#

caching members, channels, presences, etc

stiff dust
#

I fetch guild members in some commands

lyric mountain
#

well, go with 1GB, most providers allow upgrading later on if necessary

stiff dust
#

tnx

#

also us or eu ?

lyric mountain
#

get the one closest to your target audience

#

but it doesn't matter much, unless you're doing music, latency will be the least of your worries

rancid wadi
#

How do i make These things?

spark flint
#

Modals

rancid wadi
#

Okay thank u

slender wagon
#
 if (cips < price) {
         return res.redirect('/store?nomone');
      }

hey guys this is by far the worst error handling, if u can even call it that

#

i wanna implement a new one and recieve them on form of messages in frontend as well

fathom sonnet
#

any1 have idea on how to fix this?

#

happens when i try to deploy bot to heroku

slender wagon
#

don't upload node_modules on herku

#

smh

#

don't upload em on github either

wheat mesa
#

^

fathom sonnet
#

yea...this never happenes beafore

#

why would it now

slender wagon
#

idk man i wasn't there before

wheat mesa
#

because you uploaded node_modules to heroku?

lament rock
#

Different operating systems have different file encodings

wheat mesa
#

Just upload your package.json and use npm i

slender wagon
#

i think heroku will do that automatically for u

lament rock
#

and uploading node modules to heroku is bad because dev machine might have different binaries than production

slender wagon
#

don't forget remove this too

wheat mesa
lament rock
#

do not remove package-lock!

slender wagon
#

i always remove it when uploading to heroku

#

hhhh

#

it configures automatically

lament rock
#

In instances where you have to fix npm security issues in dev, removing package-lock makes you vulnerable

slender wagon
#

🤔

lament rock
#

npm would also have to fetch additional metadata for the tree if you do not commit package-lock

vivid fulcrum
#

package-lock does exactly what the name says, locks the package versions and their sources

slender wagon
#

aren't the versions already defined on package.json

lament rock
#

No, because some versions of a package accept newer versions of packages that might be vulnerable

#

"^0.1.x" might have installed 0.1.2 when initially installed, but if 0.1.3 exists, then it will use that.

slender wagon
#

right

fathom sonnet
#

bruh

#

i was trying to: push...dosent matter

#

i was pushing wrong directory

#

...

#

i realised when i checked the name

sick agate
#

is there anybody who has windows, a tp-link adapter , and a hotspot capable phone

midnight marsh
midnight marsh
wheat mesa
#

it broke after about a year and a half, my ping would spike all the time

midnight marsh
#

I am currently using DSL-2720u

wheat mesa
#

I wasn't too upset though, only paid like 20 bucks for it

sick agate
#

try to connect a wifi called #

midnight marsh
midnight marsh
sick agate
#

welp

midnight marsh
#

I have mobile data and that's good for me

sick agate
#

well

#

you dont need to access anything

#

just need to connect

fallen holly
#
          await interaction.editReply({
                content: 'Heads',
                ephemeral: true
            })

ephemeral true is not working

quartz kindle
#

well using editReply with ephemeal doesnt make sense in the first place

pine nova
#

is it just me or npm kinda slow and crashy? Thonk

fallen holly
#

i tried it with interaction.reply and followUp still not working

slender wagon
winter pasture
slender wagon
pine nova
#

npmjs

#

i use yarn

#

tho

#

copium

winter pasture
#

Oh, well.., the site is no better KEKW

pine nova
#

💀

winter pasture
#

I mean, npm is fine for me atm, just as slow as normal

pine nova
#

i only use npm for global installs

slender wagon
#

Johand bullying npm is not allowed

winter pasture
#

~4 sec from clicking search results to package page loaded

split hazel
#

pnpm is cool

#

it tries reusing the same packages

winter pasture
#

We've significantly reduced the Next.js install size. We did this by moving our monorepo to pnpm, which allows us to remove duplicate packages while creating the pre-compiled versions that we use. This leads to a reduction in install size of 14MB.

#

Pretty nice numbers from the recent next.js release

quartz kindle
woeful pike
#

pnpm caused so many issues for the topgg repo that i ended up moving back to yarn lol

#

it didn't integrate with GitHub actions tooling at the time either

quartz kindle
#

i've had tons of issues with both pnpm and yarn so i switched back to normal npm lol

lyric mountain
#

what would be the best http status to use in case I require additional data to proceed?

split hazel
#

you mean the request doesnt contain all the necessary data error or

lyric mountain
#

no, like, I'm making a websocket endpoint where I require an authorization key right after the client connects to proceed

#

else it timeouts

quartz kindle
#

thats not an http status then is it?

#

thats a custom application close code

lyric mountain
#

well yeah

quartz kindle
#

use a 4xxx close code

lyric mountain
#

why 4?

#

ah, because of "client error" range?

quartz kindle
#

the 4xxx range is reserved for applications

lyric mountain
#

ic

#

ty

spark flint
#

If I'm reposting files with files: Array.from(message.attachments.values()), how can I spoiler them?

quartz kindle
#

idk, try something like Array.from(message.attachments.values()).map(x => (x.spoiler = true) && x)

spark flint
#

👍

spark flint
#

didn't work

#

😔

pine nova
#

there was a website that told about sharding and scaling stuff on discordjs bots something like "dumb" i forgot. can someone share the link pls? weirdsip