#development

1 messages · Page 2025 of 1

wheat mesa
#

I will not use replit

#

I would rather shoot myself in the foot

boreal iron
#

How about your pants down?

pallid zinc
#

Azure cloud

boreal iron
#

To make a dirty deal

wheat mesa
#

replit is quite possibly the worst service I have ever used for development in my entire life

wheat mesa
boreal iron
boreal iron
#

Could have opened a lot of doors for you

wheat mesa
#

I'm using oracle for hosting my bot on a vps because they have a forever free plan that won't sneakily charge you $1000 without you knowing

slender thistle
#

SkySilk has stuff for 3 bucks a month

#

But it's VPS

#

Not sure if that's what you want

wheat mesa
#

I mean would it be a bad idea to host it on my oracle vps

boreal iron
#

A free vps must be a very good one

wheat mesa
#

there's no complex api or anything, just a portfolio with a few nextjs routes

slender thistle
#

Glitch!

pallid zinc
#

Replit

wheat mesa
#

No

boreal iron
spark flint
#

why isn't markdown working angery

#

(from a bot)

boreal iron
#

Doesn’t look like an embed

spark flint
#

it works outside of embeds

wheat mesa
#

it doesn't

boreal iron
#

No

spark flint
#

i use on my bot

wheat mesa
#

wtf

boreal iron
#

It shouldn’t

earnest phoenix
#

👀

spark flint
wheat mesa
#

that definitely should not be working

lament rock
#

Webhooks can use text styling outside of embeds

boreal iron
#

Instant report to discord, you’re abusing the system freerealestate

spark flint
#

maybe only works on slash commands?

lament rock
#

It only works on webhooks

boreal iron
#

And embeds

spark flint
#

my bot deffo isn't a webhook Eyes

lament rock
#

slash commands route through webhooks

spark flint
#

oh

#

ah ok

boreal iron
#

Lemme verify that

#

Aye he didn’t lie to us

lament rock
#

ofc

boreal iron
#

we can never be sure in here

spark flint
#

lol

wheat mesa
#

:C

boreal iron
lament rock
wheat mesa
#

I'll scare you away with java

boreal iron
#

You already did when telling me you use the oracle cloud

wheat mesa
#

I use it for hosting my shitty bot

#

Because it's free and I never have to look back at it or worry about getting charged for going over my bandwidth limit or anything

#

Broke student life can't take any chances

boreal iron
#

lol

pallid zinc
wheat mesa
#

wdym

#

I have a few open source projects but none of them are actively being worked on

boreal iron
#

You could use my dirty services but that would bring us back to your pants and your age oldEyes

pallid zinc
#

You can get free hosting for open source projects

wheat mesa
#

In less than 2 months I will be the age of consent to be fair

boreal iron
#

lmao

lament rock
#

I am still tempted to make an api where people can use some of my custom LavaLink nodes since I have a ton of headroom

pallid zinc
wheat mesa
pallid zinc
#

Ig

#

They provide services for open source projects

boreal iron
wheat mesa
#

That looks promising

#

I'll look into that

#

But I'm not sure if my personal portfolio website would fall under their umbrella of good use cases of their service haha

lament rock
#

it'll probably be a private api like weeb.sh is

#

but ofc people would be able to apply

pallid zinc
boreal iron
#

Hmm I see no real business man in here

pallid zinc
#

True

lament rock
#

I'm not about money or votes you know CVRchanSad

wheat mesa
#

I mean I have a few projects on github that are open source but I don't actively contribute to them nor does anyone else

pallid zinc
#

Pulling pants was better then filling 29 forms

wheat mesa
#

Which I don't really plan on working on for a while anyways

boreal iron
lament rock
#

I already have a job paying for everything

boreal iron
#

There’s never enough cash freerealestate

lament rock
#

you think people would want to pay for an api of lavalink nodes other people use instead of just buying their own node

pallid zinc
boreal iron
#

No I think you should offer it as free service, let them sign your contract and charge them after doing so KEKW

lament rock
#

No that's stupid

#

going through payment providers is also stupid

boreal iron
#

I see, can’t recruit scammers in here

lament rock
#

You'd be better off with the callers trying to tell you about your car's extended warranty you never knew you had

boreal iron
#

lol

wheat mesa
#

I could still apply but I'll have to look at my other options first

pallid zinc
#

Hmm

wheat mesa
#

Thanks for the suggestion though

boreal iron
#

What do you actually need?

wheat mesa
#

Just some host for a portfolio site made in react

#

I've already got a domain

cinder patio
#

github pages?

spark flint
#

netlify works

wheat mesa
wheat mesa
spark flint
cinder patio
#

unless you're doing SSR, your portfolio should be static

wheat mesa
#

SSR

#

Actually no

#

I'm not using SSR on second thought

cinder patio
#

Then github pages could work for you

wheat mesa
#

It is however configured with nextjs

#

To define routes and such

pallid zinc
lament rock
#

Just drop that and have a static website

cinder patio
#

then just npx next export and next.js will turn it into a static site UNLESS you have an API

wheat mesa
#

Yeah on 3rd thought I think I'm using some sort of SSR, the site looks very wrong when it's exported as static

cinder patio
#

how does it look

wheat mesa
#

normally would look like this

#

instead looks like

cinder patio
#

Add

assetPrefix: "./",
#

to your next.config.js

wheat mesa
#

rebuilding it rq

#

works... sorta

#

I think I'm going to just go with a host like netlify or something

#

I'm not done with the website yet anyways

cinder patio
#

It should work fine if you don't have any API routes

#

and only pages

wheat mesa
#

The svg background isn't there and I'd have to refactor all my links and such so for now I'm not gonna worry about it

cinder patio
#

Refactor links?

wheat mesa
#

They're not relative links, they point to routes in the url whereas it needs to point to files when it's static

#

I'll try fixing that rq

#

yeah I'll fix that later

#

I'm gonna take a break for a bit

#

been working on this a little bit too much and I don't wanna get burned out over config stuff

proven lantern
#

vercel is a good website host

tulip ledge
#

Anyone knows how to solve driver state failure bluescreen? Can't find a recent guide on how to fix it

quartz kindle
#

thats usually caused by a bad driver

tulip ledge
crystal wigeon
#

hey um, quick question. So i have a global var with Map() with some values. lets say this map has some 1k key -> value pairs. and this Map will keep getting more values over time. now my question is. If i remove certain keys at a certain time, will it cause memory leak. so far im suspecting this global var is the root of my memory leak issues im having which stores upto 10k+ props

quartz kindle
#

and see what windows does with them

tulip ledge
#

should I make a backup first?

quartz kindle
#

shouldnt be necessary

tulip ledge
#

alright

crystal wigeon
#

so like all the props will store is key -> numeric of 0 - 3

#

ex: 123123213 => 1

quartz kindle
#

if you're storing objects, and those objects also exist elsewhere, if you delete them they will still exist elsewhere

#

other than that, Map uses a hash table behind the scenes, and hash tables grow by a specific amount every time the number of items reaches a certain limit

#

for example lets day your Map has 60 items, and the Map internally has a max size of 128, and a threshold of 80

#

once you reach 80 items, the Map will be internally resized to max 256

tulip ledge
quartz kindle
#

so the memory usage of a Map does not only depend on the items it stores, but how big the table is as well

crystal wigeon
#

i see

#

makes sense

quartz kindle
#

and usually these kinds of tables do not get smaller when items are deleted, idk how they do it in js

crystal wigeon
#

i was thinking the size could remain the same when i delete some of these itmes once their purpose is served

#

or when i no longer need them

#

keeping the size to a minimal constant

quartz kindle
#

yeah that shouldnt be a problem

crystal wigeon
#

gotcha thanks, i'll try this out

tulip ledge
quartz kindle
#

they usually belong to something that might be under a different name

#

for example badlionanticheat.sys is from an anti cheat software used in many games like minecraft hypixel

tulip ledge
#

yeah but I doubt that's the one causing the blue screen as I haven't launched minecraft in like a year

#

It's the cdd or nwifi that's causing it I think

#

but I can't seem to find either one

quartz kindle
#

nwifi is usually your wifi chip, under networks

#

cdd looks to be some kind of screen/display/monitor thing?

tulip ledge
quartz kindle
#

no

#

drivers often have multiple dlls and sys files, you risk breaking it completely if you change one of them but not the others

tulip ledge
#

oh ok

#

so do I remove on of these?

quartz kindle
#

you can try running a driver scanner software to scan for outdated drivers

#

like drivereasy or those craps

quartz kindle
tulip ledge
#

i'll just install drivereasy

quartz kindle
#

screen drivers, if they exist, should show here

#

most times they are not even needed tho

tulip ledge
earnest phoenix
tulip ledge
#

holy fuck like all of my drivers are out of date

quartz kindle
#

show them

#

you dont necessarily need to update all of them

#

and its not always better to update them with the software

tulip ledge
quartz kindle
#

sometimes the software makes mistakes

tulip ledge
quartz kindle
#

is it a laptop or a desktop?

tulip ledge
#

laptop

#

those are all out of date

quartz kindle
#

i would download most of them from your laptop's maker website

tulip ledge
#

so asus

quartz kindle
#

yeah, go to asus and look for your laptop's model number in their website and see what drivers they have there

#

after you install the drivers from there, you can try scanning again and see whats left

tulip ledge
#

well

#

thats funny

#

guess it doesn't exist

tulip ledge
#

I just download all of them?

#

some of them are folders and I have no clue what to do with them

glass charm
#

does anyone know how do i show the server count like in the example?

spark flint
glass charm
spark flint
#

what language is your bot

glass charm
#

javascript

spark flint
quartz kindle
#

there are different editions and different versions of the same laptop model, so they just put all the drivers together, but not all drivers are the correct ones for your specific device

#

for example they have drivers for both intel wifi and realtek wifi

#

you just need the one your laptop has

#

which is intel wireless

glass charm
#

@spark flint does it take some time to show it there?

#

or its instant

quartz kindle
#

other than that, they also give you multiple versions of the same driver, so you can just download the latest one

quartz kindle
proven lantern
#

Is there a possibility that discord.js-light is caching the results of this?

client.shard.fetchClientValues('guilds.cache.size')
glass charm
#

@spark flint so if my bot console logs the posted stats i just gotta wait a bit right? i used the code below and puted my token too

const { AutoPoster } = require('topgg-autoposter')

const ap = AutoPoster('', client)

ap.on('posted', () => {
  console.log('Posted stats to Top.gg!')
})
spark flint
#

yep

#

takes a while for the site cache to clear

glass charm
#

ok, thank you

quartz kindle
#

there is no caching on those functions afaik

proven lantern
#

mmkay, i'll look see if i'm doing some weird caching.

#

i have this in a setInterval call and total is always logging as the same value on my server. only changes when i reset

quartz kindle
#

hmm weird

#

btw that try catch is not doing anything

boreal iron
#

1.44e+7

#

Pretty human readable

proven lantern
#

i was awaiting before

#

i should just remove that comment

quartz kindle
#

try broadcasteval instead of fetchclientvalues

proven lantern
#

and the interval function was async

#

mmmkay

#

eval?

#

evil?

quartz kindle
#

lmao

proven lantern
#
const results = await client.shard.broadcastEval(c => c.guilds.cache.reduce((acc, guild) => acc + 1, 0))```
this seems to work
#

also this

quartz kindle
#

dude

#

await client.shard.broadcastEval(c => c.guilds.cache.size)

#

lmao

proven lantern
#

that's too simple

quartz kindle
#

also, if you want to catch errors properly in that interval, either use .catch() or make it async () =>

quartz kindle
proven lantern
#

ohh

#

i think i know what i was doing

#

my setinterval was async like this and it cached the result of the promise

#

but it still logged somehow

#

like thisjs const p = new Promise((resolve)=>{resolve(Math.random())}) setInterval(async () => { console.log(await p) }, 1000)

quartz kindle
#

yeah like that you're creating 1 promise and then resolving the same promise over and over

proven lantern
#

it's weird that the console.log still happened even though it's cached

quartz kindle
#

why is it weird?

#

its logging something every 1 second like it should

proven lantern
#

but actually it's a function that returns a promise so it shouldn't be cached

quartz kindle
#

the only way to make it cache the results of the guilds cache would be if you did this ```js
const promise = client.shard.fetchClientValues(...);
setInterval(() => {
await promise;
}, 999)

proven lantern
quartz kindle
#

yeah that should be fine

fallen holly
#

idk what's wrong with it

boreal iron
#

The property in front of the startsWith method is undefined

#

as the error says

quartz kindle
#

in your messageCreate.js file, at line 17

#

it seems message is not a valid message

spark flint
#

you probably want async execute(client, message, Discord)

#

as the normal order is client, message not message, client

quartz kindle
#

depends on how his eventHandlers.js was done

wheat mesa
#

Why are you guys passing client and Discord in

#

Quite possibly the most useless function params

#

Access client through message.client

spark flint
spark flint
fallen holly
#

i changed it but its not working no err or anything

boreal iron
fallen holly
spark flint
#

we need the messageCreate event

#

where the command gets executed

fallen holly
#

aight but it's not even throwing an err

quartz kindle
#

where is eventHandlers.js?

boreal iron
#

Does it by any chance not start with your prefix?

#

As you return nothing there

#

_case sensitive _

#

Don’t forget that

fallen holly
#

it starts with my prefix

neat ingot
# fallen holly this is my handler https://pastebin.com/iJRNhBCc

you should (imo) use an async file loader, and use a custom 'require' function to reload the file each time its called, rather than use the cached version. then your exported module can be reloaded to reload commands when changed, instead of the bot having to reboot.

#

^ forces fresh require

boreal iron
#

that function name

#

lol

spark flint
#

how to stop the divs overlapping

boreal iron
#

What are they “relative” to?

spark flint
#

idek

#

i was looking at stack overflow

boreal iron
#

Then remove the position class

spark flint
#

i did now

#

still the same KEKW

boreal iron
#

Divs don’t stack if you don’t change their position property

spark flint
#

still the same

boreal iron
#

my gosh 4th edit

spark flint
#

lol

boreal iron
#

centered might also be a position change

spark flint
#

ah

#

i think thats why

boreal iron
#

Aye

spark flint
#

idk how to center then KEK

#

needs to be in middle of the page

boreal iron
#

Well just margin one of them

#

First div

#

margin-top: -50px

#

Ugly but works

quartz kindle
#

you want to center vertically?

spark flint
#

yeah

boreal iron
#

display: table
margin: 0 auto

radiant kraken
quartz kindle
#

well, one option is to use a negative margin-top which is exactly 50% of the height of the div, but tht requires the div to have a fixed height

#

or just use flexbox

spark flint
#

because stupid

#

me

#

i'm stupid

radiant kraken
quartz kindle
#

flexbox is like

spark flint
#

flex justify-center items-center h-screen

#

found that

quartz kindle
#

the magic fix for every single thing

radiant kraken
#

^

quartz kindle
#

that has troubled people for decades

spark flint
#

how do i put on new line

quartz kindle
#

you put them in a container

radiant kraken
#

try to change the order of the flexbox iirc

quartz kindle
#
<body or whatever with flex>
  <div>
    <p>hey there</p>
    <p>i code shit</p>
  </div>
</body>
#

the container div will be aligned by the flexbox

#

the text lines will be independent

radiant kraken
#

remove the "shit" in the desc too

spark flint
#

why mimu_sob_cry

radiant kraken
#

because it isn't true

#

i hate it when people self deprecate in their portfolios

quartz kindle
#

what if it is true

#

:^)

spark flint
#

it is very true

radiant kraken
#

no

spark flint
#

my code is just like "it just about works"

radiant kraken
#

so does every developer

quartz kindle
#

just change it to "i code nice things"

#

btw

#

the word "shit" can mean good things as well

spark flint
#

yeah

quartz kindle
#

"i code the shit"

#

"i code cool shit"

spark flint
#

i generally mean i code shit as in like i code stuff

#

shit can mean stuff

quartz kindle
#

because u dumbo

spark flint
#

yes

#

am stupid

quartz kindle
#

you didnt add justify center and items center

spark flint
#

because I don't want it in the middle on this bit

quartz kindle
#

then where do you want it

spark flint
#

ah wait

#

just justify-center this time

quartz kindle
#

not bad

radiant kraken
#

see

#

it's not shit

quartz kindle
#

also, if you wanna learn more about flexboxes, check this out

spark flint
radiant kraken
spark flint
#

lol

fallen holly
boreal iron
#

We build our fundaments on solid css2 and not magical aligning stuff

slender thistle
#

Grid ass looking mf

boreal iron
spark flint
#

yep

boreal iron
spark flint
boreal iron
#

You know what means sir

#

Oh no color changing text oldEyes

slender thistle
boreal iron
#

Shut up or I’m gonna flex you

slender thistle
#

Yes da

boreal iron
#

Stop with your magical properties or I’m gonna call the catholic church and tell them about your magic tricks

#

Css3 is evil

radiant kraken
boreal iron
#

lol

woeful pike
#

there's a ton of stuff html5 got rid of tho so aDubuCringe

simple stump
#

Is there a package similar to Puppeteer that doesn't launch Chromium? The reason for this is that I host my NodeJS projects on a VPS which only has 2GB of RAM, so even running in headless takes a good 30 seconds before Chromium is actually finished loading. This is going to send sketch but I'm asking because I'm attempting to web scrape a website that utilizes lazy-loading, so using Axios isn't enough.

quartz kindle
#

did you try looking into the network tab and see if the data you want can be found on any subrequests?

sharp geyser
#

Any idea on how I can make the button center?

#
      <Container style={{minHeight: "85vh", display: "flex", margin: "auto", alignItems: "center"}}>
          <Avatar className={'mr-5'} radius="lg" size="xl" src="https://imgs.search.brave.com/Q1JPL__FReDNKqetfnrYnBMKYs-uB8OwCnE6G55y7LE/rs:fit:1200:1200:1/g:ce/aHR0cDovL3dhbGxz/ZGVzay5jb20vd3At/Y29udGVudC91cGxv/YWRzLzIwMTcvMDEv/RG9nLWZ1bGwtSEQu/anBn" />
          <div className={'flex-wrap'}>
              <h1 className={'text-2xl'}>Hello I'm Aaron and I'm {age}</h1>
              <p className={'text-lg'}>I'm a small time developer who enjoys working on random projects. I also love nature and watching MacGyver.</p>
              <Button>Click Me</Button>
          </div>
      </Container>
wheat mesa
#

use a grid and be lazy

#
<Grid>
  <Grid.Col span={2} offset={5}>
    <Button>Click Me</Button>
  </Grid.Col>
</Grid>
``` something like that
sharp geyser
#

Mmmm

#

Never touched the grids in it but I can try

neat ingot
#

cant you just 'mx-auto'?

sharp geyser
#

Apparently not

neat ingot
#
.mx-auto{margin-right:auto!important;margin-left:auto!important}```
sharp geyser
#

Also wtf does span do?

wheat mesa
#

how many columns the column takes up

#

grid component uses 12 cols by default

#

like bootstrap grid

wheat mesa
#

personally I use grid for basically everything

#

really easy to lay out and visualize

#

though beware they can cause your page to overflow due to the fact that they have a -8px margin by default

sharp geyser
#

I see

wheat mesa
#

which I usually fix by wrapping the app

sharp geyser
#

I think for this use case it is fine how it is

wheat mesa
#
              <Box id={"box-container"}>
                  <Grid m={0}>
                      <Grid.Col span={12}>
                          <Component {...pageProps} />
                      </Grid.Col>
                  </Grid>
              </Box>
sharp geyser
#
      <Container style={{minHeight: "85vh", display: "flex", margin: "auto", alignItems: "center"}}>
          <Avatar className={'mr-5'} radius="lg" size="xl" src="https://imgs.search.brave.com/Q1JPL__FReDNKqetfnrYnBMKYs-uB8OwCnE6G55y7LE/rs:fit:1200:1200:1/g:ce/aHR0cDovL3dhbGxz/ZGVzay5jb20vd3At/Y29udGVudC91cGxv/YWRzLzIwMTcvMDEv/RG9nLWZ1bGwtSEQu/anBn" />
          <div className={'flex-wrap'}>
              <h1 className={'text-2xl'}>Hello I'm Aaron and I'm {age}</h1>
              <p className={'text-lg'}>I'm a small time developer who enjoys working on random projects. I also love nature and watching MacGyver.</p>
              <Grid>
                  <Grid.Col span={2} offset={5}>
                      <Button color={'gray'} variant={'subtle'}>Click Me</Button>
                  </Grid.Col>
              </Grid>
          </div>
      </Container>
#

this is how I have it rn

#

it works so

#

just not responsive at all but 🤷‍♀️

gloomy vessel
#

any reason why the background wont change?

bright thorn
#

Why its not sending true emper...

#

am new in slash

#

🥲

graceful yacht
#

hi

pallid zinc
#

plus you can only send reply/defer for first time and then send new followup

pale vessel
#

follow up should support ephemeral

slender thistle
#

It should yeah

#

It does, actually. A friend of mine has a bot that uses ephemeral messages on follow-ups

pallid zinc
#

I checked guilds too

old cliff
#

I think for that the main reply should also be ephemeral

bright hornet
rustic nova
#

because you're looping through the results without sorting them

#

is at least what im seeing

#

you're also sorting by either the wallet or bank, then looping through the results, then summing it together when adding it

neat ingot
bright hornet
neat ingot
#

yes. but wwhat you are actually doing is adding two strings together, then sorting your database by a 'key' that doesnt exist.

slender thistle
#

walletbankdescending is walletbankdescending yes

pale oasis
#

How am I able to check how many bytes are in a variable in Javascript?

#

Couldn’t find anything online.

bright hornet
pale oasis
neat ingot
#

there are literally hundreds of results to that google search 😂

#

idk how custom objects work with such calculations tho

#

how well*

pale oasis
neat ingot
pale oasis
#

So everyone just counts the length by using .length and passing it as bytes?

neat ingot
#

the length or what?

#

of*

pale oasis
bright hornet
pale oasis
neat ingot
quartz kindle
#

for example, there are a few different container types for strings alone, depending on what characters the string has and how it was constructed

#

the real size of a simple string with n ASCII characters (8 bit per character) is 12 + 4 * Math.ceil(n/4)

#

"" takes 12 bytes
"1" through "1234" take 16 bytes
"12345" through "12345678" take 20 bytes
"123456789" takes 24 bytes, and so on.

#

all containers are rounded to the next multiple of size_t, so in 64 bit systems, all data sizes are rounded up to the next multiple of 8

#

an example of all the different string type containers in v8

#

the same goes for numbers, there are several different containers for them, like SMI, Double, HeapNumber
there are also 6 different types of arrays depending on its contents, etc...

#

but if you're using a different engine, ie firefox uses spidermonkey and not v8, then its likely gonna be completely different rules

pale oasis
#

I’m using Edge’s Chakra. So I’ll have to google all these rules online for the engine I’m using.

quartz kindle
pale oasis
#

I haven’t bothered to update.
I’m using a very old version. 🥲

quartz kindle
#

rip

#

see if the dev tools has a memory profiler you can use

wheat mesa
#

I always wondered why Java didn’t allow multiple inheritance, then I looked at an inheritance tree for a complex multiple inheritance program

#

And I realized how fucking messy it was

earnest phoenix
#

pls pos @sage heronty#7072

#

pls pos @earnest phoenix#7072

#

pls uptime @earnest phoenix#7072

#

BRUH

boreal iron
wheat mesa
#

lmfao

#

the bots you're looking for in here are not here

neat ingot
#

wth lmao

quartz kindle
#

packed smi = array of small integers

#

packed double = array of numbers

#

packed elements = array of non-numbers or mixed types

#

holeys are non-sequencial arrays, arrays with holes

neat ingot
#

but you can have holey arrays too? is that only for strings?

quartz kindle
#

ie [1,,2]

neat ingot
#

ahhh

#

quite interesting tbh 😄

quartz kindle
#

yeah, and these transitions can be quite costly

#

so for example if you keep adding and removing different data types, the array will keep transitioning

#

[1,2,3] = smi
.push("a") = transition to elements
.pop() = transition to smi again

neat ingot
#

so im guessing really its just about how v8 handles the memory and collection? like, a packed smi would be easier to handle than a holey array or w.e

quartz kindle
#

yeah

#

also, because in C land everything has fixed byte sizes

neat ingot
#

lol yea

quartz kindle
#

an smi array has a fixed size allocated for each element

#

if you add a double, it has to transform the entire array into double sizes

neat ingot
#

yea, where a holey could be anything or nothing

quartz kindle
#

lets say [1,2,3,4] uses 4x 32 bits

#

if you do push(1.1)

#

it has to transform the array to doubles

neat ingot
#

yea

quartz kindle
#

meaning the whole array now uses 5x 64 bits

neat ingot
#

so it performs that op on all elements?

quartz kindle
#

and not 4x 32 + 1x 64

neat ingot
#

yea that makes sense, i think

#

lol

#

yea ok i get that

quartz kindle
#

the entire container will use the largest item as the size for all items

split hazel
#

tf is a holey elements

#

does it have holes

quartz kindle
#

yes

neat ingot
#

so for talking sake, lets say i have an array that has like [object, 1, 2, 3]

#

all elements would be 'holding' enough memory capacity based on the size of the object?

quartz kindle
#

not exactly, because object here is a pointer/reference

#

so its size is always size_t

neat ingot
#

ooooohhh ok

quartz kindle
#

aka 64 bit on a 64 bit cpu

#

but yes, all items in the array will use 64 bit because there is one 64 bit type in there

split hazel
#

how I would handle a dynamic array is uh - store elements as a fixed size struct stating its type and size and a pointer to an entry in the heap for it

#

hey that's what my database is gonna do

#

works for memory too

#

how are initial sizes allocated

#

do they get expanded over time

quartz kindle
#

likely through a hash table

#

im not sure what v8 uses for array indexes

neat ingot
#

👀 dang

quartz kindle
#

size went from 44 bytes to 124 bytes

#

hmm

#

i removed the "a" with .pop()

#

and the type didnt change

neat ingot
#

nor the bytes

quartz kindle
#

yup

neat ingot
#

it must not autoconvert it back

quartz kindle
#

added a 1.1

neat ingot
#

do another push with an int

split hazel
#

what's smi

quartz kindle
#

small integer

split hazel
#

oh so under the hood it treats numbers differently

neat ingot
#

yea, has to for floats/doubles

quartz kindle
#

this is a new array of doubles

#

this is after push(1)

neat ingot
#

0o

quartz kindle
#

size went from 64 to 224 lol

neat ingot
#

64->224

#

lol

split hazel
#

is the array ever shrinked

quartz kindle
#

interestingly

#

if i do a push with the same type

#

the size still goes to 224

neat ingot
#

so maybe the act of pushing is not optimized? 😂

quartz kindle
#

there seems to be a difference between a read-only object, and a read-write object

#

i popped the array until it became empty

#

went down to 144

#

did push({})

#

a lot of interesting things happen under the hood that we dont really understand

neat ingot
#

yea im so confuzed rn wth

#

it must be as you say~ based on read/read-write. its likely objects that are modified are marked as 'dirty' somehow. but you would think that the 'dirt' would be auto cleaned during gc

#

or maybe thats it, maybe it hasnt ran gc yet

#

so its still holding internal reference to elements that no longer exist

#

totally nailed the discord gui rip-off 😂

quartz kindle
#

xD

neat ingot
#

my nub app has had like 800+ downloads now 😮

#

and i legit only made it so i could advertize my bot, which i havent written any code for for like a month 😂

#

code on github is an absolute mess tho 😭

#

ive spent the past few weeks trying to clean it all up to be pretty, havent pushed the changes yet 😄

quartz kindle
#

lmao nice

neat ingot
#

nah, it will be nice when i can finally move on to the next thing 😄

#

just... cant leave half chewed code on my github for a semi successful project. it deserves to be cleaned 😄

#

i've been thinking of trying out some kind of framework like vue or react or next.js. never tried any of them, seem like they could be helpful

cinder patio
#

You're telling me you did this without any frameworks? madman

neat ingot
#

dont need a framework to make an input element and get its value 😛

#

but no, ive never used any framework. kind of built my own over the years using ejs templating/rendering, but idk, seems like some frameworks could make things a fair bit faster

cinder patio
#

handling stateful input with the document API is a pain in the ass

neat ingot
#

tbf, my nub app only really has two states: running or stopped 😛

quiet pawn
#

is anyone here goodwith regex

#

im trying to make a word filter

#

i made a discord serverlink filter but i cant figure out how to with just normal words

neat ingot
#
simple stump
#

I have this function for using selenium:

async function seleniumGet(url) {
  if (!driver) {
    await startSelenium();
  }
  try {
    await driver.get(url);
    await driver.executeScript("window.scrollTo(0, document.body.scrollHeight)");
    for (let i = 0; i < 20; i++) {
      await driver.wait(until.elementLocated(By.className('lazyloaded')), 5000).catch((err) => {
        console.log("Wait error");
      });
    }
    console.log("Done waiting");
    await driver.getPageSource().then(function (source) {
      resolve(source);
    });
  }
}

However, when logging the result of the function using console.log(await seleniumGet("https://myurl.com")); returns undefined. I also tried:

let src = await driver.getPageSource();
resolve(src);

But the result is still undefined. Logging await driver.getPageSource(); works fine (the page source is logged correctly), but resolving src returns undefined.

earnest phoenix
simple stump
#

Oh I'm stupid I forgot an entire line of code. Never mind whoooops

simple wave
earnest phoenix
#

Can we directly put code on top.gg bot page description for html website

quartz kindle
#

yes you can use html in your bot description

#

as long as you respect top.gg's existing structure and css

rustic nova
#

Note that when using javascript, it may not want to save

#

as script doesnt work nonetheless

mellow flint
#
    let flag = 0
    const timeout = 86400000

    flag = await fetch(`https://top.gg/api/bots/${interaction.client.application.id}/check`, {
      method: "GET",
      body: JSON.stringify({
        userId: interaction.user.id
      })
    })

if (flag = 0) ---> user dont vote
else ---> user vote```
TypeError: Request with GET/HEAD method cannot have body
spark flint
mellow flint
#

insted body, what I need to write?

spark flint
#

you shouldn't need to send a body

mellow flint
spark flint
#

nowhere does it say send body

mellow flint
#

this does not explain how to fetch

spark flint
#

it does

#

https://top.gg/api/bots/${interaction.client.application.id}/check?userId=${interaction.author.user.id}

spark flint
#

np

spark flint
#

you need to pass an authorization header

mellow flint
#

it work

#

tnks

#

💙

simple stump
#

That moment you accidentally create an illegal directory and can’t delete it

lyric mountain
#

rm -rf <directory> (add --no-preserve-root for extra adrenaline ||DON'T||)

simple stump
#

Thanks 🙏

#

I think I created a directory with an array as the name

#

Somehow idk

#

But windows ain’t allowing me to delete it cause it “doesn’t exist”.

rustic nova
#

probably something that can be resolved by just restarting

#

or you fuck up your whole machine by doing so, cant remember

slender thistle
simple stump
#

I have not I’ll do that in a sec

stiff dust
#

whats the problem?

simple stump
stiff dust
simple stump
#

Can you send us more of your code?

stiff dust
#

there isnt any more this is the whole code

#

message.guild.emojis.cache is the collection of server emojis so it shouldl return emojis I dono whats going on

quartz kindle
#

for(const emoji of emojis.values())

simple stump
#

^

quartz kindle
#

or just replace your entire code with a single line:

#

v!eval [...message.guild.emojis.cache.values()]

stiff dust
stiff dust
quartz kindle
#

v!eval [...message.guild.emojis.cache.values()].map(x => x.name)

stiff dust
#

awsome

quartz kindle
#

v!eval message.guild.emojis.cache.map(x => x.name)
this is better

stiff dust
#

works great

stiff dust
stiff dust
quartz kindle
#

Collection extends Map, its default iterator works on entries, not values

#

but Collection has .map function built in that Map does not have, and this function iterates over values and returns an array

stiff dust
#

oh ok get it

hybrid wasp
#

I get an error if a bot doesn't have permission to send messages in channel and then the bot just dies
I tried doing if (!message.guild.me.permissions.has("SEND_MESSAGES")) return;
but it still shows an error DiscordAPIError: Missing Permissions
how do I fix this error. I tried try catch and it still didn't work.
discordjs

quartz kindle
#

show code

hybrid wasp
#

client.on('messageCreate', message => {
 
if (!message.guild.me.permissions.has("SEND_MESSAGES")) return;
  if (message.author.bot) return;


  db.collection('guilds').doc(message.guild.id).get().then((q) => {
    if (q.exists) {
      prefix = q.data().prefix;
    }
  }).then(() => {
    if (message.content.toLowerCase() == "@floral pumice") {
    const mentionEmbed = new MessageEmbed()
      .setColor("#fcc603")
      .setTitle(
        `Hey there, my prefix in this server is \`${prefix}\`\nTry \`${prefix}help\` to see the commands.`
      )
      .setFooter({
        text: `${message.member.user.tag}`,
        iconURL: `https://cdn.discordapp.com/avatars/${message.author.id}/${message.author.avatar}.jpeg`,
      })
      .setTimestamp();
    return message.channel.send({ embeds: [mentionEmbed] });
  }
    if (message.content.toLowerCase().startsWith(prefix)) {
      const args = message.content.slice(prefix.length).trim().split(/ +/g);
      const commandName = args.shift();
      const command = client.commands.get(commandName.toLowerCase());
      if (!command) return;
      // message.channel.sendTyping()
      command.run(client, message, args, prefix, db)
    }
  })
})

#

long boy

stiff dust
#

TIM 👀

I have too many emojis and all of them start with 00 or maybe 01 so I want to remove the 00 or 01 from the emojis can u help with that?

some thing like this:

const emojis = message.guild.emojis.cache

for (const emoji of emojis.values()) {
if (emoji.name.startsWith('00')) { /* remove the 00 from it */ } 
if (emoji.name.startsWith('01')) { /* remove the 01 from it */ } 
}
quartz kindle
#

and if command.run is an async function, you have to catch that as well

hybrid wasp
#

oki doki

#

so i just put everything inside an aync function and then just call it whenever it detects a new message?

quartz kindle
stiff dust
#

tnx

quartz kindle
#

you want to use try catch?

hybrid wasp
#

yep

quartz kindle
#

then(() => {
v
then(async () => {

hybrid wasp
#

ohhhhhhh

stiff dust
#
const emojis = message.guild.emojis.cache

for (const emoji of emojis.values()) {
 if(emoji.name.startsWith("00") || emoji.name.startsWith("01")) {
  emoji.setName(emoji.name.slice(2)
  }
})
#

correct me if im wrong

hybrid wasp
quartz kindle
quartz kindle
stiff dust
# quartz kindle await emoji.setName(emoji.name.slice(2));

but i need async for await how can I use await here?

v!eval

const emojis = message.guild.emojis.cache
for (const emoji of emojis.values()) {
    if (emoji.name.startsWith("00") || emoji.name.startsWith("01")) await emoji.setName(emoji.name.slice(2)
})
quartz kindle
#

you need your eval command to support async

#

if it doesnt, then you can run a self-executing async function

#

eval (async () => { your code here })()

stiff dust
#

so v!eval (async () => {

const emojis = message.guild.emojis.cache
for (const emoji of emojis.values()) {
if (emoji.name.startsWith("00") || emoji.name.startsWith("01")) await emoji.setName(emoji.name.slice(2)
})

})()

#

should work

quartz kindle
#

yes

hybrid wasp
#

no worky

stiff dust
#

tnx alot Tim

hybrid wasp
#
client.on('messageCreate', message => {
  if (message.author.bot) return;
  db.collection('guilds').doc(message.guild.id).get().then((q) => {
    if (q.exists) {
      prefix = q.data().prefix;
    }
  }).then(async () => {
    try{
    if (message.content.toLowerCase() == "@floral pumice") {
    const mentionEmbed = new MessageEmbed()
      .setColor("#fcc603")
      .setTitle(
        `Hey there, my prefix in this server is \`${prefix}\`\nTry \`${prefix}help\` to see the commands.`
      )
      .setFooter({
        text: `${message.member.user.tag}`,
        iconURL: `https://cdn.discordapp.com/avatars/${message.author.id}/${message.author.avatar}.jpeg`,
      })
      .setTimestamp();
    return message.channel.send({ embeds: [mentionEmbed] });
  }
    if (message.content.toLowerCase().startsWith(prefix)) {
      const args = message.content.slice(prefix.length).trim().split(/ +/g);
      const commandName = args.shift();
      const command = client.commands.get(commandName.toLowerCase());
      if (!command) return;
      // message.channel.sendTyping()
      await command.run(client, message, args, prefix, db)
    }}catch(e){}
  })
})

what did my small brain do now

quartz kindle
stiff dust
quartz kindle
hybrid wasp
#

i need to do in inside the command handler files too?

quartz kindle
#

depends

#

what is the full error?

hybrid wasp
#
/home/runner/ChompBot/node_modules/discord.js/src/rest/RequestHandler.js:350
      throw new DiscordAPIError(data, res.status, request);
            ^

DiscordAPIError: Missing Permissions
    at RequestHandler.execute (/home/runner/ChompBot/node_modules/discord.js/src/rest/RequestHandler.js:350:13)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async RequestHandler.push (/home/runner/ChompBot/node_modules/discord.js/src/rest/RequestHandler.js:51:14)
    at async TextChannel.send (/home/runner/ChompBot/node_modules/discord.js/src/structures/interfaces/TextBasedChannel.js:175:15) {
  method: 'post',
  path: '/channels/967401048597725184/messages',
  code: 50013,
  httpStatus: 403,
  requestData: {
    json: {
      content: undefined,
      tts: false,
      nonce: undefined,
      embeds: [
        {
          title: 'Cat',
          type: 'rich',
          description: null,
          url: 'https://docs.thecatapi.com/',
          timestamp: 0,
          color: 15443968,
          fields: [],
          thumbnail: null,
          image: {
            url: 'https://cdn2.thecatapi.com/images/6xLEBwiUS.png',
            proxyURL: undefined,
            height: undefined,
boreal iron
#

You’re missing the permission to post a message and/or embed

quartz kindle
#

what command is that embed from?

#

some kind of cat command?

boreal iron
#

At least in that channel

quartz kindle
#

if you use .then() a lot

hybrid wasp
#

cat api 🐱

quartz kindle
#

you will need to convert all of those to await

#

try catch only works on things that are awaited, not on things that are .then()ed

#

show your cat command

hybrid wasp
#

OMG

#

can i type

#
const fetch = require("node-fetch");
const { MessageEmbed } = require("discord.js")

module.exports.run = (client, message, args) => {

  const options = {
    method: 'GET',
    headers: { 'x-api-key': `${process.env.CAT_API}` }
  };

  async function cat() {
    await fetch(`https://api.thecatapi.com/v1/images/search`, options)
      .then((res) => res.json())
      .then((data) => {
        const CatEmbed = new MessageEmbed()
          .setTitle(`Cat`)
          .setURL('https://docs.thecatapi.com/')
          // .setDescription(`Requested by <@${message.member.id}>`)
          .setColor("#eba800")
          .setImage(data[0].url)
          // .setTimestamp()
          // .setFooter({
          //   text: `${message.member.user.tag}`,
          //   iconURL: `https://cdn.discordapp.com/avatars/${message.author.id}/${message.author.avatar}.jpeg`,
          // })
        return message.channel.send({ embeds: [CatEmbed] });
      })
  }
  cat();
};

module.exports.name = "cat";
quartz kindle
#

either do return cat() or await cat()

hybrid wasp
#

so everytime i return a message

#

just return or await

hybrid wasp
quartz kindle
#

depending on the situation yes

#

in this situation cat is an async function

#

if its returned, then it will be awaited in await command.run()

#

if its not returned, you can await it, and the catch will still work

#

but if you dont return and dont await, then the command will exit before the cat function is finished

hybrid wasp
#

ic

#

ok so doing await cat();

quartz kindle
#

yes

hybrid wasp
#

isnt working lemmi try to return

quartz kindle
#

ah yes to do await cat() you need to add async to (client, message, args) => {

#

but return should still work

hybrid wasp
#

ok so i tried return IT WORKS!

#

one more thing

#

i have the ping command

#
const { MessageEmbed } = require("discord.js");

module.exports.run = (client, message, args) => {
  return message.channel.send(`Latency is ${Date.now() - message.createdTimestamp
    }ms.\nAPI Latency is ${Math.round(client.ws.ping)}ms`)
}

module.exports.name = "ping";
#

what do i do in this case

#

can i just put it inside a function and return the function?

#

or because i return the message it shouldnt do an error?

quartz kindle
#

since you are returning it, it will be caught by the await command.run

hybrid wasp
#

gotcha

#

so everything should be working now

boreal iron
#

Your api latency technically is the gateway ping or websocket ping and the first measurement is the api response time

#

_just to say _

hybrid wasp
#

im just adding that

#

idk why

#

its more of a test command
but good to know

#

also Tim thank you so much!

lament rock
#

@earnest phoenix Tried out your proxy stuff and can't quite get it to work the way I want it to. A module I made exports a boolean, but the return value when logging is the internal Object I try to proxy all stuff through.
Code:

const obj = {};
const obj[placeHolderKey] = requiredModuleReference;
return new Proxy(obj, {
    apply(target, thisArg, argumentsList) {
        return Reflect.apply(target[placeHolderKey], thisArg, argumentsList);
    },
    construct(target, argumentsList) {
        return Reflect.construct(target[placeHolderKey], argumentsList);
    },
    defineProperty(target, property, attributes) {
        return Reflect.defineProperty(target[placeHolderKey], property, attributes);
    },
    deleteProperty(target, property) {
        return Reflect.deleteProperty(target[placeHolderKey], property);
    },
    get(target, property) {
        return Reflect.get(target[placeHolderKey], property);
    },
    getOwnPropertyDescriptor(target, property) {
        return Reflect.getOwnPropertyDescriptor(target[placeHolderKey], property);
    },
    getPrototypeOf(target) {
        return Reflect.getPrototypeOf(target[placeHolderKey]);
    },
    has(target, property) {
        return Reflect.has(target[placeHolderKey], property);
    },
    isExtensible(target) {
        return Reflect.isExtensible(target[placeHolderKey]);
    },
    ownKeys(target) {
        return Reflect.ownKeys(target[placeHolderKey]);
    },
    preventExtensions(target) {
        return Reflect.preventExtensions(target[placeHolderKey]);
    },
    set(target, property, value) {
        return Reflect.set(target[placeHolderKey], property, value);
    },
    setPrototypeOf(target, value) {
        return Reflect.setPrototypeOf(target[placeHolderKey], value);
    }
});

// somewhere else
console.log(ReturnValueWhichShouldBeAProxy) // { __heatsync_default__: false }
// what I expect
// console.log(ReturnValueWhichShouldBeAProxy) > false
#

Seems like the traps only work when doing thing.property

#

not when displaying the default thing

quartz kindle
#

pretty sure what you're trying to do is not possible

lament rock
quartz kindle
#

you will always need an object container, you cant work on primitives

lament rock
#

welp. I guess I can discard all of my changes

fallen holly
#

what does this mean

spark flint
#

you've already replied to or deferred the interaction

crystal yew
#

So when I turn off my bot, there is a chance Express fails to turn off, and the only way I know to turn it off is if I shut my computer down or wait a long time. How can I shut it off if this does happen?

quartz kindle
#

wdym fails to turn off

#

does the process not exit?

crystal yew
#

yes

quartz kindle
#

how are you turning it off?

#

is express inside the bot file?

crystal yew
#

idk, it just does not shut off sometimes

quartz kindle
#

how are you turning it off?
is express inside the bot file?

crystal yew
#

it turns on when I turn the bot on, and supposed to turn off when i shut the bot off

quartz kindle
#

so its in different files?

#

where is it hosted?

crystal yew
#

Self hosting, beta bot where I am having the issue

#

Like im turning the bot on and off for beta testing

quartz kindle
#

how are you turning it on?

#

what command are you running?

crystal yew
#

"node -v"

quartz kindle
#

node -v is for showing your node version

#

not running anything

crystal yew
#

idk the command, I press button and bot starts

quartz kindle
#

what button?

wheat mesa
#

replit button probably

crystal yew
#

The run button

quartz kindle
#

they said they are self hosting

#

what run button?

wheat mesa
#

oh

crystal yew
quartz kindle
#

...

#

are you using replit?

crystal yew
#

Im not upload the code to a host, because im, testing the code

quartz kindle
#

what

#

are you using replit/glitch?

crystal yew
#

neither

quartz kindle
#

then what run button?

crystal yew
#

The run button on my software in which im coding my bot in

quartz kindle
#

what software?

crystal yew
#

VSC

quartz kindle
#

vsc doesnt have an autoconfigured run command for node projects afaik

#

how did you configure it? show your package.json file

crystal yew
quartz kindle
#

do you have a .vscode folder with a launch.json file?

crystal yew
#

no idea what that is

#

so imma say no

quartz kindle
#

if you have it it will show in your list of files

#

on the left side panel

crystal yew
#

yes or no, is it possible to turn off the express node without restarting my computer?

quartz kindle
#

of course it is

crystal yew
#

then how?

quartz kindle
#

literally just exit the script

#

thats what everybody does

#

but i have no idea how you are starting and stopping your script because i have no idea how your workflow looks like

#

so i cant help you if i know nothing about what/how you are doing

#

most people start stuff by running node myfile.js and then stop it by pressing ctrl+C
if you're not doing it like everyone does, then i need to know how you are doing it to be able to help

crystal yew
#

Imma get help elsewhere

quartz kindle
#

good luck

spark flint
#

using nodejs canvas

#

how can i place text in the center of a canvas (idk what its called)?

quartz kindle
#

fillText

#

you can measure the height by the pixel size and the width by measureText

#

and use those to get the X and Y position for where to draw the text

#

X = canvas width / 2 - measuredText.width / 2
Y = canvas height / 2 - font size / 2

proven lantern
#

I'm still having an issue with the guild count being cached. any idea how total could be cached?

lyric mountain
proven lantern
#

thanks typescript

slender thistle
#

I'm fucking amazed

sage bobcat
#

One message removed from a suspended account.

feral aspen
#

I want to create a function called type() with several properties such as channel, message, etc. i.e, if I execute type(272764566411149314).channel, it would replace the value of, supposedly, GUILD_TEXT, to its explanation, a guild text channel.

I'm supposed to be using a class (although I want to write all of this in a seperate file as a class and then export it to use in another file), how should I be planning out the class since I'm confused how I'll do the .channel, .message, etc.

quartz kindle
stable eagle
#

My bot is constantly going offline at midnight for some reason, is there any reason why? My host is galaxygate

lyric mountain
#

Basically make a class that auto-cast to the target value

#

For obvious reasons, you'll need to throw an exception is all cases except for the correct one

#

Or return null

#
class From {
	class Type {
		const id;

		constructor(id) {
			this.id = id;
		} 

		function channel() {
			return client.channels.cache.get(id);
		}
	} 

	function type(id) {
		return new Type(id);
	}
} 
#

Something like this

#

Idk if js allows inner classes, or even abstract and private definitions

#

Ideally you'd have Type private, and From abstract so u can't instantiate it

#

Then just call From.type(1234567890).channel()

#

You can transform the last methods into properties if u load all variables during constructor

#

That'd fit better ur request

boreal iron
#

Is there even a keyword private? I think private vars and functions start with a #

lyric mountain
#

But am on mobile, and writing code here is shit

lyric mountain
#

Actually, I could count on hand how many reserved keywords exist

quartz kindle
boreal iron
#

Tim’s always ready to fuck somebody up

quartz kindle
#

some of those have been removed since ES5

boreal iron
#

I see private but this hasn’t to do anything with classes I guess

quartz kindle
#

thats one of the removed ones

boreal iron
#

Or private vars and functions?!

#

Yeah

quartz kindle
boreal iron
#

It was a little confusing to come to JS without public, protected and private keywords

quartz kindle
#

i didnt even know what those were until i looked beyond js

boreal iron
#

And the fact private vars and functions start with a #

quartz kindle
#

yeah that decision was just stupid

boreal iron
#

Well it is how it is

quartz kindle
#

ts to the rescue

boreal iron
#

Err

#

Are private vars/functions accessible in an extended class?

quartz kindle
#

no idea, never used them

boreal iron
#

Hmm

quartz kindle
#

i like using _abc as the unofficial standard for private stuff

boreal iron
#

That’s why PHP has protected keyword

quartz kindle
#

i dont care about making my stuff unhackable

boreal iron
#

lol

#

But things can get complicated when having huge extended classes and may one public var exists two times

quartz kindle
#

just dont use the same name :^)

boreal iron
#

I’m also not a fan if I include an helper class for example in my database class and then call helper functions using my database class

#

That’s the reason private and or protected vars/functions exist

#

Js might not be the best oop language here

quartz kindle
#

it never was and never will be

boreal iron
#

Or let’s say might not have the best oop functionality

#

Yeah

quartz kindle
#

oop is just like

#

something you can do with it

#

but you dont need to

boreal iron
#

It’s feels like moving between two worlds sometimes

quartz kindle
#

im moving between 2 worlds rn

#

awake and sleep

boreal iron
#

Yeah got only 1h of sleep

quartz kindle
#

rip

#

go slep

boreal iron
#

Can’t atm but later

quartz kindle
#

i will go too

boreal iron
#

When I’m done working

quartz kindle
#

kthxbye

boreal iron
#

Bye

proven lantern
bright hornet
#

https://sourceb.in/IMQ4apBY0X when im using member.id it keeps throwing error like this Cannot read properties of undefined (reading 'id') but when im pinging the member its fine.

wheat mesa
#

Well, your member either isn’t cached or you’re not giving an id/mention for it to parse

bright hornet
rocky dagger
#

i got a message with a button and when i press that button i want to get the message content of that message, how am i able to do this?

boreal iron
#

You receive the corresponding interaction event which includes the message object (and content) as property

bright thorn
raw nest
#

I'm using Prisma. How can I get all records that have value bigger than x?

raw nest
#

yeah got it thanks^^

#

another question... can I somehow put variables in a query? variable as the column?

earnest phoenix
spark flint
#

I have a function called checkName(username) which returns { scam:true, reason:"whatever" } or { scam:false }, how can I check all members from all the servers my bot is in to see if any return scam:true?

neat ingot
# spark flint 😔

depending on what you are wanting to achieve, you may be approaching the solution backwords. If you are wanting to keep a record of all the users in each server that have been flagged as 'scam:true' then, imo, you should create a specific database table/collection for those entries and then you add to it, or check it as required. otherwise the alternative would be to iterate over every single guild you are in, then every single member, then forcing fresh data for each member, then checking the flag. which is not a good approach for a number of reasons

spark flint
#

I’m mostly checking for any users that are scam accounts that haven’t been flagged because It was from before I started checking for them

#

I did a check for users with the word modmail in etc and got 36 users

#

I just now need to get those user ids and then I’ll add to the database too

neat ingot
#

ahh, if your only planning to run the operation once, that isnt too bad. just iterate over each guild, fetch the guild data, iterate over each guilds user, fetch the user data, then check/add

simple stump
#

Is it possible to download a file from a blob URL? I'm not sure how those work, but for some reason certain blob URL's work and some don't. For example this one results in the image:
blob:https://mangadex.org/6bb8e02d-ae5f-486b-a42d-bd655de28e39
But this one results in Firefox saying the "url doesn't look right":
blob:https://mangadex.org/6cbbfd0b-2dd0-49c0-801f-9ac8ef4fa021
(FYI Mangadex allows you to download the images directly from URL's using their API, but I'm trying a different approach since their API isn't all the greatest imo)
When I try to use this bit of code to download files from a URL, I get a timeout error.

async function downloadFile(file, path) {
  const streamPipeline = util.promisify(nodeStream.pipeline);
  const response = await axios.get(file, { responseType: 'stream' });
  await streamPipeline(response.data, fs.createWriteStream(path));
}

Error:
https://sourceb.in/b0bh3bvFjB

timber fractal
#

how do I call a js function, using ejs?

for example, I want this p element to have as content the output of Math.floor(Math.random() * 10), how would I do that?

wheat mesa
#
try {
  switch (smth) {
    case 'B':
      result += 5;
      throw new Exception();
    case 'C':
      result += 6;
      throw new Exception();
    case 'D':
      result += 7;
  }
} finally {
  ...
}
``` thank you for coming to my Ted talk on “how to avoid using `break`”
#

My teacher hates when I use break in loops, so I’ll just do this for loops instead of switch cases

crimson vapor
#

Why does he hate using break?

#

Does he think it will break the loop not the switch case?

sage bobcat
#

One message removed from a suspended account.

lyric mountain
bright thorn
#

how check

vivid fulcrum
#

do you want to check whether the channel is a dm channel or if it's a specific dm channel

bright thorn
#

i want to reply a button which is in user dm

vivid fulcrum
#

???????????

bright thorn
#

i want to add remind me reply

#

from interactionCreate.js

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

wheat mesa
#

Break is of course allowed in a switch case

wheat mesa
lyric mountain
#

then why not case XX -> ...?

wheat mesa
#

It’s a joke

lyric mountain
#

a

tidal nymph
#
const perms = [
        Permissions.FLAGS.VIEW_CHANNEL,
        Permissions.FLAGS.SEND_MESSAGES,
        Permissions.FLAGS.USE_EXTERNAL_EMOJIS,
]

channel.permissionsFor(guild.me).has(perms);

Is this the right way to check if my bot has permissions in a channel?

lyric mountain
#

depends on whether has expect inputting arrays

woeful pike
tidal nymph
#

kinda weird

lyric mountain
#

are u saving the file?

wheat mesa
lyric mountain
#

like, pretty dumb but sometimes happen

tidal nymph
lyric mountain
#

the file ur code is in

tidal nymph
#

do you mean when its being hosted?

#

it rebuilds every new deploys

#

I dont think its related at all tbh

#

maybe its something about discord cache

lyric mountain
tidal nymph
#

ok nvm I think I found out that sending embed message with link also needs embed_links perm 🤔

proven lantern
#

does anyone have an idea why total would get cached? The value doesn't update until i restart the bot

proven lantern
#

line 8 of the 3rd ss?

#

oh

#

like dont use the cache

#

so maybe that doesn't add it to the cache?

lyric mountain
#

idk how d.js works (let alone timfork), can't help much with it

fluid garden
#

I need help pls

#

How can i keep alive my repl it js bot

#

🙏

lyric mountain
#

ping it once every a few minutes

fluid garden
#

Realy? Or u joking?

#

He will get alive if i pinged?

lyric mountain
#

ye

#

repl.it is supposed to be used for sites and services

#

both are supposed to never be 24/7 and only start when called (aka on-demand)

#

so if u want to keep it 24/7 u need to trick it into thinking someone is acessing it

fluid garden
#

Ob

#

Oh

#

Just normal mention?

lyric mountain
#

no

fluid garden
#

Like @lyric mountain

#

How?

lyric mountain
#

HTTP ping, not discord ping

fluid garden
#

It is not python

#

And idk how to make that in js

lyric mountain
#

fetch("the bot repl.it url")