#development

1 messages · Page 1753 of 1

woeful pike
#

yes absolutely

#

the error message here is really wonky because I did some hacks to make this work but in general it's almost always better than js

spare badger
#

I really had to get used to defining types for everything when I used Typescript for the first time. But when the project got bigger I absolutely understood why it's better.

woeful pike
#

I think my blog is the only thing I still have in js only because I don't care if things break there

spare badger
#

😂

quartz kindle
#

ayyy

green vale
#

I've always had some trouble working with TypeScript, whether it be compilation errors or some sort of weird bug

opal plank
#

//@ts-nocheck does not get compiled

#

for whatever reason

quartz kindle
#

weird

opal plank
#

so

#

heres the thing

#

[i need //@ts-nocheck there to make sure my main file doesnt get type errors

quartz kindle
#

there are likely some differences between tsnode.register() and the tsnode cli

opal plank
#

and then the ts-expect error afterwards for then ts-node.register() gets called

woeful pike
#

Map<string, 0> Thonk

opal plank
#

itsw kinda odd, but its a quirk i managed to get around

woeful pike
#

isn't that just Set<string>

opal plank
#

i guess so, but i think maps are better indexed

#

and 0 is the smallest byte-wise thing i can set there

#

rather than using includes() or some other sort of array method

woeful pike
#

I haven't heard of performance comparisons between map and set like that

#

in theory the smallest value you can have is nothing the way sets do

opal plank
#

i'd be interested to see which is more performant tbh, a set or map for indexing

quartz kindle
#

set.has should have comparable performance to map.has, no?

opal plank
#

thats what im not sure

#

tim, performance testing is ur area

quartz kindle
#

im not on pc now otherwise id already be benchmarking it

opal plank
woeful pike
#

I can't imagine there's any meaningful difference between indexing a set and a map. Aren't they implemented similarly under the hood

opal plank
#

i would benchmark it but im the middle of work rn

#

probably so, but these workers are meant to grab a lot of traffic

#

since they are dealing with presences, i'd like to make it as performant as possible

quartz kindle
#

use objects then lul

opal plank
#

im getting 1-2 presences per second now as oppose to the 150k i was getting before on a single thread

quartz kindle
#

objects are more performant when keys are strings

#

maps are better for non-string keys

opal plank
#

delete obj[id]
obj[id] = 0

?

quartz kindle
#

yes

opal plank
#

i should probably set it to 1 then so i check for truthy?

#

or hasOwnProperty() ?

quartz kindle
#

ye

#

better set it to 1

opal plank
#

aight, lets roll with that then

quartz kindle
#

but hasOwnProperty has the same perf

opal plank
#

well, might as well go for 0 and hasOwnpropertyy then

#

just to reduce a bit of bytes

woeful pike
#

at what point do you go ok maybe javascript is not the right tool for the job here lol

quartz kindle
#

never

#

:^)

opal plank
#

realistically i wouldnt be worrying about that too much, its just due to the fact that i ACTUALLY managed to clog a very high end server with presences alone

#

so worrying a bit too much here wouldnt be that bad

#

spikes were going up to 160%

#

now its stable at 5%

quartz kindle
#

because you were single threading right

woeful pike
#

Map<string, {}> SWEATYHAM 100% cpu usage vps dying
Map<string, 0> feelsgood 0 resource usage we chillin solo bolo

opal plank
#

at least in dev

opal plank
#

now with the workers the main thread is at 5%

#

though now im not doing any parsing in the main thread

#

im just emitting the userid, the guildid and if a new presence was triggered or no

#

since i need to know when they start/stop playing

prime mist
#

I would use a Set personally. Until performance was really a concern.

burnt fox
#

How to rule

cinder patio
#

rule what?

#

the world?

quartz kindle
#

yes

vivid fulcrum
#

get engaged to bill gates

analog tinsel
#

how i can insert data fetching in function?

wary pollen
#

Think you can just return data without the ()

analog tinsel
#

it not worked

umbral zealot
#

Do not use JSON as a database.

analog tinsel
#

if bot is public

umbral zealot
analog tinsel
#

im just using json for 15-20 member data

umbral zealot
#

The size of your bot, whether it's public, and what data you're storing, is utterly irrelevant.

#

Do not use json as a database. It's not.

analog tinsel
#

uh oke

#

however

#

gotting this error

umbral zealot
#

no no, don't argue. Just switch to something better.

analog tinsel
#

i promise you

umbral zealot
#

And you also you can't... like... send your entire DB as a response to a web request.

#

that's stupid

analog tinsel
#

i switch to other data things

#

after fix this

umbral zealot
#

no

#

you can't "fix" this

analog tinsel
#

ye ye

#

i can

umbral zealot
#

You cannot send your entire DB as a web request

analog tinsel
#

because

umbral zealot
#

if you want to know what's in it, LOG it.

analog tinsel
#

2 min ago i opened question on stackowerfellow or which name is trash site

vivid fulcrum
#

lmfao

analog tinsel
#

im gone fix this

umbral zealot
#

Look, you're using notepad++, trying to use a json db, and use var. You obviously cannot be trusted to understand the impact of what you're doing.

#

stop.

analog tinsel
#

i understand

#

but

#

but

#

json is good for me

umbral zealot
#

Jesus christ kid, this isn't fixable, it's dumb, stop doing dumb things when grown ups tell you to stop.

#

DO NOT use JSON as a database.

analog tinsel
#

noooo

umbral zealot
#

STop it

analog tinsel
#

json > all

boreal iron
tacit sequoia
analog tinsel
#

notepad + cmd > vs code + terminal

umbral zealot
#

Use nedb

#

or quick.db

#

or enmap

analog tinsel
#

bruh

#

i already using quickdb

#

buttttt

#

i cant use for just 20-25 member

umbral zealot
#

yes you can

#

the size isn't relevant

analog tinsel
#

im using quick db for more big size datas

umbral zealot
#

It's a few kb of space

#

just use quick.db again.

analog tinsel
#

if you tell me how to quick db fetching in function

#

yes

umbral zealot
#

What

#

db.get('thing')

boreal iron
#

Who cares about the size? It’s just an optimized storage system offering huge amount of possibilities.

umbral zealot
#

it's not that hard?

analog tinsel
#

im making website

#

every refresh page

#

i need new data see on site

#

but now

umbral zealot
#

yeah, ok? Same deal as in Discord, man

vivid fulcrum
#

you have a looooooooot more to learn before making a website

analog tinsel
#

when i restart then it

umbral zealot
#

quick.db will save your data just fine on restart

analog tinsel
#

bruh

boreal iron
analog tinsel
#

i didnt meaning this

boreal iron
#

Files on your drive, nothing else

analog tinsel
#

im making api and fetching data from api to make html table

cinder patio
analog tinsel
#

so every refresh page

opal plank
analog tinsel
#

need to get new data

umbral zealot
#

Right ok so just keep using quick.db, it's not cached, so the data is always the fresh one

#

ezpz

analog tinsel
#

oke

#

im trying now

#

if not

#

im invite here my all json using friends

boreal iron
umbral zealot
#

JSON would be worse for this. Literally, the worst thing you could use for this.

analog tinsel
#

but you false at there

#

if json not be maked

boreal iron
vivid fulcrum
#

you can also implement a second level cache so you can prevent querying your database every single time

#

but again

analog tinsel
#

then quick.db not be here

vivid fulcrum
#

backtrack and learn web development properly

opal plank
umbral zealot
#

One of the intents of quick.db and enmap is to enable rapid prototyping and simple development without having to deal with databases. So, really, it's perfect for someone who's wanting to learn web dev.

vivid fulcrum
opal plank
#

i wonder if at this point they just just modify some boiler-plate

analog tinsel
opal plank
#

since they are lacking SO much in terms of developing front-end/back-end

umbral zealot
#

To be fair there's no one right way to learn web design

analog tinsel
#

im just using json for these 10 moderation user

umbral zealot
#

No you're using quick.db for these 10 moderatoon users.

boreal iron
vivid fulcrum
#

uh

analog tinsel
#

did you want to learn what is real?

umbral zealot
#

I want you to stop being an idiot and start doing the right thing

opal plank
#

theres a difference in passing json to your website(which uses js) and likely your api/db returns a json payload. That doesnt mean you're storing the data in json

umbral zealot
#

because no one here will help you load the shotgun you're aiming at your foot like a noob.

analog tinsel
#

however json > all

umbral zealot
opal plank
vivid fulcrum
#

the point of second level cache is so data you pull frequently is stored in memory, any update done on a second level cache entry first updates it in memory and then the database as a side effect

opal plank
#

had a stroke there ngl

boreal iron
umbral zealot
opal plank
umbral zealot
#

I mean it really depends

#

tbh someone starting in web dev would be best served by using EJS or PUG

opal plank
#

the way they are saying suggests they are confusing the json format to what they get in the front-end, not how its saved on the backend

boreal iron
umbral zealot
#

rather that straight-up understanding the correlation between fE and BE with requests.

boreal iron
#

God past perfect

#

English is complicated notlikenoot

#

sometimes

opal plank
#

hmmm ejs would be a good thing

vivid fulcrum
#

that whole thing just screams 2006 cliche web vulnerabilities

opal plank
#

react would likely be a good alternative, its amazing for dynamically changing things on the go

#

svete might be another strong contender

umbral zealot
#

Obviously, cry. Beginners need to go through this process of making shitty things in order to understand how they're shitty. Hopefully without falling a victim to some hacking

opal plank
umbral zealot
#

If you don't go through the pain of creating a bunch of static pages before realising how beautiful dynamic generation is, how can you appreciate the beauty?

opal plank
#

or some other already secure-ish thing. Firebase should have some very decent db/website options with GUI instead of code

#

though i agree with you evie

boreal iron
opal plank
#

i personally would have 100000x more satisfaction seeing my own thing

analog tinsel
#

and one thing, using json data and choosing harder way to searching thing for make website and choosing your way to easily make website and not understanding anything

umbral zealot
#

what

#

that didn't make sense

analog tinsel
#

i think i just wasted my 3-4 hour for searching something on google

#

if i just used quickdb or other things

umbral zealot
#

You're going to waste a lot more time trying to use json

analog tinsel
#

it just be 10 min for me but not understanding anything or wasting my time to make better

umbral zealot
#

trust me, please, if you're ever going to trust someone with more years of experience than you've even lived, trust me here : JSON IS PAIN

opal plank
#

^^

umbral zealot
#

do NOT use JSON as a database

opal plank
#

the only thing worse than json is jsonb tables

analog tinsel
#

json = data quickdb = data

#

so why are you crying

opal plank
#

see what i mean evie?

umbral zealot
#

no , they are not equal

analog tinsel
#

yes it equal

analog tinsel
#

quickdb just more performance

#

to store everyting

umbral zealot
#

let's be clear. do not store thigns in .json files

analog tinsel
#

and json is minimalized to store

opal plank
#

they are probably confusing front-end with backend if they state they use quickdb

umbral zealot
#

You can definitely store objects and shit in quick.db and enmap

#

the problem isn't the json format.

#

the problem is storing in json files.

#

You'll still need to exchange json strings between your backend and frontend, that's fine, and required

analog tinsel
#

im saying against

umbral zealot
#

What you cannot and should not do, ever, unless you're literally mentally incompetent, is think that you can and should store data in .json files and modify them programmatically.

#

Don't do this

analog tinsel
#

if im going to make holy owo bot or anything i need to develop / waste time

#

i can use quick db

#

but im now just making for 20 moderation user

umbral zealot
#

It will be faster to use quick.db instead of json files

#

it will be easier

analog tinsel
#

and they dont know how to edit quickdb

umbral zealot
#

it will be quicker

analog tinsel
#

json = right click open

#

you can edit manual

umbral zealot
#

That is a stupid argument

opal plank
#

we've sucessfully waste 17 minutes trying to explain that quickdb is not equal to .json

umbral zealot
#

because you don't edit data manually in a file when you have a website

#

if you want them to be able to edit data, you make a form with a Save button

analog tinsel
#

bruh

#

website not main job

#

its discord bot

umbral zealot
#

Don't care

opal plank
#

here, you are SO angry about how easily you can modify data?

analog tinsel
#

if you download db browser sqlite

umbral zealot
#

I started with Discord Bots

analog tinsel
#

yes

umbral zealot
#

and now I'm paid $80k/year to make websites

opal plank
#

@analog tinsel here

#

this is how hard it is to modify data in a database

umbral zealot
#

And guess what I never ever did in my bot developer or web dev career? store data in json.

#

That's why I'm actually paid $$$

analog tinsel
#

bro

#

you not understanding

opal plank
#

you are not making sense

umbral zealot
#

You already know quick.db , you have zero excuse

analog tinsel
#

im just making bot for private server

umbral zealot
#

I don't care what you're doing.

boreal iron
opal plank
#

we are understanding, you just not making any sense

umbral zealot
#

use quick.db

analog tinsel
#

so i want to give their basic bot system

umbral zealot
#

I do'nt even like quick.db and I want you to use it

opal plank
#

it doesnt matter if you are using a bot, facebook, a new discord platform or a new mail, just DONT USE .json

#

its bad

#

period

umbral zealot
#

If you're making something for a private server, give them commands in the bot to edit things if they need it

analog tinsel
#

ughhhhhhh

umbral zealot
#

and it's going to be much easier to change things in quick.db

analog tinsel
#

ughhhhhhhhhhhhhh

#

you re not understanding

umbral zealot
#

We understand you perfectly

analog tinsel
#

i hope you sponsored with quick db

umbral zealot
#

but we don't care.

#

Use a real database.

opal plank
#

dude, i HATE quickdb

boreal iron
#

I would suggest SQLite but who cares

opal plank
#

im a postgres/redis and keydb fan

analog tinsel
#

my data = number

opal plank
#

we are saying you should use it cuz you ALREADY HAVE IT

umbral zealot
analog tinsel
#

not any string or anything

#

number

umbral zealot
#

Doesn't matter

analog tinsel
#

num

opal plank
#

you can store ANYTHING

analog tinsel
#

ber

opal plank
#

doesnt have to be string

umbral zealot
#

10-15 entries in a quick.db file will take about 5kb of space

opal plank
#

look

#

i got numbers AND strings

umbral zealot
#

yay numbers. lol.

opal plank
#

whats ur argument now?

boreal iron
opal plank
#

i can even show you arrays if you keep giving bad arguments

analog tinsel
#

do you see????????????

#

im using quick db tooooooooooooooooooooo

#

but i dont want now quick db on current project

opal plank
#

make colums for EACH thing inside your json

umbral zealot
#

you do'nt need to edit things manually when you're making a website or bot

#

you use commands and UI features

opal plank
#

^^

analog tinsel
#

im saying firstly itttttttt toooooo

#

i dont need ui features

#

its just basic project

opal plank
#

i give up

boreal iron
#

Lmao using a database to store a JSON string

opal plank
#

they SOMEHOW managed to make 2 columns

#

but theya re stuck there

analog tinsel
#

its like google or opera

opal plank
#

they dont understand they dont have to have only TWO colums

analog tinsel
#

im choosing holy opera

umbral zealot
#

So here's the thing, right? That "one thing" you need help with, is literally the simplest thing you can do, which is read data.
After you figure that out, you need to figure out a way to write this data
After that's figured out, you realise the data doesn't update so you need to figure out how to "reload" the data
And after that, you need to figure out how to load, edit, and save the data to change it.

#

None of these things are easy in json

#

All of these things are super trivial in quick.db

analog tinsel
#

bro

#

my all problem not with json

umbral zealot
#

yes it is

analog tinsel
#

when im getting some code from another user

umbral zealot
#

Click the big fat "invite" button on the right.

analog tinsel
#

im just store it and

#

using to create new system

#

so if i get there help with json

#

im going use this system on .... system too

umbral zealot
#

ok but you're not even there yet

analog tinsel
#

json is not main problem here

umbral zealot
#

it is

analog tinsel
#

as you can see

umbral zealot
#

You haven't even started learning what you need to know to start doing the shitty thing

analog tinsel
#

i just ask function

#

and you talked 20 min about quickdb

#

so do you see

opal plank
#

@analog tinsel does this make sense to you?
instead of ```
|id | json |
|123| {"stats": 1, "otto": 1010} |

You do

| id | stats | otto |
|123 | 1 | 1010 |

analog tinsel
#

how harder to talk

umbral zealot
#

Again, I'm speaking from experience here : you haven't scratched the surface that is the horrible pain of using json as a database

#

you don't know how hard this is because you literally are at step 1 of understanding

#

and there's at least 10 steps of pain

analog tinsel
#

bro bro

umbral zealot
#

I'm telling you to stop not just because it's bad, but because it's bad and hard

analog tinsel
#

okey im last saying to you

#

in my project

opal plank
umbral zealot
#

I don't care what justification you have

analog tinsel
#

one last problem is

#

quick db = fresh data

#

json = old

#

right?

boreal iron
#

Lol Hindsight... why do you want to convert him?

analog tinsel
#

and im choosing hardest way

#

okay?

umbral zealot
#

Because I cannot allow this tragedy to continue

analog tinsel
#

i dont need quickdb

umbral zealot
#

yes you do

#

we will not help you here.

#

period. end of discussion

boreal iron
#

Looks like an exorcism. KEKW

umbral zealot
#

It's for your own good, child.

analog tinsel
#

so if you dont answer its all right

#

you can find another members to invite quick db using

umbral zealot
#

We did answer, we gave you the right answer.

analog tinsel
#

but im happy with json

umbral zealot
#

It's not the answer you wanted, but it's the right answer.

opal plank
# umbral zealot period. end of discussion

you shall not stop me from doing ```ts
client.on('message', (m) => {
m.content.startsWith('ping') m.reply('pong');
client.on('message', (m) => {
m.content.startsWith('hi') m.reply('world');
})
})

umbral zealot
#

The only reason we keep saying quick.db is because you've used it before. I would suggest enmap, otherwise. smh.

analog tinsel
#

example

opal plank
#

why people bother asking questions if they dont listen to the answer?

umbral zealot
opal plank
#

maxEvenetLIstener reached, memory leak detected

analog tinsel
#

there was discord bot maker user and javascript/python another code language user

#

some people can choose discord bot maker

#

some people can choose node etc...

umbral zealot
analog tinsel
#

you cant talk about choice

sudden geyser
umbral zealot
#

Dunning Kruger at its best.

sudden geyser
#

They'll find some answer later or until they get hit in the head sign with a stop sign

boreal iron
opal plank
umbral zealot
# analog tinsel you cant talk about choice

This is not about choice. This is about using the right tool for the right job. If you're trying to use a phillips screwdriver to unscrew a square head screw, you would usually have a dad around scolding you and handing you the square head screwdriver because it's the right tool. You're not even using a screwdriver, you're using a hammer, because you don't have any idea what you're doing.

analog tinsel
#

these image saying everyting

opal plank
#

we are saying your setup is TERRIBLE, not bad, TERRIBLE

umbral zealot
#

it's not a choice problem, it's a "correct tool" vs "not even a proper tool" problem.

analog tinsel
#

i dont need waste time with you re all

opal plank
#

good, next customer pls!

analog tinsel
#

im saying tooooooooooooooooooooooooooooooooooooo quickdb is uiiiiiiiiiiii and other godmode thingsssssssssssss

#

and im using to quickdbbbbbbb

#

but in current project im using json

umbral zealot
#

oooookkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk so keeeeeeeeeeeeeeeeeeeep usinnnnnnnnnnnnnngggggggggg quickdbbbbbbbbb

opal plank
#

@umbral zealothow's the weather there evie?

umbral zealot
#

Partially cloudy but very pleasant. lol.

boreal iron
opal plank
#

its starting to rain here

#

hoping it stops so i can go grab some grub

umbral zealot
#

ok bai

#

understandable have a nice day

opal plank
#

understandable have a nice day

boreal iron
#

Well exorcism failed - mission failed

umbral zealot
#

Well what did you expect from an inbread cat.

boreal iron
opal plank
#

"you can lead the thirsty donkey to the water, but you cannot make it drink it" - well known brazilian saying

umbral zealot
#

especially when the donkey is convinced the toxic radioactive mud pit on the way looks very appetising, eh?

opal plank
boreal iron
#

Speaking about monkeys, you like to throw your shit around, too?

#

... oh actually donkey not monkey

opal plank
#

correct, do you not see me spreading detritus around like some sort of jeovah witness?

boreal iron
#

lmao

#

I wonder you didn’t tell him to use Detritus

#

Wallet is full enough already hmm?

opal plank
#

judging that detritus means trash, wouldnt be too far off to say, yeah, you are correct, i speak the words of shit

sudden geyser
#

So detritus is a waste

boreal iron
#

lel

opal plank
solemn leaf
#

One mans waste is anothers treasure

#

?

#

Idk I dont use ut

opal plank
#

cough cough detritusjs best discord lib cough cough

sudden geyser
#

Anyway that last discussion was very aggressive. You should've just let them fail and learn for themself

boreal iron
opal plank
#

oops, sorry, my throat is sore

#

ACTUALLY

#

unironically

#

microsoft suprised me

#

and worse of all

#

its using edge

marble juniper
#

the carrot of bill gates is micro soft

solemn leaf
#

Most of us here use windows 10 each day

opal plank
#

my friend managed to compile his electron app that was 110mb down to 2mb with that

umbral zealot
opal plank
#

it uses rust for backend

marble juniper
#

rust is left in the dust

umbral zealot
#

I'm saying by experience, btw. Do a search json from: Awsome#6366 and tell me we didn't have 6 entire months of pain from one person that took this long to finally use a real database. and then we finally convinced them to switch and they did.

marble juniper
sudden geyser
#

That's how a lot of development goes. They stick with their poor solution until they learn for themself and learn to think differently

opal plank
umbral zealot
#

I'd rather stop them dead in their tracks and put them on track for at least a decent place rather than let them wallow in the mud for months

marble juniper
opal plank
#

he wasnt putting any effort to even understand, hence why i gave up and just asked evie hows the day

umbral zealot
#

because once the system has been implemented with something shitty, changing it is even harder than preventing it from happening in the first place

#

we know this.

marble juniper
#

export ur data
import ur data

umbral zealot
#

This is experience talking

marble juniper
#

loioooooooool

opal plank
#

i consider myself a good dev, but every 2 weeks i come back and think " who wrote this shit code", just to realise it was me

marble juniper
opal plank
#

even experienced devs will look back and see the flaws and shit design of their own code

marble juniper
#

lol

opal plank
marble juniper
#

what it I reverse it and you kiss me and bite my dog

#

😳

opal plank
#

the dog would bite me back, duh

boreal iron
opal plank
#

i legit look back just 2 or 3 weeks

boreal iron
#

But the funny story is it worked, too even if it was trash

opal plank
#

perhaps even a month at best

#

dont get me wrong, i have a great capacity of making things work. Now, efficiency, thats a different story

marble juniper
opal plank
marble juniper
#

but that first part doe 😳

opal plank
sudden geyser
#

Programming is a learning curve where everyone's curves are different. Programming is not meant for everyone, but if you choose to proceed regardless, it's uncommon to run into people like that (in fact, I'd say most programmers are like this today). I personally believe, no matter how inexperienced the person is, failure and bad solutions is the fastest way to improve, as opposed to aggressively forcing a solution on someone.

Anyway, I have to go to school. See ya

opal plank
marble juniper
#

time to roast him on his way to school

sudden geyser
#

yes

opal plank
#

why should you go outside putting your hand in fire?

marble juniper
#

lol

opal plank
#

why do you need school to teach u?

boreal iron
#

Imagine going to school... ewww

opal plank
#

its better to learn from someone experience so you can jump straight into the "good dev" than being stuck in the mud for years until you finally pick up good habits on your own

#

you might flail at HOW to do it, but its always best to ask what approach you should take, at the very least

umbral zealot
#

"If you do not heed the lessons of history you will be doomed to repeat them". I try to teach the lessons of history to people.

opal plank
#

you have the path, you just missing the legs to walk it

umbral zealot
#

IF they won't listen they can go fail on their own, I'm not going to help them

opal plank
#

^^

boreal iron
opal plank
#

the issue is that, the more time i spend trying to tell them, the angrier i get that they dont listen and made me waste all my time when they arent even willing to listen even after asking

umbral zealot
#

Right.

boreal iron
#

Don’t bother him he’s at school to learn something!

umbral zealot
#

Yes, being taught the right methods to do things. Whoddathunkit

boreal iron
#

This generation might be our future.
Don’t ruin them hindsight

umbral zealot
#

hey no I'm supposed to be the generation of our future

opal plank
#

same generation that ate tidepods

umbral zealot
#

or was that our parents

opal plank
#

cant get worse

boreal iron
#

lmao

#

Actually true

opal plank
#

And that was our Ted Talk. Thank you for coming!

boreal iron
#

==> PING <== State is now: ERROR (13:48h 2021.05.18) State before: OK (was 15 days)
yikes and the node died

sudden geyser
#

You can still help them (look no further than me). I feel a lot of people don't recognize that this channel is more or less for beginners (in fact, I'd say this server is for beginners). I still think people should experience failure and see the light from it and learn to adopt great standards early on, but I feel the way some members offer solutions is done poorly. It often stems from aggressively pressuring users to accept "suggestions" or diminishing their current solution for the wrong reasons. I'd like to explain more but typing on a phone is hard while walking.

marble juniper
#

ok

#

but why not jump straight to the light

sudden geyser
#

It's harder for beginners to capture it

eternal elbow
#

Hi, I wrote a backend with express and then I wrote auth with passport-discord. The auth works fine but I have no idea how to pass it to frontend, can you help?

#

@earnest phoenix

#

I especially expect from you :D

tacit sequoia
umbral zealot
#

I presume that means you're doing a reactjs front-end?

eternal elbow
#

Yes

umbral zealot
#

You didn't say but it feels implied

eternal elbow
umbral zealot
#

mostly this is done from the express, and the sessions

earnest phoenix
#

pass it as a prop in getServerSideProps if you're using nextjs

umbral zealot
#

Here's the magic: React doesn't need to "deal" with the authentication

#

react gets a cookie when you create the session in express

#

and it uses that cookie on every request

#

the back-end reads that cookie

#

That's your authentication

eternal elbow
eternal elbow
umbral zealot
#

Basically yes. Express will generate it when you create the authenticated session as part of the passport-discord process

eternal elbow
#

But it is not necessary to change the code and change the query there, right?

umbral zealot
#

Not from the react side, no

#

Because you're querying the same back-end endpoints, and the back-end checks the auth

eternal elbow
#

So a final question is one of the ports 3000 and the other 3001 does that make any difference?

umbral zealot
#

no that's just... ports.

#

So, now, let's say you want to have a "secure route" in the front-end, right? You want to not show, say, an "admin" link to normal users. Or just a "my profile" link for authenticated users.

#

What you need to have is an endpoint to get the current logged in user's "state". I usually have /me that returns the current username, avatar, and status, whether they're admin, etc. This is sent from Express, and if the user is authenticated you get a response, otherwise you get a 403

#

So now you know, from React, on page load, whether the user is authenticated or not ^_^

eternal elbow
umbral zealot
#

You can't read cookies from react

#

you can't read cookies from javascript at all from within your page

#

that's the magic of it - you don't check auth directly from your app

eternal elbow
#

API ?

umbral zealot
#

you just query backend URLs which will return data if authenticated but return a 403 if you're not authenticated

#

So if you do GET /api/me and that returns, say, { username: 'SteoidVoid", isAdmin: true } then you know that you're authenticated, your username, and that you're admin

marble juniper
#

what about the state parameter

#

for oauth2

umbral zealot
#

the what now

marble juniper
#

its just for security

umbral zealot
#

passport-discord deals with this already on its own

marble juniper
#

to prevent clickjacking and csrf

#

no but

#

the state parameter has to be appended by frontend

#

doesn't it

umbral zealot
#

We're talking about FE<->BE authentication here with express, not oauth2 login

#

session management !== oauth login

marble juniper
#

k

earnest phoenix
earnest phoenix
#

like ejs

umbral zealot
#

hhhfgngngngng

dense spire
#

does anyone know a goodway to bold inside of a codeblock?

umbral zealot
dense spire
#

through code?

#

cause discord supports bolding inside

umbral zealot
#

Are you talking about a markdown codeblock, or an html <code> block?

earnest phoenix
umbral zealot
dense spire
#

this bad boy

umbral zealot
#

we just had an entire conversation on this where I gave them information, please.

umbral zealot
#

you cannot format inside a codeblock.

dense spire
#

but i did striking inside

rocky hearth
#

in a container, I've make an image follow my cursor, with top and left values with js.
I was thinking if it is a good idea to use these, or I should use transform translate for the img to follow my cursor in that container
bcoz I hv read that translating an element is faster

umbral zealot
#

What do you mean you did striking inside

dense spire
#

i struck a specific line inside a code block

umbral zealot
#

I can do test but that's still formatting outside of it

dense spire
#

no no

umbral zealot
#

you can only affect the entire codeblock

earnest phoenix
dense spire
#

in code i did it inside

umbral zealot
#

there's no formatting inside

#

if you did, it's a bug.

dense spire
#

i did it with the

#

'\u0336'

earnest phoenix
#

Hi, I wrote a backend with express
that's why express

dense spire
#

character

#

but it doesnt work the same for bolding : (

umbral zealot
#

which you apparently didn't read at all 😛

eternal elbow
umbral zealot
earnest phoenix
umbral zealot
#

No he didn't mention it, but again, we had a full conversation about this

#

smh people replying to 15-minute old questions without scrolling down

marble juniper
#

imagine not replying to a year old message

dense spire
#

i think '\u0336' works cause its not true striking. Rather its a character that overlaps with the character in front of it

umbral zealot
#

probably

dense spire
#

cause theres still slight spaces when inserting

marble juniper
#

I replied to ur message from may 6th

#

have fun

umbral zealot
#

yes I can see that

earnest phoenix
#

autorise

#

cn any one say how

zenith terrace
#

what

earnest phoenix
#

OAuth2

wary swan
umbral lake
#

hey I have a question

#

how to make a autorole but like:

#

when i have a invite.gg in my statut, the bot add a role?

umbral zealot
#

This sounds like you're trying to get people to advertise a server and give them a reward for it. Don't do it, that's against the discord ToS

umbral lake
#

😮

umbral zealot
#

Any feature where you give something in return for advertising is bad. Don't do it.

umbral lake
#

ok ok

rocky hearth
#

hey evie, u know react well?

earnest phoenix
#

how does discord change the window href without the browser reloading the page

umbral lake
#

oh and just

umbral zealot
umbral lake
#

this:

#

omg, i just‫ my message ‫

#

its against discord tos?

#

or no?

umbral zealot
earnest phoenix
#

how

umbral zealot
earnest phoenix
#

there's a window API method for that?

umbral lake
#

a bot can write on a website?

umbral zealot
umbral lake
#

and copy something of a website?

umbral zealot
#

uhhh I mean, you can programatically read and write to websties using code, yes

#

"bots" don't do that

#

code does

umbral lake
#

oki

umbral lake
#

because the glitched edited message, its a website

umbral zealot
#

uhhh what

#

I've no idea, and that's not consequential to bots at all

umbral lake
#

oh

umbral zealot
#

any programming language that can do queries on a URL can read websites

#

which is most of them

earnest phoenix
#

even lolcat can do that

#

iirc

rocky hearth
#
function () {
  const dot = useRef(<Dot />)
  const onClick = (ev) => {
    // Error: Argument of type 'Element' is not assignable to parameter of type 'Node'.
    ev.currentTarget.appendChild(dot.current)
  }
}

this onClick event is applied to multiple buttons.
I want to append the same dot to these buttons, without instantiating a new dot
so the dot can be moved to each button one by one
So how do I achieve something like that

umbral zealot
#

I have a feeling you're going about this entirely the wrong way

earnest phoenix
#

dot.current

urban snow
#

Showing ping on mongoose is like this, isn't it?

  await sunucuschema.findOne();
  let DatabaseLatency = Date.now() - DatabaseTimeNow;```
umbral zealot
#

don't programatically append shit using code, that's not how react works.

#

Change your data, and have it update from your render function

#

that's how you do it

earnest phoenix
#

add an id to every button,use state to store the button id and render the dot beside the correct button on rerender

frigid warren
#

It can be

cinder patio
rocky hearth
#

hmm, and then check the position with button position?

cinder patio
#

I'd have an array with all the buttons and their content, rendering each of them via map

umbral zealot
#

Again, use actual data that you modify, and then render from that data

#

instead of mixing up rendering in your setup function

#

This is a no-no in react.

rocky hearth
#

ok, lemme try

cinder patio
#

button position = button index in an array

#

and set the key to the button's content if it's not unique, if it is then use the index

#

This is for the chess game right?

ionic hawk
#

is there a better way of making an xp bar than using the boxes emojis

pale vessel
#

circle emojis

#

take it or leave it

cinder patio
#

you can use custom emojis

#

and make one yourself

ionic hawk
cinder patio
#

unless it's in the footer

#

of an embed or smth

rocky hearth
ionic hawk
ionic hawk
cinder patio
#

The title of the field or the content?

ionic hawk
#

content

cinder patio
#

Then you can use custom emojis

ionic hawk
#
embed.add_field(name="Progress Bar [lvl]", value=boxes * ":blue_square:" + (20-boxes) * ":white_large_square:", inline=False)``` i wanna use something else cuz it bugs alot and it ends up creating more boxes if all the boxes are filled
clear marlin
#

it should work

rocky hearth
#

can I add classes to element with ev.currentTarget.classList.add('dot') dynamically though?

cinder patio
#

You shouldn't do that in React

#

kinda defeats the purpose

umbral zealot
#

Exactly

rocky hearth
#

I was hoping to add/remove classes, and use dot::after in css

cinder patio
#

you can still use add / remove classes, but use state

ionic hawk
umbral zealot
#

You can have a dynamic/conditional class in your render function

ionic hawk
#

how does the mee6 xp bar work? is it a custom emoji too?

solemn latch
#

You mean the image they generate?

ionic hawk
#

oh yeah its an image

#

how is that made?

solemn latch
#

Mee6 probably does it completely custom for efficency.
But many bots use canvas

ionic hawk
#

oh

rocky hearth
ionic hawk
#

ill check it out

#

thanks

cinder patio
#

too bad they're using python

ionic hawk
#

im using python...

#

is that js only?

rocky hearth
#

mee6 is python bot?

cinder patio
#

I'm sure there's a library equivalent to canvas for python

#

just gotta search for it

ionic hawk
#

so mee6 is a js bot?

pale vessel
#

Pillow

pale vessel
#

Not sure if it's still the same

ionic hawk
#

i see

cinder patio
#

but w/e

dense spire
#

how do i get the shard amount from commands.AutoShardedBot

#

python 3.6.9

earnest phoenix
#

@livid jackal help

#

-botinfo 559726241280688130

gilded plankBOT
#
Bot info
ID

559726241280688130

Username

Watcher

Discriminator

8293

Short Description

This bot watches over the bots in the top.gg server to make sure everything is following the rules uwu

Library

discord.js

Prefix

watcher

Total Upvotes

17

Monthly Upvotes

2

Server Count

15 Servers

Owner(s)

@coral trellis dblMod dblCertified
@tulip loom

Links
pale vessel
#

watcher help

#

watcher ping

#

oasijapsida

copper cradle
#

dam

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

pale vessel
#

LOL

#

I thought this was commands

crimson vapor
#

watcher watch

pale vessel
#

fr

crimson vapor
#

🇫🇷

sage bobcat
#

One message removed from a suspended account.

earnest phoenix
stable eagle
#

Is there a way to message collectors continue after bot restarts? So that new ones don't need to be made

vivid fulcrum
#

you're going to have to make new ones regardless

umbral zealot
#

no, if you have collectors you'd need to start them again after reboot

#

alternatively, you should consider using regular events for this sort of functionality

lyric mountain
pale vessel
#

yooo we're from the same country!

zenith terrace
#

you could also use the pretty-ms package which will return the hours/minutes etc themselves

eternal osprey
#
var thenum = response.replace( /^\D+/g, '');
 
    
    if(m.embeds[0].fields[0].value.includes('Time travels')){
      userman = await guild.members.fetch(`${first}`)
      console.log(thenum)
      if(thenum = 1 || 0){
        console.log(thenum)
        message.channel.send(`**You have **${response} **. I am giving you the Super Miniboss 500+ role and tt0-tt1 role, If you want to remove any of the roles , react in [#839731098153517099](/guild/264445053596991498/channel/839731098153517099/)**`)
        userman.roles.add(rolett1)
      }else{
        userman.roles.remove(rolett1)
      }```hey why is thenum first logging 4 (the right number) and then 1?
distant cobalt
#
client.on("messageReactionAdd", async (reaction, user) => {
    const Logchannel = client.channels.cache.get('843647036394176580')
    Logchannel.send(`${user} sent ${reaction}`)
})``` why won't this work? there isn't any errors, nothing happens.
umbral zealot
#

by default this will not listen to reactions on old messages (uncached messages sent before the bot started)

earnest phoenix
#
import discord
from discord import colour
from discord.ext import commands
import config

class status(commands.Cog):
  def __init__(self, bot):
    self.bot = bot
  
  @commands.command(name=f"check-status", aliases=['cs', 'check-s'])
  async def check_users_status(self, ctx):
      if "support me" in str(ctx.author.activites):
        print("Should work I hope")
      else:
          print(f"the activity is {ctx.author.activites}")

def setup(bot):
  bot.add_cog(status(bot))``` trying to see uses activity but doesn't work. `prints None`
mental raven
#
@client.event
async def on_message(message):
  if message.author == client.user:
    return
  for happyWords in message.content:
    randomDis = random.choice(disencouragements)
    await message.channel.send(randomDis)
    break

Why this not work? It's replying to every message I send not the ones I have in the list

sudden knoll
#

because you did for happyWords in message.content: ie everything

umbral zealot
#

Because you're telling it to send a message for each word in the content

mental raven
#

oh

sudden knoll
#

and then you break immediately so it does it once each message

umbral zealot
#

you seem to be missing... some sort of condition? Or the understanding of what is a condition versus a loop.

sudden knoll
#

also use snake_case in python

mental raven
sudden knoll
#

that's more a style nitpick, but it's a good habit to follow style conventions

mental raven
sudden knoll
#

idk what are happyWords

#

idk your code

mental raven
#

it's a list

sudden knoll
#

so check if a word in that list is in message.content

mental raven
#

ye

sudden knoll
#

you should be able to do that yourself

mental raven
#

wdym?

umbral zealot
#

sounds like that'll require some double loop. "for each word in happyWords, check if it matches one of the words in the content"

distant cobalt
#
if(reaction.message.id == 844229915116830821){
        reaction.remove()
    }``` i only want the bot to remove the author's reaction. not everyones reaction. how can i do that?
earnest phoenix
umbral zealot
#

activites

earnest phoenix
#

I changed it

#
import discord
from discord import colour
from discord.ext import commands
import config

class status(commands.Cog):
  def __init__(self, bot):
    self.bot = bot
  
  @commands.command(name=f"check-status", aliases=['cs', 'check-s'])
  async def check_users_status(self, ctx):
      if "support me" in str(ctx.author.activities):
        print("Should work I hope")
      else:
          print(f"the activity is {ctx.author.activities}")

def setup(bot):
  bot.add_cog(status(bot))```
#

see

mental raven
#

I think you need to actually have a status

sudden knoll
#

have you tried stepping through the code and looking at what your local variables are

umbral zealot
#

I'm guessing ctx.author.acitivities is.. some stucture. like a dict or soemthing.

earnest phoenix
umbral zealot
#

it's not a string you can just throw in a message

earnest phoenix
#

wdym

umbral zealot
#

you need to format this correctly

sudden knoll
#

it's a tuple

mental raven
sudden knoll
#

that does nothing

#

an f string autoformats to a str

mental raven
#

oh yewah

#

me stupid

#

i forgot

earnest phoenix
#

?

#

oh

mental raven
#

hmm

earnest phoenix
#

nah it's needed

mental raven
earnest phoenix
#

when is it a good idea to use a react class component

cinder patio
#

honestly, never - function components can do anything class components can

#

but if you prefer the syntax, then go ahead

umbral zealot
#

The time where you'd use class components is when you want to extend them

#

which is rare enough

static trench
#

hello, I am trying to use an API that is a web link and than the api output at the link. how do I incoroprate that into my D.py bot? in other words, how do i send to the channel the API output from the link? the api is here: http://161.35.137.131:3001/info

cinder patio
#

is that your ip?

static trench
#

no

#

not even close

#

its a crypto currency

earnest phoenix
#

that is zibiz pool's ip ig

static trench
earnest phoenix
#

pog

static trench
#

so how can I incororate the output from an api call to a discord.py bot?

earnest phoenix
earnest phoenix
#

idk py

static trench
#

ok

earnest phoenix
#

but ig you use the requests thing

static trench
#

ya

deep mantle
#

use requests or something to scrape it, get the json and send it

static trench
#

ok

earnest phoenix
#
import requests
pale vessel
#

Use aiohttp please

earnest phoenix
#

since when did flaze know py

static trench
#

lol

deep mantle
static trench
#

@deep mantle @earnest phoenix @pale vessel ty for ur help. ill google and try and figure out

sudden knoll
# earnest phoenix I
  1. you need the presences intent
  2. activities returns multiple activities if there are multiple so you'll need to format with that in mind
earnest phoenix
sudden knoll
#

but you're checking activities not message

earnest phoenix
sudden knoll
#

activities != status

earnest phoenix
sudden knoll
#

very different things

earnest phoenix
#

Could you help me code it then please because I am so lost.

sudden knoll
earnest phoenix
#

guys can someone help me with my minecraft server command? I dont know whats wrong. I'd appreciate it. :)

sudden knoll
#

read the attributes

sudden knoll
#

read the attributes

umbral zealot
earnest phoenix
sudden knoll
umbral zealot
earnest phoenix
#

Hmm

umbral zealot
#

it's saying ping isn't a function, but you're not using ping

#

so it's in their code

#

¯_(ツ)_/¯

earnest phoenix
#

Oh yea ik

#

i changed it

earnest phoenix
#

to npmmc

#

there

#

same thing

umbral zealot
#

Ah, right, ok

earnest phoenix
# sudden knoll that would be how to change your own status
import discord
from discord import colour
from discord.ext import commands
import config

class status(commands.Cog):
  def __init__(self, bot):
    self.bot = bot
  
  @commands.command(name=f"check-status", aliases=['cs', 'check-s'])
  async def check_users_status(self, ctx):
      game = discord.Game("support me")
      if str(game) in str(ctx.author.activity):
        print("Should work I hope")
      else:
          print("yikes")

def setup(bot):
  bot.add_cog(status(bot))```
umbral zealot
#

uhhhh this sounds like an rtfm moment, hold on

sudden knoll
earnest phoenix
#

oh 1 sec

sudden knoll
#

there's an attribute called status

#

it's in the docs

umbral zealot
# earnest phoenix

it in, indeed, not a function. Seems like you're missing the thing you want to do with npmmc

#

ther'es .status(), .query(), .scanLAN(), etc

earnest phoenix
#

Ok ty

earnest phoenix
# sudden knoll I see you're still checking activity not status
import discord
from discord import colour
from discord.ext import commands
import config

class status(commands.Cog):
  def __init__(self, bot):
    self.bot = bot
  
  @commands.command(name=f"check-status", aliases=['cs', 'check-s'])
  async def check_users_status(self, ctx):
      game = discord.Game("support me")
      if str(game) in str(ctx.author.status):
        print("Should work I hope")
      else:
          print("yikes")

def setup(bot):
  bot.add_cog(status(bot))```
sudden knoll
#

why are you looking for game

#

wut

#

statuses don't have games

umbral zealot
#

What in heavens is discord.Game() ?

sudden knoll
#

activities are not statuses

#

like I said before

#

they're not the same thing at all

earnest phoenix
#

...

umbral zealot
#

oh it's a special thing... I see.

#

can't just, like, check a string or something? smh

earnest phoenix
#

I just the bot to tell me Yes or No if this says "support me".

sudden knoll
sudden knoll
earnest phoenix
#

You just confuse me

sudden knoll
#

you confuse me

#
 @commands.command(name=f"check-status", aliases=['cs', 'check-s'])
  async def check_users_status(self, ctx):
      if "support me" in str(ctx.author.status):
        print("Should work I hope")
      else:
        print(f"the activity is {ctx.author.status}")
earnest phoenix
#

They I change it to status and you say why you doing that smh

sudden knoll
wind kayak
#

i need a free vps for hosting discord bot if you know any pls tell me with ping

umbral zealot
#

why does it sound like you're gearing yourself to checking whether someone has an invite status so you can give them a reward

umbral zealot
worn sonnet
#

Lol free hosts is something u will never get

earnest phoenix
sudden knoll
earnest phoenix
#

it sends:

#

I don't want that

earnest phoenix
#

and it's wrong

#

I am online

#
  • It doesn't do what i wanted it to.
worn sonnet
#

What do u want? lazy to read the messages above

wind kayak
thin quarry
umbral zealot
#

Repl.it can work but it's very limited in power and you will most likely end up sharing the IP of someone that's api-banned and not be able to use your bot

#

There are no good free hosts.

thin quarry
worn sonnet
#

But it's pain in as* when something doesn't work

umbral zealot
wind kayak
worn sonnet
worn sonnet
earnest phoenix
umbral zealot
wind kayak
worn sonnet
worn sonnet
umbral zealot
earnest phoenix
thin quarry
#

doesnt matter for me at least

worn sonnet
umbral zealot
#

So, it's a thing to be considered. Repl.it isn't private, IPs are shared so it can be blocked, and you need a web server with external ping service. All these things make repl.it not as good as a paid host and thus not a good host.

umbral zealot
earnest phoenix
umbral zealot
#

They want to know if someone has a specific custom status. it's pretty simple. they're using a python bot.

thin quarry
#

@umbral zealot there is an alternative

worn sonnet
#

So u want to see the custom status of a user

thin quarry
#

buy a raspberry pi

umbral zealot
#

Of course there's always alternatives. raspberry pi is fine. But it's not free.

worn sonnet
umbral zealot
#

smh

earnest phoenix
umbral zealot
#

yes so do I, that's not the question or the point

thin quarry
umbral zealot
#

depends where you live

novel jetty
#

Could someone help me with this? I can't seem to be able to fix the issue

#

Its djs

umbral zealot
#

sounds like active.channelID was not a valid channel ID, thus get() returned null

thin quarry
worn sonnet
#

Tried this?

umbral zealot
# thin quarry but you can pretty much have infinity bots

Not at all, rPIs are very underpowered and cannot run a lot of code. You can get away with a few, but none very large, and certainly not music bots or bots manipulating images. It's limited, it's not free, it requires an always on power and internet connection, thus does not fit the definition of "free host"

mental raven
#

Why does my bot randomly go offline?? I host it on repl.it and uptimerobot

thin quarry
#

and i deal with it

umbral zealot
#

... did you not just say repl.it works fine for you??? lol

worn sonnet
# thin quarry dats rare

For someone like me who uses internet connection via phone and runs the bot on heroku, it's the common issue

umbral zealot
#

Arguing a solution works great then agreeing the solution doesn't always work is such a karen move.

earnest phoenix
thin quarry
worn sonnet
earnest phoenix
#

Ehh

thin quarry
umbral zealot
#

You do a lot of this "for me" crap. You have to take other people's needs into considerations, not just yourself.

earnest phoenix
worn sonnet
earnest phoenix
#

I will make a Command on my server

I will make /Fessel
Bot:"Du fesselst jemanden" I will make that so

#

Can i get help?

earnest phoenix
# worn sonnet Explain pls

Like if it says "support me" I want it to say in a channel they have "support me" in status else they don't have it.

worn sonnet
umbral zealot
sudden knoll
#

I have figured out the errors

worn sonnet
#

Use

await channel.send(f"{status}")```
earnest phoenix
worn sonnet
#

I don't remember if get_channel is Coro or not

sudden knoll
#

why is a custom status under CustomActivity, wack

worn sonnet
#

?

deep mantle
sudden knoll
#

to see a custom status, it's in CustomActivity

#

get_channel(ID) is correct

#

for python at least

umbral zealot
umbral zealot
#

What did you do, what did you try, what problem are you having?

worn sonnet
umbral zealot
#

We're basically talking about having a ping/pong command with different text

worn sonnet
#

Oh oke

umbral zealot
#

shouldn't be that hard, but it requires you to... y'know, at least have a bot that exists.

earnest phoenix
sudden knoll
#

I think he's doing slash commands

umbral zealot
#

is it though

worn sonnet
#

Oh

umbral zealot
#

could be just a prefix