#development

1 messages · Page 111 of 1

spark flint
rustic nova
#

Never seen that ngl

#

Lmaoo

#

But thats not just an image right?

spark flint
#

yeah same server only

rustic nova
#

Lol

#

Well tbf there's no practical use for stickers so fair

spark flint
#

only for memes

#

and abusing sticker perms in large servers SickBro

rustic nova
spark flint
gaunt echo
#

oi emoji

#

:verified_bot_developer:

rustic nova
#

Your bot needs to share a server with that emoji in it

lyric mountain
#

<a>

gaunt echo
rustic nova
#

And that wont work either

gaunt echo
rustic nova
#

You need the full mention

gaunt echo
#

ik

quartz kindle
#

can bots create stickers?

spark flint
#

yse

#

yes

#
message.guild.stickers.create(`url`, `sticker name`, "name of default emoji")```
#

i always put headstone or moyai

#

as default emoji

quartz kindle
#

then is just like those bots that require you to create a channel named "logs" or whatever

#

the bot will create the stickers it needs in every server it joins

#

lmao

hushed robin
#

guys how does guild.memberCount work in discord.js

#

because it doesn't seem to be live

wheat mesa
#

It’s not

#

Just an estimation iirc

spark flint
#

memberCount is the real one iirc

#

estimatedMemberCount or whatever

hushed robin
#

then why does it only update

spark flint
#

i might be thinking of invites lemme check

hushed robin
#

when a new guild joins

#

my bot

spark flint
#

memberCount: 607964,

#

thats the real count

#

approximateMemberCount is null

hushed robin
spark flint
#

if you were to check 693237498264027156

#

yeah

hushed robin
#

hm

#

why don't it update for me then

spark flint
#
const guild = client.guilds.cache.get("693237498264027156")
guild.memberCount```
hushed robin
#

do i need the guild members intent?

spark flint
#

dont think so

#

wai

#

probably

#

you can always get it from an invite

hushed robin
#

it's outdated 😲

#

why is yours right

spark flint
hushed robin
#

but not mine

spark flint
hushed robin
#

so i need that for it to always be right?

spark flint
#

yes

hushed robin
#

bruh

#

fuck that

#

isn't that a privileged intent too?

spark flint
#

yes

hushed robin
#

damn

spark flint
#

otherwise it would be abused for scraping on large bots

hushed robin
#

so discord probably won't even give it to me

#

cus they're stinky

spark flint
#

well do you have a reason for it

hushed robin
#

no

#

besides total members on help command

#

which isn't a valid reason i think

spark flint
#

just say you are adding guild stats

#

then you will get it

hushed robin
#

lie?

#

🫣

solemn latch
#

Or don't lie and use the approximate count

spark flint
#

i got it on my first bot from lying LUL

solemn latch
#

Which is generally somewhat accurate

spark flint
#

yeah true

hushed robin
#

it's kinda accurate

spark flint
#

if you generated an invite and kept checking that invite it would show accurate

hushed robin
#

but that would require generating an invite for all the guilds

#

which i don't think is a good idea

spark flint
hushed robin
#

discord is poopy

spark flint
hushed robin
#

what do i add to my discord bot

#

🙁

#

there's nothing to do

quartz kindle
hushed robin
#

makes sense

#

do you guys think 110mb is a lot of memory for a bot in 100 guilds

quartz kindle
#

yes and no

hushed robin
#

hm

#

the only intent i have is guilds

#

I think that's quite high

quartz kindle
#

from a strict efficiency standpoint, its a lot and could be much less, but from a djs standpoint its pretty normal

hushed robin
#

well tbh i don't know how to lower it

#

the bot itself is pretty simple

quartz kindle
#

not much you can do, thats the djs way of doing things

hushed robin
#

hm

#

do you think it's discord.js?

quartz kindle
#

you can check your caches, channel cache usually takes a lot of memory

hushed robin
#

yeah i cache all channels bc i have to

quartz kindle
#

also check your heap to rss ratio (process.memoryUsage)

#

heap is what js is actually using (djs caches, etc), rss is what node itself it reserving from the system (not actually using, but reserved)

hushed robin
#

{"rss":119013376,"heapTotal":45862912,"heapUsed":41186440,"external":1892048,"arrayBuffers":622723}

quartz kindle
#

so the actual js usage is 45mb

hushed robin
#

is this in bytes

quartz kindle
#

which is still a lo

#

t

#

yes

hushed robin
#

is that my fault

quartz kindle
#

probably just djs

hushed robin
quartz kindle
#

you can easily test that

#

compare your bot with a barebones djs bot without any other code

#

and see how much ram they take

hushed robin
#

so i should remove all the code from my bot and run it?

quartz kindle
#

sure

hushed robin
#

makes sense

#

can i have my bot connected twice

#

cus i don't want to shut it down

#

while i test it

crystal wigeon
# quartz kindle sure

hey um, how would you send dms to lets say 44k users or even more without getting rate limited? how does dyno or carl do it

hushed robin
#

you don't

crystal wigeon
#

then how does dyno send reminder messages?

#

and a lot of people use dyno

hushed robin
#

by sending them

#

and they probably have more flexible rate limits because they're big

crystal wigeon
#

yeah but logically how would you do it, queue? wait 500ms before sending the next dm?

#

that would just make reminders inefficient no

quartz kindle
hushed robin
#

maybe? tim could probably give you a better answer

crystal wigeon
#

yeah was hoping

#

tim? any ideas?

wheat mesa
#

queue + sharding + probably upgraded ratelimits from discord

quartz kindle
wheat mesa
#

that too

#

they have features that are probably a lot more requests than simply reminders

crystal wigeon
#

yeah

#

but just wanted to know how you could deal with a scenario where you want to send dms to a lot of people without rate limit

wheat mesa
#

queue is probably the best way to avoid a ratelimit imho

crystal wigeon
#

ig

quartz kindle
#

the rate limit is usually 5 per 5 seconds per channel, different dms are different channels, so they dont share the same rate limit

#

but you may run into the global rate limit of 50 per second shared with all requests

crystal wigeon
#

aha

#

gotcha thanks, so i can send 50 per second

quartz kindle
#

big bots have a larger global rate limit

crystal wigeon
#

understood

hushed robin
crystal wigeon
#

thanks

quartz kindle
#

in any case thats something your library should be handling

hushed robin
#

connecting a bot with no code should cause no issues with the main connection right?

hushed robin
#

ok

#

tyyyyyyyyyyyy

quartz kindle
#

lmao

hushed robin
#

wawa dance

spark flint
#

me when wawa_dance

#

we have asta_dance too

hushed robin
#

whos asta

spark flint
#

one of the other admins

hushed robin
#

oh

#

where the void dance

#

bro was left out

spark flint
#

i only added wawa dance today

#

void needs to pick one

#

then triff

hushed robin
#

guys how can i see the size of a file in linux

rustic nova
#

du -sh filename

hushed robin
#

ok

rustic nova
#

h for human readable

#

the s idk

hushed robin
#

46mb

#

bruh

rustic nova
#

Size prob

hushed robin
#

so big

#

how can i make my database become smaller

#

this is concerning

spark flint
#

46mb is not concernin

hushed robin
spark flint
#

no

#

close to a month

#

oh

#

wait

#

i missread

hushed robin
#

☠️

spark flint
hushed robin
#

is that the

#

domain stuff

spark flint
#

ye

hushed robin
#

actually it's not too bad ig

#

in 1 year there will be 2.3 gb

rustic nova
#

@spark flint wanna have a fun tool to play around with logs?

hushed robin
#

but the amount of data I collect is slowly increasing so it'll probably be closer to 3 - 4 gb

spark flint
#

that looks fun

hushed robin
#

wtf is this

rustic nova
#

Funny way to visualise logs

#

Lol it has a git one too

hushed robin
#

it's old ah shit

rustic nova
#

Idc

#

Still more useful than 99% of my dusty apps

hushed robin
#

video on the website is from 2009 flushWobble

rustic nova
#

Cry

dry imp
#

smile

topaz terrace
#
process.on('unhandledRejection', async (reason, p) => {
    return errorChannel.send({
        embeds: [
            new Discord.EmbedBuilder()
                .setTitle("New unhandledRejection encounted")
                .setDescription(`\`\`\`${reason.stack}\`\`\``)
                .setFooter(`${client.user.tag}`)
                .setColor("#f09999")
        ]
    })
});
process.on('uncaughtException', (reason, origin) => {
    return errorChannel.send({
        embeds: [
            new Discord.EmbedBuilder()
                .setTitle("New uncaughtExpection encounted")
                .setDescription(`\`\`\`${reason.stack}\`\`\``)
                .setFooter(`${client.user.tag}`)
                .setColor("#f09999")
        ]
    })
});
process.on('uncaughtExceptionMonitor', (reason, origin) => {
    return errorChannel.send({
        embeds: [
            new Discord.EmbedBuilder()
                .setTitle("New uncaughtExceptionMonitor encounted")
                .setDescription(`\`\`\`${reason.stack}\`\`\``)
                .setFooter(`${client.user.tag}`)
                .setColor("#f09999")
        ]
    })
})```why wont this error handler sending a error to the webhook? instead it logs in the console.log
deft wolf
#

It would be easier if you posted the code of where it occurs

sharp geyser
#

Why even monitor these specifically

deft wolf
#

You wrote that it logs in the console.log(). It would be nice to see this part of the code instead

#

I don't see any console.log() here

topaz terrace
#

yea

#

thats the whole reason

#

it logs in the console

#

and not send a message via the webhook

deft wolf
#

Are you using any try catch or .catch() there?

topaz terrace
#

and when i try to make an error happen it somehow doesn't log anything

carmine summit
#

How do I log every time the Express server uses res.write() using Axios?

surreal sage
#

chat gpt moment

#

You can't push stuff into a const array = [] right?

quartz kindle
#

yes you can

surreal sage
#

fuck

quartz kindle
#

in js there are two categories of data, primitives and objects

#

array is an object

#

and all objects are references

#

so const chunks holds a reference to that array

surreal sage
#

interesting

quartz kindle
#

the const immutability applies to the reference only, the array itself is still mutable

#

so you cant do chunks = something else

#

but you can do chunks.something = something else

surreal sage
#

If you'd print it

#

Or some

quartz kindle
#

something like <Array> [], something: something else

surreal sage
#

hmm

quartz kindle
#

everything that is not a primitive (string, number, null, undefined, etc) is an object, and all objects can have keys added/removed

#

so you can add random keys to arrays, functions, etc

#

js is weird like that

surreal sage
#

And guessing you can do "abc".key = 1

quartz kindle
#

you can, but it wont work, bcause string is a primitive

#

but it works with arrays

#

and funcions for example

#

because they are both objects

eternal osprey
#

hey guys i got an assignment of my university in java and i am trying to test my code with a tester they gave me. My code runs perfectly fine yet the tester says this:

because the return value of "java.util.Map.get(Object)" is null
java.lang.NullPointerException: Cannot invoke "java.lang.Double.doubleValue()" because the return value of "java.util.Map.get(Object)" is null

#

if you could help, please @ me here so i can dm you the files to inspect.

rustic nova
#

@eternal osprey whatever (hash)map you're trying to access, the value you're trying to get does not exist

#

though cant 100% help you since this is way beyond what I have ever done in java ngl

eternal osprey
#

The problem is, if i run the same exact expression in my own main it works

rustic nova
#

oh

eternal osprey
#

just in the tester it fucks up??

rustic nova
#

whats env?

eternal osprey
#

a hashmap of<String, Double>

rustic nova
#

and e.eval does what?

eternal osprey
#

evaluate an expression, so:

add(con(5.0), con(3.2)) will return 5+3.2 = 8.2

quartz kindle
quartz kindle
# topaz terrace ```js process.on('unhandledRejection', async (reason, p) => { return errorCh...

its not a good idea to catch errors like that, not all errors can be caught, for example syntaxError cannot be caught, its harder to tell where exactly the problem is coming from, unhandledRejection will likely give you a generic stack trace with no useful information, some errors can leave the process in a corrupted state, in which case it will exit anyway, and who knows what other issues you might face

the correct way of handling errors is to handle them on the correct places in your code, for example if you want a global error handler for all events, apply a try catch in your root event handler

wheat mesa
#

You can pass with a pointer or a reference

#

Reference for this sounds like what you want though

#

Yes

lament rock
#

game dev makes me want to off myself

#

my free trial on enjoying life has expired

wheat mesa
#

Make an engine, then game dev with a proper engine will make you appreciate it more

lament rock
#

The coding part is so fucking tedious and since this is my first try at anything like it, I literally have no fucking clue what I'm doing or what I should do to achieve what I want. I want to just world build and design not slave away at code and read forums which mostly consist of outdated answers from 6 years ago

wheat mesa
#

You doing 2d or 3D

lament rock
#

3D

wheat mesa
#

And what engine are you using

lament rock
#

Unity3D

wheat mesa
#

Ah

#

Can’t speak much for 3d tbh, but it might be useful to make a simpler 2d game to get familiar with the engine first

lament rock
#

I tried Unreal, but I just couldn't

#

2D isn't something I wanna go for

wheat mesa
#

Yeah unreal is a massive learning curve

lament rock
#

I don't play 2D games. They're just not fun to me

wheat mesa
#

Well yeah but I’m just saying that 2d will help you familiarize yourself with the engine more before you try more difficult stuff

rustic nova
wheat mesa
#

It doesn’t have to be a polished game, you can just create something fun and stupid to get used to the process

lament rock
#

I'm familiar with the engine - well now I am

lament rock
#

I do have fun with the scene editing part

rustic nova
lament rock
#

for context, I'm working on a looter shooter and I don't have a concrete story yet, just a general idea for the game, so for a tech demo, I'm making a survival mode first which this is the arena so far

#

gotta add textures to the terrain and add vegetation

#

Also have player controls and spawning already done as well as 2 cameras to render the first person hud and the game view separately (fov reasons)

#

Using chatgpt and novel ai to generate concept art and ideas

#

as well as coding help

#

actually really helpful

hollow lance
#

hola

eternal osprey
#

Omg could i send my file to someone that is experinced in java

#

i have a really stubborn issue in my tester

#

and honestly i am clueless by now

wheat mesa
#

Sure

#

C:

eternal osprey
#

thank you so much

#

i will dm you everything

lyric mountain
#

Still doing that math expression parser?

lament rock
#

Math expression evaluators are the bane of existence

#

Mathjs straight up using the eval function be having an exploit every week

#

Only real solution would be to do your own arithmetic

#

instead of relying on the language's native math parser if a function to evaluate an expression exists. This approach is always bad

lyric mountain
#

The lib i use doesn't mmLol

untold geyser
#

so like-

#

I'm trying to verify my bot

#

and does anyone know why discords doing this 💀

#

I literally got no idea, I never had this happen before

rustic nova
#

because your bot doesnt have the add server button iirc

untold geyser
#

I havent verified a bot in like a year

#

nvm

#

got found a yt vid

sharp geyser
#

It is just in your bot settings

warm surge
#

Oh

#

Nvm

#

I didn’t read everything

#

don’t listen to me

untold geyser
#

💀

earnest phoenix
warm surge
hushed robin
#

guys whats the best way to make an inventory with sql

#

cus i don't think making a table for every user is a good idea

rustic nova
hushed robin
rustic nova
#

Have 3 tables

One for the item info
One for users
One that associates the item with the user

Item info can contain info like the name and a description, perhaps a price too

The user table should at least have one column that contains the id of the third table

The third table is responsible for associating the item with a user, such as a user id and the item id, perhaps a count too of how many items you have

#

That's at least how i would work with that

hushed robin
#

wym thats not how it works

rustic nova
#

Why do you want tables for each user, thats not how SQL works

lyric mountain
#

remember the farthest battle got was basic crud ops

hushed robin
#

because it separates the data for each user

rustic nova
#

Thats still not how sql works

#

I cant even explain because thats the basics of sql

hushed robin
#

#

your not making sense

rustic nova
#

Whatever

#

Its difficult to explain basics to you, sorry

#

Lemme find you some resources

hushed robin
#

you didn't even explain anything to me

#

lol

rustic nova
#

I provided you with an approach that assumes you understand the basics of sql

hushed robin
#

I know the basics of sql

rustic nova
hushed robin
#

I was never referring to that

hushed robin
rustic nova
#

Ugh

hushed robin
#

how is that not how it works

#

⁉️

rustic nova
#

Why do you want to have a table for each user

hushed robin
#

I said why already

rustic nova
#

Because that is not how SQL works, that is not how SQL is structured on

hushed robin
#

?

#

but I could do that, no?

rustic nova
#

No

hushed robin
#

why not?

#

I just create a table for each user

rustic nova
#

That is not what SQL is meant for and that is not something you can easily do

solemn latch
#

you could, but your database would not grow at all

lyric mountain
#

I dont even know how you'd make queries for that structure

hushed robin
#

that doesn't explain anything you said but ok

lyric mountain
#

since table names cant be dynamic

rustic nova
#

But like

#

?????

hushed robin
#

I can just create a table with the users ID

rustic nova
#

Again refer to my approach above, 3 tables, one that's responsible for your inventory items (description, names, prices) one that is responsible for the user (user id, name etc), one that associates a user to the item, essentially the inventory table

hushed robin
#

uhhthis doesn't make sense

lyric mountain
#

by unknown I mean not static

rustic nova
#

If thats something you can't understand, consider using nosql databases like mongodb

hushed robin
#

no

rustic nova
#

Or any other key value database

hushed robin
#

I understand what you mean

hushed robin
#

so I'm wondering what you're referring to

lyric mountain
#

aurel means you're using a spoon to eat beef

#

you can, but it's not how you're supposed to do it

hushed robin
#

hm ok

rustic nova
hushed robin
#

so I should just create an inventory table for everyone and do something like SELECT * FROM inventory WHERE user = '307307861032304652';

solemn latch
#

You should create three tables

hushed robin
#

why do i need 3

rustic nova
#

Relational tables

#

Another aspect of SQL

solemn latch
hushed robin
#

do i need the middle one

#

i don't see the purpose of it

rustic nova
#

Yes, to associate the 2 tables, multiple users can have the same item

solemn latch
#

It also is important for expandability.

hushed robin
rustic nova
#

The middle table is the inventory, having the id from the user table and the id of the item, aswell as something like a item count

hushed robin
#

whats the third one for then

lyric mountain
#

the items

hushed robin
#

but thats the first one

#

⁉️

rustic nova
#

Item: contains your items
UserItem: contains the user and its items (such as user 1 owns item1, user 1 owns item2 etc)
User: the user ofc

#

Also, you're saving a lot on redundancy

solemn latch
hushed robin
#

you just said not to do that uhh

rustic nova
#

???????

solemn latch
#

👀 read the article tbh

rustic nova
#

Head hurt

hushed robin
solemn latch
#

ok

hushed robin
#

i have another question tho

#

how would i make like

#

random chance of something

#

like lets say I have 5 items and I want each to be rarer than the other, how would I go about randomly generating a set amount of the items

lyric mountain
#

funny how you literally diregard any info they give yet ask another question right after

hushed robin
#

I partially understand 👍

hushed robin
#

actually nvm I found this package and imma just steal it's code https://www.npmjs.com/package/random-item-percent

#

😋

rustic nova
#

2-3 lines of code, difficult for sure to make

#

Head hurt

hushed robin
#

only 3?

#

hm

#

i don't think so

#

this package is more than that

neon leaf
#

you can also do it in one

hushed robin
#

fr?

wheat mesa
#

Crazy how bro can’t do basic math 😭

#

Needs a package to do it for him

hushed robin
#

😁

wheat mesa
#

Average js “dev”

hushed robin
#
export default ({
    itemsList = []
}) => {
    let chances = []

    const sum = itemsList.reduce(
        (prev, curr) => prev + curr.percent,
        0
    )

    let acc = 0
    chances = itemsList.map(
        ({ percent }) => (acc = percent + acc)
    )

    const rand = Math.random() * sum

    const itemIndex = chances.filter((el) => el <= rand)
        .length

    const result = itemsList.find(
        (_, index) => index === itemIndex
    )

    return {
        itemEnum: result ? result.itemEnum : null,
        item: result ? result : {}
    }
}
#

looks about right

wheat mesa
#

Guarantee you have no idea what that code even does

hushed robin
#

I kinda do

#

it's ok

#

😁

#

If it works it works

#

!!!

quartz otter
#

Bruh

lament rock
#

the performance of that code would fucking tank at scale wtf

lyric mountain
#

don't think they'll ever reach "scale" to begin with

lament rock
neon leaf
#

so Im trying to make a reverse proxy and the thing im currently stuck at is websockets, now if I proxy a normal websocket it works fine but for some reason socket.io websockets just end up in a socket hang. what am I doing wrong? https://pastes.dev/J4HocZs1Ww

undone rose
#

Imagine writing scalable code

lament rock
#

it isn't compliant with window.WebSocket

neon leaf
#

yeah but I doubt nginx implemented something specific just for socket.io

#

nginx reverse proxy works fine

lament rock
#

It still operates under HTTP and the thing is that you only need to forward the Upgrade request and keep the socket open and just pipe the data of the client socket to the internal one and vice versa

#

er maybe it doesn't use Upgrade. Check the docs

#

it might just be a keep-alive

neon leaf
#

in my browser console its just a normal ws connection

lament rock
#

Never trust the browser since each one varies

#

always trust the data you get on your server

neon leaf
#

I mean, it has 1:1 websocket headers

#

like, its a websocket but with boilerplate

lament rock
#

Maybe it's backed by WebSocket, idk

lyric mountain
#

it switches between them all the time

neon leaf
#

so I basically need to also support polling?

lament rock
#

That's up to the server

#

The server has the logic

#

Just support the HTTP messages

slender wagon
#

what have i done

neon leaf
#

I should be, all http requests work fine

solemn latch
lament rock
#

try seeing what fails then

slender wagon
#

all i did was installing mui

slender wagon
lament rock
#

iterating over the array too many times

hushed robin
#

hm

solemn latch
hushed robin
#

maybe I’ll google to see if theres a better solution

solemn latch
#

I dont use it, but I wish I did

lament rock
#

You don't even need an Array to get chances

solemn latch
#

something like that ye

hushed robin
lament rock
#

Math

hushed robin
#

what math

lament rock
#

There's a mathematical equation using Math.random() to get a random number between 2 numbers

hushed robin
#

but i want it to be precentage

lament rock
#

Math.random() already returns a value between 0 and 1, so just multiply by 100

hushed robin
#

but how would i assoicate that number with the precentage to see which item was picked uhh

wheat mesa
#

battleless when he can't find a package or dev to do all of the work for him

lament rock
#

associate different items with ranges of numbers like 0-0.10 could be 1 thing while 0.11-0.20 can be another.
Of course, this is an even distribution outcome so you cannot weight towards anything specific

hushed robin
#

hm

lyric mountain
#

a few weeks ago battle said studying in school isn't important

hushed robin
#

bruh

#

i didnt say that

#

capper

lyric mountain
#

u did

#

all you need is to pass the test, remember

hushed robin
#

no

#

i did not

lyric mountain
#

when we were talking about how you don't pay attention until the last week

hushed robin
#

i dont recall saying that

wheat mesa
hushed robin
lyric mountain
#

not that one

#

there's another, I'll find it

hushed robin
wheat mesa
#

I'm just trying to support kuuhaku's claim here

neon leaf
wheat mesa
#

But also your logical reasoning is VERY questionable

lyric mountain
#

oh u found it

hushed robin
#

i just dont study

lyric mountain
hushed robin
#

you guys are putting words in my mouthuhh

wheat mesa
#

these are quite literally words that came out of your brain

#

you conceived these thoughts and communicated them willingly

hushed robin
hushed robin
neon leaf
wheat mesa
#

we just think it's funny that you refuse to think for yourself and try to get everyone to do the hard part for you

hushed robin
#

in none of those screenshots i said studying wasnt important

lyric mountain
wheat mesa
#

^^

lyric mountain
#

math classes specifically

wheat mesa
#

Even if not directly related, you'd figure out how to logically reason your situation out, especially if you ever did any sort of stats

wheat mesa
#

Waffle signing out 🫡 good luck to you soldiers that attempt to reason with delusion

hushed robin
#

lmao

#

you guys are just liars smh

neon leaf
#

I still cant believe people like you are real and not trolling, its like talking to a kindergartener that wants to do all the cool stuff but understands shit so asks every step of the way instead of taking his time to actually understand what hes trying to do

#

yeah no you can spare your response, I dont care about you

hushed robin
#

lol

neon leaf
#

good

hushed robin
#

everyone here just always attacking me for no reason

#

bros lying about shit i apparently said

neon leaf
#

and there we go again

hushed robin
#

kuuhaku is always trying to make me look bad for some reason

neon leaf
#

because you are bad 💀

#

you are the most delusional "person" ive ever seen

neon leaf
#

you cant know what ive seen

hushed robin
#

you guys just call me delusional for no reason

hushed robin
solemn latch
#

I'm going to be honest guys, we're probably going to have to start muting for this stuff. It turns into the same conversation all the time, and its kind of getting out of hand.

In the future just ignore questions if you don't feel like answering them in a productive way please.

quartz kindle
#

lmao what did i miss

eternal osprey
#

hey guys could someone help me with some web scraping.

#

i tried to get some listings for cars from this site

#

but it returns me errors, does it have anti-scraping measures?

spark flint
eternal osprey
#

foooock

#

i suppose there's no workaround

#

well, might have to manually check for cars then

#

how do you check it so easily?

#

I was looking for so long

spark flint
#

do they have an api or something

#

perhaps an internal api so it renders client side not server side

eternal osprey
#

hmm maybe

#

do you know how i can see whether a site is scrapable or not?

lyric mountain
#

curl it

#

actually, wget it

eternal osprey
#

are there any online tools for that?

#

I want to first check if it's possible before trying it out lol

lyric mountain
#

yes, simply send a get request to the url

eternal osprey
#

hehhe

eternal osprey
#

i am trying to get the price

#

const price = $('h2.boxedarticle--price')

#

but it returns me literally nothing, an empty string

#

why is that?

quartz kindle
#

keep in mind that $() returns the jquery-wrapped element

#

not the value/contents of the element

rustic nova
#

Also don't need the h2

#

Only . And so on

quartz kindle
#

if you want the text content, add .text()

quartz kindle
eternal osprey
#

ahhh yeah it worked for me

#

my compiler is bugging for some reason

#

tbh mac is soo cool to code with

#

but many pgrograms just have bugs lmao

#

intellji refuses to fucking work

#

vsc has such a bad code runner for mac

#

🤮

knotty schooner
#

any idea

lament rock
#

Nobody thinks, so nope no ideas

knotty schooner
#

very true

#

anyone able to help me understand why i am getting this error

lament rock
#

You only defer the reply if the label is modal_maxwarnings when that defer should be in the else block. Even the first if will fail because the interaction would have already been replied to so you can't reply again

knotty schooner
#

so i should remove the defers and place the defer in the file that creates the modal?

lament rock
#

You don't even need the defer and edit original since you aren't doing any async work it seems

#

just regular reply unless you're doing async work elsewhere

knotty schooner
#

async is at the top of the file

lament rock
#

but are you awaiting anything

#

just because something is async doesn't mean it's gonna take forever

knotty schooner
#

nope only the bit below

#

alr

lament rock
#

ah nvm I am totally blind yeah you do need the defer

#

just move the defer into the else block before the findOne

#

and delete it from the first if block

knotty schooner
#

alr

#

cheers thanks

topaz terrace
#

what's the difference between

and ==?

radiant kraken
#

=== also does strict type checking

#

if both types dont match, it will always fail

knotty basalt
spark flint
#

oh christ

knotty basalt
spark flint
#

lol

knotty basalt
#

lmao

spark flint
#

Ok people who are good with Next.js

#
https://next-auth.js.org/errors#client_fetch_error undefined {
  error: {},
  url: 'http://localhost:3000/api/auth/session',
  message: undefined
}```
#

Getting this whilst attempting to get logged in user

#

doing ```js
import { getSession } from "next-auth/react";

export default async function handler(req, res) {
if (req.method !== 'POST') {
return res.status(405).json({ message: 'Method not allowed' });
}

const { tag } = req.query;

const session = await getSession({ req });
if (!session) {
console.log([API] Unauthenticated user tried to verify clan ${tag});
return res.status(401).json({ success: false, message: 'Unauthorized' });
}
}```

#

(cut down code)

#

nextauth_url is present

spark flint
#

Works when I visit in my browser

#

weird as fuck

vocal canopy
spark flint
#

I managed to figure it out

#

it wasn't related to that

#

when I removed the headers it worked

#

by headers, I was literally only passing content type

#

but when removed, it worked fine

maiden gazelle
#

why does it never work to copy codes from the internet

#

i have to explain it to someone but i dont know how to tell it

deft wolf
#

Because you need to know what you're copying and why it works the way it does

#

Nobody mindlessly copies code from the Internet hoping that it will somehow work. Sometimes code needs tweaking to make it work in your project

maiden gazelle
#

ik that is what i was saying but i mean like i use for a option in a slashcommand name: 'name here' but the tutorial is saying .setName("name here")
altough we use the same version so why is that

hushed robin
lethal cipher
#
deft wolf
#

Exactly, the builder is optional and I personally prefer not to use it, even though they use it in practically every "guide"

hushed robin
#

yeah^

lethal cipher
deft wolf
hushed robin
lethal cipher
#

yeah but someone says it wil not work

#

and some say it wil

hushed robin
#

why not? it's relatively new, only 2 months old

lethal cipher
#

okay thank you

#

okay

deft wolf
#

From what I can see, there is no link to github in this video, so rewriting this code from the video will be a pain

#

Ah yes, you can only get the source code if you support the channel

#

I would rather find similar code on github KEKW

hushed robin
#

yes

earnest phoenix
#

Basically don't put the styling outside of the []()

#

But rather inside

#

E.g. [**bold**]() or [__underlined__]()

thorn spruce
#

Does anyone already try to install vc_redist with a MSI from Electronjs?

knotty basalt
#

without bugs for now xD

lament rock
earnest phoenix
#

much js

earnest phoenix
#

Is it okay to Make my Discord Bot with YouTube Source Supported?

#

bcz I heard a news that Discord removing discord bots that support YouTube Source

#

is it true?

earnest phoenix
#

Yes

clear plinth
#

That is a risk yeah. If they spot it they’ll remove.

median ginkgo
#

o

mental ocean
#

Hoo

grim aspen
lethal cipher
#

found 0 vulnerabilities
Started refreshing application (/) commands.
DiscordAPIError[50035]: Invalid Form Body
5.name[BASE_TYPE_REQUIRED]: This field is required
6.name[BASE_TYPE_REQUIRED]: This field is required
at SequentialHandler.runRequest (/home/container/node_modules/@discordjs/rest/dist/index.js:933:15)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async SequentialHandler.queueRequest (/home/container/node_modules/@discordjs/rest/dist/index.js:712:14)
at async REST.request (/home/container/node_modules/@discordjs/rest/dist/index.js:1321:22)
at async /home/container/index.js:27:9 {
rawError: {
code: 50035,
errors: { '5': [Object], '6': [Object] },
message: 'Invalid Form Body'
},

does anyone know what i need to do

lyric mountain
boreal iron
#

also tells you where

#

/home/container/index.js:27:9

lethal cipher
#

okay thank you

rustic nova
#

i think your issue is referring to a form not being valid

lethal cipher
boreal iron
#

Just show us the lines

#

You aren't setting a (valid) field name

lethal cipher
#

data: new SlashCommandBuilder()
.setName('ticket-set')
.setDescription(this sets up the ticket message and system)
.addChannelOption(option => option.setName('channel').setDescription(the channel you want to send the ticket message in).addChannelTypes(ChannelType.GuildText).setRequired(true))
.addChannelOption(option => option.setName('category').setDescription(the category you want the ticket to be sent in).addChannelTypes(ChannelType.GuildCategory).setRequired(true)),
async execute (interaction) {

boreal iron
#

you're sure those are the right lines?

lethal cipher
#

idk witch line i need to give you

#

where does is say

boreal iron
#

/home/container/index.js:27:9

#

show me index.js around line 27

lethal cipher
#

try {
console.log('Started refreshing application (/) commands.');
await rest.put(
Routes.applicationCommands('1092805473696223283'),
{ body: commands },
);

#

but before i was coding the ticket bot i didnt have any problems with this code

boreal iron
#

so... one of the commands you're trying to register doesn't have a valid form

#

console.log commands there and we will find out

#

i hope there aren't much of it

lethal cipher
#

that

boreal iron
#

console log the var commands before, please

lethal cipher
#

can you call

#

?

boreal iron
#

what do mean?

lethal cipher
#

can you join general voice call

boreal iron
#

how would that help in any way? just console log the var and paste the results here

lethal cipher
#

how do i console log the VA

#

VAR

boreal iron
#

some of your slash commands (and options) simply doesn't follow the rules of discord

grim aspen
#

console.log()

#

and whatever you need in the parenthesis

#

oops i wasn't paying attention to chat

lethal cipher
#

okay wait i am now in fluidnodes. and where do i need to console.log('my command')

grim aspen
boreal iron
#

just log the var right before your try/catch clause

#

technically it could also be an issue of a command response like an invalid embed field etc.

grim aspen
#

it has the exact error there

#

hold on

boreal iron
#

no it has not

#

An Invalid Form Body can be caused by countless ways of sending your form to the rest api

grim aspen
#

that's a brand new option i haven't noticed yet

boreal iron
#

an invalid command form, embed etc.

grim aspen
#

i bet it has to do with .addchanneloption

stuck dawn
#

Is there any way to responsive center grow animation in Framer Motion?

lethal cipher
#

DiscordAPIError[50035]: Invalid Form Body
5.name[BASE_TYPE_REQUIRED]: This field is required
6.name[BASE_TYPE_REQUIRED]: This field is required
at SequentialHandler.runRequest (/home/container/node_modules/@discordjs/rest/dist/index.js:933:15)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async SequentialHandler.queueRequest (/home/container/node_modules/@discordjs/rest/dist/index.js:712:14)
at async REST.request (/home/container/node_modules/@discordjs/rest/dist/index.js:1321:22)
at async /home/container/index.js:27:9 {
rawError: {
code: 50035,
errors: { '5': [Object], '6': [Object] },
message: 'Invalid Form Body'

how to fix this

boreal iron
#

without providing the logs I asked for, we can't do anything

lethal cipher
#

okay but i dont know where to do that and how

#

so can you come in to a call with me to give me good information on how to do it

boreal iron
#

you seem to be lacking the fundamental knowledge of the language you're using then

#

which makes it hard to impossible to help

#

sadly

lethal cipher
#

sorry i am dutch

#

and my english is not very good

grim aspen
#

understandable

boreal iron
#

the programming language, Sir

grim aspen
#

unlike someone else

lethal cipher
#

but how do i need to do the logs because is dit

console.log(menu)

#

in the command

boreal iron
lethal cipher
#

okay so what do i need to type and where

boreal iron
#

to keep things as simple as possible to understand, just remove the commands file by file and see which one is causing the error

#

that would almost help a lot

#

instead of guessing around

lethal cipher
#

okay

boreal iron
#

if you know which ones is causing the error, get back and we will continue

lethal cipher
#

i have 2 commands wich give the error i think

#

it is ticket-setup and ticket-disable

boreal iron
#

alright

#

let's start with the first one

#

lemme see what u done there

#

try not to send it in here, please

#

use a service like hastebin or sourcebin

celest geyser
grim aspen
#

use *

boreal iron
#

else it's impossible to view on mobile

grim aspen
#

copy my text above

lethal cipher
grim aspen
#

that works too

lethal cipher
#

this sourbin is from my ticket-disable.js command

grim aspen
#

what is ticketschema

boreal iron
#

you're 100% sure this command is causing the error?

grim aspen
#

first question i have is about ticketschema

lethal cipher
grim aspen
#

because i see nowhere that it is defined

lethal cipher
#

ticket schema

grim aspen
#

oh

lethal cipher
#

ticketSchema*

boreal iron
#

what's your djs version

lethal cipher
#

v14

boreal iron
#

latest built?

lethal cipher
#

i think

#

how do i check?

grim aspen
#

look in package.json

lethal cipher
#

14.8.0

#

is the discord.js

grim aspen
#

can you send the code for the other command

lethal cipher
#

ofc

boreal iron
#

ok, did the error occur right on when starting your bot or when executing the command in discord?

#

because the body of the command your linked is valid

grim aspen
#

looks like command execution

lethal cipher
grim aspen
#

holy

#

ok gimme a bit

lethal cipher
#

xD

lyric mountain
grim aspen
#

nah that has to be a joke

lethal cipher
#

he is death srs

boreal iron
#

I keep thinking the action row component type is missing

grim aspen
#

i feel like something wasn't defined

lethal cipher
#

wdym

boreal iron
#

console.log(menu)

#

What does it show?

lethal cipher
#

where can i see that

#

because i run the bot in fluidnodes

boreal iron
#

in your console once you execute the command

lethal cipher
#

okay

boreal iron
#

dunno what that service is, sorry

#

but I guess there's a console or log file etc.

lethal cipher
#

okay but where can i see the console.log thing logs

#

because i dont understand

boreal iron
#

idk fluidnodes, there must be some console window, terminal or logging file somewhere

lethal cipher
#

yes there is

#

but if i type console.log(menu)

#

it doesnt show anything

boreal iron
#

that's already inside your command you shared

#

can you execute the command in your discord server ?

lethal cipher
#

owhhh

#

nu it doest show the slash command

#

no*

celest geyser
lyric mountain
#

this is insanely overpriced

grim aspen
#

you can't

boreal iron
#

ok so the registration fails but the command has a valid name, description etc

lyric mountain
#

what can u even run in 1gb storage/250 ram?

boreal iron
#

asking your once again, are you sure, 100% sure this file is causing the error?

grim aspen
#

hold on

#

i think the link provided to the database doesn't exist

lethal cipher
#

yes because i removed the other file and it gave the same error

grim aspen
#

that means it's not that code

lethal cipher
#

yes wait

#

look

boreal iron
lethal cipher
#

error

grim aspen
boreal iron
#

the interaction is missing because one interaction to register is creating the error and the process stops

celest geyser
#

what dose everyone evan code on

grim aspen
#

nodejs, python, and c#

earnest phoenix
grim aspen
#

almost fell for that

lethal cipher
#

okay

grim aspen
#

yeah those two commands aren't what's causing the error

lethal cipher
#

i have 2 codes

#

they both give the same error

boreal iron
# lethal cipher error

just change your code to this and see if the error occurs again
I still bet it's the command being read before, but let's go for it

#
const { PermissionsBitField, EmbedBuilder, ChannelType, ActionRowBuilder, selectMenuBuilder, SlashCommandBuilder } = require("discord.js");

module.exports =
{
    data: new SlashCommandBuilder()
        .setName('ticket-set')
        .setDescription(`this sets up the ticket message and system`),
    async execute(interaction)
    {
        await interaction.reply({ content: `your ticket system has been set up in ${channel}`, ephemeral: true });
    }
};
lyric mountain
boreal iron
#

this question...

lethal cipher
#

t

grim aspen
#

bruh

#

i just was saying that earlier

civic scroll
grim aspen
#

i don't think the database exists

lethal cipher
#

wow

lyric mountain
boreal iron
lyric mountain
#

that is, if it's valid at all

lethal cipher
grim aspen
#

there

lyric mountain
#

you just answered ur question then

grim aspen
#

it doesn't exist so it doesn't exactly know what that 'database' is

boreal iron
civic scroll
boreal iron
#

TRAILING COMMA

#

bannable offense

civic scroll
#
// codex.format.global.sayu
// ...
trailingComma: true
boreal iron
#

what prevents you from not using the builders at all?

grim aspen
boreal iron
lyric mountain
civic scroll
#

using builder is for some conditional stuff

lyric mountain
#

trailling comma on EVERY line

civic scroll
#

for const values, just use the object

lyric mountain
civic scroll
#

more readable, less function calls

boreal iron
lyric mountain
#

the lines u don't put a comma get formatted into a single line

grim aspen
#

TIL about trailing commas

boreal iron
#

the pain is real

lyric mountain
#

and become this

civic scroll
#

lmfao

lyric mountain
#

so yeah, you either live with commas or live with 800 char lines

#

and no, u cant customize the formatter

grim aspen
#

aka dangling commas typed after the last item of a list of elements

lyric mountain
boreal iron
#

me waiting for the dude to reply while getting physical pain by trailing commas

civic scroll
#

> Sayuri.Codex config style:trailingComma LanguageRequirement

#

Updated config, updated one language [Dart]

lyric mountain
boreal iron
#

ouch

lyric mountain
#

yes, 2-space tabs btw

#

I honestly want to say "fuck you" to whoever considered enforcing dart formatting

boreal iron
#

god bless me for not knowing this

#

prevents me from having to deal with it

civic scroll
lethal cipher
#

the line where my bot token is. the last line it says''SyntaxError: Unexpected end of input''

grim aspen
#

what's the code

#

do not put the token

boreal iron
lethal cipher
#

bot.login('my token')

boreal iron
civic scroll
#

i stopped using djs before the builders show up

#

so

#

i also assign the option manually from code

grim aspen
#

must be somewhere else

#

unless you have something else under it as in an extra line with something in it

boreal iron
civic scroll
#

unnecessary function calls

#

unreadable code

lethal cipher
#

const rest = new REST({ version: '9' }).setToken('my token');

#

is this good for in the beginning

lyric mountain
#

tf is rest

boreal iron
#

imagine dealing with the clusterfuck of changing the guards, methods, classes whenever djs decides again to change their names, or simply change their case etc

civic scroll
grim aspen
civic scroll
lyric mountain
#

they call it REST?

wheat mesa
#

It’s a client for accessing raw API methods pretty much, even though djs has methods for that in the normal client already

grim aspen
#

it's REpresentational state transfer

wheat mesa
#

It’s pretty awful design for the guide to teach people to use it

lyric mountain
#

ik what rest is, I just don't know why d.js uses it for bot client building

boreal iron
#

no need to import and use the REST handler in djs at all, how many times did I already say to use the INBUILT CLASSES AND METHODS

lyric mountain
#

like, a builder called REST

civic scroll
wheat mesa
#

There isn’t a reason pretty much, the guide is pretty bad in terms of writing decent code

lethal cipher
#

bot.login('TOKEN')

SyntaxError: Unexpected end of input

boreal iron
#

because they are clueless

civic scroll
#

check where the text editor highlight the error

wheat mesa
#

This is why I don’t build bots anymore

grim aspen
#

so wait

wheat mesa
#

The only lib I ever truly liked still isn’t maintained :c

boreal iron
grim aspen
#

nvm

civic scroll
#

also use discordx if you know typescript

grim aspen
#

what i was about to say would prove a point

civic scroll
#

better way to build bot commands

wheat mesa
#

This guy clearly does not know javascript, let alone typescript KEKW

grim aspen
#

so they can remove that unnecessary rest line then

boreal iron
lethal cipher
wheat mesa
#

inb4 he’s using notepad

boreal iron
#

no, some online editor I guess

#

which is part of the service

grim aspen
#

is that what fluidnodes is?

#

lemme look

civic scroll
#

gaming

boreal iron
#

SimpleCommand yikes

#

where's ComplicatedCommand

grim aspen
#

yup it's a hosting service

#

does it underline the certain area where the syntax would be

#

it would look like }); ^ SyntaxError; Unexpected end of input

#

usually unexpected input error is self explainable

boreal iron
wheat mesa
# civic scroll gaming

I can’t wait until I have time to start another ts project, native support for decorators is pog

boreal iron
#

there's has been a } too much

grim aspen
#

agreed

boreal iron
#

now tell me if the command still throws and error

#

it shouldn't

lethal cipher
#

Again

grim aspen
lethal cipher
#

no the error was already gone

grim aspen
#

so there's another error?

lethal cipher
#

but i main the error of the bot.login('my token')

deft wolf
#

How

grim aspen
#

does the () show up as two lines?

#

like does it show up as

#

client.login('
')

lethal cipher
#

no

#

as

#

bot.login('TOKEN')

earnest phoenix
#

But just very basic requests

maiden gazelle
#

Hi I am making a ticket system but when i choose the category to send the tickets in and then i create a ticket it doesnt send the ticket in that category but just on top of the channel list in the server
i already tried to console.log it but it says undefined

#

but i saved it the right way to my db

earnest phoenix
quartz kindle
#

lel