#development
1 messages Β· Page 273 of 1
Webhook integration for receiving vote data
12 hours.
so a user can vote every 12 hours meaning twice a day, and what timezone is this based on for top.gg?
So I can synchronize the validity of the vote
Youβre very welcome. Let me know if you need any more help.
yep just gonna set this up now and wait for verification
interface TopGGVote {
bot: string;
user: string;
type: "test" | "upvote";
isWeekend: boolean;
query?: string;
}
export async function POST(request: Request) {
const reqHeaders = await headers();
const authorization = reqHeaders.get("Authorization");
if (!authorization || authorization !== process.env.TOP_GG_WEBHOOK_AUTH) {
return new Response("Unauthorized", { status: 401 });
}
const body = (await request.json()) as TopGGVote;
const cache = await connectCache();
await cache.set(`topgg-vote:${body.user}`, "voted", "EX", 60 * 60 * 12);
}
π
Does discord allow you to detect if a message is a reply to a certain message?
It already has the reference on the message?
yessir
god i hate this embed
Also the message type has Reply << 19 flag
Thanks!
*type
Yea i did say type
oh I just read flag, idk how I missed the type but yeh
no still wrong
its just 19
it's not a bitboard
so there is no bit shifting and no flag
That's what enum flags are bitwise operations
there is no bitewise operation for types
hes talking about the representation of enums "under the hood"
Yea... ^
it then would be 19 << 0 = 19
I think you might be confused with how different langs show it
what I mean is that you just have like type: 19, unlike with flags where you have flags: (1 << 0) | (1 << 5)
Yea 19 code is shorthand for 1 << 19 which is to the power of x19
But generally libs use the 1 << 19 syntax
if you use a typescript enim it would just be ```ts
enum MessageType {
Reply = 19
// ...
}
const t = MessageType.Reply;
enum MessageFlags {
Crossposted = 1 << 0,
HasThread = 1 << 5,
// ...
}
const f = MessageFlags.Crossposted | MessageFlags.HasThread;
so saying reply is `<< 19` is odd when you just could say `19` (and you're missing the `1`, since nothing woud technically use `0`)
Yea ik
(where 0<<n is 0)
XD
and it's not the way the docs represents it so it fried my head
not generally tbh
Huh? 1 << 19 is not 19.
Yea that's what we were on about 1 << 19 (bitwise) over just 19 the number
That's what we were talking about Waffle xD
,
i thought it would be a bigger number but it is only 3 more bits than 16 after all
gotta remember it doubles for every additional shift
const guildIds = client.guilds.cache.map(guild => guild.id);
TypeError: Cannot read properties of undefined (reading 'guilds')
ihave guild intents on
how did you define "client"
i just realized my command handler or interation handler doesnt pass client in the execute, i fixed it by defining client as interaction.client
Why is console underlined 
i use eslint
I hate mdx
whats mdx
Yeah
Looks...interesting
Its great, but also a pain
What is its uses though
Can it be exported or I guess turned int oa working md file?
does it inline whatever is imported?
Has to be in a react file.
Its great for stuff like blog posts.
For example adding a YouTube video embed in markdown.
Ah
I thought it was like, to easily create markdown files using jsx components
Either way thats rather neat
When you're making a website for someone else you never know what they'll want. Easier to do it this way ^-^
Next time i might just use markdown though
Honestly fair
it also allows them to easily edit it themselves without needing to do much
Whatcha guys think of this idea, I saw it on some github repo
I wonder what they would do to accomplish it
since receipts don't always show the full name of what you bought
more of the receipt deciphering part since names can be incomplete but an LLM would likely be able to flexibly infer a lot of it
besides its 2025 we need π AI π in every single thing regardless of whether it helps or not
Sounds like something openai might be able to accomplish.
guys you rather use local data storage (as in .json files) or through database?
please dont ever use json as a makeshift database
why not?
it works fine
also i use multiple jsons
each for their own storage thing
like one json stores the currency part of the bot
with server id - > user id
until you run into file corruption :^) please look into proper databases
my bot host has one of those raid configuration that corruption barely happens
they have a lot of redundancies
again, thats not what json is for. You will avoid many issues by simply using a database
But you will be happy about this choice once you look back at it
i will probably be happy
but the destination to there
i dont wanna think about it now
idek how to make it work with database
host does provide a free database
which is pretty nice
Its a good choice
using even like sqlite3
Is MUCH better
- You're unable to use multiple threads
- Jsondb is HIGHLY prone to corruption
- No types
- Unable to alter structure without rewriting every single entry
- Unable to clusterize
fair
also u cant do queries at all, so u lose on data preprocessing
oh, and every single access requires u to load the entire "database" in memory
thats why you should use a yaml database !!!!!!
wait until you guys hear that you can batch changes together + enforce one write at a time to eliminate all corruption and improve performance
json dbs arent cursed if you know what youre doing theyre just very simple and wont scale
this is inspiring me to make a reliable json db npm module just to prove a point
at that point just use a normal db
it will be written in RustΒ©οΈ π π to ensure it is blazingly π fastπ π
on a proper note how do you actually synchronize a function in js to ensure it isnt executed by multiple threads?
most reliable way i can think of is a queue type system
v8 isolate already does that
the same instance of a function cant be shared across threads
the only shareable data (that does not copy value) are sharedbuffers
i mean mostly in terms of async/libuv threads, if you do multiple io async calls these could end up executing on different threads in parallel (which is probably where json db corruption comes from)
yeah, multiple async file saves at once is the cause of corruption
easiest fix is to mark data as changed and write on an interval
you dont have to worry abt that, js doesnt have "multiple threads"
unless you go out of your way to use the node stuff
it sort of does though, async doesnt really work if you dont have multiple threads, json db corruption wouldnt be a concern either
async uses event loop
marking could be done via sharedarraybuffers
^
yes but you wont really get performance gains without threads to handle blocking calls in the background
so node/libuv always spawn additional threads for those
not unless you force it to
nodejs has 2 threads normally
main code thread
and io thread
workers/cluster can add additional but its not implicit needs to be invoked manually
this looks like multiple threads to me π
only one is used for the actual code (same v8 isolate)
setInterval(() => {
console.log("hello world");
}, 2000);
yes in async only one thread executes code but it doesnt mean multiple blocking tasks arent processing in parallel
parallelism doesnt exist in nodejs without worker threads/cluster
only delaying
async is nothing more than a delayed function too
they aren't
your code is primarily running on 1 thread
unless you use something like workers/childprocesses/exec
people confuse concurrency with parallelism
stuff like fetch appears parallel because the implementation of tcp is not in js itself so it does not follow the event loop fully
You'll find if you take multiple promises and shove it into a Promise.all it'll use more than one thread afaik
but I only saw that with fetch idk abotu anything else
likely this tbh
I'd say that promises are running in other threads but that could be wrong
correct, they run on the same thread
unless io related
so it's just purely concurrent outside of io
io related = offload it and run rest of pending promises but wait for all to finish
I mean I run 14 child processes (basically as workers) atm so yeh
I just use rust 
I really hate go syntax tbh
but I don't consider myself proficient enough to write bug projects with it yet
I like it because it's similarity to TS
well
I didnt use it because I felt its not similar to ts
lol
idk why but I feel more at home with rust
(maybe because I love memory management)
eh, rust does most of it for you
I already create memory leaks with js
I mean I fuck GC more than the memory itself
love go
we use go at topstats for things that we know are gonna need to be multithreaded
I just like it for simple http servers
I learned rust by rewriting 3 repos that are active in production in rust π₯
I got into go pretty fast tbh
why do you need this?
or was it to learn
uh it's just prettier
same for rust for me, rewrote all 3 repos in like 1.5 weeks (50k-ish lines of code)
Ah fair play
very fun experience
this was my first rust rewrite i think https://github.com/0x7d8/draw-together
7mb ram usage (6mb of that is the pixel data)
my first was nekostic
all the three repos are actively in prod
my main language still is TypeScript
still wish it was faster (well technically js)
https://github.com/mcjars/api and https://github.com/blueprintFramework/api took the longest to rewrite
but both worth it for learning
I have like one rust project to convert units
like mm to km, C to F
or F to km, C to milliinches
yes
love hetzner
just wish their vps's weren't so heavily IO space limited
yes yes
still use drizzle for my db schema lol
too much of a hassle to change (closed source backend requires it)
yeah I switched from prisma to drizzle to sqlx + drizzle
very fire π₯
something very cool is that sqlx does build-time sql validation
so it will check if this query is syntactically correct and the inputs match whats expected from the db
while building the app
golang π
Found this interesting tool that scans for vulnerable packages in different languages, bad configurations, docker image vulns and other issues.
https://trivy.dev/latest/
Gonna integrate it to my Dev Space project for docker container scanning.
Trivy - All-in-one open source security scanner
golang users spawning in 100 goroutines at any given point for their 10 clicks a day app
(ive seen this happen before)
Friends, I want to save the --FragXX file in a folder named --Frag, but I can't figure out what to do.
When the music bot is playing a new song, it is created between the main files and as the server gets bigger, the files also get bigger. I don't want it to interfere with the config files.
π
most buffer overflows arent too serious with the exception of probably a crash
a lot of conditions have to be just right to get any code execution or info extraction
probably good to get it patched though
love this
Hello, there is something I don't understand, it's how to add webhooks.
What webhooks do you mean?
You can't use discord webhooks because they only accept a specific data, top.gg sends a completely different one
Generally, a webhook is nothing more than a web server that accepts a request from top.gg
If you don't care about any rewards and just want a message to be sent on the channel that someone voted for the bot, you can use https://webhook-topgg.com
Simplifying top.gg webhooks for all users, allowing non-developers and developers to use webhooks for their bot and server without confusing configuration.
This is the error I get when I try to send a test message: Something went wrong
An error has occurred while processing your request
what's wrong with it?
ig it suggests to a internal error on top.gg's side
That's what we were thinking, I'm using on_dbl_vote and the topgg webhook manager to try and test votes and we have this returning everytime
maybe something was setup wrong? never used topggs webhook tbh
It's a genuine nightmare, the documentation is all over the place and any external guide is over 3 years old
damn
If ur using the python import
Its outdated
you have to make a server urself
why does this take 1.2s
SELECT version, percentage
FROM (
SELECT
data->'blueprint'->>'version' AS version,
(COUNT(*) * 100.0 / (
SELECT COUNT(*)
FROM telemetry_data
WHERE id IN (
SELECT latest_telemetry_data_id
FROM telemetry_panels_with_latest
)
AND created > NOW() - INTERVAL '2 days'
))::float8 AS percentage
FROM telemetry_data
WHERE
id IN (
SELECT latest_telemetry_data_id
FROM telemetry_panels_with_latest
)
AND created > NOW() - INTERVAL '2 days'
GROUP BY version
) x
WHERE x.version LIKE 'beta-202_-__'
ORDER BY x.percentage DESC;```
and this 30ms
```sql
SELECT version, percentage
FROM (
SELECT
data->'blueprint'->>'version' AS version,
(COUNT(*) * 100.0 / (
SELECT COUNT(*)
FROM telemetry_data
WHERE id IN (
SELECT latest_telemetry_data_id
FROM telemetry_panels_with_latest
)
AND created > NOW() - INTERVAL '2 days'
))::float8 AS percentage
FROM telemetry_data
WHERE
id IN (
SELECT latest_telemetry_data_id
FROM telemetry_panels_with_latest
)
AND created > NOW() - INTERVAL '2 days'
GROUP BY version
) x
ORDER BY x.percentage DESC;```
the like should only check on 4 rows, no?
(subquery result: (39ms))
percentage should also be no decimal (or rounded) 
.,
compare the EXPLAINs
Sort Key: (((((count(*))::numeric * 100.0) / ((InitPlan 1).col1)::numeric))::double precision) DESC
-> GroupAggregate (cost=16495.22..16495.26 rows=1 width=40)
" Group Key: (((telemetry_data.data -> 'blueprint'::text) ->> 'version'::text))"
InitPlan 1
-> Aggregate (cost=8234.52..8234.53 rows=1 width=8)
-> Hash Join (cost=8231.88..8234.50 rows=8 width=0)
Hash Cond: ((max(telemetry_data_3.id)) = telemetry_data_2.id)
-> HashAggregate (cost=8198.89..8200.89 rows=200 width=4)
Group Key: (max(telemetry_data_3.id))
-> Hash Join (cost=8117.62..8191.47 rows=2968 width=4)
Hash Cond: (telemetry_panels_1.id = telemetry_data_3.panel_id)
-> Seq Scan on telemetry_panels telemetry_panels_1 (cost=0.00..64.52 rows=3552 width=16)
-> Hash (cost=8080.52..8080.52 rows=2968 width=20)
-> HashAggregate (cost=8050.84..8080.52 rows=2968 width=20)
Group Key: telemetry_data_3.panel_id
-> Seq Scan on telemetry_data telemetry_data_3 (cost=0.00..7728.89 rows=64389 width=20)
-> Hash (cost=30.79..30.79 rows=176 width=4)
-> Index Scan using telemetry_data_created_idx on telemetry_data telemetry_data_2 (cost=0.29..30.79 rows=176 width=4)
" Index Cond: (created > (now() - '2 days'::interval))"
-> Sort (cost=8260.69..8260.70 rows=1 width=32)
" Sort Key: (((telemetry_data.data -> 'blueprint'::text) ->> 'version'::text))"
-> Nested Loop Semi Join (cost=8117.91..8260.68 rows=1 width=32)
Join Filter: (telemetry_data.id = (max(telemetry_data_1.id)))
-> Index Scan using telemetry_data_created_idx on telemetry_data (cost=0.29..32.11 rows=1 width=702)
" Index Cond: (created > (now() - '2 days'::interval))"
" Filter: (((data -> 'blueprint'::text) ->> 'version'::text) ~~ 'beta-202_-__'::text)"
-> Hash Join (cost=8117.62..8191.47 rows=2968 width=4)
Hash Cond: (telemetry_panels.id = telemetry_data_1.panel_id)
-> Seq Scan on telemetry_panels (cost=0.00..64.52 rows=3552 width=16)
-> Hash (cost=8080.52..8080.52 rows=2968 width=20)
-> HashAggregate (cost=8050.84..8080.52 rows=2968 width=20)
Group Key: telemetry_data_1.panel_id
-> Seq Scan on telemetry_data telemetry_data_1 (cost=0.00..7728.89 rows=64389 width=20)```
full
" Group Key: (((telemetry_data.data -> 'blueprint'::text) ->> 'version'::text))"
InitPlan 1
-> Aggregate (cost=8234.52..8234.53 rows=1 width=8)
-> Hash Join (cost=8231.88..8234.50 rows=8 width=0)
Hash Cond: ((max(telemetry_data_3.id)) = telemetry_data_2.id)
-> HashAggregate (cost=8198.89..8200.89 rows=200 width=4)
Group Key: (max(telemetry_data_3.id))
-> Hash Join (cost=8117.62..8191.47 rows=2968 width=4)
Hash Cond: (telemetry_panels_1.id = telemetry_data_3.panel_id)
-> Seq Scan on telemetry_panels telemetry_panels_1 (cost=0.00..64.52 rows=3552 width=16)
-> Hash (cost=8080.52..8080.52 rows=2968 width=20)
-> HashAggregate (cost=8050.84..8080.52 rows=2968 width=20)
Group Key: telemetry_data_3.panel_id
-> Seq Scan on telemetry_data telemetry_data_3 (cost=0.00..7728.89 rows=64389 width=20)
-> Hash (cost=30.79..30.79 rows=176 width=4)
-> Index Scan using telemetry_data_created_idx on telemetry_data telemetry_data_2 (cost=0.29..30.79 rows=176 width=4)
" Index Cond: (created > (now() - '2 days'::interval))"
-> Sort (cost=8234.66..8234.68 rows=8 width=32)
" Sort Key: (((telemetry_data.data -> 'blueprint'::text) ->> 'version'::text))"
-> Hash Join (cost=8231.88..8234.54 rows=8 width=32)
Hash Cond: ((max(telemetry_data_1.id)) = telemetry_data.id)
-> HashAggregate (cost=8198.89..8200.89 rows=200 width=4)
Group Key: (max(telemetry_data_1.id))
-> Hash Join (cost=8117.62..8191.47 rows=2968 width=4)
Hash Cond: (telemetry_panels.id = telemetry_data_1.panel_id)
-> Seq Scan on telemetry_panels (cost=0.00..64.52 rows=3552 width=16)
-> Hash (cost=8080.52..8080.52 rows=2968 width=20)
-> HashAggregate (cost=8050.84..8080.52 rows=2968 width=20)
Group Key: telemetry_data_1.panel_id
-> Seq Scan on telemetry_data telemetry_data_1 (cost=0.00..7728.89 rows=64389 width=20)
-> Hash (cost=30.79..30.79 rows=176 width=702)
-> Index Scan using telemetry_data_created_idx on telemetry_data (cost=0.29..30.79 rows=176 width=702)
" Index Cond: (created > (now() - '2 days'::interval))"```
subquery
looks pretty much the same
actuially
" Index Cond: (created > (now() - '2 days'::interval))"
" Filter: (((data -> 'blueprint'::text) ->> 'version'::text) ~~ 'beta-202_-__'::text)"
" Index Cond: (created > (now() - '2 days'::interval))"
it seems like its running like on all rows of telemetry_data, not the grouped results
intellij REALLY helps reading those things
I believe it does run on the grouped results, since x.version doesnt exist otherwise
this is indeed a weird case, they shouldn't have such a big disparity
yeah im really confused
...
@lyric mountain
I ran ```sql
DROP INDEX IF EXISTS "telemetry_data_created_idx";
CREATE INDEX IF NOT EXISTS "telemetry_data_created_idx" ON "telemetry_data" USING brin ("created");
now its 100ms
brin?
well the panels send data every 24h, currently theres 1.2k active panels
hm, asked cuz count() is fairly expensive, since it requires a full scan
yeah, these queries arent quite optimized currently, but anything under 300ms is fine for now
I dont know how im gonna be able to do historical data though (since panels shouldnt be counted twice and not if too old, etc)
for performance reasons prob a mat view
if you only ever need last 2 days, then you can use triggers + secondary table for holding counts
well the date - 2 days is just when telemetry data is considered "out of date", I only ever need the latest value of a panel for a specific time
like, you put in an AFTER INSERT trigger to increment a value on a count table - key being the date itself - and the next 2 dates as well
for example, if you insert an entry today, you'd increment the count for dates 31/03, 01/04 and 02/04
ah
when you needed the total count you'd just retrieve the value for the current date
since it'd include the past 2 days + today
Ok thanks you
stop trolling
Update it now π« π€
Free 50$, no way
@zinc fable
ty
@zinc fable
oh dear
Derek playing scam bot tower defense 
fr π
+respect for recommending triggers
they are extremely underappreciated but so powerful
Am I the only one that despises these kinds of prs https://github.com/mcjars/mcvcli/pull/2
π How's this
you exceed the available storage which allows you to "seep" into the next memory section
so u can execute arbitrary code by invading your neighbor's area
How to get bot developer role ?
..
You want to develop a bot and add to top.gg website
I did
What's your bot name ?
How can i get Bot Developer role too please?
Submit a bot to top.gg and get it accepted
you... have it already?
It was given to them like 2m after they asked in #support as well
How can I get Team role 
You donβt need it, its okay
I got it like after 7min of my question π
@crimson vapor weeb
Nuh uh
..
WOOO it works
whatca makin?
Magic π
why isn't that shown anywhere ππ i've been struggling with this for ages
do i need to use a third party for my webhook then?
just either make a flask server or use a webhook server like hookdeck
thanks a lot, that's extremely helpful
do you have any documentation or guides you recommend because the topgg ones have been driving me mental
create a server with an endpoint with POST method that will parse the body sent by topgg. the fields are https://docs.top.gg/docs/Resources/webhooks/#bot-webhooks
Webhook integration for receiving vote data
Hello yβall I wanna know why my bot doesnβt display any Images in top.gg π€π€
What images
I meant profile
Thank you
Does discordjs have the forward message feature already? π
He's asking about discord.js library
And yes, looks like discord.js supports it
-# https://discord.js.org/docs/packages/discord.js/14.18.0/Message:Class#forward
Yes I just saw ty tho
Does anyone know how to use playwright to automate the browser? I'm trying to use it in tandem with an extension called Testim that also automates the browser, but I keep getting errors related to the extension. I'm wondering if there's a way to automate the browser exactly as if I had manually pressed the button without interfering with chrome's internals
Well i can guide you through it
Don't quite understand why on mobile the card inside the accordion goes beyond the screen's width

I am really stumped on this one
I am trying everything and nothing seems to fix the width
is that shadcn?
Yep
wym
do you mean how do I do my content?
This is my main layout
no, the element for years months days hours etc
Oh
the Card one
to the main div of the card content?
to the div inside cardcontent where there are flex flex-row gap-8

I swear
this looks ugly as fuck still
π
Oh wait
this is kind of cringe
eh nvm
wow, a love letter 
ahhh, nah your gf must be proud having her bf making a site just for birthday
I have a navbar so I might just move it into it, but idk
She doesn't know
she knows im making something using my programming skills
but beyond that she has no clue
:0 a surprise
Yup!
Thought i'd do something personal and something I can easily do
or so I thought
I underestimated how much it'd take to make this look pretty
and idk what to do
π good luck!!

π π
@radiant burrow u are a design nerd any idea?
in regards to the accordions?
are you coding in normal html or react or something
I am using react (specifically with nextjs but yea)
ok cool
and nah im talking in regards to the entire screenshot
Like hte accordion idk if i need, and the navigation thing just looks out of place
yeah, if it's just a time listed, an accordion might not be necessary. since you're using react you could pretty easily make a timer in the middle with buttons below to select different anniversaries.
a fun idea could be to add sticker/stamp elements that scatter the website, they can just be whatever but can help fill the space
This is what it looks like without an accordion
oh ok ok then you could keep that or do something like I said and use that template but allow for selection of different dates. imo that looks cool having each time value counting
yuh! I wish it was in realtime, meaning the seconds and what not countup
but idk how to do that π
I will have to look it up
make a time component that takes a date and updates once a second
You'd cry if you saw how I currently do it
like you might burn me
function parseDate(date: number) {
let delta = Math.abs(date - Date.now()) / 1000;
const years = Math.floor(delta / (365 * 24 * 60 * 60));
delta -= years * 365 * 24 * 60 * 60;
const months = Math.floor(delta / (30 * 24 * 60 * 60));
delta -= months * 30 * 24 * 60 * 60;
const days = Math.floor(delta / (24 * 60 * 60));
delta -= days * 24 * 60 * 60;
const hours = Math.floor(delta / (60 * 60));
delta -= hours * 60 * 60;
const minutes = Math.floor(delta / 60);
delta -= minutes * 60;
const seconds = Math.floor(delta);
return { years, months, days, hours, minutes, seconds };
}
const talkingDate = parseDate(1741302147500)
const datingDate = parseDate(1743201242286)

oh my oh my
I TOLD YOU IT WAS BAD
I haven't programmed in so long
its been 2 months at least

i meannn... at least it works
i'm not even much better i'm sure my backend code is rough and i just don't know it
export default function Timestamp({className}: {className?: string}) {
const [currentTime, setCurrentTime] = useState(new Date());
useEffect(() => {
const interval = setInterval(() => {
setCurrentTime(new Date());
}, 1000);
return () => {
clearInterval(interval);
};
}, []);
function formatTime(time: Date): string {
return time.toLocaleTimeString('en-US', {
hour: 'numeric',
minute: '2-digit',
second: '2-digit',
});
}
return <span className={className}>{formatTime(currentTime)}</span>;
}
here's a component i have that creates a timestamp for the current time, you can take the basic concept and adjust it to instead take in a date object and return the time since that date
π
Mar 07 2025?
6th
I still think I did it poorly
but I got it!
Thanks for the nudge in the right direction :))
Laziness made me use this code in conjunction
cause I can't be arsed to make it better
if you guys are curious bout the code

You guys think i should add anything to this Join message?
I'd actually recommend removing eveything and just not doing install messages. Too many permissions checks and complexity to determine an "appropriate" channel to send it to, plus the message isn't really useful knowledge to anyone imo. The person who added the bot probably already knows most or all of that info. If you still intend to do it, it should be meaningful
I think I worded that a bit more harshly than I meant it. I adopt a philosophy of trying to stay out of the way of people until they intend to use my bots because I personally find it annoying when bots act "on their own accord" so to speak
and most of the time when they do, I find what they're doing to be not meaningful
instead of sending that embed on join, in my opinion, better to send that embed when someone mentioned the bot. by that, the user actually dont know how to use it thus send the instruction embed.
Idk just send it via DM. The only permission check would be if the bot is allowed to send a DM
But won't that result in bot quarantine?
I personally would avoid anything related to DMs
Also it seems to me that there is no way to check who added the bot to the server except via Audit Logs but that's another permission + API request afaik
Oh, okay. You can do this with webhooks. I thought it only worked for account authorization, but this works for server authorization too
At the end of the day, i think its fine to assume some general knowledge the user is expected to have
Just provide a help command, that should be recognized by users
I know if a bot dms me randomly I immediately hate it
Heyo, I wanted you guys to ask for feedback!
I just finally released my own async Discord Api Client in rust with a python wrapper for learning purposes at first but then continued until I was ready to push this on PyPI and Open-Sourced it. I tried my best to make the code understandable with comments but I think I overused them π
I would really appreciate any feedback and suggestion on this π
Current features:
- Asynchronous Python interface using asyncio
- High-performance Rust core for Discord API interactions
- Support for Discord REST API and Gateway (WebSocket) connections
- Resilient WebSocket connection
- Event-based architecture for handling Discord events
- Slash command support with command registration and interaction responses
- Support for ephemeral responses, embeds, and deferred responses
- Minimal memory footprint and CPU usage
/project/rustcord/ on PyPI
https://github.com/ghulq/rustcord/
-# I thought this would be the best way to get constructive feedback on my project since this server is for discord bots and I hope that I may ask for this here, if not tell me and I delete this. This is not a advertisement but for feedback and suggestions around my project.

π
here is a recording of the component example bot
ws_sender: Arc<Mutex<futures::stream::SplitSink<tokio_tungstenite::WebSocketStream<tokio_tungstenite::MaybeTlsStream<tokio::net::TcpStream>>, WsMessage>>> simplest rust type
Not even that bad if you ignore the traces or whatever you call em
what even is a MaybeTlsStream<>?? like
Arc<Mutex<SplitSink<WebsocketStream<MaybeTlsStream<TcpStream>>, WsMessage>>>
Looks cleaner
It may be a tls stream or it may not
I guess
Interesting
after looking at the source code, i feel like there's many room for improvements! do you mind if i plan on making a pull request?
null is the smartest rust user here
I highly recommend at least looking at their recommended changes 
go ahead :D

and I haven't seen someone mix python and rust before
thx gonna need that xD
-# I'm going insane
javascript is nice sometimes
damn what is it about?
ewwww

Better than touching it with my own hands
js is not too bad tbh
ts
rust ftw
ts puts a bandaid on the problem
js is fucking horrendous for actual applications
yea
If youβre the only one writing it, sure, itβs fine
its "allow anything" behaviour pisses me off
But the second you have to work in a team you want to jump off of a tall building
and leads to people implementing bad practices
which leads to problems when as waffle said gets into team usage
Using a language that enforces types and good practices is better imo
i can see that
Hard to do stupid shit if the language doesn't really allow it
even stupid things in C# run somewhat ok

for rust?
mhm
it might be a preview version
I started this project early 2025 so I thought edition meant this
nope
as in the rustfmt edition?
the one in Cargo.toml
i haven't used rust in a year
I am dumb boy now
@compact condor the latest valid rust edition is 2024
woopsie
ooo
gonna need to change that then good to know what it means now
i'll include it in my pull request
honestly i also need to update my rust projects to use the 2024 edition

they still use 2021
also forgot to change the version in the Cargo.toml π
which version?
0.1.0?
the version of rustcord is currently 0.1.2
Imagine following the normal versioning conventions
just be like djs
release breaking changes so every release is a major release


noted!
I also updated this on github
a lot of clone
yeah, but i can see what they were going for since they are all Arc
I had problems when I did just Arc so I did Mutex and then it worked smh
true xD
@compact condor is it required for every python ffi method to return a PyResult?
How can I make the carousel take up the full height
cause I cant seem to get it
I've tried setting the height in numerous places and it doesn't do anything
className={'h-full'}
or you can do h-[100vh]
Well I know this
but the problem is no matter where I set it
it doesn't actually do anything
what component library are you using it from
shadcn
what framework is this?
whilst I look at the docs
shadcn
shadcn for components
and nextjs for the actual web portion
I also use tailwind obv for css utilities
import {Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious} from "@/components/ui/carousel";
The path it adds it to when I run the pnpm command
yea sorry misstyped
I also hate how no matter what I do, its not responsive 
I know why I think
its the div
remove the md: temporarily
i think it's literally just the div you're containing it in
I dont think the md has anything to do with it
no dice
based on docs
it's supposed to be on the Carousel component
Aaron

for sanity sake can you try just putting it outside of the <div> container you put it in for now
and try changing the height on the Carousel component then?
The parent container do h-full instead of md:h-full
Actually shouldnt really make a difference
I think it might be the div
Thisi s what happens when I do what you say luke
The carousel gets bigger
can you check it's not the parents height
even when its in a div and I set the height directly on the carousel
So the div isn't the problem
Apparently
even setting the height on the card doesn't do anything tho
try setting h-full on the iframe?
It already is
Go into the CarouselContent component and change the className to this
className="overflow-hidden h-full w-full"
it has w-full and h-full
looks like w-full to me?
ah okay
mans a god
spent too much time dealing with shad the last couple days huh :^)
Like this? cause if so this is the result
Also in more context, its now slightly less bigger than the cards above it
so it messes with my ocd

CNTRL + CLICK CarouselContent component
And it'll jump to the component under /ui/carousel
nothing
weird
still not conforming to the height of the div
that just makes it so every item shows
true
how about you try h-full on the carousel
ignore me
he has
i only use nextui so might not big help
he has
oh wait, i saw the old code
it makes it bigger
but the card inside doesn't adhear to the new height
and remains the same
bizarre
this pic outdated?
can you push your changes π
This isn't on github
ah different proj
yea
@sharp geyser Would you mind sending the code in dms or here, and I will slap it in and see if I can figure it out
its the web for my gf
Just what you have with the carousel
if you push this to topstats dev build xig i might die from laughter
nah i wont lol
we should do a carousel of bot pages 
import {Button} from "@/components/ui/button";
import Link from "next/link";
import {Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious} from "@/components/ui/carousel";
import {Card, CardContent} from "@/components/ui/card";
export default function Main() {
const videos: Array<string> = ["https://www.youtube.com/embed/rn1ph-gmoLA?si=LnxkVqZ7LTiv_4rh", "https://www.youtube.com/embed/evJ6gX1lp2o?si=8IZ4tZcqQcA_B0zg"];
return (
<>
<div className="h-full w-full flex flex-col items-center space-y-4">
<div className={"space-y-4 md:w-3/4 h-full"}>
<Carousel className={"h-full"}>
<CarouselContent>
{videos.map((url, index) => (
<CarouselItem key={index}>
<Card>
<CardContent>
<iframe
className={"w-full h-full"}
src={url}
title="YouTube video player" frameBorder="0"
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
referrerPolicy="strict-origin-when-cross-origin" allowFullScreen></iframe>
</CardContent>
</Card>
</CarouselItem>
))}
</CarouselContent>
<div className={"md:block hidden"}>
<CarouselPrevious/>
<CarouselNext/>
</div>
</Carousel>
</div>
</div>
</>
);
}
wait
space-y-4
π
surely thats not causing it
I wouldn't imagine so
π
yea fair
Also fuck discord formatting
why does it look so ugly when copy pasting

Should of put it in a pastes instead but oh well
Yeah its likely the iframe needing a static height
btw
if you need a static height you can always make it programatically grab the parents height and use that

it's jank but it works
it's actually
also dont use iframes 
I mean, download it, and host it locally on the page with a custom video player
:^)
thats a joke
maybe instead of overflow-hidden I do overflow-x-hidden
yea that should work
that element is not in the elements in your code
cuz its from a component
that overflow-hidden is from the CarouselContent component
oh yeah, if you've tried adding h-full in that, then it's your parent problem
your element does not know what to fill the 100%
then how do I tell it
because i've added h-full to every fuckin thing
and still no dice
doesn't work for me
you sure added this right
put h-full in the CarouselContent class name inside your /components/ui/carousel file
alright well there we go
I am so fucking confused
I did this already
and it didnt work
Apparently this works flawlessly now
and I added h-full to CarouselContent like last time
I dont need a static height on the parent apparently

somewhere on top of that must've
Well thanks guys
I think I really pulled this together
page looks much better
π
Should I have everything centered or like this
I kind of like it like this
but im not sure π
i'd rather want you to have margins on both sides of the page
Okay well there is
sorry thats not the full page
the stuff itself is centered
I was mainly talking about like the text and buttons
I think if EVERYTHING is centered it looks weird
yeah i can see that
aaron, how about this?

what did you do here if I might ask?
did you make thius???
Yes
All me
its v nice
wait you are leaking it π
it was a backup file of gateway.rs but is outdated now. It doesn't serve any functions and can be deleted now tbh
YEAAAAHHHH
ty for the recommendation
oh alrighty
π

The navbar is so overengineered when it won't be seen in most of the pages
It has an animation effect
that only works on 1 page so far
oooo can i see
it isn't but I heard it's a good practice to do so for error handling
uhm you don't have to hahahaha
cuuteeee

I made use of a npm package meant to add a snowflake effect
but it allows custom images
soooo
Yup!
slay!
I plan on making a discord bot for it as well
since I plan on adding a gallary section
it will allow for easy uploading of images
:p
probably wont be until after her bday but ima try
Since I have to incorporate cloudflare r2 into this
fancyyyyy
I saw waffle typing
I wonder what he was going to say
I rounded the iframe as well
sharp corners was ugly
based
wedding invite when?
Guys crazy idea
do I make this an actual lock & key situation
where she has to put the key into the lock

Hopefully we get to that point
But when and if it happens for sure you will get one
Make her mine a Bitcoin block to find the hash that unlocks the page
I wonder what i'd need to do for something like this

make her brute force a sha256 hash
By hand
waffle...
how did you get your wife
dont tell me
you made her brute force a sha256 hash by hand
I waited 6 years in the friendzone and then got saved by covid texting since I was awkward irl
I missed my chance when I was in 5th grade when she gave me a flower for Valentineβs Day
Couldnβt get the hint
But itβs okay because 5th graders shouldnβt be dating anyways
and you missed it
I mean fair enough
but still
luckily she didn't give up then
π
I asked her out in 8th grade and got hard friendzoned
Then she asked me out in 10th grade and thatβs when we started dating π
Donβt worry I donβt even have a wedding invite for myself yet
Ah
Courthouse thing, small event
10 closest family members since we were only allowed 10 people
But lowkey getting a courthouse wedding is so much better than stressing over wedding plans for 2 years then spending $50,000 for a day
Very true
Idk, he bought me a domain for a year
Nah, but I just recently got a domain for free thatβs very similar to the old one
Oh cool
Got waffledev.me instead of waffledev.tech
.me > .tech
change my mind (ps you cant)
True
What the fuck is this supposed to mean react
you use client components on server component
your welcome
I wont be doing any SSR in that page
so I can just make it and its components use "use client"
Thanks
I am really hoping my idea works
it'd be legit if it did
π
I dont know if I can make it with my skills tho
actually, you dont need to put that on every component. if the page that renders the component is already client, then everything in it is client, so you dont need explicitly add use client
so server components are rendered on the server and client components are rendered on the client?
correct
yes
i see i see
good luck!!

All this
for some effect
its worth it but my god am I in pain
My idea is to have a key thats draggable, can be put into a lock, turned, and then it unlocks the rest of the site
o wow, thatβs quite tricky
Yuh
When you do this you should send videos this sounds awesome
I am trying right now
and my god is it kicking my ass
I have no fucking clue what im doing

Terrible artwork, but im using a mouse and keyboard
Essentially my idea is chains on 4 corners, lock in middle, key draggable, key goes into lock, key turns, lock unlocks, falls, and then the chains fall
Rather ambitious if I may say
and I have 3 days to do it (and I still have other shit to do)
IN THREE DAYS???

Good luck ππ
@solemn latch
sounds like something sayu would make
HTTP 503








