#development

1 messages · Page 281 of 1

round cove
#

whatever, it worked so

plain coral
#

probably dylan this code post and get 😄

rustic nova
#

have not seen a cli-based request client @round cove ngl

rustic nova
#

very interesting

round cove
#

i'm on arch and didnt want to deal with installing postman

#

also hi hope it's been eons

neon leaf
#

httpie

round cove
#

Okay bot devs that have to shard(t).

Having to restart 40 shards is like a dice roll some times, but I also don't know how feasible it is to have shards constantly connected and just be able to reload commands.

Sometimes shards literally just die for no reason and fail to reconnect properly, thus making some bot functions absolutely just die.

How do y'all handle shard issues, because sometimes it's getting super annoying lol

lament rock
round cove
lament rock
round cove
#

That could be a fun challenge I guess.

lament rock
#

There would theoretically be a way to hack in messages from another lib to d.js but that's internals I don't know

#

djs can consume raw messages and process them

round cove
#

It's just so frustrating that shards will die for absolutely no reason and never reconnect just to make any commands that depend on aggregating across shards die lol

#

And because that usually requires a full restart, well waiting for 40 shards to come online takes forever.

And then sometimes as they try to connect they just get stuck in a failing to connect loop !!!

#

:^^^^)))))

lament rock
#

Is your max_concurrency still 1?

round cove
#

that would me funny

#

it probably is

#

lmao

lament rock
#

Well the gateway determines how many shards can identify at once. Larger bots are granted larger max_concurrency. I wouldn't be surprised if you were at least set to 2. Though idk if djs supports it! Personally I need to revise the logic in my own lib for max_concurrency iirc otherwise I already did it and I can't remember

round cove
#

I use the sharding manager from djs, I know you can manually spawn shards,

#

so I guess I'll make a get request rq to see what my max is

lament rock
#

Oh. That's another thing that would be lost. The Shard class instances

round cove
#

Yeah >_<

lament rock
round cove
#

what's a little rewrite

#

:^^)

lament rock
round cove
#

lmao

lament rock
#

Fuck

#

Eventually I bit the bullet and did a full rewrite and I'm glad I never went back

round cove
#

I'm sure it would be fun

#

My bot isn't exactly mission critical to anyone, or me, might just be a cool thing to figure out at this point

lament rock
#

Y'know. It wasn't horrible. It was kinda fun working with the raw api. Also means I could implement newer Discord features like components v2 day -30 (there was a closed alpha period)

round cove
#

Nice

round cove
# round cove

This seems funny given the bot is ~40k servers, I wonder when they permit you to have a higher limit lol

prime cliff
#

vibecat Auto focus search boxes on various pages so you can immediately type, now that's what you call good user experience

ancient cedar
#

Someone can help me? Dms me

ancient cedar
ancient cedar
deft wolf
#

Huh?

quartz kindle
#

there is no in-between

#

which is stupid af lmao

#

also not sure if djs actually supports increased concurrency, last time i checked it didnt, it was hardcoded to spawn 1 shard every 5.5 seconds

long marsh
#

For those that use SQL databases, do you typically store the discord id as TEXT? Or another data type?

neon leaf
#

I store it as varchar(22) but I believe a bigint is optimal

long marsh
neon leaf
#

as long as the column is indexed it isnt really something you will notice that much, obviously a bigint would only be 8 bytes though compared to around 22bytes for a varchar(22)

#

I ran queries on a 2mil row table with text hashes instead of storing them as bytes, it was only around 10% faster after switching to the optimal format

prisma nebula
#

Does


    @app_commands.allowed_installs(users=True, guilds=True)  # Allow users to install this command
    @app_commands.allowed_contexts(guilds=True, dms=True, private_channels=True)  # Allow execution anywhere

Work for group commands?

#

Because cant be found in dms

long marsh
#

Anyone here use typing in their Python source?

#

At this point, I'm not sure I could use Python without it. uv + ruff + pyright is an insane combination.

#

But I am curious, for those that do it, what's your preferred? Pydantic vs. dataclasses vs. typeddict for modeling structures of data. I'm not referring to the difference between schemas / models ... just curious what your preference is at the domain layer for your DTOs / internal models.

lean swan
#

Will this required the member intent?
interaction.guild.members.fetch(userId).catch(() => null);

sharp geyser
#

Using .catch like that is not good

slender wagon
#

So i have this website made in nextjs and im hosting it on my vps.
I send a bunch of requests and it gets stuck at random times.
Like the vps isn’t overloaded it simply gets stuck

#

Keep in mind I access it via the ip

#

As its kind of private

#

But it annoys me how it just randomly gets stuck at loading requests

small tangle
#

Add more log statements to try to find the cause for that

quartz kindle
round cove
round cove
#

Also hi Tim! Long time no see

pearl trail
slender wagon
pearl trail
#

neko_think could it be the connection between your vps and yours?

slender wagon
#

i tried it on my phone as well

#

with data

round cove
#

@long marsh I personally haven't had performance issues honestly. I store message / role / channel ID's as strings and I query by them all the time.

long marsh
#

I figured for my scale it won't be bad ever

round cove
#

What's your scale currently?

long marsh
#

I have one discord bot that has anywhere between 10 - 15 concurrent players (in 800+ servers). 1 concurrent player equates to 1 - 2 database reads per initial click ... and cache hits after that until the TTL expires. I have a write-through cache so the cache is frequently updated + database is written to every click.

#

A click from a player playing typically is done a handful of times over a 5 - 10 minutes session, every 2 - 3 seconds.

round cove
#

Yeah I wouldn't expect any issues to arise from that size.

long marsh
#

Even if the game got to 100 - 200 concurrent players, it likely wouldn't be a problem if we're being honest.

round cove
#

And I imagine your DB relationships arent too complicated either.

long marsh
#

I'm not using Postgres for that one haha

round cove
#

What're you using?

long marsh
#

But I'm comparing the scale of that one with the current one I'm going to be building.

long marsh
round cove
#

Oh wow

long marsh
#

I work with it in my day job, so I'm fairly proficient with it

round cove
#

I see you like spending money

#

:^)

long marsh
#

It's completely free and will likely be free until I'm reaching thousands of concurrent players.

#

It's all about how you model your data / the access patterns you create upfront.

round cove
#

How are you communicating with it? I would expect you to have to either host your bot in an ec2 instance, or have a cloudfront instance exposing it which I thought required RDS?

long marsh
#

API Gateway as the proxy -> EC2 -> DynamoDB

#

Nah you don't need RDS at all

round cove
#

I made a RDS instance, never used it, and got charged $90 in like my first week of it just existing.

long marsh
#

Yeah checks out

round cove
#

Yeah lol..

long marsh
#

I never manually spin up anything – everything is through AWS CDK

round cove
#

Ah

#

Are you having to use IAM to communicate to your gateway? How're you preventing "potential" public accesses to it?

long marsh
#

I'm using discord's HTTP interaction endpoint option – so I need to allow discord to send outbound webhooks to it.

round cove
#

Ah so you're using lambda's for your bot?

long marsh
#

Nah – the cold start would be too problematic

round cove
#

Aint that the truth lmfao

#

fucking ~40seconds

long marsh
#

A 40 second cold start would be a code smell lmao

#

The most I've seen is between 2 - 4 seconds.

#

And, in production on a highly used API, the # of cold starts are minimal

#

I also use Discord's HTTP interaction option with the 3 second response. I never callback into discord.

round cove
#

I think I'm thinking of azure's blob storage

long marsh
#

Yeah it's actually a super neat option

round cove
#

I defer literally everything just for the sake of it

long marsh
#

It's a fair assumption to do that – I just took on the constraint myself to always respond within 3 seconds haha

#

My bot is a clicker bot, so that shouldn't be a problem.

#

My full stack on AWS costs about $17/mon.

That's including:

  • EC2 costs
  • Network ingress/egress
  • DynamoDB
  • DynamoDB stream via a lambda
  • Elasticache (Valkey)
  • Elastic container registry (docker images)
  • API Gateway
  • Another lambda to process cron jobs
  • S3 bucket
round cove
#

I had an issue were my bot was getting interactions like 5 seconds after they occurred on my end so I can't even respond to them.

round cove
#

yeah :V

long marsh
#

Which one?

round cove
#

d.js lmfao

long marsh
#

oof – yeah I could see it taking 5 seconds to get to your domain logic through that damn web of functions lmao

round cove
#

This wasn't an issue until I hit ~5k servers

long marsh
#

I don't use any framework.

round cove
#

and now I'm ~40k so each shard has to have only 1k each

round cove
#

I have a server at home and host my bot there. So the bot lives with the PSQL db, it has no reason to ever be slow.

long marsh
#

You may need one for all the things you do, but for the interaction HTTP endpoint ... it's fairly trivial to spin up a command registry, an API to handle the routes, and then just route to your commands.

wheat mesa
round cove
#

fuck saas 🤝

long marsh
#

The ECR was extra because I wanted to publish my images automatically / have it update containers without me having to login to the server

wheat mesa
#

I still hate integrating saas into a discord bot, I’d much prefer just using a docker image to run a Postgres instance

long marsh
#

And the cron jobs I could have ran on the EC2 ... but figured the lambda would be easiest

long marsh
#

I respect it, but I'd rather delegate the management of the postgres instance.

#

At a minimum, I'd spin up my own server with postgres installed / no docker for that.

round cove
#

I hate it because I'm so paranoid about exposing things on the public net and also the amount of money it cost to run it lmao

#

that's my cope

long marsh
#

I have billing alerts setup. If something like that ever happened, I'd be notified immediately

wheat mesa
#

I prefer paying 0 money to AWS

long marsh
#

I'm actually the opposite

#

It's provided me income, it's given me the infrastructure chops to sell software to enterprises, and I'm an "AWS Community Builder". So only bias towards it from me haha

#

But, like said, I definitely respect your hustle @wheat mesa

wheat mesa
#

I’m a uni student so I’ve got light pockets haha

long marsh
#

Exactly! I would have done the same shit

#

Stuck everything into a single server, called it a day.

round cove
#

when I was in uni I hosted my bot on a rpi for a couple years

wheat mesa
#

I have an rpi that I host things on for proof of concept, then if needed I’d go for cloud infra

long marsh
#

I had mine on an heroku instance when they were still free.

prime cliff
wheat mesa
#

I hate subscription fees in general, I’d much rather run my own small server

#

Plus I learn so much more managing it myself

prime cliff
#

You also don't really need S3 buckets or fancy "API gateways"

long marsh
#

I mean $9 vs. $17 is such a moot point

round cove
#

just build your own server like me for the cheap price of 1.2k

prime cliff
#

k ThinkOwO

long marsh
round cove
#

it unironically is great to be able to have physical access to your own server at times

long marsh
#

Use ufw to disable certain ports, maybe put cloudflare in front if you're feel spicy, etc.

round cove
#

the only time it sucks is when tornados spawn outside and power goes out, but it's so rare and it's only short outages that in the grand scheme it doesnt matter

round cove
#

I bought a UPS for my PC but not my server funny enough lmfao

#

but I SHOULD buy one

long marsh
#

Ironically speaking, you spending $1.2k on a server will likely be more than I'll ever spend over the lifetime of my 2 bots hosted on AWS

round cove
#

thankfully I host more than just my bot on it

long marsh
#

Do you have a NAS?

round cove
#

I've got game servers and other friends bots on here too

long marsh
round cove
#

nah

long marsh
#

Even $1/mon is a steal haha

#

anything

round cove
#

lmao

#

I'm all for free things

long marsh
#

Refund them the dollar if it goes down due to power outages

round cove
#

they make money off their bot and need it more than I need it

#

I just wanna help some friends

long marsh
#

Even $1?

neon leaf
#

no point in charging for $1

round cove
#

fr lmao

long marsh
neon leaf
#

im excited for my second homeserver 🙏

#

1500€ investment

long marsh
#

I got taken advantage of eventually / it just led to me getting pissed off

#

If you have a healthy relationship with your friends, that's all that matters.

neon leaf
#

I dont yet know what im going to do with 512gb ram

#

but ig ill find out

round cove
#

AYOOOOOOO

#

that's sick

neon leaf
#

tbh the ram was way cheaper than I expected, it was only 300€

round cove
#

build a server good enough and it looks like it's never used

neon leaf
#

yes yes

#

sadly my main server is very used

#

i cleared up 300gb disk space a few days ago

round cove
#

nice

#

I also use moved away from google photos and use my server with immich which replaces it

neon leaf
#

same!

round cove
#

yesssssss

#

it's so good

neon leaf
#

the second i saw it i fell in love

round cove
#

I didnt know there was a stats thing

#

where is that

neon leaf
#

/admin/server-status

round cove
#

you use a lot more than I do LOL

neon leaf
#

yeah i hoard my photos

round cove
neon leaf
#

they are dating back to 2005

round cove
#

me and my gf

#

tldr; everyone get a home server

neon leaf
#

yes

long marsh
#

I have over a TB of content haha

neon leaf
#

same

#

i have 2 raid arrays

#

2x1tb = 1tb
2x4tb = 4tb

delicate zephyr
neon leaf
#

yes

round cove
#

yeah it's nice

prime cliff
#

How do you mess up an input box that bad....

quartz kindle
quartz kindle
long marsh
quartz kindle
#

and also procrastinate as much as possible :)

long marsh
quartz kindle
#

its pretty nice so far

long marsh
#

I assume you're using svelte + sveltekit in that?

quartz kindle
#

ye

long marsh
#

On that note, I'm not aware if sveltekit can be used by itself 🤔

quartz kindle
#

i dont think so

long marsh
#

How do you typically find your freelance clients?

quartz kindle
#

in this case they found me on linkedin and emailed me

long marsh
#

That's pretty neat!

#

I had a friend who would work half the year and earn 6 figures when he did contractual stuff

quartz kindle
#

thats pretty cool

#

my earnings are nowhere near that lol

long marsh
#

But it was always run-of-the-mill boring shit that no one wanted to specialize in. Typically Java + Spring Boot.

quartz kindle
#

ew xD

long marsh
#

Pays great 🤷‍♂️

#

An API is an api, ya know?

quartz kindle
#

true

#

i need to finish my projects, havent worked on any of them in ages

long marsh
#

I'm currently running a discord bot, working on another.

Work a full time SWE role in my day time though.

quartz kindle
#

im good at starting shit and never finishing it lol

long marsh
quartz kindle
#

idk, i guess i lose motivation when it gets to the packaging and marketing stage

#

i like the problem solving part

#

i hate turning it into a product

long marsh
#

See if there's a market that will pay for it, so to speak.

#

Even if you solve a complex problem, if no one cares enough to pay for it ... then is it worth it? From my capitalist perspective, probably not. Then again, we'd never have open source software if everyone thought that way.

cloud rune
#

hello folks

mellow rock
#

hi hi

sharp geyser
#
# SERVER_ERROR:  [Error: Missing credentials for "PLAIN"] {
  code: 'EAUTH',
  command: 'API'
}

@quartz kindle you've used nodemailer

#

can you explain this

#

cause like

#
const transporter = createTransport({
    host: process.env.SMTP_HOST,
    port: 587,
    secure: false,
    auth: {
        user: process.env.SMTP_USER,
        pass: process.env.SMPT_PASSWORD,
    },
    tls: {
        ciphers: 'TLSv1.2',
    },
});
#

I am supplying it

#

I have already checked that those envs are valid

pearl trail
#

SMPT ?

quartz kindle
#

lmao

sharp geyser
#

That will do it

#

I've been staring at this all night

hidden gorge
#

I love using that

slender wagon
small tangle
#

well

quartz kindle
sharp geyser
#

Caused a problem with my nextjs app

#

Introduced a loop that would just continiously redirect to / in my middleware

#

Now after fixing said loop it just refuses to load the page

#
type Session = typeof auth.$Infer.Session;

export async function middleware(request: NextRequest) {
    const sessionCookie = getSessionCookie(request);

    if (!sessionCookie) return NextResponse.redirect(new URL('/', request.url));

    const { data: session } = await betterFetch<Session>('/api/auth/get-session', {
        baseURL: request.nextUrl.origin,
        headers: {
            cookie: sessionCookie ?? '',
        },
    });

    if (session && request.nextUrl.pathname === '/')
        return NextResponse.redirect(new URL(`/dashboard/${session.user.id}`, request.url));

    return NextResponse.next();
}

export const config = {
    matcher: ['/', '/dashboard'],
} satisfies MiddlewareConfig;

#

I think I fixed it anyway right?

#

I am not making another mistake?

tacit estuary
#

I'm just gonna ask if anybody knows how to work with time zones in python discord? I got regular time down, but no idea how to deal with time zones so for now it defaults to UTC+0.

sharp geyser
#

How are you getting their timezone?

tacit estuary
# sharp geyser How are you getting their timezone?

time = datetime.now()

Added
from datetime import datetime, timezone
to get it to always store it UTC+0
time = datetime.now(timezone.utc)

No idea how to get it to show it in the users time zone so for now it stays in UTC+0.

sharp geyser
#

How are you getting their timezones though

#

Do they input it themselves or what

tacit estuary
#

I don't. On my end it the time will be shown in my time zone and on the official bot online, it is shown as +0.

sharp geyser
#

Then...what are you having problems with?

#

Forgive me if im slow but you can't show it in their timezone without getting their timezone

tacit estuary
#

I was trying to see if when the user checks like say their high score listings if the time can be shown in their time zone instead of default UTC+0 thing if that makes sense.

That is what what chatgpt told me. In that case, this makes things pretty easy.

sharp geyser
#

Well you'd have to acquire it somehow

#

from what I know discord doesn't give it to you

tacit estuary
#

I found something that converts it to the users time!

#

And it actually works after testing.

sharp geyser
#

Mind sharing it?

wheat mesa
#

If you’re trying to show in a user’s timezone there is a formatter to do so

#

You never get shown the actual user timezone

#

It’s a client side tjing

#

<t:UNIX_TIMESTAMP:R> or something like that

#

There’s more options than that but it’s just what I remember

#

<t:1747710178:R>

sharp geyser
#

Well yeah I guess you could do that too

tacit estuary
#

Yeah the above was right.

I'm using visual studio code and the greenish color after import no longer shows and I been with chatgpt for like one hour trying to figure it out and it giving me a headache.

tacit estuary
#

The colors came back oddly.

pliant yoke
limpid rain
#

hi

delicate zephyr
#

@zinc fable

zinc fable
#

got it

neon leaf
#

@zinc fable

zinc fable
#

tyty

prime cliff
harsh crown
#

Do y'all think ts is possible?

#

If so, are there any that are public rn?

#

@shell tundra can you give ur thoughts on ts?

warped glacier
#

Just wait your turn

#

yknow im bored. Yesh that is agents TOS as it logs users IP to determine VPN attempts. Also tracking users is not allowed either

shell tundra
harsh crown
harsh crown
warped glacier
harsh crown
#

i.g dark forums or sum

warped glacier
#

Wrong place to ask

lyric mountain
#

aside from being unable to have it verified in either topgg or discord

warped glacier
#

<style>
body {
margin: 0;
padding: 40px;
font-family: Arial, sans-serif;
color: white;
background: url('https://i.imgur.com/AfPAkxt.png') no-repeat center center fixed;
background-size: cover;
}

.card {
  background-color: rgba(0, 0, 0, 0.85);
  border-radius: 16px;
  padding: 40px;
  max-width: 900px;
  margin: auto;
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.6);
}

.fly-left {
  opacity: 0;
  transform: translateX(-60px);
  animation: flyLeft 1s ease forwards;
}

.fly-right {
  opacity: 0;
  transform: translateX(60px);
  animation: flyRight 1s ease forwards;
  animation-delay: 0.6s;
}

@keyframes flyLeft {
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes flyRight {
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

h1 {
  text-align: center;
  color: #00ffc8;
}

h2 {
  color: #00ffc8;
}

.highlight {
  background-color: #1a1a2e;
  padding: 10px 15px;
  border-left: 5px solid #00ffc8;
  border-radius: 8px;
}

.buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 30px;
  flex-wrap: wrap;
}

.btn {
  display: inline-block;
  text-align: center;
  width: 120px;
  height: 50px;
  line-height: 50px;
  font-weight: bold;
  font-size: 15px;
  border-radius: 12px;
  text-decoration: none;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  transition: transform 0.2s ease;
}

.btn:hover {
  transform: scale(1.05);
}

.btn.invite {
  background-color: #ff3366;
  color: white;
}

.btn.vote {
  background-color: #2b2f31;
  color: white;
}

</style>

<div class="card">
<h1>🔒 AntiScammer – Your Community's First Line of Defense</h1>

<!-- English Section -->
<div class="fly-left">
  <h2>EN:</h2>
  <p>
    AntiScammer is a powerful Discord bot designed to protect your community from known scammers and potential fraudsters. It automatically bans flagged accounts, scans for suspicious activity, and helps your moderators take action before damage is done. With real-time detection and an ever-growing scammer database, AntiScammer ensures a safer space for everyone.
  </p>
  <p class="highlight">
    ⚙️ To activate protection, server admins must run <strong>/setup</strong>. This links a report channel where scam alerts and escalations will appear. Without setup, the bot will not take action.
  </p>
</div>

<!-- Spanish Section -->
<div class="fly-right">
  <h2>ES:</h2>
  <p>
    AntiScammer es un poderoso bot de Discord diseñado para proteger a las comunidades de conocidos estafadores y banear cuentas. Escanea por actividad sospechosa y ayuda a los moderadores a tomar acciones antes del daño. Con detección en tiempo real y una base de datos que crece todos los días, AntiScammer proporciona un espacio seguro para todos.
  </p>
  <p class="highlight">
    ⚙️ Para activar la protección, los administradores deben ejecutar <strong>/setup</strong>. Esto conecta un canal de reportes donde se enviarán las alertas y escalaciones. Sin este paso, el bot no funcionará.
  </p>
</div>

<!-- Buttons -->
<div class="buttons">
  <a href="https://top.gg/bot/YOURBOTID/invite" class="btn invite">Invite</a>
  <a href="https://top.gg/bot/YOURBOTID/vote" class="btn vote">▲ Vote (0)</a>
</div>

</div>

lyric mountain
warped glacier
#

Hell

lyric mountain
#

not only you dont, but if you put them they'll make the whole thing not work

#

topgg is already inside body

#

put styles inside a <style> block and consider everything else to be body

warped glacier
#

So like this?

lyric mountain
#

also u cant change title

#

and cant set a meta charset

warped glacier
#

OM

lyric mountain
#

actually just style alone, pretty much nothing else will work

#

style and the actual body

warped glacier
#

FFS im trying here.

#

This is confusing

lyric mountain
#
<style>
  your styles here
</style>

the actual content
#

anything aside from that will either be ignored or blocked

warped glacier
#

Its in style block

lyric mountain
#

yes, your current msg should work

warped glacier
#

ABOUT TIME!

#

OM that was rough

#

They have that odd

lyric mountain
#

lul, it's a common mistake to attempt to use actual site html inside longdesc

#

it makes sense when you consider you are inside body already

warped glacier
#

it makes sence. but it makes coding it annoying

lyric mountain
#

just write a site and have it send the acesser's IP back to your API and register in a database

#

same IP = probably same user

#

but it's easy to bypass anyway

harsh crown
#

not exactly someone who'd trust me to open up a site

lyric mountain
#

I mean, there's no magic that'll give you info like that

#

every altchecker bot relies on data collection and statistic

harsh crown
harsh crown
lyric mountain
#

there's literally NO connection between two accounts without the target giving you info

harsh crown
lyric mountain
wheat mesa
#

Yeah there is no way to definitively say. This is also somewhat skirting the line of legality

lyric mountain
#

GDPR isn't to be taken lightly

wheat mesa
lyric mountain
wheat mesa
#

Keep in mind that tracking alt accounts without prior consent is definitely a privacy violation and amounts to at the very least a violation of TOS

lyric mountain
#

the magic is in the site side, since there u have a lot of info about who acesses it

warped glacier
#

Id say get off this chat since its circling legality issues

quartz kindle
#

who cares about legality

#

illegal chats are awesome

#

who wants to rob a bank with me?

deft wolf
#

With you Tim? Always

tawdry summit
slender wagon
#

Hi guys, I'm starting to work on a project that will be multiplatform. And i want to have one central API.
For database i have it set to use postgres, idk if i should use prisma or not.
This project might get lots of concurrent users, and idk i really don't know if i should go with express or something else. But it has to be in TS

#

Any suggestion would help

acoustic bough
#

and for http server Id go with fastify or hono

#

although since I use bun I use Bun.serve

slender wagon
#

i tried fastify on a simple project this week

#

its great

#

and no Bun is a big no no

acoustic bough
#

it's much faster than express

#

express is the slowest you can use

slender wagon
#

it's been acting up on my vps's

acoustic bough
#

works fine for me

slender wagon
#

looking at kysely rn

lament rock
#

How about something like uws.js. It has a higher learning curve but its performance is great

sharp geyser
#

Is this not how you do route groups so you can have diff layouts?

#

When visiting localhost:3000/dashboard I get this

hidden gorge
#

I guess not

sharp geyser
#

Wow gee thanks for that input

hidden gorge
sharp geyser
#

Wdym

#

It's route grouping

hidden gorge
#

You have (dashboard)

sharp geyser
#

Yes, because its route grouping

pearl trail
#

interesting, never seen or used that feature before

hidden gorge
#

Hmm I've actually never heard of route grouping

#

Medium has proven itself unhelpful

sharp geyser
#

Guess it was a nextjs hot-reload issue

#

But now im wondering whats the point of this if the layouts don't change Waaaaaah

#

Nevermind

#

Forgot to add my styles file 💀

hidden gorge
#

Just wondering has anyone here implemented Google authenticator into their site and how hard is it. Just trying to figure out before I start

sharp geyser
#

they have a guide on webauthn

#

Which includes TOTP

quartz kindle
slender wagon
#

Never done that

#

Its good for scaling?

quartz kindle
#

depends how you code it

slender wagon
#

Ill be caching lots of stuff as well

quartz kindle
#

which part did you never do before?

slender wagon
#

No framework

quartz kindle
#

for http or postgres?

slender wagon
#

http

#

Postgres i have done it before

quartz kindle
#

its pretty simple to use, but depends how complex you need your routing to be

#

i can show you how i use it

slender wagon
#

It will get a bit complex

#

Since i will have different roles

#

The endpoints need to be secured properly

#

Blablabla

#

You know it

#

I was thinking on using better auth for the auth part

slender wagon
quartz kindle
#

basically the gist of it is like this:

const server = http.createServer(requestListener);
server.listen(port, () => {
        console.log(`Server started on port ${port}`);
});
async function requestListener(req, res) {
    const path = req.url?.slice(1) || "/";

    // check if route exists
    const route = routes[path]; // define your routes somewhere, like a js object
    if(!route) {
        respond(res, 404, '{"error":"Invalid endpoint"}'); // basic 404
        return;
    }

    // check if request body exists (for POST requests)
    let data;
    try {
        data = (await readStream(req)).toString(); // read request stream
        if(!data) {
            throw new UserError("Received empty request");
        }
    } catch(e) {
        respond(res, 400, `{"error": "${e}"}`);
        return;
    }

    // check if body is valid json
    let json;
    try {
        json = JSON.parse(data);
    } catch(e) {
        respond(res, 400, `{"error": "Received malformed request: ${e}"}`);
        return;
    }

    // check if body is valid object
    if(!json || typeof json !== "object") {
        respond(res, 400, '{"error":"Received empty request"}');
        return;
    }

    // call route
    try {
        const result = await route(json); // route function is obtained from the relevant route file
        const response = JSON.stringify(result);
        respond(res, 200, response);
    } catch(e) {
        const error = /** @type {Error | UserError} */ (e);
        if(error instanceof UserError) {
            respond(res, error.code || 400, `{"error":"${error.message}"}`);
        } else {
            console.error(error);
            respond(res, 500, '{"error":"Internal server error"}');
        }
    }
}
#

although this example is for a POST only JSON api

#

auth is done via api key in auth headers, which i dont show here

#

but essentially that is what soemthing like fastify will do for you behind the scenes when you use app.post(...)

#

i just like having more control over each step

slender wagon
#

Hmmm

#

Hinestly i might go with fastify for now

quartz kindle
#

for example, stuff like express/fastify will have parameterized urls, like "/path/:param", which you can access using its functions

#

using native http you would need to do that yourself from the req.url variable

#

and for post requests you dont have access to the posted data directly, you receive it as a stream in the req variable, which you need to read yourself

#

other than that there isnt much difference between an http framework and native http

#

aside from all the routing helper functions and middleware system, which you can easily do yourself imo

slender wagon
#

But is there much benefit to it?

quartz kindle
#

more control over what happens on each request

#

im not a big fan of a library/framework doing stuff to the request before i can see it

slender wagon
#

So basically less stuff that can go wrong

quartz kindle
#

and also, less dependencies to manage :^)

neon leaf
#

yes yes

#

I do think that depending on what you are doing, readability can be more important than squeezing out all performance

quartz kindle
#

assuming we are talking about the central API for your project, you can further scale it like this:
nginx multiple upstreams -> multiple nodejs instances
or
nginx upstream -> nodejs gate/auth -> multiple nodejs workers/child processes

#

for multi-process caching i like lmdb for local, or one of those redis-esque things for remote cache

#

although i personally dont see a point in remote caching

neon leaf
#

was mainly useful for php

#

where data gets lost after a request

quartz kindle
#

an even better cache is to use ip hashing in nginx so that the same ip always ends in the same node process, so you can simply cache in local objects/maps

#

but if you need persistent cache that survives restarts, lmdb is the way to go

hidden gorge
#

now i see why i do dumb things i created a whole class for config files 😭

sharp geyser
#

That's not necessarily dumb

#

If you have more than just get that is

quartz kindle
wheat mesa
#

From the looks if it you’re just reinventing the wheel here

#

Actually you don’t even need a map, I forget that objects in js are just magical and you could simply load your configuration into an object instead of having to write your own methods

hidden gorge
quartz kindle
hidden gorge
quartz kindle
#

yeah its not a big issue, but its generally not considered a good practice

hidden gorge
quartz kindle
#

there is no "risk" per se, exept that it makes the code more complex and less maintainable, its essentially a big global variable that all files can access, and consequently any file can make changes to it and affect other files that use it, which can lead to issues

hidden gorge
#

Hmm good to know

quartz kindle
#

as long as you're aware of those characteristics its fine

hidden gorge
#

Yeah In reality all I do is assign classes

sharp geyser
#

Told you from the beginning it’s not good practice

scenic kelp
#

doing stuff like that you're essentially removing any chance of making something unit testable

#

realistically you should be doing dependency injection but it doesn't matter much for a discord bot cause who actually wants to write tests for those

lament rock
#

I made my own fake server once to unit test my bot

#

The files are lost to the void tho

neon leaf
hidden gorge
wheat mesa
#

If it were C#, sure

crude hound
quartz kindle
hidden gorge
hidden gorge
#

@zinc fable

zinc fable
#

tyty

hidden gorge
neon leaf
#

@zinc fable

zinc fable
#

🙏 ty

hidden gorge
quartz kindle
quartz kindle
#

xD

hidden gorge
#

though*

#

like its easy to add new things

#

plus i think for the rewrite i'm gonna make my own Enum directory

quartz kindle
#

how about something like this?

import config from "./config.json";
import Logger from "some_logging_lib";
import DB from "some_db_lib";

export const config;
export const logger = new Logger();
export const db = new DB();
neon leaf
#

Sir Tim, when will you join the dark side

quartz kindle
#

dark side?

#

you mean typescript?

neon leaf
#

Rust

quartz kindle
#

ah

#

lmao

#

idk never tried getting into it, im more used to c++ syntax, but even that i barely use

neon leaf
#

I had some difficulties switching from ts to rust but now that I'm locked in, I've never felt so productive

#

I especially love rust """enums""" (they aren't enums)

quartz kindle
#

lmao

pearl trail
#

Ts and rust is night and day arent them

quartz kindle
#

im still married to js, so i cant, that would be cheating

hidden gorge
#

i just added an easier way to check bitflags imo

neon leaf
#

🙏

quartz kindle
#

that is against the bible

#

:^)

neon leaf
#

Then use rust to make wasm

quartz kindle
#

tbf i did a bit of emotional cheating already by using a web framework for the first time

#

sveltekit

neon leaf
#

Mhm

#

It was a total pain because I'm rewriting from a go codebase

quartz kindle
#

what does it do?

neon leaf
#

Are you aware of the pterodactyl game panel?

hidden gorge
neon leaf
#

This is a replacement for it's go based daemon that runs on all nodes to control the server containers

quartz kindle
#

lmao jk

hidden gorge
#

...

quartz kindle
#

looks good

hidden gorge
#

i forgot that on the dev version i didn't remove the remember me toggle 💀

quartz kindle
#

nice

neon leaf
#

I always am

#

It's where I make my money

#

I need to keep it alive

hidden gorge
quartz kindle
hidden gorge
neon leaf
#

I make addon

quartz kindle
#

ah

neon leaf
#

The project itself is kind of dead

quartz kindle
#

thats cool tho

neon leaf
#

Yes yes, 5 figures per year

quartz kindle
quartz kindle
neon leaf
#

A bit high lol

hidden gorge
neon leaf
#

It's not that crazy

quartz kindle
#

i've never had a "normal paying" job xD

neon leaf
#

Weren't you a teacher?

quartz kindle
#

yeah, part time, and on a per-course basis, 3 weeks at a time, only when needed

#

paid like 500 bucks per course

neon leaf
#

Not bad

quartz kindle
#

i did it like 3 times only

#

last time was jan-feb, they havent called me again yet

hidden gorge
#

is it actually better to do this over const?

neon leaf
#

Oh bruh

quartz kindle
#

im doing a freelance job now on a sveltekit website, paying 25/hr, but im only allowed to work 10hrs per week

neon leaf
#

...

#

Nice pay

#

I work at a hosting company and also get 25/h

#

No limit but there's just nothing to do lol

quartz kindle
hidden gorge
#

there*

quartz kindle
#

ah you mean require vs import?

hidden gorge
#

yes

quartz kindle
#

there are many differences under the hood

#

but it doesnt really matter that much

#

to use import you need to declare your project as a "module"

#

and there are syntax differences, like being allowed to use import/export or not

#

and the loading system is also different

#

require loads files synchronously, import is async

#

import also does a lot of more stuff under the hood

#

most people are gradually moving towards using import everywhere, so its fine to go that route

#

but for some time it was complicated because of certain incompatibilities between the two

#

A battle has raged on for millennia, claiming numerous casualties in its wake, where no single individual, corporation nor entity was safe from the wreckage that followed in its trail; hidden deep within the binary bunkers, there festered something so awful, so terrible that mankind is still reeling from it today.
Of course, I'm speaking of the dreaded 20-year war that is commonly known as...
COMMON JAVASCRIPT (CJS)
VS
ECMA SCRIPT MODULES (ESM)

hidden gorge
#

rn i fell like what im doing with the start server may be wrong i cant tell:

async function startServer() {
    try {
        core.logger.info('Starting the server...');
        core.db = new database(databaseCfg.databaseURI, databaseCfg.dbName)
        core.logger.attempting(`Attempting to connect to the database at URI: ${databaseCfg.databaseURI}`);

        await core.db.connect().then(() => {
            core.logger.info('Database connected successfully!');
        }).finally(() => {
            app.listen(httpCfg._proxying._port, function () {
                core.logger.info(`API server started and listening on https://0.0.0.0:${httpCfg._proxying._port}`);
            })
        })
    } catch (error) {

    }
}

startServer()
#

didnt code in the catch stuff yet

sharp geyser
#

Whats the problem

quartz kindle
#

since they both do the same thing

hidden gorge
quartz kindle
#
// async/await with return
async function abc() {
  try {
    const result = await xyz();
    // do something with result
    return result;
  } catch(error) {
    return error; // or throw if you want to catch it elsewhere
  }
}

// then/catch with return
function abc() {
  return xyz().then(result => {
    // do something with result
    return result;
  }).catch(error => {
    return error; // or do something else
  })
}

// then/catch without return
function abc() {
  xyz().then(result => {
    // do something with result
  }).catch(error => {
    // do something with error
  })
}
hidden gorge
hidden gorge
#

Hey, just need some feedback on an idea here. I wanna redo my API key system and include bit flags to limit the abilities of some keys. is this a good idea?

frosty patio
lyric mountain
#

just mind how many flags you intend to have

#

byte can hold 8 flags, smallint can hold 16, int can hold 32 and bigint can hold 64

hidden gorge
#

this is what ive done rn

lyric mountain
#

that's plenty

hidden gorge
#

wait does mongo work with bigint?

prime cliff
#

Yea monogdb has it as Int64

neon leaf
#

gotta love lto

#

20mb to 12mb

quartz kindle
neon leaf
#

y

quartz kindle
#

because on some systems it was crashing

#

aka amazon linux

neon leaf
#

bru

quartz kindle
#

i debugged it with help from voltrex and turns out some linux distros have non-standard locations for their build stuff

#

so the linker was not found during build

#

lmao

neon leaf
#

ah well mine are prebuilt

#

I guess its fine

quartz kindle
#

ye probs

neon leaf
#

1m 52s to build one binary on github actions 🔥

quartz kindle
#

not bad

#

my stuff is usually pretty smol

#

so build times are like 10-20s for me

neon leaf
#

Im going to move my build stuff home soon probs

neon leaf
#

so I can abuse my 9900x for rust

deft wolf
#

He's banned here or what?

queen needle
#

Left here

quartz kindle
#

pretty sure hes banned

#

i dont remember why tho

#

also speedy

#

miss those guys

deft wolf
queen needle
#

Ohh

#

I didn't know I just knew he wasn't in gere

#

And haven't really talked to him in awhile

deft wolf
#

I mean, he's still on DDevs but he's not active there at all

queen needle
#

Yeah I have 4 servers in common with him not really active in any

deft wolf
#

[*]

frosty patio
hidden gorge
hidden gorge
#

so rn im kinda stuck here im trying to work with JWT but it keeps returning 401 even though im supplying the token

API:

            const JWT_SECRET = "m9X!4rN#7vL@zQ2pFs8WdYjKtGhB5CeU";


            const token = jwt.sign(
                { id: userData._id, email: userData.email },
                JWT_SECRET,
                { expiresIn: "1h" }
            );

            return res.status(200).json({ result: true, token });

Web-Frontend:

 fetch('/backend/verifyLogin', {
            method: 'POST',
            headers: {
                'Content-Type': 'application/json'
            },
            body: JSON.stringify({
                email: email.value,
                password: password.value
            })
        })
            .then(response => response.json())
            .then(data => {
                if (data.result === true) {
                    const token = data.token;
                    localStorage.setItem('auth_token', token);
                    console.log(token)

                    document.getElementById('signin-success').style.display = 'block';

                    fetch('/backend/authUser', {
                        method: 'POST',
                        headers: {
                            'Content-Type': 'application/json',
                            'Authorization': `Bearer ${token}`
                        },
                        body: JSON.stringify({})
                    })
                        .then(res => res.json())
                        .then(userData => {
                            console.log("Authenticated user data:", userData);
                        })
                        .catch(err => {
                            console.error("Auth request failed:", err);
                        });

                } else {
                    document.getElementById('signin-error').style.display = 'block';
                }
            })

Web-Backend:

const express = require("express");
const router = express.Router();
const passport = require("../../handlers/passportAuth");
const { v4: uuidv4 } = require("uuid");

router.post(
    "/",
    passport.authenticate("jwt", { session: false }),
    async (req, res) => {
        try {
            const user = {
                id: uuidv4(),
                email: req.user.email
            };

            res.json({
                result: true,
                user: user,
            });
        } catch (error) {
            console.error("Unexpected error:", error);
            res.status(500).json({
                result: false,
                error: "Internal server error",
            });
        }
    }
);

module.exports = router;
#

anyone know why it keeps returning 401?

#

I'm testing it on Postman with the token itself and now its saying Unauthorized as well

hidden gorge
# quartz kindle show passportAuth.js
const passport = require("passport");
const { Strategy: JwtStrategy, ExtractJwt } = require("passport-jwt");
const speakeasy = require("speakeasy");


const JWT_SECRET = "m9X!4rN#7vL@zQ2pFs8WdYjKtGhB5CeU";

passport.serializeUser((user, cb) => {
    console.log("[Passport] Serializing user:", user);
    process.nextTick(() => {
        cb(null, { id: user.id, email: user.email });
    });
});

passport.deserializeUser((user, cb) => {
    console.log("[Passport] Deserializing user:", user);
    process.nextTick(() => {
        cb(null, user);
    });
});

const opts = {
    jwtFromRequest: ExtractJwt.fromAuthHeaderAsBearerToken(),
    secret: JWT_SECRET,
};

passport.use(new JwtStrategy(opts, async (jwt_payload, done) => {
    console.log("[Passport] JWT payload received:", jwt_payload);
    try {
        return done(null, jwt_payload);
    } catch (err) {
        console.error("[Passport] Error in JWT strategy:", err);
        return done(err, false);
    }
}));

console.log("[Passport] JWT strategy initialized");

module.exports = passport;
quartz kindle
#

does it log JWT payload received?

hidden gorge
#

this is all it gets

hidden gorge
quartz kindle
#

is the router path correct? add a console.log in the router function

quartz kindle
#

according to the docs:
secret: JWT_SECRET
should be
secretOrKey: JWT_SECRET

hidden gorge
# quartz kindle according to the docs: `secret: JWT_SECRET` should be `secretOrKey: JWT_SECRET`

it is

const passport = require("passport");
const { Strategy: JwtStrategy, ExtractJwt } = require("passport-jwt");
const speakeasy = require("speakeasy");


const JWT_SECRET = "m9X!4rN#7vL@zQ2pFs8WdYjKtGhB5CeU";

passport.serializeUser((user, cb) => {
    console.log("[Passport] Serializing user:", user);
    process.nextTick(() => {
        cb(null, { id: user.id, email: user.email });
    });
});

passport.deserializeUser((user, cb) => {
    console.log("[Passport] Deserializing user:", user);
    process.nextTick(() => {
        cb(null, user);
    });
});

const opts = {
    jwtFromRequest: ExtractJwt.fromAuthHeaderAsBearerToken(),
    secretOrKey: JWT_SECRET,
};

console.log(opts.secretOrKey)

passport.use(new JwtStrategy(opts, async (jwt_payload, done) => {
    console.log("[Passport] JWT payload received:", jwt_payload);
    try {
        return done(null, jwt_payload);
    } catch (err) {
        console.error("[Passport] Error in JWT strategy:", err);
        return done(err, false);
    }
}));

console.log("[Passport] JWT strategy initialized");

module.exports = passport;
#

apparently i copied the wrong version earlier

quartz kindle
#

what do you use for jwt.sign()?

#

is it also from passport-jwt?

delicate zephyr
hidden gorge
hidden gorge
#

i just went through some of my code and in the sign its called a null id

#

wait nvm

#

im stupid

#

it is calling the correct id

quartz kindle
#

idk everything looks fine

#

can you test using jsonwebtoken.verify()?

hidden gorge
frosty patio
#

I am not fine 😞

quartz kindle
#

on the token you created using jsonwebtoken.sign()

frosty patio
#

Jk 🐦😂

hidden gorge
#

okay wtf i just found the cause...

#

i think

frosty patio
#

Let him cook

quartz kindle
#

cook some nice pasta

hidden gorge
#

SOMEHOW ADDING THIS FIXED IT

quartz kindle
#

....that.... makes zero sense?

hidden gorge
frosty patio
quartz kindle
#

idk man, ghosts

hidden gorge
#

now to go fix my redirect issue

#

like it works...

frosty patio
#

If adding logging fixes my errors my life would be 1000 times better

hidden gorge
#

okay so it wasnt that log that fixed it

#

but something did fix it

#

and idk what did

frosty patio
#

He cooked too hard he forgot what he cooked

hidden gorge
#

I FOUND IT

#

WHEN I USE CONST IT BREAKS

#

WHEN I USE VAR IT WORKS!??!?

#

HUH

#

explain that to me plz

quartz kindle
#

there is no explanation lol

sharp geyser
#

Scoping issue?

hidden gorge
quartz kindle
#

and if you undo that it stops working again?

hidden gorge
#

and idk why

quartz kindle
#

that makes literally zero sense

hidden gorge
#

NOW ITS WORKING WTF?!?!?

#

i am lost for words

quartz kindle
#

well, i guess the problem was not that after all

#

:^)

hidden gorge
quartz kindle
#

is the api and the front/backend in the same server?

quartz kindle
#

check the server time in both servers

hidden gorge
#

API = Seperate Server,
Backend/Front = Same Server

#

usually its on a VPS but im on the dev version

quartz kindle
#

the only thing that makes sense is somehow the expiration date set in one server is invalid in another server

#

if it started working out of nowhere after some time, one of the servers having an incorrect system time would explain it

hidden gorge
#

okay now my isAuth aint working

#
const passport = require("passport");

const isAuth = (req, res, next) => {
    console.log("[Auth] Incoming headers:", req.headers);

    passport.authenticate("jwt", { session: false }, (err, user, info) => {
        console.log("[Auth] Error:", err);
        console.log("[Auth] User:", user);
        console.log("[Auth] Info:", info);

        if (err || !user) {
            return res.status(401).json({ result: false, error: "Unauthorized" });
        }

        req.user = user;
        next();
    })(req, res, next);
};

module.exports = isAuth;
pearl trail
#

isnt that jwt supposed to be filled? phmm_c

quartz kindle
hidden gorge
#

ah

quartz kindle
#

are the incoming headers correct?

hidden gorge
#

but idk where i would do that for each request

#

oh wait

#

hold on

#

im just setting the location

#

mb guys

#

i am very new to JWT...

quartz kindle
#

is it working now?

hidden gorge
quartz kindle
#

the jwt token needs to be added to every single request you make

hidden gorge
#

is there not a way to redirect in EJS while sending headers?

quartz kindle
hidden gorge
#

i just did some janky things and got somwhere

#
                        .then(userData => {
                            console.log("Authenticated user data:", userData);
                            fetch("/dashboard", {
                                method: 'GET',
                                headers: {
                                    'Content-Type': 'application/json',
                                    'Authorization': `Bearer ${token}`
                                },
                            }).then(response => {
                                if (!response.ok) throw new Error("Unauthorized or other error");
                                return response.text();
                            }).then(data => {
                                console.log("Dashboard response:", data);
                                window.location = "/dashboard";
                            })
                                .catch(err => {
                                    console.error("Auth request failed:", err);
                                });
                        })
[Auth] Error: null
[Auth] User: {
  id: '680474384ea222c6a57a1887',
  email: 'I removed this',
  iat: 1748052020,
  exp: 1748055620
}
[Auth] Info: undefined
quartz kindle
#

you can either set the jwt in a cookie, or you can put it in the url as a query parameter

hidden gorge
quartz kindle
#

well, its easier to steal the token

#

the thing with jwt is that there are no sessions, a single token defines everything

hidden gorge
#

it works

quartz kindle
#

yeah, it will work anywhere and everywhere

#

if you copy the url to another pc, it will still work there

hidden gorge
#

oh..

#

well then

quartz kindle
#

because your login status is not bound to any particular device or session

#

thats how jwt works

hidden gorge
#

wait but now im confused

#

yeah im going to cookies

quartz kindle
#

yes, cookies are safer, make sure to set them as httpOnly and secure

hidden gorge
#

ima go insane

#

okay that broke wtf

#

it wont set the cookie 😭

#
const express = require("express");
const router = express.Router();
const passport = require("../../handlers/passportAuth");
const { v4: uuidv4 } = require("uuid");

router.post("/", (req, res, next) => {
  console.log("HIT");
  passport.authenticate("jwt", { session: false }, (err, user, info) => {
    if (err) return next(err);

    if (!user) {
      return res.status(401).json({
        result: false,
        error: "Unauthorized",
      });
    }

    req.user = user;
    next();
  })(req, res, next);
}, async (req, res) => {
  try {
    const authHeader = req.headers.authorization;
    const token = authHeader && authHeader.startsWith("Bearer ") ? authHeader.slice(7) : null;

    if (!token) {
      return res.status(400).json({ result: false, error: "No token provided to set cookie" });
    }

    res.cookie("token", token, {
      httpOnly: true,
      secure: process.env.NODE_ENV === "production",
      sameSite: "lax",
      maxAge: 24 * 60 * 60 * 1000,
    });

    const user = {
      id: uuidv4(),
      email: req.user.email
    };

    res.json({
      result: true,
      user: user,
    });
  } catch (error) {
    console.error("Unexpected error:", error);
    res.status(500).json({
      result: false,
      error: "Internal server error",
    });
  }
});

module.exports = router;
#

oh i forgot credentials: 'include'

quartz kindle
#

if you are doing the request using fetch you need to include credentials

hidden gorge
#

and nope...

#

doesnt show up

#

but its in my local storage

#

ah fixed

wheat mesa
#

Yeah def go with the cookie approach, pretty much anything else is unsafe to XSS attacks

warped glacier
#

I am stumped. Anyone have any ideas why discord says the command is outdated (Im rebooting client each reboot so i am getting latest)



#

At the end isw a


client.run(TOKEN)
#

I jsut cut it as it has my token

lament rock
# warped glacier I am stumped. Anyone have any ideas why discord says the command is outdated (Im...

When you patch your commands with new commands, it takes Discord a bit to update the commands on their end so while they're doing that, they don't want to send you old commands where the arguments may have changed and break your bot. Give it a while before they update and they should be okay. Though it's not recommended to try to patch your commands every bot restart. You should have a REPL function do that

crude turtle
#

i think it's near instant nowadays

#

it's probably caused by the fact that you remove all the commands and then add them again, not very ideal, i'd just set instead of remove and add

deft wolf
#

It is instant but this "error" is due to the cache and usually restarting Discord is enough

prime cliff
deft wolf
#

Both should be instant tbh

crude turtle
#

global commands taking a long time to register was only because of cache and they solved that a while back

warped glacier
deft wolf
#

Wdym "reboot"?

warped glacier
#

kill discord via taskmgn then reopen i9t

#

Thats always how ive resynced my command

deft wolf
#

Ctrl+R is enough

warped glacier
#

still though. It is not letting me use the command despite multiple recaching attempts

#

Yeah like its been 10hrs and im still getting

2025-05-24 14:18:30 ERROR discord.app_commands.tree Ignoring exception in command 'setup_tcp'
Traceback (most recent call last):
File "/home/container/.local/lib/python3.12/site-packages/discord/app_commands/tree.py", line 1310, in _call
await command._invoke_with_namespace(interaction, namespace)
File "/home/container/.local/lib/python3.12/site-packages/discord/app_commands/commands.py", line 883, in _invoke_with_namespace
return await self._do_call(interaction, transformed_values)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/container/.local/lib/python3.12/site-packages/discord/app_commands/commands.py", line 871, in _do_call
raise CommandSignatureMismatch(self) from None
discord.app_commands.errors.CommandSignatureMismatch: The signature for command 'setup_tcp' is different from the one provided by Discord. This can happen because either your code is out of date or you have not synced the commands with Discord, causing the mismatch in data. It is recommended to sync the command tree to fix this issue.****

frosty patio
#

You are getting the error bcz the commands on ur code arent synced with discord they prob have some old ones

warped glacier
#

def init(self):
intents = discord.Intents.default()
super().init(intents=intents)
self.tree = app_commands.CommandTree(self)
self.config = self.load_config()

#

async def setup_hook(self):
self.tree.clear_commands(guild=None)
self.tree.add_command(self.setup_command)
await self.tree.sync(guild=None)

frosty patio
#

Try

#

def init(self):
intents = discord.Intents.default()
super().init(intents=intents)
self.tree = app_commands.CommandTree(self)
self.config = self.load_config()

async def setup_hook(self):
self.tree.clear_commands(guild=None)
self.tree.add_command(setup_tcp)
await self.tree.sync()

#

Btw i changed the name of the commznd make sure to update it wherever u define it

warped glacier
#

Let me try that rq

#

Traceback (most recent call last):
File "/home/container/app.py", line 118, in <module>
client = TCPBot()
^^^^^^^^
TypeError: Client.init() missing 1 required keyword-only argument: 'intents'

...

#

one second

#

i shouldent need anything there due to how its configured

#

My mind is soo confused

frosty patio
#

Fixed?

warped glacier
#

nope

frosty patio
#

And include its context

warped glacier
#

OOP

prime cliff
#

It literally tells you it's missing an argument lol

warped glacier
#

WRONG BOT

prime cliff
#

TypeError: Client.init() missing 1 required keyword-only argument: 'intents'

warped glacier
prime cliff
#

Yea but it's not saying that for a reason

warped glacier
#

If intents are already set in startup it dosent need to be restated. This is how i do all my bots.

warped glacier
prime cliff
#

Is discord.Intents.default() wrong or returning null

frosty patio
#

You need to pass intents in tcp bot init

hidden gorge
frosty patio
hidden gorge
warped glacier
#

OMFGGGGGG

frosty patio
# warped glacier OMFGGGGGG

class TCPBot(discord.Client):
def init(self):
intents = discord.Intents.default()
super().init(intents=intents)
self.tree = app_commands.CommandTree(self)

warped glacier
hidden gorge
#

wtf now its not even getting a payload

frosty patio
warped glacier
#

ITS BACK UP. FCKJ

#

Ok i can deal with this

frosty patio
warped glacier
frosty patio
hidden gorge
#

there we go

frosty patio
hidden gorge
#

that fixed it

hidden gorge
#

i managed to get this working last night

warped glacier
# frosty patio What function u getting the arg error on?

2025-05-24 15:10:54 ERROR discord.app_commands.tree Ignoring exception in command 'setup_tcp'
Traceback (most recent call last):
File "/home/container/.local/lib/python3.12/site-packages/discord/app_commands/tree.py", line 1310, in _call
await command._invoke_with_namespace(interaction, namespace)
File "/home/container/.local/lib/python3.12/site-packages/discord/app_commands/commands.py", line 883, in _invoke_with_namespace
return await self._do_call(interaction, transformed_values)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/container/.local/lib/python3.12/site-packages/discord/app_commands/commands.py", line 871, in _do_call
raise CommandSignatureMismatch(self) from None
discord.app_commands.errors.CommandSignatureMismatch: The signature for command 'setup_tcp' is different from the one provided by Discord. This can happen because either your code is out of date or you have not synced the commands with Discord, causing the mismatch in data. It is recommended to sync the command tree to fix this issue.

frosty patio
#

Bro s making his own top.gg and getting help from topgg community

hidden gorge
warped glacier
#

Were back to step 1 yey 😡

frosty patio
#

😂

warped glacier
#

No it wont. Ive tried last night,

frosty patio
#

Try claude

#

And make sure you read what it says not just copy paste the code

warped glacier
#

i always do. GPT thinks its discord being dumb (Its not its on the code.)

#

This is what it has said for the last 5 hours

#

lol

rustic nova
#

imagine saying "ask chatgpt for this issue" for an issue that chatgpt doesnt have context for and wont be able to provide a viable solution for

warped glacier
#

I've given it context and use a gpt specific for dpy

hidden gorge
#

lets go i finally made logout work

deft wolf
#

No mods :(

hidden gorge
deft wolf
#

Someone pinged you to join scam server

hidden gorge
deft wolf
#

Yea, server called "Support Desk" with 1,5k members weirdsip

hidden gorge
#

...

lyric mountain
#

What do they even do in these servers?

neon leaf
#

prob have some verify bot

#

that makes a qr code

#

to steal your login

deft wolf
#

They are trying to scam you

#

But seriously, it's something with crypto wallets. They probably tell you to send some "verification" payment

#

Also this is how their message looks like

lyric mountain
#

The hell

pearl trail
#

:/

fast fable
#

Does anyone know a place where I could get my bot tested for feedback or bugs? Idk if there’s like a server that does that or not or where I could testers

deft wolf
#

Ask your bot's users

#

Or your friends

frosty patio
#

or at least they give you a quick sneak peek before you get asked to register

#

and idk how seo would work with content that requires authentication

#

also you can add a red dot at the end of your website s name on the navbar

hidden gorge
frosty patio
hidden gorge
#

bc we only do news relating to first responders we can paywall stuff

#

i only do that bc we need to handle costs for operating and equipment

frosty patio
# hidden gorge yes

thats lit that way you catch them with the public content and then get them to sign up

prime cliff
frosty patio
#

not fully limited access

hidden gorge
#

thats why we require login

fast fable
fathom warren
#

Yo there are people who can help the server develop

lethal geyser
#

hey bro i want to contact to staff rn

deft wolf
#

About what exactly?

prime cliff
#

I like how he said that in here instead of #support xD

deft wolf
#

This channel is simply better than any other KEKW

neon leaf
#

@solemn latch

deft wolf
#

Woo pinged in 3 different channels 😔

last yoke
#

Lol

solemn leaf
#

How can I achive buttons positioned inside the embeds of webhook?

lament rock
#

Depending on what lib you use, it might support it already. Update just to make sure and then go from there

#

Pretty cool stuff

solemn leaf
#

v2? is it some flag

#

or a different api endpoint

lament rock
#

Yes it is a message flag and then that will enable you to use the new components

#

anywhere you create a message or interaction, you must set the new message flag

solemn leaf
#

lol last time we spoke papi was in 2021

lament rock
#

I have little to no memory of 2021 tbh tho I also have no idea what I ate yesterday

#

but happy to see old faces amandacomfy

quartz kindle
#

and also the day before

#

and also before that

lament rock
solemn leaf
#

Same to you tim

#

lol

#

I developed that not-chan bot during covid

#

Crazy how much i've progressed from then lol

#

thanks for being for me there and continuing to support those wishing to improve

quartz kindle
solemn leaf
#

what

quartz kindle
#

oh i thought you were replying to what i said to papi

#

lmao

solemn leaf
#

No

#

lol

#

I was adding on to what I said

quartz kindle
#

i see i see

#

but i remember seeing you more times and more recently, not just 4 years ago

solemn leaf
#

what

#

Do you use youtube music desktop app lol

quartz kindle
#

nop

solemn leaf
#

idk where you;d see me from then

quartz kindle
#

here?

solemn leaf
#

Not plausible

quartz kindle
#

then i must have confused you with someone else with a similar username i guess

solemn leaf
#

¯_(ツ)_/¯

fierce shard
#

-botinfo 1356575287151951943

gilded plankBOT
#

Use $commands.
This is a Multipurpose bot packed with giveaway, poll,ticket,games,etc

ID

1356575287151951943

Username

PrimeBot

Prefix

$

Server Count

0 servers

Monthly Votes

7 monthly votes

Total Votes

7 total votes

Tags

create-polls, emoji, giveaway, poll, ticket-system, utility

Owners

@fierce shard

vestal cove
#

Just a quick question, because the slash commands when u press / list all the commands for the bot do i need to make a help command for my bot for it to get approved? Because I see no point in doing it with the fact discord already has the feature built in.

lament rock
#

I believe you are required regardless

#

Even so when I migrated from message based commands to / commands, I just included a help command as it was inconsequential

vestal cove
#

Yeah i guess makes sense I will put one in

quartz kindle
elfin helm
#

when are you required at all

lament rock
#

Since forever

#

Even if all your commands do show up, some people may find a large list daunting and may want some kind of entry point

elfin helm
lament rock
#

On the form to submit a bot, you need to put in an entry point command

elfin helm
#

i dont remember doing that when i was submitting my bot

neon leaf
#

I submitted mine without /help, but it depends on what your bot does

#

if it needs some kind of setup, /help is a good idea

deft wolf
#

When I was making the bot, I also made a help command for those "less experienced" users, and there are probably a lot of them on top.gg

frosty gale
#

@quartz kindleglitch is shutting down lol

#

they had it coming

deft wolf
frosty gale
#

founders sold it out to fastly, fastly probably only bought it to poach a few engineers and left it to die

#

a lot of people prob have a lot of nostalgic projects on there so would recommend you download all of them asap before theyre all gone

deft wolf
#

Luckily I have never used this site. I knew it existed but I haven't heard about it for a long time

frosty gale
#

yeah its been dead for quite a while with only a few people still using it

#

ive started out programming on that platform so have lots of projects i wanna fetch and archive

pearl trail
quartz kindle
#

companies finding out that offering free hosting is not a good business idea

sharp geyser
#

I mean they did it for years so

#

Kinda a them issue at that point if they only just now found out it was a terrible idea

frosty gale
#

they released their employee handbook and holy shit do glitch employees get treated well

#

they get really really good benefits

#

@quartz kindle@sharp geyser they pitched away from free hosting for a while, they added this thing called project hours which basically means you cant really host a bot on it for a long time without paying for their plan

#

but their plan was awful, barely had anything, and too expensive for what it offered

#

repl.it did a much better job at expanding and probably why theyre still in business

frosty gale
#

so they were left with pretty much no community and no paying customers

rustic nova
frosty gale
#

one of the glitch employees said "this hurts me more than it hurts a lot of you" yeah i'd be hurting too with those employment benefits

vestal cove
#

Because the bot will DM you with the link to set it up.

tawny coral
#

Just make a help command with gives the link to the website. Problem solved

#

People are more likely going to do /help after adding a bot before doing anything else

tawny coral
vestal cove
tawny coral
#

Mainly just has link to support server, link to add bot and link to vote nowdays

vestal cove
#

But the whole point of me doing this dashboard is to make it more user friendly for the new people

tawny coral
#

I don’t think it needs to fully list each command, that could be overwhelming too. Just details how to use the bot. But yeah, if you have a dashboard, then a link to it I think would be perfect. There can also be the issues like Dyno and some other bots have had with dashboards where people are logged into discord on browser as one user and discord app as another, so it gets confusing

#

I’m just lucky my bot doesn’t need any config, so I don’t need any of that stuff

vestal cove
neon leaf
#

implemented a dynamic extension system for my rust app 🔥 (still very wip, not quite proud of how it works rn)

use wings_rs::extensions::Extension;

#[unsafe(no_mangle)]
#[allow(improper_ctypes_definitions)]
pub extern "C" fn load_extension() -> Box<dyn Extension> {
    Box::new(ExampleExtension)
}

#[unsafe(no_mangle)]
pub extern "C" fn api_version() -> u32 {
    wings_rs::extensions::API_VERSION
}

#[repr(C)]
pub struct ExampleExtension;

impl Extension for ExampleExtension {
    fn info(&self) -> wings_rs::extensions::ExtensionInfo {
        wings_rs::extensions::ExtensionInfo {
            name: "Example Extension",
            description: "An example extension for demonstration purposes.",
            version: env!("CARGO_PKG_VERSION"),

            author: "Your Name",
            license: "MIT",

            additional: serde_json::Map::new(),
        }
    }

    fn router(
        &self,
        state: wings_rs::routes::State,
    ) -> utoipa_axum::router::OpenApiRouter<wings_rs::routes::State> {
        utoipa_axum::router::OpenApiRouter::new()
            .route(
                "/example",
                axum::routing::get(|| async { "This is an example endpoint." }),
            )
            .with_state(state)
    }
}
sharp geyser
#

What exactly is the point of this if I may ask?

neon leaf
#

to allow extending the app

#

mainly router

quasi lark
#

hello im currently making my own bot and i

  1. want to test it
  2. need updates for what really is needed
    can anyone help
charred nest
#
  1. just test locally, use a beta bot for it ( just replace the token etc with the beta bot's)
  2. cant say what would be needed without knowing what your bot really does. can you describe it and what your vision for the bot is?
quasi lark
# charred nest 1. just test locally, use a beta bot for it ( just replace the token etc with th...

For now its a simple bot for discord server owners to have their discord server in their hands but easy

A ticket system but not specially in discord but a website i made that is connected with your account and all the servers. You can write in discord /ticket and you fill in the basics and you get a link. In the website the owner or admins can help all tickets. You will be able to see the server stats but also like.
If you have a decent server you get a new mod he does not big tasks but the admins you trust will be able to access your servers site and handle everything

crystal wigeon
#

peeps any advice on how to grow discord bot? like to get more users and get more people to try the bot

deft wolf
crystal wigeon
#

im alr there but it doesnt really help with growth cause the bots with more votes are always on top