#development
1 messages Β· Page 269 of 1
drawing together
ah i see
isnt it a bit overkill?
like
if you have 100 people drawing
you have 300 threads lel
apparently this is how its properly done
π€·
not like there is another way to really do it
Performance 
I mean
its also in their docs https://docs.rs/tokio/latest/tokio/task/fn.spawn.html#examples
Spawns a new asynchronous task, returning a JoinHandle for it.
Just get a better server 
ah @quartz kindle
not all spawn calls go to different threads
Spawning a task enables the task to execute concurrently to other tasks. The spawned task may execute on the current thread, or it may be sent to a different thread to be executed. The specifics depend on the current Runtime configuration.
ah
then it should be fine
you can then do the same thing for the pixel array
create a task that receives the pixel messages and updates the snapshot
You could have a different thread process each chunk of pixels, something like that
That way you are never concurrently writing on the same section of the array
But you still benefit from concurrency on a per-line basis
ah, it's like pixelcanvas
when I did something similar I simply stored the operations, instead of the canvas itself
then simply re-generated the canvas on the clientside
this way u dont need to worry about concurrency or flooding your server with threads
hello mate
out of all the messages above he decided to say hi to tim specifically
lel
better luck next time
Fittingly with this talk, how would you implement websockets for something like honk.me?
I couldn't link it, but it was a chat app where you saw the typing live
and I've always thought what would be the best way to implement that websocket wise, because with something like a collaborative google doc there is still delay in the typing
chat apps are typically one of the first things people do with websockets, tons of guides on how to do it.
Well I meant specifically that instant typing aspect, if you visit the website you can see an example of it
Because the first thought is, send every keystroke, but I guarantee there's a better way
Are you talking about the server side or client side?
Server side it just receives the start typing, and end typing and broadcasts it to whatever clients it needs to.
Client side it just has a timer that goes off after x time once the user stops typing and sends the event or if they send a message.
(or well thats how discord handles it)
But i meant on there it shows what you are typing
no its not about start and end typing. if you see on the website, every character a user typed, itll be visible to the other user
Maybe its just a stream then? π
I wouldnt expect it to be handled with websockets, the overhead on that would be pretty large π
Rate
Maybe they would buffer requests and make it appear as though you're seeing the live typing.
Ie, a user starts typing, buffer the first word, send it. type it the way the user typed it, buffer the next segment
fancy π
βΊοΈ Sml
I need to give it a aesthetic look π₯²
Ik this project is gonna blow up
that's what i thought
like a debounce effect, that displays different on the client if that makes sense
It could be per character, but it wouldnt use websockets
My mind just exploded.
TCP is handled by the os, not the browser
Looking at other protocols than websockets lead me so far down the rabbit hole.
I somehow ended up on graphql
That is a very way out there destination on the journey
The mention of graphql reminded me of this cool mc project I saw a long time ago. https://github.com/WorldQL/mammoth
smallest rust project
@quartz kindle got it down to 7bytes per msg for now, instead of 9
x (u16) + y (u16)
turned into
xy (u24)
action (u8) + height (u8)
turned into
actionHeight (u3 + u5)
height is multiplied by 4 to look better, aka 4-128 (same as before)
I was also thinking of maybe doing x (u13) and y (u11) since usually screens are wider, not taller
that would be 8192x2048 instead of 4096x4096
cargo is basically the new node_modules meme
its the same thing
you import one package that package imports 50 different packages each of which has different code/binaries depending on the OS youre using which further adds to the package size
one thing i appreciate about C++ is that packages are usually standalone unless its some big feature which realistically cant be standalone
i just drop it into my dependencies folder and it works
package systems spoil library developers a bit so they dont feel as restricted importing packages for small things
except i fucking hate LNK2001 and LNK2019 so much
what caused this π
i've already used TOPGG_EXPORT in every class declaration which should expand to __declspec(dllexport / dllimport)
it literally says dllimport here
and ```cmake
option(BUILD_SHARED_LIBS "Build shared libraries" ON)
if(WIN32)
target_compile_definitions(topgg PRIVATE $<$BOOL:${BUILD_SHARED_LIBS}:TOPGG_BUILDING_DLL:DPP_STATIC TOPGG_STATIC>)
endif()
c
#ifdef _WIN32
#if defined(DPP_STATIC) && !defined(TOPGG_STATIC)
#define TOPGG_STATIC
#elif defined(TOPGG_STATIC) && !defined(DPP_STATIC)
#define DPP_STATIC
#endif
#endif
#if defined(_WIN32) && !defined(TOPGG_STATIC)
#ifdef TOPGG_BUILDING_DLL
#include <dpp/win32_safe_warnings.h>
#define TOPGG_EXPORT __declspec(dllexport)
#else
#define TOPGG_EXPORT __declspec(dllimport)
#endif
#else
#define TOPGG_EXPORT
#endif
@wheat mesa
π
yeah thats cool, just keep in mind that pushing a canvas to those resolutions is gonna blow up the browser lmao
canvas performance drops exponentially with canvas size
ah well I implemented 90% of it now, only issue is loading existing state
since its a whopping 67.1mb
xDddd
lmao
fetch('/history_2.raw')
.then((res) => res.arrayBuffer())
.then((buf) => new Uint8Array(buf))
.then((arr) => {
let offset = 0
while (offset < arr.length) {
const [ type, height, color ] = fromFormatInternal(arr.slice(offset, offset + 4))
const x = (offset / 4) % 4096
const y = Math.floor((offset / 4) / 4096)
draw(x, y, color, type, height)
offset += 4
messages++
bytes += 4
}
})```
i wouldnt make a canvas bigger than 2k res
the loading can be improved by ordanizing the data into a format that can be applied directly to the canvas imagedata object
for the size of the data itself you cant really do much except for some sort of compression like repeating pixels of the same color
hmmm
actually I forgot something
displayed resolution is 16384x16384
height is multiplied by 4
lmfao
16k is insane even in game engines
8k is typically seen as a max
and thats insane and seen as for atlases
ok it loads a lot faster now
1024x1024 with real res 4096x4096
~7s
impossible writing on a trackpad
still need to implement ws buffering
and make client drawings show immediately
oh nvm it was apparently caused by this π
and need to properly scale the canvas
gotta love when my http request never returns β€οΈ
@green kestrel does the bot needs to be online for dpp::cluster::request to work?
because when i tried m_cluster.request without the bot starting the function just never returns
@harsh nova
in 10.0.x, you just need to have instantiated a cluster
in 10.1.x you need to have called dpp::cluster::start() to run the reactor loop
i see
10.1 uses a unified event loop for everything
which is spun up in bot.start()
without that, it cant make any requests
10.0 just launches requester threads

i think i'll do bot.start(st_return);
okay it worked now!
wth π
oh the body just stops there??
@green kestrel do you have a limit on http response bodies? because i've been getting invalid string: missing closing quote errors
here body stops at 672 bytes
what makes it stop at 672 bytes?? is it encoding-related? i'm not sure
what's wrong with the W character????

no there's no limit
but wtaf is this
three bar equals fif?
idk,.works on my machine
use Linux like a normal bot dev 
10.1 hasn't been as tested on windows as elsewhere, could just be iffy there
real production bots aren't using windows with dpp
i presume an ASCII rendering of an UTF-8 emoji #development message
what????
howwww
@green kestrel i rewrote my code to just this
dpp::http_headers headers{};
headers.insert(std::pair("Authorization", "token"));
headers.insert(std::pair("Connection", "close"));
headers.insert(std::pair("Content-Type", "application/json"));
headers.insert(std::pair("User-Agent", "topgg (https://github.com/top-gg-community/cpp-sdk) D++"));
bot.request("https://top.gg/api/bots/264811613708746752", dpp::http_method::m_get, [](const auto& response) {
std::cout << "===BODY START===\n" << response.body << "\n===BODY END===\nSIZE: " << response.body.size() << std::endl;
g_sem.release();
}, "", "application/json", headers);
g_sem.acquire();
and now it gives 2,041 bytes??? what?
out of curiousity i reran the executable again (without recompiling) and i got the entire body (3,746 bytes)
?????
i feel like this is from dpp's end 
i'll file an issue for this in the DPP repo if you want
i reran the executable again, and i got 3,746 bytes, and then 3,410 bytes
it's very much random
@quartz kindle everything implemented https://draw-together.rjansen.dev/
nice
pixels are displayed as size 4, and stored as size 1
so 4 pixels can be on one spot even with smallest size
i think ill store both history and pixel data
pixel data so I can remove unused history entries
history so I can accurately recreate pixel data
try taking connection close header off
idk why you'd send that, but that's at odds with http 1.1 and handled by dpp
you should only need token and content type
are you able to duplicate this without the top.gg api
if instead of top.gg API you query for example this URL... one sec
@quartz kindle final solution I swear https://github.com/0x7d8/draw-together/commit/717c4766279a5ff6c01c955efca20f540b6b17ff
ohh taking connection close header off actually fixes it π
i thought connection: close was mandatory for single HTTP requests done with HTTP v1.1
because i tried it once before and it worked
kinda weird that undoing this fixed it
it is, but dpp is adding one
so you are sending two

π
you should've wrote it in the documentation
it might be nice to make a pr for that to stop people making this mistake
but there seem to be other issues with long running bots on windows, im looking into that
cuz i thought dpp::cluster::request is very low level
tbh didnt expect people to be adding random headers that affect how dpp handles its connection lol
that is confusing the server, i bet
yeah that's weird
its not the lowest level, this is: https://dpp.dev/classdpp_1_1http__request.html
bot.request/bot.co_request create one of these and insert it into the queue
below that is THIS, which you really cant directly use
https://dpp.dev/classdpp_1_1https__client.html
if (!header.has("connection")) header.insert(std::pair{"connection", "close"});?
hm, the opposite, you shouldnt be able to override it
something like
if (header.has("connection")) { ... drop that header like a mic ... }
aight nice
shouldnt headers be deduplicated?
yea
no
thats the reason its a vector of pairs and not a map
nothing in the http spec says headers should be deduplicated, and many headers can happen multiple times
like cookie headers
admittedly, connection: close is a weird one
interesting
i've yet to see code in the DPP repo that adds a Connection: close header though
From RFC2616 section 4.2:
Multiple message-header fields with the same field-name MAY be present in a message if and only if the entire field-value for that header field is defined as a comma-separated list [i.e., #(values)]. It MUST be possible to combine the multiple header fields into one "field-name: field-value" pair, without changing the semantics of the message, by appending each subsequent field-value to the first, each separated by a comma. The order in which header fields with the same field-name are received is therefore significant to the interpretation of the combined field value, and thus a proxy MUST NOT change the order of these field values when a message is forwarded.
so
the server may reinterpret:
Connection: close
Connection: close
->
Connection: close, close
wow i thought the problem was fixed and now bot.start(dpp::start_type::st_return); just crashes π
this SO post says the outcome of two connection headers is non-deterministic and depends on the server side
how could bot.start() crash tho?
dpp::cluster bot{discord_token}; discord_token here has been checked previously if it's a null pointer
nobody uses it in prod π
hmmm this isnt a constructor
is it?
its an initialisation
this RFC is apparently superseded by RFC9110 https://www.rfc-editor.org/rfc/rfc9110#section-7.6.1 and also there is says that the connection header is a list of connection options 
same thing happens if i used ()
i cant help you without a stack trace
i might as well just guess and say "it was space aliens" 
nulllll
how exactly are you able to call it twice if its st_wait
its st_return
no
it wont work then
the minute the cluster goes out of scope it'll be torn down, wont wait for requests to finish
i was ctrl-zing my test.cpp file (cuz i previously need to write it as an example for the github issue)
i wrote another bot.start() line and commented the older one

you might want to do this
before returning:
/* Wait here for the webhook to complete, but we could do anything we need here */
while (bot.active_requests() > 0) {
std::this_thread::sleep_for(std::chrono::seconds(1));
}
this may or may not do what you want, but its better to use bot.start(dpp::st_wait)
i wasnt doing it intentionally

/* Wait here for the webhook to complete, but we could do anything we need here */
while (bot.active_requests() > 0) {
std::this_thread::sleep_for(std::chrono::seconds(1));
}
gonna add this in a pr
its such a fundamentally weird thing, i never even considered it lol
while loops infuriates me
while (midnight_wolf_infuriated) { infuriate(midnight_wolf); }
yippeeee
finally got to know that my C++ SDK is working well by testing it with top.gg's small handful of still-working endpoints

god why does get_bots take like 2-3 seconds to finish
it is possible to call bot.start twice if you specify dpp::st_return
Code change checklist
I have ensured that all methods and functions are fully documented using doxygen style comments.
My cod...
first one will make sure nobody else calls bot.start twice again
second one is nothing to do with the http request headers, but i noticed it while looking
lmao
...git pun?
yeah pun intended
you mean i should be committed
@harsh nova are you proud of me
huh?
of my dad joke π
whyd the blind man fall down the well
because he couldnt see that well
hahah good one! Might perhaps steal that one
is there a rate limit on these at mentions? it keeps going back and forth between being a valid and invalid at mention
here's the same message
It's just a cache issue, whether your client has the user in cache or not
@radiant kraken https://github.com/brainboxdotcc/DPP/pull/1385
shouldn't the discord desktop client fetch user info if there is a cache miss? and if there are too many misses it would get rate limited because it does too many API calls right?
It's probably to avoid spamming the api, yes. There's a vencord plugin to fetch the user if you hover it
nicee, good job!
Typically, the api sends an object map of members that were mentioned, so you dont need to fetch them
I think the host header would be useful to keep changable
sometimes you need to send stuff to an ip with a host header because multiple sites are on it
no
it's set by the hostname you provide when you make the request
setting it a 2nd time in the header would be pointless
yeah I know, thats not always what you want though
yes it is
the interface isn't that low level
if your host doesn't resolve, that's not something that's a dpp problem
Does anyone use JDA wrapper?
I do
normal, ig
idk what to compare against, only other I've used was d.js when I barely knew how to code
but being java it's a lot more pleasant to me
where can i get webhook authorization token
i wonder why the data somehow is not the same from what being logged and inserted to db
fixed with a very bad waymaxspoilerlength:200 doesnt work, but maxspoiler:200 works?
in your bot edit page, webhook section
but only after it's approved
Yeah thanks!
hey i need help with vote registration
i have set the webhook to discord webhook on top.gg
but when i vote but didn't registers it niether sending webhook
but when i manual testing !testwebhook and !testvoteapi they works fine
should i send code here?
yes
and he was never seen again
do not send the code he will steal it and make millions
hey yall, i've been relying on the query parameters when voteing, but now it looks like there is no query data passed to the webhooks? any changes or something i can work with?
hey, what query value do you add in there? π€
the guildId that the user voted from
it was working before but ig something changed and now an empty query is passed
can you escalate that to the development team and get it fixed?
That's me
it should look like this
thanks!
please let me know as soon as its fixed (dm's fine)
will do!
ehmahgerd its verudo-san
hello tim 
herro!!!
perfectly cursed, as all things should be
according to the docs you can use topgg.DBLClient(bot=client, token=topggtoken, autopost=True, post_shard_count=True)
I'm not fetching in this case, it's the discord desktop app. But i'm thinking about moving away from those at mentions and just using their global_name instead.
I'm just saying. The desktop client should have the user info so long as the members are part of the guild since the API does return that info
that's a good point. i was able to see those two users in the Member List so that data should have already been loaded, but it still couldn't show the at mention. maybe at mentions need more data for some reason
it's doing it right now
and now it's showing up again
More than likely just a client bug
Err actually idk how mentions are handled when under embeds
But when they're in the content, the mentions is definitely having the user data sent
the only difference i know between embed and content at mentions is the embed at mentions dont ping people
pings include user data iirc
when you send a webhook message you can disable pinging at all, so it can happen in message content too.
yeah embeds have had this bug for years now i think and discord still hasnt fixed it
it looks like a caching issue, if you go on the users profiles on your client they should show up normally
the only reliable way for mentions to show up in embeds is to add it to the message content
Hello quick question what do you think is more suited monetize option for discord bots
A) One time payment
B) Subscription
I feel like users are more inclined on A but B can be more profitable long term
I imagine it depends on a few factors:
- Frequency of meaningful updates(This more applies to game bots, I suppose)
- How much time did/do you spend on development?
- How much does it cost you to maintain?
4.Value of the features(Does it do something original or in a better way that users will care about, that they can't find in a free bot?)
*posting shard count will soon be deprecated btw
i think veld is deprecating anything shard-related in Top.gg
Good stuff π₯Άπ
I just hate xml
Fr
subscriptions are blocked in some countries like India because they have consumer protection laws that don't allow subscriptions. so if you do subscriptions make sure to support purchasing subscriptions via consumables too
Doing good progress
so based
i just realised docker is like electron but for servers
uses lots of storage and memory for each instance
you can use micro VMs for minimum resource consumption
^ lxc
would want to know how much money you'd save by completely removing mongo from the stack
mongo stinky fr
I used to defend mongodb so much when I didn't know sql
now I see how much it sucks
zzz
Mongo is good for super small projects
mongo is decent for writing lots
even at a scale of just 4,000 discord servers it's just painful
but there's a lot of better alternatives
I really wonder how you scale with it
mongo has a specific usecase
you just dont
all of github audit logs are on mongodb
you just write a LOT to it
and read sometimes
a timeseries database is prob still better, dunno
arent auditlogs kinda?
audit logs are events that happen sequentially over time, and are usually sorted after time, so it would be practical to use timescale db or smth
yeah, but one big issue is that time-series dbs aren't really built for consistency
they are built for performance ingesting tons of data
which is great for many events, but not if you want to guarantee your data being sent
fair I guess
Hey why i cannot sumbit discord bot on topgg?
When i click sumbit it just reloads the button
π
wrong channel --> #support
How fix the application did not respond
Respond to the interaction
@oak cliff morning

@humble gyro any updates on the query issue?
ohh yeah
just now it started working
thank you
amazing thanks, seems to be working now π
Topgg mods hates me
if user_agent.includes('node'): error()
then how do i JSON.stringify() it without truthy?
possible that topgg thinks it doesn't exist since 0 is falsy
might just me like !server_count || !shards
maybe
which would error if both are undefined, or even just 0
I hate that I see js, py, bash, c++ and c all in one screenshot

L
close enough
even worse
batch is good
dont disrespect bash like that
BATCH IS GOOD
batch is ass
batch is the unwanted cousin of bash
batch is literally my first ever language
batch is painful
same
doesnt stop it from being bad
sadly same...
i'd rather learn VBScript than batch
nah
VBScript is also one of my first languages
gotta disagree on that one
shit start ik
same
batch -> js -> ts -> rust
To truly outline my journey
batch -> Lua -> js -> TS -> go
some other stuff too but thats for main projects I did for fun
not for money
py -> js/ts -> c# -> go -> elixir -> rust -> c++ -> c#
batch -> vbs -> js (vanilla) -> py -> js (node.js) -> typescript -> c# -> c++ -> c -> rust (briefly, then gave up) -> go -> v -> rust
that's mine
i did nodejs before any frontend js
I think im going rust + ts for life
I will use rust if I need to use low level programming on like embedded software
but C# is the goat
ye all of ther c# I saw was pretty decent
rust is cool because of macros
1000 lines less for the same performance π₯
especially useful for parsing
#[derive(Deserialize, Clone)]
struct Reroutes {
name: Option<String>,
reroutes: HashMap<String, (String, u16)>,
}
fn main() {
let file = File::open("reroutes.json").unwrap();
let data: Arc<Reroutes> = Arc::new(serde_json::from_reader(file).unwrap());
let listener = TcpListener::bind(("0.0.0.0", PORT)).unwrap();
println!("Server started on 0.0.0.0:{} (v{})", PORT, VERSION);
println!("{} reroutes active", data.reroutes.len());
// ...```
π
is it just me or does using unwrap feel dirty 
not like there are many other options
unwrap is meant for when you know it's safe to unwrap
Otherwise you should be handling it
Any free chatbot to add on my bot?
Honestly, there is so many cheap ones right now you're better off paying the few dollars a month itll likely cost you.
he's enlightened
also C# has the coolest pattern matching syntax i've seen in any language yet
being able to do like age is >= 18 and < 25 is so cool
Isnt that just standard in any other language hu?
JS dosen't have >==/>= or something?
they mean the pattern matching
if (user is { Age: >18 and <25 }) {
...
}
idk if that is valid syntax
but its pretty sweet
Hu but that's just the same as user.Age >=
I've never actually seen anyone do it like that in C# before ik you can do object is User user but not like that
Btw don't bind on 0.0.0.0 by default that opens up your program to the internet use 127.0.0.1 (localhost) instead xD
Ok good
i always bind to 0.0.0.0 because it runs in a container anyway, who cares
that too
- I host at home wo/ portforwarding, who wants to access it?? my mum gonna hack me?
best practiceβ’οΈ
it's not, its a value between 19 and 24
I understand that but the fact that you can do is that way is too weird even for a C# nerd xD
fair lol
it's a .net 8 thing i think
so fairly new
its cool because you can also do stuff like
user is { Username: "veld", Verified: true }
So it's like querying?
it is but only for in-memory data
Not querying more of a if statement structure if (user.Username == "veld" && user.Verified == true)
it compiles to effectively this in js:
"username" in user && user.username === "veld" && "verified" in user && user.verified === true
nah it's been in C# since like C#9 or so
they've changed the syntax a bit in the successive versions but
can they do that with async please
like you used to not be able to do x is not null you had to do !(x is object)
x is {}
var approvedBots is select from bots where approved is true;
can't you already do that with linq queries
only one keyword here is invalid
ig not with full pattern matching
assigns != is
have you ever seen someone use linq query syntax
like i'm very conscious it's a thing but i much prefer using lambda syntax and im pretty sure every other human on earth is the same way
c# needs two features and i will marry it and those are discriminated unions and blocks in switch statements a la java
with unions you mean like AnyOf<MyType, MyOtherType, Etc>?
yeah like F# unions or rust enums
type Option<'a> =
| Some of 'a
| None
then we'll have
ParseInt
TryParseInt
TryParseIntOption
can't wait
there's a proposal for it that also features like
A | B union types
which is more than i wanted originally but pLPEASE
c# and typescript are actually just going to be merged atp
Types are cool but I donβt want it to get to a point where I have to be a rocket scientist to understand what type to pass into something
Typescript has fallen victim to that in some places
you can just use overloads for this most of the time
people just forget they exist
yeah typescript types can be pretty disgusting but i don't think union types are terrible as a whole
and it should be possible to refactor the really evil types a bit
this is what ive been saying for a year now
please merge it tho
imagine the possibilities
they're actually gonna pull a crazy twist and merge F# with TS
fable is already a thing that compiles F# to JS
F# supremacy
not C# though
there's not really an easy way to do unions in C# without a preprocessor
type Result<TData, TError> = { ok: true, data: TData } | { ok: false, error: TError } is all u need
I am trying to fetch members who have a specific role
const role1 = await guild.roles.fetch(relevantRoleIds[0]);
console.log(role1?.members);
But it seems like no one is cached, is there a better way to go about doing this?
I have tried just fetching members and filtering it
guild.members.fetch()
but this ends up timing out, the server has about 25k members
Have you got the members intent?
I'm assuming discord.js which relys on cache for fetching members roles
Yea you need members intent to fetch the entire list
Yea figured it out thanks! Member intent was enabled but not in constructor.
π€
Thatβs an analytics endpoint iirc
Yea, it's been down for as long as I can remember and has no effect on whether the site works or not
I was going to send my bot but it didn't work and I found out it was calling this api
since it's just analytics it doesn't matter
You probably missed some required field like prefix
iirc it's an api.top.gg/graphql post that's relevant
I pressed submit registration but there was no notification message so I don't know if it was sent or not. But now I know that the bot is checking it.
does smb have experience with discord bots in bun (performance wise compared to nodejs)
slower
bleh rly
idk how to even properly benchmark it
in terms of like mps/ips
or average response time to messages/interactions (ignoring network ping/latency)
There are some libs which support both node and bun. I'd say just setup a bot and try to run it in the same code base and yeah
But really if you're trying to look to bun for more performance, I think you're looking in the wrong places.
I'll give an example from my own bot: A lot of libs depend on the ws package from the npm registry for gateway connection and personal experience with a bot in over 10k servers has shown that just gateway message processing can really eat cpu time. At the time, it was all on one cluster. However, Tim provided some great code for a stupid fast WebSocket impl and that gave a significant performance boost. This was before interactions were a thing. Just processing messages was baaaad. It all depends on your use case.
Really, the first place you should start is your dependency tree. Vet the code you install and run. Replace deps with more lightweight ones if you can and maybe also look into taking a different approach into how you build your bot. An example is to move away from libs that try to do it all like Discord.js and instead look into more modular libraries that can get you great mileage without having a lot of cpu and memory overhead from just lib internals. The raw Discord API really is not that bad. I'd plug the libs I maintain but not trying to get bonked
When I made the switch away from Discord.js, I was able to manage what data I really needed to cache in memory and the performance shifted from being the fault of libs to my own code and that helped me realize what patterns I was doing was bad for performance
there is some wrapper made for bun, don't remember the name though
yeah I know that I could use the discord api without djs, (or at least without the wrapper and just use djs/ws and djs/rest) but that would require me to rewrite the entire bot which is not my goal. I am pretty selective with the packages I install. From some projects bun is "just" faster, and would like to know if this also is the case if it comes to discord bots.
I currently run 12 clusters with 12,000 guilds and use 1.2-1.5gb ram (though I rn have about 350k messages in cache which I have to kill, that would fix most of the memory usage)
I just would like to get "free" extra performace by "just" switching runtimes
well you can tias
I still would work with djs - at least the forseeable future. if I would decide to drop djs, I probably also gonna drop js as a whole
getting closer
real 0m0.169s
user 0m0.168s
sys 0m0.001s
root@remotedev:~/projects/0x7d8/bad-lang-2# time node testing/fib.js
real 0m0.080s
user 0m0.074s
sys 0m0.008s
root@remotedev:~/projects/0x7d8/bad-lang-2# time python3 testing/fib.py
real 0m2.858s
user 0m2.813s
sys 0m0.005s
root@remotedev:~/projects/0x7d8/bad-lang-2# ```
lets go
real 0m0.065s
user 0m0.061s
sys 0m0.004s
root@remotedev:~/projects/0x7d8/bad-lang-2# time node testing/fib.js
real 0m0.086s
user 0m0.088s
sys 0m0.000s
root@remotedev:~/projects/0x7d8/bad-lang-2# time python3 testing/fib.py
real 0m2.765s
user 0m2.756s
sys 0m0.009s
root@remotedev:~/projects/0x7d8/bad-lang-2# ```
interpreted language faster than js
@quartz kindle time to switch
the real surprise here is how it python so slow
well
do you want to see the code
let a = 0
let b = 1
let temp = 0
if (#eq(n, 0)) {
return a
}
let i = 2
loop {
if (#gt(i, n)) {
break
}
temp = a
a = b
b += temp
i++
}
return b
}
fn fib_until(until) {
let results = []
let i = 1
loop {
if (#gt(i, until)) {
break
}
array#push(results, fib(i))
i++
}
return results
}
let il = 0
let it = 100000
loop {
if (#gt(il, it)) {
break
}
fib_until(55)
il++
}```
for python its ```py
def fib(n):
a = 0
b = 1
temp = 0
if n == 0:
return a
for i in range(2, n + 1):
temp = a
a = b
b = temp + b
return b
def fib_until(until):
results = []
for i in range(1, until + 1):
results.append(fib(i))
return results
Run the benchmark loop
il = 0
it = 100000
while il <= it:
fib_until(55)
il += 1```
how about using an internal timer instead?
sure wait
bruh my lang only has unix time
ill need to add ms precision time rq
67
root@remotedev:~/projects/0x7d8/bad-lang-2# node testing/fib.js
66.869545
root@remotedev:~/projects/0x7d8/bad-lang-2# python3 testing/fib.py
2892.989013671875
root@remotedev:~/projects/0x7d8/bad-lang-2# ```
nice
can you also show the js code?
const start = performance.now();
function fib(n) {
let a = 0;
let b = 1;
let temp = 0;
if (n === 0) {
return a;
}
for (let i = 2; i <= n; i++) {
temp = a;
a = b;
b = temp + b;
}
return b;
}
function fibUntil(until) {
const results = [];
for (let i = 1; i <= until; i++) {
results.push(fib(i));
}
return results;
}
// Run the benchmark loop
let il = 0;
const it = 100000;
while (il <= it) {
fibUntil(55);
il++;
}
console.log(performance.now() - start);```
looks good
i can think of a few things to change but it wont show any meaningful difference
want to share other ways of handling mem/compute for python
import timeit
import numpy as np
from functools import lru_cache
# Define Fibonacci Implementations
def fib_recursive(n):
if n <= 1:
return n
return fib_recursive(n - 1) + fib_recursive(n - 2)
def fib_iterative(n):
a, b = 0, 1
for _ in range(n):
a, b = b, a + b
return a
@lru_cache(None)
def fib_memoized(n):
if n <= 1:
return n
return fib_memoized(n - 1) + fib_memoized(n - 2)
def fib_numpy(n):
F = np.matrix([[1, 1], [1, 0]], dtype=object)
return (F**(n-1))[0, 0] if n > 0 else 0
# Set test value for n
n = 55
# Benchmark each implementation
results = {
"Iterative": timeit.timeit(lambda: fib_iterative(n), number=10000),
"Memoized": timeit.timeit(lambda: fib_memoized(n), number=10000),
"NumPy": timeit.timeit(lambda: fib_numpy(n), number=10000)
}
# Recursive is too slow for n = 55 at high repetitions, so we run it separately for fewer iterations and n = 30
results["Recursive"] = timeit.timeit(lambda: fib_recursive(30), number=100) # Limited to 100 runs
print(results)
results would reflect what you saw as realtime in sec
$ python3 performance.py
{'Iterative': 0.008456800016574562, 'Memoized': 0.00037169991992414, 'NumPy': 0.09832059999462217, 'Recursive': 6.185182299930602}
whats the difference between recursive and memoized?
they both use recursion but the memorized add caching (avoiding/reducing redundant computations)
does lru_cache do that automatically? whats the implementation for that decorator?
you could set it to say
@lru_cache(maxsize=128, typed=False)
where max size = how many function calls to cache
typed if different arg types should be cached seperate
default is maxsize=128 anyway
so basically it just takes the function arguments and caches the return value for those arguments
exactly π
π just offering different performance tests
i have a function that expands into multiple interactions. I need to gather that info from multiple menu's and handlers. How do you guys usually approach these as in what do you use to store the info through the different interactions
you can store state directly inside them via uniqueid
alternatively you can have some global object/cache/db
how is it cheating though?
not actually doing the calculations yknow
and if you had a very repeated computation that would benefit from cache you wouldnt take it?
I would, but this is purely for testing performance
@scenic kelp howβs go
that's kind of my point though and offering different performance tests - to show why one functionality differs so much from another
@quartz kindle
.setCustomId(`start_debate_modal_${uniqueId}`)
looking good?
i will have to modify my listeners tho
thats fine i guess
get what you're saying - you were after an unbiased comparison of langs, π this is where I wanted to show...its kind of up to the person to know what abilities they really have
we were comparing langs?
not really
just this
im assuming python parses the code multiple times, not quite sure why its so much slower though
i'm not even writing it i was just in vscode for smth
i will say the go team had some very strange design decisions
why the fuck did they feel the need to make x + y automatically format to x+y kiss my ass go team
It could be JIT warmup, you have to account for that
It does have some JIT
Pretty sure at least
Looks like python 3.13 has it, idk if it's used by default
pyroot@remotedev:~# python3 --version
Python 3.12.3
Theree's probably some sort of runtime optimization causing it to be slow
I remember java used to have a problem with VM "warm up" times, I can't remember exactly why (I think it still does have this)
it's just jit
java starts with compiled bytecode, then optimize it further as it goes
I thought that even pre-jit java had warmup issues
probably old issue
What all is possible with the top.gg API ? I'm building a command to reward users who vote but other than that I'm not sure what I could do to utilize it more
I would use webhooks if I were you for this purpose
I am using web hooks for the voting but was just trying to see other ideas
Later it's up to you what you want to do with this fact. Some bots give access to commands that are unavailable without voting, others give some currency in the bot or items and the biggest bots also make vote streaks thanks to which people have a reason to vote every day to get better rewards
Vote streaks is a W. Low-key didn't think of that
Thank you
Trust me, I understand that rewriting a bot is a very daunting task but also https://amanda.moe/to/stats
You can see where I ditched discord.js
Some of the data is missing and it stopped after 2023 because I got lazy to readd performance stats, but
Currently hovering at 150MB of ram usage
Telling someone to rewrite their whole bot isn't great advice. Discord.js is the most well maintained library in js and they'd either use something less maintained that would get features slower (or potentially be abandoned) or essentially write their own lib.
It also shows a misunderstanding of the real issue. You can just customize the cache in discord.js - to reduce memory usage, you should disable the intents that your bot isn't using and limit/sweep the cache.
https://discordjs.guide/miscellaneous/cache-customization.html#limiting-caches
Other libs simply cache less or not at all (and you trade less ram usage for slower performance as you need to be fetch everything, and you may hit rate limits).
I think you might not have a full understanding of the situation. Even with customization of cache, discord.js operates under a large amount of assumptions and some parts of the library simply cannot be fully bypassed. I was in the exact same situation and discord.js led me towards having a large amount of technical debt. I relied too heavily on its class system and sometimes, you can't even initialize the structures just to do rest actions without a good amount of data. Even if you literally limit the amount of data to what you'd theoretically need and use the built in Rest to make your own requests, you are basically not even using the lib at that point and are opting for internals. Just ditch the memory overhead of even importing the library. The imported string size of Discord.js already blows past what my bot's memory usage sits at during peak hours. Discord.js' approach to utilizing OOP which is what JS is known for shoots itself in the foot as you can't fully realize what you could achieve.
Your usage of the phrase "slower for performance" just because you "need to fetch everything" is such a bad take as the API actually gives you a LOT of data you'd need depending on what your use case is. You completely miss the point of trying to guide users towards making better choices just because they'd prefer to just swap runtimes and hope that magically solves all their problems. You're enabling bad choices. I would think that they would have already customized their caches which is why they'd be looking towards another runtime to fix their problems. Switching runtimes isn't just such a simple decision to make. 1.2-1.5GB of memory usage is not good by any stretch.
I also outlined in an earlier message that discord.js makes use of libs which are actually detrimental to performance. @discordjs/ws depends on ws and I have done my own tests. I've seen the before and after switching to a more lightweight ws implementation, switching to an entirely different gateway lib entirely. The CPU performance gains are nothing to scoff at.
"you may hit rate limits"
Libraries implement guards to prevent this. The only limits you'd have to worry about are the 50 requests per second globally. Even then, just cache what you actually need either in memory or in a database/object storage like Redis.
And to drive home the fact that I was hell bent on trying to maintain some semblance to Discord.js even when I was trying to migrate away from it:
https://github.com/AmandaDiscord/NEKO I wrote this before I fully gave up on Discord.js (v12) . Only later was cache customization a thing, but a global presence cache for users is still yet to be seen.
https://github.com/AmandaDiscord/ThunderStorm When I started maintaining some raw API packages, I wrote this instead of rewriting my bot entirely just so that I could avoid a total rewrite which was a waste of my time, a huge mental strain which I realized the hard way, and I ultimately stopped working on it
You switched in v12 before both customizing the caching and intents were a thing so how would you know that it doesn't fix their problem? Regardless, telling someone to rewrite their entire project rather than simply use the cache controls in the library first, or if they still use message commands to switch to an entirely interactions-based bot and disable the messages intent, is a pretty wild premature "optimization" (in reality it'll probably just be a huge time sink more than anything, since all the other libraries do is less/no cache).
Both of you are right and discord.js is known to have a some memory performance issues especially at high number of servers but not really feasible to rewrite a bot if it's only in a few servers.
The bot is in over 10k
How much memory you using?
I would think that they would have already customized their caches which is why they'd be looking towards another runtime to fix their problems
Currently sitting at 150MB which is mostly occupied by caching images in memory
Why would you assume something they never mentioned
Why else would they want to make such a big decision to jump to a totally different runtime
You'd think they'd exhaust their options
Wait only 150mb that's actually impressive
Old data, but the amount of servers never mattered
My bot is rather stateless
Yea figures with that amount of memory but a lot better still
The fact that they wanted to switch runtimes suggests that they're a beginner who doesnβt understand whatβs causing the issue, as that isn't very relevant as the memory usage is due to how much data theyβre caching. You should still get confirmation that they tried it before assuming.
You just seem like a disgruntled user of discord.js v12 but most of the issues you had were fixed with the new caching controls in my opinion. If you still disagree, you could do a more updated benchmark on your memory usage with unused intents removed and a limited cache before jumping to "ditch discord.js".
I highly doubt that doing the tests would be worth my time as the imported string size blowing my peak memory usage is still an issue
mates, maybe there is a react enjoyer here. im buildung a nextjs app with routes and somehow while prod building i get the following issue
TypeError: (intermediate value).default is not a function```
how ever, the error comes from chunks and the following lines say `at r.metadata.icon`on files like .next\server\chunks\856.js
i haven't set any metadata at all except for title within the <head> in root. i can't find any relations while searching for keywords, it doesn't matter if /upload, /users or settings, i couldn't find a pattern yet and (lol) copilot isnt that helpful. also it's my first project. my research told me i need to handle 2 files for each route: layout and page and nextjs would ask for metadata anyways. but i wonder why dev build works without errors or db issues. i can't even tell what this error means, lol
would appreciate some help :)
I'm not just trying to switch runtimes because it's the holy grail that will fix ally issues - it won't. My biggest issue isn't even memory, even with 1.5gb ram usage (I have a fix for that by limiting cache sizes to 0 and using keep over limit to only store what I need). My point rather is CPU utilization/CPU usage. things like parsing hundreds to thousands of gateway message takes time and resources, which another runtime may be better at. Bun is generally perceived to be faster, and I only really wanted to know if this would also be the case with djs (as bun may be slower than nodejs under certain conditions).
it's just not feasible to rewrite the entire bot with another library. If I was about to do this, I would drop JavaScript entirely for Golang or C++
As things stand with discord.js, I don't believe switching runtimes would have any meaningful impact like you think it would. At best case, you should have your gateway clustered across multiple machines and only ingest what messages you actually need at your workers. And ideally replace the gateway backing. the ws package is pretty bad for CPU performance at scale as I mentioned. I don't know how feasible it is to do this in @discordjs/ws, but Tim helped me write a slimmed version of a WebSocket and also an etf reader/writer
The difference of bun is really negligible at best it does have faster package install but you can just use pnpm. But you can simply switch to an interactions-only bot then you will only process the interactions you will receive and not the "hundreds of thousands of gateway messages"
I use pnpm - I need the gateway (at least until http events release)
What they mean is that If you process commands through messages, you shouldn't as MESSAGE_CREATE events can easily saturate the CPU for processing time. If you have it so that you use / commands for commands, you save up so much processing. You can still use the gateway for other events
And as a word of advice, dont use the gateway to receive interactions
the main issue with d.js is it's built to be a tool for developers to learn basically
they've built it in a way to allow not just experience devs to use it but everyone
after about 8-9k servers depending on your usage, can use way more memory than any other lib even with cache customizations
at the end of the day it falls on your experience and your willingness to learn honestly
why maxSize 500
I fear that djs breaks if I dare to call
reply on a message that's not cached anymore
wouldn't at all surprise me
will test it anyway before pushing to prod
as long as you're not replying to a message from a delete event
oh yeah no lol
even with 500 it's way better than my current 34k per cluster lmao
no idea
each channel has its own manager
ima manage u
yes
Making my own "library" for my webhook bot and can strongly recommend doing that if you can. It's fun
They made it per channel?
it's always been per channel
you set the limits for a single MessageManager object, and every single Channel has its own instance of MessageManager
there is also guild message and dm message manager but I think I can ignore it if I set a message manager
they all extend MessageManager
but ok will def set a lower max then
but the default 200 explains why a cluster is always at the 33k messages for me
thanks for the idea
Discord API docs are sometimes a bit strange but with enough trial and error it works
Nonetheless a really fun project
haha yeah, better than having no project
The new docs I feel are terrible
They used to be a lot easier for newbies to follow but now its jumbled with a bunch more jargon than needed.
Wish everyone had the quality of docs that Microsoft does
Oh really? Always been good for me
but I swear to learn one concept you have to follow 3 hyperlinks
only to be sent back to the beginning
Kinda the opposite of discord. They tell you that you need to send something to some certain route but don't link what exactly you need to send so you have to dig for it
yup
shits cursed but finally scopes work properly https://github.com/0x7d8/bad-lang-2/commit/37a44bddd759dc67ca5f7e8ddc427824ca352d61
Learn More buttons are even better
they send you to some random article filled with a dump of irrelevant information that you need to scan through to find what you need
Yup
fixed by downgrading to node 14 and react 18
next/metadata doesnt work work with newest versions
isn't node 14 EOL since a few years?
it's like 20 something by now
nextjs, my fault :>
ah yeah v15 had some changes i'm not a fan of
tyty
tbf, this is my very first react project and wasnt able to build prod at all. it was weird since dev worked without any issues. after a whole day i figured i have to use standardexports
(still not working, but new errors at least :>)
i love seeing
nameservers propogate to my ns
but then they went back to the registrar ns
So something I still have not been able to wrap my head around is keeping state that the user is logged in on the frontend.
What I mean by that is, auth is handled on the backend in my aspnet api using microsoft's Identity and OpenIdConnect libraries, the frontend makes a request to an endpoint that calls the signin function to these libraries that redirects you to the oidc auth page of my auth server then back to the frontend on successful auth. The problem is that a cookie is saved on successful auth with all the information about the user, but its a signed cookie and encrypted so I can't use it on the frontend I would have to request the user info from the backend.
The problem I see with that is stale data, the data i'd save to state from the userinfo endpoint could become stale in the event they update something about their user, my idea was to call a mutation whenever something is updated (by mutation I mean a function that updates the state locally that fetches the user info endpoint to update this "stale" state).
I also think I may be overthinking this and there is a better solution to keep track of this state on the frontend, because all I really need to do is be able to keep track of the user info so I can use it when querying for things from the backend.
You realize you can just implement controller routes to return user info that you can use with javascript fetch too xD also what front-end are you using?
Yes I know, thats what I was referring to when saying "hitting a userinfo endpoint"
I am using react
I plan on using a state library like zustand or something
There should be state stuff in react that you could look for it's a very old framework
Yea but its not as good as an external lib
zustand gives me more features to work with that'd be more beneficial
yes I know of it
but thats component specific and its harder to saturate that amongst numerous components
so a state library is better since it makes it easier to access state anywhere
This one seems to be more global https://react.dev/reference/react/useContext
Right but this still doesnt solve what I perceive is the root problem
Keeping the userinfo up to date on the frontend.
How important is it to keep the userinfo?
You could just set a background timer every 15s to update or just refetch the userinfo when doing crucial tasks.
Either that or you switch your front-end to a server side rendered app
I guess its not super important
The only real thing I would need is their user ID which I know will never change, everything else is just info like their name, email and roles they have
I can fetch it again in cases I need to check if they have permission to do something in case they did get a new role added to em
I know their name and email will almost never change in my use case
Well you would need to check permissions server-side anyway so that's not a good point xD
Well yea
honestly I dont think I will ever need to refetch user info
Thinking more about it
None of it is important to the frontend except their ID
Should I keep track of their access token in state as well or nah?
That's already in the cookie?
hm fair
Or jwt whatever way you do it
I was only asking because the frontend would need a way to authenticate it but I guess that wont matter since the Identity library does that already iirc
Yea oauth stuff should just redirect the front-end to auth on the backend
π
Best case is you shouldn't really trust the front-end for user/security stuff because it can be manipulated or browser console changed
Np i'm not the best with web either but i'm doing a server-side blazor app
Yea once it comes to front end Iβm a fish out of water
You could take some ideas from this and implement 2FA stuff π
Luckily my auth server handles all that
I just need to make api calls and it does the rest
Ah you doing a self hosted auth like keycloak/authentik or just standard oauth stuff with google/discord
Iβm using a self hosted auth server
Itβs called zitadel
It handles different forms of auth between multiple providers or can be used as a local auth provider with email and password
Or a combination of both
Itβs rather neat
@quartz kindle I think its now possible to write a discord bot in my language
fn handleconn(connection) {
let data = tcp#readstr(connection)
let head = array#get(string#split(data, "\n"), 0)
let parts = string#split(head, " ")
array#pop(parts)
let method = array#get(parts, 0)
let path = ""
let i = 1
loop {
let part = array#get(parts, i)
if not (part) {
break
}
path = string#concat(path, part)
i++
}
io#println(method)
io#println(path)
tcp#write(connection, "HTTP/1.0 200 OK\n")
tcp#write(connection, "sus: ok\n")
tcp#write(connection, "\r\n")
tcp#write(connection, "Hi sir, from bad-lang\n")
}
loop {
let connection = tcp#getconn(listener)
thread#launch(handleconn, connection)
}```
tcp streams work now
some perf fixes later
nice
why is the slowest 16 seconds lmao
xD
variable lookups are still very expensive
you're using rust right?
yes
nice
Wow, it only took forever.
https://nextjs.org/blog/next-15-2#nodejs-middleware-experimental
15.2 was a really good update
the error page updates are ugly af though π
what?!?! I love the new error pages
this is very funny however
Hello, I had asked the same question in 2024 and now I would like to ask it again in 2025, do you think even skilled programmers will lose their jobs due to the rise of AI technology?
Well, my opinion at this point is that it possibly can replace people who've chosen computer science just because they thought they would make much money for free and are not willing ti stay updated against any updates in the field/industry
not really, AI has a major flaw when it comes to anything: it cannot create
besides, non-programmers rarely can explain exactly what they want, AI would have a hard time figuring out
You got such a good point, you still need to know how to program in order to provide the AI service decent prompts
yep, there's even a comic for that
Aw lol
AI can replace people the day that clients know how to describe exactly what they want
Aka never
Not to mention that AI inbreeding is going to fuck over the quality of LLMs soon enough
lmao
Companies that are replacing juniors with AI will find themselves in deep shit 5 years down the road when they aren't creating senior developers that actually do a good chunk of work
The breeding of trying to produce them faster and trying to make them magically "better" besides?
for (let i = 0; i < messages.length; i++) {
add_to_training_set(predict(messages[i]));
}
LLMs are just predicting the next token in a sequence of tokens. Their quality is based almost entirely on the data they are trained on. Without good training data, you get poor output.
basically they are chewing pre-chewed content
When you have a bunch of these "AI developers" making shit and training the newer LLMs, it starts to hurt their quality because the AI developers make terrible quality code which gets fed to the training data of the newer LLMs
You reduce your "genetic diversity" so to speak, just like inbreeding irl
AI is training on AI generated content
i want to see some more research and tests in this area, how much is the quality of LLMs impacted by generating & adding predictions back into the training set, also across different models
so do you think in some time we'll see ai's having to be completely retrained on new data like they were once trained? to get rid of this
technically if you raise the temperature and adjust the token prediction algorithm you can come up with completely new sentences not seen in the training set
I think that more people are going to have to work on knowing what code is good and what code is bad to feed to LLMs for them to produce better quality responses... aka software engineers...
Besides that, it sounds way too utopic to have AI handling everything
so like approve and decline but for code feeding llms lmao
yes, and you get the cordless phone effect
Not to mention that these models are fundamentally flawed; they don't "think". Even the reasoning models aren't "thinking", there is just some clever tricks used to make it appear that way
Yes well, it is that most people don't know what a LLM is
where they start making stuff up leading to incorrect or straight up unrelated answers
im not sure your use of terminology had the intended effect π
maybe from the so called cordless phone effect you mentioned
I meant the kid game where you gather everyone in a row and one side whisper a phrase to the next, propagating till the last player
telephone game lmaoooo
usually the message will be completely unrelated to the original
i think they usually call it chinese whispers
just "telephone" too apparently
here we call it "telefone sem fio"
gamer as fuuuuuck
the middleware update might be useful to you too.
We call it "deaf telephone" 
finally node.js runtime in middleware π
Helps with nextauth
I'm confused on what that adds to next.js middleware
you being able to use nextjs middleware on nodejs
and not just when using vercel.com
question, if i want to quickly check if a channel id matches another id. Would i rather use a json file to match it or a query on my postgres?
the question would be which one is faster
would use some KV for smth like that
is there a date limit to how far you can read messages in a channel in a bot?
as in be able to get the messages for an entire channel
planning to export a channels messages which i use for notes offline
huh?
What do you mean by this
the rule is that ids within a specific domain cannot overlap, but they aren't unique globally
so 2 channels cant have the same id, nor 2 guilds, but those channels can share the same id as the guilds
i am sorry for the confusion
i have a forum in my server and this forum has posts. Now i have a bot that creates posts and it only grants access to certain people.
My question would be which way would be the best and fastest way to store an id and compare it with the channel id. That way i can delete messages of users that aren't allowed to post in that forum post
I'm doing all of this because discord doesn't give you a way to limit permissions on forum posts
Whatever method you have for storing the user IDs, your bot would have to run the sender's ID through the list, and if it's not on the list then it would just autodelete. You can't directly compare User IDs to Channel IDs.
I'd say we'd need to know how you determine if users are allowed to post. Is it a role? Some form of acknowledgement with your bot?
If it's something like a ticket system or something where it's your bot's mechanisms that decides who can use it, I'd have two tables in pg. One that describes necessary info on the forum post channel and then another table to describe who has access to it.
If you only need to store user ID and channel ID, you can have just 1 table and then create an index in that table off of channel IDs. No pkey.
For instance, the table could just have two columns which is the user ID and channel ID. Then you
SELECT user_id FROM posts WHERE channel_id = $1 and since the channel ID is the indexed column, it'll be stupid fast to return all of the users who have access to channel_id.
If you do need more info wherein you'd need 2 tables, your query might look more like
SELECT post_access.user_id FROM posts INNER JOIN post_access ON posts.channel_id = post_access.channel_id WHERE channel_id = $1
In this case, you should index channel_id on post_access and pkey channel_id on posts or however else you wanna pkey it
Assembly 'Mercatus.Database' with identity 'Mercatus.Database, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' uses 'Microsoft.EntityFrameworkCore, Version=9.0.2.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' which has a higher version than referenced assembly 'Microsoft.EntityFrameworkCore' with identity 'Microsoft.EntityFrameworkCore, Version=9.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'
What the fuck does this mean. No where am I using EFCore 9.0.0.0
Unless its a dependancy issue where one of my deps is using it
Its what I thought it was
well thats fucking annoying since the latest package only uses 9.0.1
and all my other EFCore packages use 9.0.2
Downgrading everything to get it to work is too much of a hassle
Fixed it, luckily only had to downgrade Design and Tools and it did all the other deps itself
Portainer vs my project, it actually looks pretty nice now
I sent my bot for verification... but it didn't appear in the logs, and a few days have already passed... what should I do?
You've to be patience until bot gets verified
I know, what made me curious is that last time there were logs, but this time there aren't.
sorry, am new to entire platform i just gone through docs of topgg about review and other stuff's.
Anyone know of any (working) embedded-able embed visualizers? preferably for TS/NPM
ping if reply
I mean, I read several docs, and I didn't understand anything
who can help me add bots to my discord server
bruh
a
b
c
d
e
f
z
-warn @zinc fable
Is there any place that can guide me on integrating votes with my bot's system? (Such as rewards, for example.)
You'll want to use webhooks.
https://docs.top.gg/docs/Resources/webhooks
Webhook integration for receiving vote data
Exactly what I was looking for, thank you!
broskis. i am working at my very first react project and for days i wasnt able to build. i've tried literally everything and even bought 20$ cursor subscription. i've head problems with nextjs's metadata and always problems with the favicon.ico
claude 3.5 and 3.7 looped into a fix hole, until i realized bruh, i have 2 favicons.ico, renamed the wrong one and vuala
dunno if i wanna cry or hug the world lol
welcome to AI
ai is very clutch but you cant trust it to do anything significant for you without handholding
is the intel cpu hetzner has that bad to the point where the amd variant costs more with less ram lol
its a xeon gold, but idk model
the amds are epyc 7002
im a bit torn between the x86 and arm variant, i heard the arm machines are much faster on hetzner
but some of the projects i want to have on there have libraries that may not work well with arm64
i'll try compile them for arm and see how that goes because ill get much more out of the server if i go with arm
run some benchmarks
im on the epyc one rn
the CPX11
it looks good but im quite a bit pissed about half the ram
afaik the other one used to be the same ram
did they increase it recently?
i remember 4gb ram being 7+ bucks not 4
this is all i see atm
or i can go balls to the walls with the more expensive AMD plan
yeah not a good start trying to compile one of my main rust projects for arm
probably because its trying to link my X86 libraries
I mean, by given errors, no other react dev was able to fix it so these were my only options
