#development

1 messages · Page 191 of 1

north cairn
#

bro i cant see anything fr

#

i can make that in console

lyric mountain
#

Yes, it's supposed to be with console

north cairn
#

like first get the number,then get the operator,then get second number

lyric mountain
#

Yes

#

Then do more complex stuff

#

A snaker game is a really nice project

#

Yk, the snake that has to eat apples and avoid its body

north cairn
#

oh yeah that

#

does not that include animation

#

taht possible in js?

lyric mountain
#

I do it in every lang that I start

quartz kindle
#

yes, using canvas

#

or svg

lyric mountain
#

Even console tbh

quartz kindle
#

yes even console

lyric mountain
#

Just need to clear it on every frame

quartz kindle
#

remember that telnet link

#

that plays the entire star wars movie in your terminal

#

with ascii

#

telnet to towel.blinkenlights.nl

#

lmao

north cairn
#

on the internet,i only find snaker games with web dev

lyric mountain
#

The concept is the same on every lang

#

Arrays + recursion

#

But that's just an example, you can come up with any project u want

quartz kindle
#

thats also where knowledge about computer science comes in, it helps you determine the limits of each language and environment and lets you know what is possible and what is not possible

lyric mountain
#

The more you challenge yourself, the better you'll become

quartz kindle
#

become a challenjour

lyric mountain
#

Just try to avoid online help as much as you can, except for documentation ofc

#

Only resort to it when u become truly stuck

north cairn
#

alright thanks guys

#

i'll dive into javascript

quartz kindle
#

also, dont stress yourself too much

#

we got to where we are after many years of experience

#

you'll get there as well

north cairn
#

btw you guys are web devs or application devs or what

#

must be doing job somewhere right?

quartz kindle
#

i work on my own personal projects, i do freelance work and i teach js part time

north cairn
#

freelance hmmm
so website slike fiverr and all?

sage bobcat
#

One message removed from a suspended account.

quartz kindle
#

it mostly through my bot and linkedin

#

my area is pretty niche

#

astrology/astronomy programming

north cairn
north cairn
#

linkedin ohh

#

cool

#

let me try your bot actually

covert ingot
#

so let's say, the url is quote/quote-here then for the quote-here quote the textbox be a slightly darker colour

#
    if (keys.includes(req.params.id)) {
        console.log('yes' + req.params.id)
        key = req.params.id;
    } else {
        console.log('no')
    }``` I am assuming I am supposed to add something in the if the conditoon is true - however I am unsure
#
         <% Object.values(constants.quotes).forEach((q) => { %>
         <div class="col-6">
            <a href=""></a>
            <div class="p-3 border"><%- q %></div>
         </div>
         <% }); %>``` for the `a href="<key here>"` i am unsure on how to match the `object.value` to the `object.key`
pale vessel
#

u can use Object.entries(quotes) instead

#

that will give both key and value in an array

covert ingot
#

Let me tryhow would I display?

pale vessel
#

Object.entries(constants.quotes).forEach(([key, value]) => {

covert ingot
#

that works - thank you

quartz kindle
#

for example, you already have a class p-3 and border in your div element

#

you can change the color style for one those classes

#

or create a new class and add it to the div

#

and set the color for that class in your stylesheet

sage bobcat
#

One message removed from a suspended account.

quartz kindle
covert ingot
quartz kindle
#

or add an inline style

#

<div class="p-3 border" style="color:<%- colorvarfromjsside %>"><%- q %></div>

covert ingot
#

yh but then it'd change all the colour? not the specific one though right?

#
      <div class="row gy-5">
         <% Object.entries(constants.quotes).forEach(([k, q]) => { %>
         <div class="col-6">
            <div class="p-3 border">
               <a class="quote" href="<%- k %>"></a>
               <%- q %>
            </div>
         </div>
         <% }); %>
      </div>``` this is how it is looking now
deft wolf
#

Specific one

covert ingot
#

Ah

#

Let me try

quartz kindle
#

you will need to define which colors for which quotes in your quotes data

#

and specify a variable for them

covert ingot
#

thats what I am struggling to do, how would I go about doing that?

quartz kindle
#

for example, you already have a quotes object

#
{
  abc: "my abc quote"
}
#

you can simply make the quote an object so it can have multiple values

#

and add a color to each quote

#
{
  abc: {
    quote: "my abc quote",
    color: "#ee44ff"
  }
}
#

of course, since you're changing your structure, you will need to adapt your code accordingly

quartz kindle
#

you're using Object.entries(constants.quotes).forEach(([k, q]), which means the variable k is the key in the object, ie "abc", and the variable q is the value of that key, whcih before was "my abc quote" but now its { quote: "my abc quote", color: "#ee44ff" }

#

so instead of using q directly, you will now need to use q.quote or q.color

earnest phoenix
#

i keep getting "Authentication failed" from mongo even though my creds are correct?

frosty gale
#

or your syntax is incorrect

#

i assume youre trying to connect to mongodb atlas?

earnest phoenix
frosty gale
#

pterodactyl?

soft laurel
#

When it comes to sharding, is it pretty simple to implement this in k8s? I'm thinking 1 shard per Pod. Curious what other people have done or if this is overkill

lament rock
#

There isnt really anything special with sharding. If your gateway logic is simple enough, you can implement cluster logic and make use of multiple cores or push the single core to the limit. Depending if you need message events then spreading more would be beneficial

soft laurel
#

My question makes it seem like I know more about it then I do lol, when you say the gateway logic, I'm hearing a seperate service to handle the incomeing requests that get forwarded to the appropriate shard. I'm using the JDA library to implement the discord bot.

lament rock
#

Idk if jda is just monolithic, but the idea to not be monolithic if you want to spend less on servers and have your logic separated into where it makes sense like gateway and worker logic

soft laurel
#

ah I gotcha

#

I've been looking through JDA and it sounds like it's more monolithic. But i'm hearing ya

#

It's not worth it to me to implement the discord API myself lol. Thanks for the advice

earnest phoenix
#

and also

#

here's a live issue of this happening

#

and hence this happens in node

#

even though it doesn't happen in compass

storm kernel
#

you can run anyof your shards on any hardware anywhere so, so using a k8s pod per shard makes sense

quartz kindle
#

the problem is sharding across different machines takes a lot of orchestration and synchronization

#

rest rate limits need to be centralized, shard connection statuses also need to be centralized and correctly queued

storm kernel
#

Uhhh, I don't think that's the case

#

Pretty sure one can think of each "shard" of your bot as completely independent from each other

quartz kindle
#

yes, the shard itself

#

but not the rest api, and not the login sequence

#

ie, how many shards can login at once, and which shards

#

which is important when handling reconnections

#

for small bots its fine, since you can ignore and retry

#

but for big bots you wont be able to ignore such things

storm kernel
#

ah, the max_concurrency field on start?

quartz kindle
#

yes

storm kernel
#

guess i've never had a bot get large enough to care about that haha

#

but even more reason you could build out in k8s to make some of that inter-shard communication 🙂

quartz kindle
#

max_concurrency works in buckets, so for example if you have 160 shards with max_concurrency 16, you can login shards 0-15 concurrently, but not shards 0,16,32,...

#

if shard 16 disconnects, you need to check if shard 0, 32, 48, 64, ... are connecting before you reconnect

#

so you need to have some central server to handle that part

earnest phoenix
#

uhhhhh why?

#

lol isn't this optional?

warm surge
#

oooo

#

free mongodb jk

stark abyss
#

Is fire base config considered environment variable or not? I am so confused

#

Like the API key, etc

earnest phoenix
sturdy shuttle
#

uh

civic scroll
tulip ledge
#

I'm trying to generate best case array for quicksort, this is the code I'm using:

fn make_median(arr: &mut [i32], lo: usize, hi: usize) {
 if lo >= hi {
   return;
 }

 let mid = lo + (hi - lo) / 2;
 arr.swap(mid, lo);

 make_median(arr, lo + 1, mid);
 make_median(arr, mid + 1, hi);
}

The initial array given is a sorted array. It should give the best case input for quicksort but I have a one off somewhere
For a length of seven it generates the array [3, 2, 1, 0, 5, 4, 6] which when used quicksort gives:
[2, 1, 0] 3 [5, 4, 6]
The second array is correct and can be split into [4] 5 [6]
But the first gets split into [1, 0] 2 [] when it should be [0] 1 [2]

The correct array should thus be [3, 1, 2, 0, 5, 4, 6]

tulip ledge
harsh aspen
#

Hello tim, just to inform you that intel cpus is better than that Ampere (ampere doesnt even have AVX)

lyric mountain
#

ok, does anyone here know how to work with godot? specifically godot 3

harsh aspen
#

why huh

lyric mountain
#

wait, writing context lmao

harsh aspen
#

for discord activity?

#

godot 4 is better

solemn latch
#

omg make your game use discord activities

harsh aspen
#

you are slow bro

lyric mountain
#

I'm trying to connect to value_changed signal of Slider, which I need to pass 2 additional parameters

#

however

Error calling method from signal 'value_changed': 'Control(Settings.cs)::_SliderValueChanged': Method not found..

lyric mountain
#

and I'm not going to use a python-like language

#

yikes

harsh aspen
#

4.3 does I guess

lyric mountain
#

doesn't

#

else I'd not be backporting my 4.3 code back to 3.6

harsh aspen
pale vessel
#

kuylar moment

lyric mountain
# harsh aspen

I'll get an earlier commit of my repo to try it, brb in a sec

harsh aspen
lyric mountain
#

the buttons are grayed out

#

4.3.dev5

harsh aspen
#

ouch

#

maybe because of C#

#

bad luck

lyric mountain
#

yes, that's why I resorted to 3.6

#

iirc it's due to c# wanting to have .net as entrypoint, but godot uses something else

#

anyway, need to figure out how to connect this method to the signal

lyric mountain
#

but first I'm porting my ship game to get experience with godot

lyric mountain
#

solved it

#

stupid cause, the node path was wrong

#

anyway, now the code is fully ported back to 3.6, time to resume what I was doing

#

that being the rest of the game

harsh aspen
#

nice

north cairn
#

i hosted my bot on cloudflare workers but it keeps going off as soon as i close vs code

#

what do i do

neon leaf
#

Are you sure you deployed it?

north cairn
#

yes i did

#

when i open dashboard on cloudflare

#

it is showing my worker there

#

help guyz

north cairn
#

guys help??!

#

it is not even repsonding to commands after i close vs code

#

responding*

unborn helm
#

there probably might be an error at production, things like maybe missing token maybe?? you should review cloudflare logs if there is one (i've never used cloudflare myself).

quartz kindle
#

afaik cloudflare workers only support "serverless" bots, ie bots that only use the interactions api and do not keep an active websocket connection

dusky idol
#

Why isn't the bot returning guild owner for many servers?

#

It works for few like mine

#

when i do server.owner for others it just returns none

#

is it because the bot got into too many servers or smth?

#

but it's just in 960 servers for now

pale vessel
#

damn haven't seen jishaku in a while

dusky idol
#

Awesome but thats not helping xD

pale vessel
#

pretty sure guild.owner_id exists, so fetch the member or user using that

dusky idol
deft wolf
#

Try owner_id

north cairn
#

what is a wbesocket

pale vessel
dusky idol
#

I totally overlooked _id's existence xD

north cairn
dusky idol
#

Well for some context the system is like

the bot goes over all server's it's inside, if the command user has bot in any of his/her server, they get an extra pull every reset

pale vessel
quartz kindle
dusky idol
#

Well for now there's only 1000 servers, would it be bad to run this check once the bot's in a ton of servers

quartz kindle
#

websocket = bot keeps a constant connection to discord servers and receives events via this connection. this is the type that most libraries use, it requires keeping the connection online, reconnecting when it drops, dealing with shards, etc

pale vessel
#

unless u fetch the owner though

dusky idol
pale vessel
#

i don't think u need to, ID is enough right?

north cairn
dusky idol
#
        for guild in self.bot.guilds:
            if guild.owner_id == ctx.author.id:
                total_pulls+=1
                break```
this is the piece
quartz kindle
#

webhook = serverless type of bot that does not require a connection. instead you give discord a specific URL in your bot's page, and discord will send web requests to your url whenever you receive an interaction event, and you respond like an API

pale vessel
#

yeah that's awesomesauce

dusky idol
pale vessel
#

don't think so

dusky idol
#

hm

pale vessel
#

u just have to run that same code on every individual shard

north cairn
dusky idol
#

ah aight sounds simple

quartz kindle
quartz kindle
#

then you dont

north cairn
quartz kindle
#

yup, the first box there

north cairn
#

i remember i saw some vid about setting this cloudflare on dc bot and he did smth about that box

#

but i did not tho

#

so what is the problem rn

#

bot completely is not online

quartz kindle
#

the problem is that cloudflare workers are a serverless system, that turns itself off and on based on activity

#

and activity comes via http requests

#

a normal bot does not receive http wequests, it uses websocket

#

so to the cloudflare worker, your bot is not active

#

so it turns itself off

#

and it will turn itself on again once activity is detected

north cairn
#

so what would the solution

quartz kindle
#

but activity can only come through http

north cairn
#

nah nah wait

quartz kindle
#

which your bot doesnt use

north cairn
#

bot is not responding to commands

#

once i close vs code

#

bot goes off

#

and does not responds to command

quartz kindle
#

yes, because it turned itself off

north cairn
#

so what can i do to fix

quartz kindle
#

you cant fix it

#

unless you change how your bot works

#

and depending on the features your bot has

north cairn
#

so basically cloudflare is useless for me right now

quartz kindle
#

yes

north cairn
#

hmmm,how much changes would i need

quartz kindle
#

a serverless discord bot has to be designed from stratch, first of all you wont use a noirmal library like discord.js

#

youd need a specific library for discord webhook interactions

north cairn
#

sighs

#

so all bots like dank,carl uses that

deft wolf
#

No

quartz kindle
#

then you need to have a domain and url assigned to your cloudflare workers

#

so that when you access that URL, it runs the worker

#

then you put that URL in your discord bot dev page

north cairn
#

i saw some vid as i told and he went to some website to get some endpoint as i remember

#

well,can i get some docs/vids
Coz yeah i want my bot online 😩

quartz kindle
#

also

#

a serverless bot is never "online"

#

because it doesnt have a connection

#

and there are many features it cannot use

north cairn
#

example of a serverless bot would be?

quartz kindle
#

my bot is serverless

#

it doesnt have the online green mark

deft wolf
#

There is Giveaway bot that is serversless I think

quartz kindle
#

it responds to interactions only

#

it does not receive any other type of events, and cannot access data from other events

north cairn
#

ok and if i dont want like that
i can not use cloudflare workers

quartz kindle
#

it cant even access guild count for example

#

so i dont know how many guilds it is exactly

#

i can only go by what discord reports

north cairn
quartz kindle
north cairn
#

cloudflare was free so iused it

north cairn
deft wolf
#

Free but limited

north cairn
#

yea yea

#

so what u guys suggest me rn

deft wolf
#

But replit has its problems with rate limits

north cairn
#

500mb is just too less

north cairn
quartz kindle
deft wolf
quartz kindle
#

also, cloudflare workers can only be online for 30 seconds max

#

and have a cpu limit of 10ms

deft wolf
#

You can't create a growing bot on free hosting

quartz kindle
#

cloudflare workers are designed to run small things and only when needed, they turn themselves on when a request comes, and turn themselves off when the request is done

#

you cant run anything persistent on it

quartz kindle
#

i dont think you can find anything better for free

#

although you can try that oracle thing

#

i dont know if still exists, but they were offering free stuff up to 24gb

#

but they also cancel you for no reason

north cairn
#

hmm

#

man i am feeling i might need to leave bot dev

deft wolf
#

XD

north cairn
#

first i had memeory issues
now i have hosting issues

quartz kindle
#

what most bot devs do once their bot grows is pay for a vps

north cairn
#

yes

#

but i am not in Us

quartz kindle
#

5 bucks per month

north cairn
#

5 bucks in US might be some one's pocket money

quartz kindle
#

you dont need to be in the us, but you do need some form of payment

north cairn
#

5 bucks means to me

#

5 bucks here = 415.6

tulip ledge
quartz kindle
#

well, if you wanna stay free, either make a serverless bot, or make a cacheless bot

north cairn
#

so first thing is bot won't grow until i have some unique idea (which if is complex will require me to pay money)

north cairn
tulip ledge
quartz kindle
#

there is no message, member, presence, channel, etc events

tulip ledge
#

essentially you're only using the api to post your slashcommands

north cairn
north cairn
#

💀

deft wolf
north cairn
#

i wonder if dank and carl used to pay 5 bucks even when there bot was not grown and no donations

north cairn
tulip ledge
#

and I get 0 donations

#

I got 1 40$ donation once

#

thats it

quartz kindle
deft wolf
north cairn
tulip ledge
#

You shouldn't be developing bots with the intent of making money

#

not many bots are lucrative

quartz kindle
#

if youre making a bot for money, thats not a good idea

north cairn
#

hmm,well what else i do it for

deft wolf
#

For fun

tulip ledge
north cairn
#

and i cant be in loss right

tulip ledge
#

why can't you be in loss?

quartz kindle
#

people do it for fun, for challenge, for wanting to provide a service

north cairn
#

bro i ain't some rich guy

tulip ledge
#

I've probably spent a good 500$ on hosting my bot

#

over the years

north cairn
tulip ledge
#

but one vps can hold multiple bots

tulip ledge
#

I also have a couple other things on the vps

#

not just bots

#

like backends for some websites i made etc

quartz kindle
#

i used to make like 50 bucks a month from my bot, today i get like 10

tulip ledge
#

I would recommend a vps cause you'll learn a lot about managing a server aswell albeit on a low scale application

north cairn
#

look the thing is
i cant be in a loss coz 416 rs is smth that mean to me

quartz kindle
#

ye

tulip ledge
#

iirc there's hosts specifically for bots that charge $1-$2/month but idk how reliable they are

#

and u only get like 256mb of ram or something like that

covert palm
#

I made a bot to get what I consider to be a missing feature and already had an infra, which is good because right now I'm my only user issou

quartz kindle
north cairn
tulip ledge
#

look, you shouldn't get into bots to make money

#

if you want to develop stuff to make money go freelance websites or something

covert palm
#

there is a free tier on Google Cloud, AWS and Oracle Cloud, you can host your bot there but make sure you don't store anything important there because they can lock your account at any time for no reason

quartz kindle
#

so of you dont wanna pay, you can learn how to make it use less resourxes so yoi can stay in the free tier for a long time

north cairn
#

i dont expect much money,but should be enough to pay for vps and all

tulip ledge
covert palm
#

the free Oracle Cloud tier is generous

quartz kindle
#

i was not paying fpr vps until my bot reaxhed like 2000+ servers

tulip ledge
north cairn
#

AWs with lambda functions

#

this one dev suggested me

covert palm
#

You didn't pay for a VPS until your bot reached 2k servers
I was paying for dedicated servers before I even had a bot
We are not the same

tulip ledge
quartz kindle
covert palm
tulip ledge
#

also can't AWS charge you if you go over the limit?

#

I've seen some absurd bills for AWS

covert palm
#

(there is an in-between, but what I mean is bills can indeed grow a lot if you don't put limits in place)

#

also AWS requires quite a lot of knowledge just to understand their dashboard and the sheer amount of products they have

north cairn
#

ngl i am feeling like to leave bot dev and just develop skills for 3-4 years enough to get a job

#

web dev,mern uff

covert palm
#

I work with AWS because that's essentially my job, but I'm never using them for personal projects

tulip ledge
#

a bot is a good project to work on

#

problem is if you want it online 24/7 you'll need a reliable host

north cairn
#

bot name*

covert palm
#

you can host the bot at home on a cheap computer or Raspberry Pi

tulip ledge
covert palm
#

in the learning phase you don't need 24/7

tulip ledge
#

yeah but if you're, like them, only developing for making money you'll need 24/7

north cairn
#

well techinally if i see
I can make projects
and what can happen if i dont host

earnest phoenix
#

Hi

north cairn
tulip ledge
#

but like we said earlier, especially if you don't have enough skills yet you'll want to make projects to learn

#

and imo a cheap vps is definitely worth it

#

you'll learn skills to manage your server which is essential if you're looking to get a CS job

#

you'll also want to learn docker and stuff like that which is also an essential tool to learn

north cairn
#

hmmm

#

i'll get into web dev ig

covert palm
#

make a bot that can run on your computer, you can install tools like Docker or Node.js or Python just fine

tulip ledge
north cairn
#

ik ik linux is god

#

(hacking)

covert palm
#

:(

tulip ledge
earnest phoenix
#

Raspberry Pi

north cairn
covert palm
#

once you have a working bot, come back to us and I'm sure we'll find a way to find you a VPS lol

tulip ledge
covert palm
covert palm
#

my own bot will be verified the day I'm not its sole user issou

north cairn
#

👀

#

do some marketing when

tulip ledge
#

it's interesting

#

add support for toml aswell

covert palm
#

it was imagined by b1nzy, a former Discord employee, when he made rowboat

tulip ledge
#

because rust

covert palm
#

Aperture is a rowboat clone that spawned when rowboat was stopped

#

then it was maintained, iterated on, etc.

covert palm
north cairn
#

JUST DO IT

covert palm
#

it's like, if you need it you'll probably find it, otherwise you have no reason to invite it lol

north cairn
#

about me-
Aperture - link
My own bot(name) - link

covert palm
#

technically it's one of the many domain names on my profile already

pale vessel
covert palm
#

I didn't even remember we had that emoji on ShareX lmao

unborn helm
# north cairn man i am feeling i might need to leave bot dev

if you are just looking to keep your bot online for now, one thing you can do is dockerize your server and host the image locally using the docker desktop app, this should keep your bot online without relying on your local development environment.

uncut timber
#

Why cant i submit my bot?

charred nest
lyric mountain
#

at best you'll break even, very very rarely you'll go positive IF the bot is popular enough

#

you oughta think about it as personal hobby (so you're never at loss, as you're investing in yourself) or you'll jump out of it

#

also I saw you mention web dev, I have bad news for you lul

north cairn
north cairn
solemn latch
#

Have you thought about trying to take advantage of some referral programs?

#

Galaxygate has a $3 a month vps, their referral program offers 10% of whoever uses your referral link.

a hanful of people using your refferal link would cover that $3 a month.

#

I just list my referral link in my discord profile and it can cover a large amount of my VPSs'

wheat mesa
#

Oracle has VPSs for free

#

Just sayin

#

No idea why nobody ever mentions it, it’s perfect for discord bot hosting, especially if you can’t afford a “real” host

#

(You still need a debit card for verification purposes but no purchase is required)

tulip plume
neon leaf
#

Yep

wheat mesa
tulip plume
#

oh, totally skipped that line

lyric mountain
#

oracle might terminate your services with no previous warning

#

happened to me, tim aswell

acoustic bough
#

oracle is fun if you want to live dangerous

sage bobcat
#

One message removed from a suspended account.

eternal osprey
#

hey guys, i have used mysql to create my program. Could someone enlighten me on how to actually deploy this program to my vps?

#

Like, do i need to install mysql client on the vps as well and run the localhost database or,..?

lyric mountain
#

you created a program that uses mysql as a database, I suppose

#

or did u manage to make a program with mysql lul

#

anyway, install mysql as you did in your local machine, then run the ddl there

eternal osprey
#

hahaha no sorry i used mysql as my dbms for my program

lyric mountain
#

or dump the db and restore there

lyric mountain
#

there's no mysql client, only mysql

eternal osprey
#
 connect() {
    const connection = mysql.createConnection({
      host: "localhost",
      user: "root",
      password: "pass",
      database: "BackupBot",
    });

    connection.connect((error) => {
      if (error) {
        console.error("Error connecting to database: ", error);
        return;
      }
      console.log("Connected to MySQL database");
    });
    this.#connection = connection;
  }```

this is how i connect tot the database, it's bound to my user account. Should i just keep this configuration and dump the code onto the vps? From there on load it and it should work??
lyric mountain
#

you want to host the database there or on your pc?

eternal osprey
#

on my vps

lyric mountain
#

then you can keep those configs

#

since localhost will become your vps

timber hatch
#

does anyone know how to access auth js session serverside?

eternal osprey
#

aha i see

#

awesome, will test my database and deploy i guess! Thank you!

eternal osprey
lyric mountain
#

been a while, tho people are switching back to functional js again nowadays

#

personally I'll always use classes, they're much more intuitive imo

wheat mesa
#

I’ve never had a problem with them

#

But the only thing I’ve used them for is hosting a discord bot

#

I must say though their 2fa is dogshit and it got me locked out of my VPS, and I’m too lazy to contact support to login to my account

eternal osprey
#

i love java mainly for its classes and such

#

tho i have never used api's with java, is it easy?

#

Packages as a whole seems really hard compared to nodejs

lyric mountain
#

barebones http request is extremely verbose, but on the other side of the spectrum there's stuff like okio, which is extremely simplified

frosty gale
#

they also love banning you from making an oracle account for no apparent reason

#

and will refuse to tell you why

#

theyre like an ex that wont tell you what went wrong

solemn latch
#

You didnt pay enough

#

They're the gold digger ex that wont tell you you're too poor

#

WELL LOOK AT ME NOW ^-^

frosty gale
#

oddly specific bro 😭

quartz kindle
#

that sounded like a confession

sly turret
eternal osprey
#
let botInfoEmbed = new EmbedBuilder()
            .setColor(embed["color"] || "DarkButNotBlack")
            .setFooter({ text: `${embed["footer_text"]}` })
            .setTitle(`${embed["title"]}`)
            .setDescription(
              `> *Original embed sent by <@${message["message_author_id"]}> at ${message["message_timestamp"]}:*\n\n${embed["embed_description"]}.`
            )
            .setTimestamp();

this is the embed["color"]: 2895667
Uncaught DiscordjsError TypeError [ColorConvert]: Unable to convert color to a number.
how is this possibl

#

djs accepts numbers as color right?

sterile lantern
#

youre not providing a number

#

|| "DarkButNotBlack"

eternal osprey
#

i am

sterile lantern
#

"darkbutnotblack" is not a valid color

#

im assuming its using that

eternal osprey
#

it's a valid string representation that is accepted by setColor

sterile lantern
#

oh right djs accepts certain ones

#

hmm

eternal osprey
#

and embed["color"] has a number.

#

so it will not use the rhs of the or

sterile lantern
#

when u print embed["color"] you get that number (2895667) right

eternal osprey
#

yu

sterile lantern
#

hmm

#

maybe force it as a number?

eternal osprey
#

it already is an Int

sterile lantern
#

or see what the type is of embed["color"]

#

ah

eternal osprey
#

apparently you were right lmao

#

I forgot my database stores the color as a varchar

quartz kindle
#

haha nub

eternal osprey
#

hey guys, to host a website, we can practically do it for free using free certificates and hosting right?

#

I hosted some before and i paid a lot for domain names and stuff

#

but certbot is a free Certificate Authority, does it also provide webnames?

solemn latch
#

like domain names?

certbot just provides certs, it doesnt provide the domain.

#

I think theres two ways to go about it.

Pay for hosting, youll often get a free domain with it. Or pay for a domain and use github pages or some other free static site host for free hosting.

I dont think free domains are a thing anymore from anyone unless you're paying for something else.
Ie paying for hosting.

frosty gale
frosty gale
#

like .ga

#

but idk about 2024

solemn latch
#

Well, freenom was shutdown

frosty gale
#

i pay for all my domains now

#

good that place was shady and exploiting

solemn latch
#

because they had so many phishing domains and whatnot they no longer are allowed to provide domains.

frosty gale
#

but it did provide free domains

solemn latch
#

They loved to wait until your site blew up, then take away your domain and make you pay a large fee to get it back

#

Thats how they made money.
Free domains, if you were the one in a million that grew they would hold you and your domain hostage

#

At least imo

frosty gale
#

actually yeah freenom must have been paying for the domains indirectly

#

because icann at least charges a fee for allocating the domain

#

are there websites which let you get a subdomain at least for free?

#

i know you have glitch but i dont think you can use their domains without hosting on their platgorm

solemn latch
#

Yeah, but they are typically application based.

frosty gale
#

but how would it make money

solemn latch
frosty gale
#

yeah i thought of that but they dont let you use it for everything

#

has to be connected to js in some way

#

and have decent content for an audience

solemn latch
#

Yeah, those are typically the kinds of requirements you have to meet.

I dont think anyone really wants to provide subdomains unless you use their service, or you are doing something that they want you to(like js.org for things related to js)

eternal osprey
#

owh i thought certbot was a CA lmao

#

how are these CA's selected btw

#

like an authority that deems a website as secured... i suppose not everyone can claim the role of a ca right

frosty gale
#

i believe becoming a ca is pretty difficult

#

you have to number one make a business that can release certificates

#

then you need to convince browsers and tools to trust you as a certificate authority

#

the whole thing is based off of trust

solemn latch
#

I imagine the process is somewhat like getting your own tld. If I wanted to make a .woo tld its crazy hard and expensive

frosty gale
#

i would imagine its mostly the trust part thats tricky and getting browsers and operating systems to add your certificate authority as trusted

#

anyone can make a custom certificate authority with openssl

eternal osprey
#

i see that's really interesting

#

i always figured how a CA was setup

frosty gale
#

and one incident like leaking your master certificate authority private key thats used to sign certificates under your ca is enough to ruin that hard earned trust and get you taken off every trusted list

#

i believe that has happened to CA's before

#

so they take security and keeping that stuff safe extremely seriously bc its literally their entire business

eternal osprey
#

i forgot the name

frosty gale
solemn latch
#

I'm pretty trusted

#

right?!?

frosty gale
#

by the way the only exception to that rule is if the government like NSA/FBI asks you to make a fake certificate for them

#

i believe theyve done that before

eternal osprey
frosty gale
#

this is why we actually dont trust hardware encryption (like TPM's and hardware drive encryption) in our security consultant laptops because they often contain backdoors which can be used by the gov or an attacker or an insider

frosty gale
#

internet is supposed to be free and decentralised to an extent

#

if you had one CA that can only give out certificates youve given them control of the internet to an extent

#

and they can make a dangerous monopoly like charging extreme rates for certificates

eternal osprey
#

ahh yeah i see ofc

brazen crystal
#

Whenever I go to the site to vote, it says application error (see browser console for more information). What is the reason for this?

dusky idol
#

Can someone recommend me a solid bot hosting which doesn't have resource charges or such?
Currently I use railway to host the bot, it's awesome for 5$ plan but it's like 5$ + network usage charges.
For network as my bot uploads images to discord in many-many commands, I believe the charges are a bit too high. It asks me to pay like 5$ for hosting + 80$ for network charges monthly?!?!
Is there a way or some different hosting to avoid that?

deft wolf
#

Any VPS

#

The least I was able to observe was 1TB of data transfer per month, which is still more than any bot needs unless it sends hundreds of photos a day

#

Personally, I think this offer without setup fee is very attractive (contabo)

dusky idol
# deft wolf Personally, I think this offer without setup fee is very attractive (contabo)

Sounds awesome, another little trouble! Usually my close friend or you can say project admin does the payment as my card doesn't support international payments.
Regardless of whatever hosting I choose, I'd have to ask him to do the payment. Is there a way on this one to conduct it or such? Like maybe a gift feature/buy for someone else etc.
Usually I just give them my railway log-in details to buy the host on account as it shares minimum information.

eternal osprey
#

what??

deft wolf
quartz kindle
# eternal osprey what??

happened to me as well, discord seems to block a lot of messages that contain suspicious numbers, that resemble phones or ids

eternal osprey
#

i see

#

sparkedhost is so fucking shit

#

i cannot connect to my mysql database

#

it's so annyoing

#

they don't even provide console access, only logging?

quartz kindle
#

is connecting to localhost, is the db installed in the same system?

quartz kindle
real rose
#

you literally

#

could not be anymore accurate

#

however, it's topgg blocking them, not discord in general KEKW We get a ridiculous amount of phone number whatsapp scams so we have to block them unfortunately

quartz kindle
real rose
#

but yeah without automod this place would be like the trenches KEKW

surreal sage
#

why is it blue

#

😭

real rose
#

yeah mines th esame, wasn't sure if that was me or not

neon leaf
dense veldt
#

Quick question. Is it worth rewriting a whole bot after not touching it for a while and having gained more experience?

sly turret
#

what would be the best way to host an api? mainly searching for easy scalability without needing to spend hundreds of euros into a single server if my api gets and does tens of thousands of requests a day

hard radish
#

I am a 🤓

sly turret
#

to reinforce and use your experience

dense veldt
#

like, the last time i rewrote it i tried to keep it clean but it still looks so ugly. for example: ```javascript
public static async SendNewArticleToAllGuilds(bot:Client)
{
await this.getFullArticleData()
await delay(2000)
var image = FullArticleData.image
var title = FullArticleData.title
var secondTitle = FullArticleData.secondtitle
var date = FullArticleData.date
var link = FullArticleData.link

    var guildIds = bot.guilds.cache.map(guild => guild.id);

    guildIds.forEach(guild =>{
        try
        {
        var Rguild = bot.guilds.cache.get(guild)
        if(Rguild?.channels.cache.find(channel => channel.name == "riot-games-news"))
        {
            var channel1 = Rguild?.channels.cache.find(channel => channel.name == "riot-games-news")
            var embed = new MessageEmbed()
            .setColor("#eb3434")
            .setTitle(title)
            .setDescription(secondTitle + "\u200B" + " [Read the full article](" + link + ")")
            .setImage(image)
            .setTimestamp()

            if(Rguild.me == null) return
            if(channel1?.permissionsFor(Rguild.me)?.has("SEND_MESSAGES") && channel1.permissionsFor(Rguild.me).has("VIEW_CHANNEL"))
            {
                if(channel1.type == "GUILD_TEXT")
                {
                    try {
                        channel1.send({embeds: [embed]})
                    } catch (error) {
                        console.log(error)
                    }
                }
            }
        }
        } catch (error)
        {
            console.log(error)
        }
    })
}```discord.js btw
#

the await delay(2000) 💀

civic scroll
#

is this

#

uergh

#

var????

dense veldt
#

wait, is this bad practice?

civic scroll
#

yes

#

var bleeds

#

use let if you mutate

#

or const if you plan to only assign once

dense veldt
#

whats the problem with var?

sly turret
# spark flint hetzner

do you recommend a server in particular? all is need to do is execute bun and pray that nothing dies

spark flint
#

Depends on your budget

sly turret
#

it’s for an enterprise

#

budget doesn’t matter that much

spark flint
#

I recommend their dedicated servers, I host an api handling 250k requests a day there and it’s fine and fast

#

35eur a month for 64gb ddr4 ram, 8core i7, 1tb ssd dedi

#

It’s under server auction

dusky idol
#

Ello ello more issues!
I finally bought a hosting and it's working fine for most text commands.
The commands that build a connection to database are very-very slow. I believe its because the location of my database is set to India and my hosting is set to Texas US.

How can I change location of my mongodb database?
I tried doing it but the "review changes" button doesn't highlight or anything https://prnt.sc/URhiWc4Af0Aj

Lightshot

Captured with Lightshot

sly turret
#

oh yeah that does look good

#

what about scalability?

spark flint
#

You can easily get more than one and use Hetzner load balancing

#

Same with their vps servers

sly turret
#

good to know

spark flint
#

If you’ve got a choice, Cloudflare load balancers all the way

sly turret
#

i’ll note that, thank you!

spark flint
#

It’s balanced at DNS level so higher availability

#

Np

sly turret
#

cf for sure yeah

civic scroll
# dense veldt like, the last time i rewrote it i tried to keep it clean but it still looks so ...

your whole code becomes

public static async SendNewArticleToAllGuilds(bot: Client) {
   const { image, title, secondTitle, date, link } = await this.getFullArticleData();
   for (const guild of bot.guilds.cache) {
        if (!guild.me)
            continue;
        
        const channel = guild?.channels.cache.find(channel => channel.name === "riot-games-news");
        if (channel?.type !== "GUILD_TEXT")
            continue;

        const perms = channel.permissionsFor(guild.me);
        if (!(perms.has("SEND_MESSAGES") && perms.has("VIEW_CHANNEL")))
            continue;

        const embed = new MessageEmbed({
            color: "#eb3434",
            title,
            secondTitle: `\u200B [Read the full article](${link})`,
            image
        }).setTimestamp();
        
        channel
            .send({embeds: [embed]})
            .catch(console.error);
    }
}
civic scroll
#

also use === for strict comparison

#

== will attempt type conversion which may result in undesired behaviour

#

also your code looks like typescript

dense veldt
#

it is

#

i recently noticed that my code in production wasnt compiled to js but was still running as typescript

civic scroll
#

it is compiled

#

or transpiled

#

depends on runtime

#

if you are debugging, there is a good chance that the transpiled code is mapped into source code

dense veldt
#
const { image, title, secondTitle, date, link } = await this.getFullArticleData();```honestly, stuff like this i cant wrapp my head around
dense veldt
#

does it just extract the props of the object with the same name into equally named variables?

civic scroll
#

yes

#

you can compare this with your original code
see what changes are interesting

#

i made a few optimisations as well

dense veldt
#
for (const guild of bot.guilds.cache)```so this puts all the guilds into the guild var one by one and then you just check if its the current guild and continue?
dense veldt
#

Quick question. Where do i change the icon of my bot on top.gg so not the discord app

pale vessel
#

edit your bot description and click refresh data on the bot page

dense veldt
#

ah thx

short lynx
#

can anyone help me build a discord bot, I just need some guidance

quartz kindle
short lynx
frosty gale
#

like javascript/python/etc

short lynx
#

js

quartz kindle
#

a discord bot is made by creating a connection to the discord api

#

if you already know js, then you must be familiar with node.js and the npm ecosystem

#

there are many libraries on npm that will handle discord's connection for you

#

so pick one, install it with npm, then create a bot in the discord developers page, get the bot's authentication token

#

then create a js file, require the discord library and login to your bot using the bot's token

#

check the library's documentation to see how to use it

acoustic bough
#

how do I create a file

quartz kindle
#

most should provide plenty of examples

short lynx
#

i know how to create one, I just want to scrape a database and constantly have it scrape so it always updates, andd then i want that information to be accessible by a user by asking a bot a question about it

#

@quartz kindle

acoustic bough
#

then connect to the database and query it

quartz kindle
#

the discord api will send you events through the library of your choice

#

you listen to those events, for example a message event, or an interaction event for slash commands

#

and depending on the contents of the message you receive, you respond accordingly

#

generally the workflow is as follows (for slash commands):

  1. create and register a slash command with the discord api (can be done with code using the library)
  2. code an interaction event handler to receive interaction events
  3. code it so that if the interaction is a slash command and matches the command you created before, it runs a specific function
  4. code your function to connect to said database and query the information
  5. once you have the information in a variable or so, send it to discord by replying to the slash command you received earlier
frosty gale
#

you have to create a file by writing to it

#

or opening it

#

in append mode*

quartz kindle
#

dont you technically "open" an nonexisting file?

frosty gale
#

its complicated

#

i think the intention is you wouldnt usually just create an empty file and leave it at that, youd wanna write to it right after

#

they want you to do it all in one go instead of making an empty file then writing to it

acoustic bough
#

well it makes sense

civic scroll
dense veldt
#

btw how do you paraphrase?

quartz kindle
#

ie mmap, socket

civic scroll
#

hi timmit

quartz kindle
#

hi sayu

#

css jail

civic scroll
dense veldt
civic scroll
quartz kindle
civic scroll
civic scroll
quartz kindle
civic scroll
#

oh

quartz kindle
#

the sign means stuff, but the constellation doesnt

#

exdee

civic scroll
#

i'm silly

quartz kindle
#

indian astro does use constellations tho

lament rock
#

anyone made any activities yet?

quartz kindle
#

i havent done anything discord related in years

#

lmao

lament rock
#

wetf

#

nobody uses etf otherwise

quartz kindle
#

i mean sure, but its not stricttly discord related

#

lmao

lament rock
#

No work to tiny discord?

quartz kindle
#

unfortunately not

#

need to prio my api

frosty gale
#

did you know the /tmp directory on newer versions of the linux kernel is usually purely memory based

#

the entire directory is stored in a ram filesystem and doesnt touch the disk

#

windows take notes instead of having a dumping ground for applications to write their "temporary" files using up your ssd erase cycles and not cleaning up after as well

wooden oyster
#

Hello everyone

#

I want to start making a Discord bot. Programming language weth. Javascript

#

What are your tips and advice?

earnest phoenix
#

read some of the opensource ones on git.

quartz kindle
#

and read their documentation

lyric mountain
#

trying to understand someone else's codebase will make it look much harder than it is, and will only confuse you

#

it's hard enough to do so when you work with that, imagine as a complete newbie

#

just spend a few weeks studying and learning what is programming and doing a few minor project, THEN attempt a bot, you'll get one running without much hassle

frosty gale
#

i dont do that because otherwise ill accidentally copy their project and their design decisions

#

i wanna make my own project

real rose
#

honestly

quartz kindle
sharp geyser
#

I looked at their code base to understand better on how to make my library

#

it was pain

#

idk how the contributors do it

real rose
#

standard practice

harsh nova
sharp geyser
#

when you dont code its your best work

sharp geyser
#

been on the hunt for some natural salt

lyric mountain
real rose
#

i laughed

#

p funny

#

the jump from d.js > raw javascript is wildd

solemn latch
sharp geyser
#

that is just add-ons

#

the gateway stuff is super annoying

solemn latch
#

Discords gateway is kinda complex, so discordjs's implementation is pain I bet

sharp geyser
#

the gateway isn't very complex

#

I just feel they implemented it poorly and overengineered it

#

not to mention they inheritence is a shit show

#

One class has a 3-4 layer inheritence

solemn latch
#

👀 I feel like this is pretty complex for a gateway no?

sharp geyser
#

no?

#

its simple to implement

#

its by far the easiest thing to do

solemn latch
#

indentify and resume is simple to implement? 👀

sharp geyser
#

imo

#

yea?

#

why not?

#

9 times out of 10 discord tells you when you need to resume a connection or re-identify e.g establish a new one

#

so its not very hard to do so.

#

Also in cases where they don't its better off to start a new connection

#

I wish I had an old repo of mine

#

the only annoying thing is handling rate limits on the gateway, making sure you aren't spamming it but shruganimated

solemn latch
#

I've never tried to work with the gateway directly, it just seems really complex to do it properly.

#

Especially in the case of a library

sharp geyser
#

if you make discord bots its something I always recommend someone trying at least once

solemn latch
#

Large bots that use off the shelf libs like djs end up running into problems with connection limits.

Realistically a lib should be exposing(and accepting) resume data right?
Like I should be able to restart a shard and provide resume data directly into djs.

#

"should" meaning in an ideal world

sharp geyser
#

I mean

sharp geyser
#

So libs that handle sharding for you like djs are perfectly fine how they are

humble gyro
#

not really

#

wait FUCK

humble gyro
#

its just

sharp geyser
#

The biggest qualm with libs like djs is that they are meant to be beginner friendly and not meant for large scale bots in a lot of cases. Using your own lib lets you control what you’re actually doing and in turn be a little more memory efficient

humble gyro
#

an auth handshake and an event loop

#

connect -> identify -> setup heartbeat -> start event loop

sharp geyser
#

Djs tacks on a bunch of overhead due to their useful features that make it easy to interact with the api and gateway

humble gyro
#
on error -> <is recoverable?> --yes--> resume
                              --no--> reconnect
#

here

#

i have docs in my gateway for this

sharp geyser
#

Yup

#

And djs usually tells you if it’s recoverable

#

If not you always reconnect

humble gyro
#

ye

sharp geyser
#

Don’t assume a connection is resumeable

humble gyro
#

i mean

#

you can also just like do it

#

and then reconnect if it fails

sharp geyser
#

Yes but why waste time

solemn latch
sharp geyser
#

Starting a new connection doesn’t hurt

humble gyro
#

YOUR TOKEN HAS RESET

solemn latch
#

Classic mimu

sharp geyser
#

Wym fool

solemn latch
#

(which is where this question comes from)

#

If you hit a connection limit you get your token reset iirc

#

The 1000 a day or something

sharp geyser
#

Well yea

#

But 9/10 you won’t be able to resume anyway shruganimated

#

I guess it doesn’t hurt to try

#

But at the same time I’ve not run into a case where it successfully resumes if discord hasn’t told me it can

solemn latch
#

I just don't see why libs don't allow you to stop a shard disconnect it, provide the resume info, then resume it. Or maybe they do I've been so disconnected from discord libraries for so long.

sharp geyser
#

They don’t

#

Cause there’s no reason to

#

What reason could you possibly need to resume yourself?

solemn latch
#

Tbh, I feel like it's the opposite.

Why would you ever want to not resume?
Resume includes all your missed events.

So any time things go down on your end you can resume.

A buggy shard can be stopped and resumed and likely lose no events.
Bot restarts, resuming is a better solution.
Even weird things, like temporarily moving shards to another server could be done.

A "rolling" update that resumes to prevent event loss

Idk, there's a lot of interesting things people could do if it was an option.
Someone out there would find something intriguing to do if it was more accessible to the developer.

quartz kindle
#

resume on restart requires the cache to be offloaded and reloaded

#

or stored off-process

#

which most libs dont do

deft wolf
#

🤔

timber hatch
#

this is very bare bones testing before i implement fully... but i'm attempting to
make request to generate pdf on nextjs client side -->
send request from nextjs backend to bot api to generate pdf -->
generate pdf bot side and return binary to nextjs backend -->
return binary from nextjs backend to nextjs frontend and download the pdf

now it downloads the pdf but the content of it is empty despite setting the page content to have stuff in it on the bot api? can anyone help pls

bot api route: https://pastebin.com/qbU9mzFp
nextjs api route: https://pastebin.com/mfv2L6SA
nextjs frontend: https://pastebin.com/CBAy2QHR

quartz kindle
#

ie, fetch it directly from the bot api, or save it locally in the bot api host then download it and open it

timber hatch
#

oh sorry should've deleted this. the issue was that the response type wasn't set to arrayBuffer

#

thank you anyways though

solemn latch
#

oo

lyric mountain
#

Tho this code is largely outdated, I didn't make it on the new rewrite yet

past field
#

hi everyone

solemn latch
#

heya mo

past field
solemn latch
#

Doing alright, same old same old ^-^

#

hbu?

#

Hows the programming journey going?

past field
#

doing good! just moved into a new house last week so been busy unpacking and setting up all this new stuff i got

past field
#

my next goal is to set up a data base but i’m having trouble lol, gonna look for some youtube tutorials at some point today

solemn latch
#

what database are you using?

past field
#

i just dk where to start with setting it up lol

quartz kindle
#

another thing is restarting the process and directly resuming instead of creating a new connection

lyric mountain
#

Ah, i misinterpreted it then

quartz kindle
#

all libs can restart shards, but very few allow you to create a shard with resume data already included

#

(mine does tho xd)

past field
#

what i’m gathering is

#
  1. install sqlite with npm install sqlite3
  2. code in a connection to the sqlite database in the the bots code
  3. create tables to define the structure of the database
  4. perform database operations to implement the methods of using the database in the code
quartz kindle
past field
past field
quartz kindle
quartz kindle
frosty gale
#

it becomes impossible not to judge

#

sometimes i think do they really pay you to write this code

quartz kindle
#

lmao

past field
#

does anyone know how in the world does emoji.gg copy emojis from a server that it isn’t in???

sharp geyser
#

So long as an emoji is used on discord you can get the id of it

#

Then bots can use that to upload the emoji to the server or download it and send it to you (though they will likely just send the cdn link to avoid downloading it)

trail crystal
#

Commands are loading but do not appear in the / section

#

application.commands is turned on in settings

deft wolf
#

What do you mean by / section?

trail crystal
deft wolf
#

And what type of commands are these, global or per guild?

trail crystal
deft wolf
#

Then make sure it's the right server and that you have permission to see them if they have any required minimum permissions. You can also check the integrations tab to see if they have been created at all

trail crystal
#

The bot has permissions, also available in the bot developer section.

pale vessel
neon leaf
#

why is this causing a RangeError: Out of memory?

import { number } from "@rjweb/utils"
import chalk from "chalk"
import fs from "fs"
import bytes from "bytes"

export default async function download(display: string, url: string, dest: string, overrideSize?: number | null) {
    const request = await fetch(url)

    if (!request.body) throw new Error('no body')

    const size = overrideSize ?? request.headers.has('content-length') ? parseInt(request.headers.get('content-length') ?? '0') : null,
        file = fs.createWriteStream(dest)

    let progress = 0
    for await (const chunk of request.body) {
        progress += chunk.length
        const percent = number.limit(Math.round(progress / (size ?? chunk.length) * 100), 99)

        process.stdout.write(`\rdownloading ${chalk.cyan(display)} ${percent}% ${size ? `(${bytes(progress)} / ${bytes(size ?? 0)})` : ''}      `)

        file.write(chunk)
    }

    file.close()
    process.stdout.write('\n')
}```
sterile lantern
#

i run into a bunch of errors when trying to install this package: https://www.npmjs.com/package/trello
on cf workers

#

i tried the node_compat stuff too and that didnt work either

trail crystal
pale vessel
#

you have to wait and have users use your bot, and then discord will know what the bot's popular commands are

#

u have to wait

#

it's not a list of all commands, it's a list of most used commands. the data for that takes time to gather

trail crystal
pale vessel
#

could take days

#

and make sure that u have active users using ur bot

quartz kindle
#

you need to wait for writes to be flushed before you write more chunks

#
await new Promise(resolve => {
  file.write(chunk, () => resolve())
})
neon leaf
#

wow, I completely forgot that

#

thanks!

quartz kindle
#

can you decide your own node version?

#

or are you using bun/deno?

sterile lantern
#

i dont think node js is enabled

#

it requires the nodejs_compat in the wrangler.toml file

#

but i cant do that bc its too big

#

idk ive imported other npm packages just fine

earnest phoenix
#

ok so
when i want to interact with my sharded mongo database, i use the config server
when i want to shard a collection, i use the mongos router?

#

is that ... right?

quartz kindle
#

they use something similar, modified, or something like bun/deno under the hood

sterile lantern
#

yeah they don’t

quartz kindle
#

they require node api's to be required using the node: prefix

sterile lantern
#

but how come that is preventing me from installing that specific package

#

I’ve installed other ones like mongo-http just fine

quartz kindle
#

which means you'd need to edit all your deps to change require("a") to require("node:a")

#

if they use node built in libs, like url and zlib

sterile lantern
#

I’ve tried that but that didn’t work either, I believe it said it couldn’t be resolved

#

Will try that again once I can

quartz kindle
#

the thing is

#

you'd need to edit it in all deps including sub deps

#

if i understand correctly

sterile lantern
#

oh

#

ic

sharp geyser
#

sup fellow nerds

radiant kraken
harsh aspen
#

Channel for chatting about development not for supping

warm surge
#

Yo fellow nerds except noooooooooob

harsh aspen
#

who is noooooooooob

#

sup mate

warm surge
sharp geyser
past field
#

tim, can you just transfer all of your coding knowledge to my brain pls man

#

at this point, i just wanna be like tim when i grow up

solemn latch
#

Lmao

frosty gale
#

i really like what tim does in terms of optimising js though

#

if theres a way he will find it

quartz kindle
solemn latch
#

@quartz kindle Since you're here.

Is it okay to upgrade to a websocket connection then authenticate it? Would I run into any issues?

#

I wrote this code awhile back, but I think I'm doing this to send proper status codes when authentication fails

quartz kindle
#

should be fine either way

#

you can send auth headers during the upgrade request and reject there

#

or you can establish ws first then auth on first message

#

like discord does

solemn latch
#

oh yeah, thats what discord does. derp

#

should be fine

#

What was that other websocket lib you recommended? thats not ws

#

I wrote it down somewhere, but I'll never find it again

solemn latch
#

That's it yeah

sharp geyser
#

uwusockets

solemn latch
#

Thankfully I'm building something very simple so trying it shouldn't be to bad. Then just picking the one I like more.

sharp geyser
#

Lmao

#

tbh I haven’t worked with web sockets in a while

#

I plan on using them soon though

quartz kindle
#

the only thing about them is that uwebsockets is pretty much designed to be exposed directly to the web

#

so if you're using a reverse proxy like nginx in front of your node, then it doesnt make sense to use it

#

since uwebsocket itself is arguably faster than nginx

solemn latch
#

So its probably super overkill for what I need

#

At max I'll have 5-10k connections at once in the next couple of years.

quartz kindle
#

give it a try anyway

solemn latch
#

yeah for sure

quartz kindle
#

not sure how to benchmark them tho

solemn latch
#

I'm just going to stick a link to this conversation in my readme lmao

solemn latch
quartz kindle
#

xD

solemn latch
#

I really should hire you one of these days to do code review on this.

I know I'm not doing things completely right

quartz kindle
#

lmao

past field
# quartz kindle lmao

gonna remade my bot to “Tim” i stg. that mf will be able to do any and every thing one day.