#development
1 messages · Page 195 of 1
I wish my bot could be webhook only

too much work
maintaining a library all the time bc discord keeps changing the api and adding new things alongside a bot
it could be worthwhile if you open sourced it
I don't like discordjs but wouldn't feel its bad enough to make a completely new library expecially now that they added more fine tuned cache control
you dont need to make any changes if you dont invent wrappers for everything discord has
yeah but what about new features and updates to existing ones that you wanna use
and you'd need them to be implemented well as well if you're considering production use
feel it's a mess
I don't use djs or do discord anymore so I don't know what the js discord ecosystem is lacking
discordjs pretty much has the beginner side well covered so what's really left is serious use for big bots
id imagine some bot devs are also fed up with djs's constant breaking changes so a stable and standardised api for a new library would already be a big plus for big bot devs
in my case, i literally dont need to do anything
whatever new thing discord does, i can literally add to the bot code without touching the lib
dont make wrappers, use the discord api directly
what do you mean by wrappers exactly
you mean code on top that abstracts the raw api calls?
ye
like why make a function to fetch members if you can make an api call to fetch members
you can abstract the api call, but you dont need to abstract the entire functionality of the api call
the problem with discord.js and similar libs is that they abstracted everything
anything you wanna do, you need to do it the lib way
so just stop adding these middlemen abstractions to the lib and allow the user to do it the discord api way
Google Cloud Platform lets you build, deploy, and scale applications, websites, and services on the same infrastructure as Google.
ok here
async function startGame() {
const shuffledChannelIds = shuffleArray([...eggChannelIds]);
let winner = null;
let eggsFound = 0;
let eggFoundMessages = new Set(); // Set to store message IDs containing the egg emoji
thx
to store the egg emojis in the array
and ```js
try {
for (const channelId of shuffledChannelIds) {
const channel = interaction.guild.channels.cache.get(channelId);
if (!channel.isText()) continue;
const messages = await channel.messages.fetch();
const eggMessages = messages.filter(msg => eggFoundMessages.has(msg.id)); // Filter messages using Set
await Promise.all(eggMessages.map(msg => msg.delete()));
}
} catch (error) {
console.error('An error occurred while deleting egg emojis:', error);
}
What’s the problem
to delete them after the game, right?
it isn't deleting the egg emojis from the channels afterwards
Is it erroring?
Also be careful calling fetch in a for loop
It can be api spammy
It’ll by default check cache which messages typically are always cached
do i need to do this?
no
But in cases where you’re fetching stuff that isn’t guaranteed to cached doing so in a for loop is ill advised
okay so
Also calling map just turns it into a new array
crazy amount of arrows on the chat
So doing eggMessages.map(msg => msg.delete()) makes no sense
ow ok
thats not what i told you to do btw
show how you store the messages in the Set
ok 1 sec
the idea is not to use the message ids to filter messages, the idea is to use stored messages to completely replace the fetch(), because fetching messages is expensive and not needed
// Store the message ID in the set
eggFoundMessages.add(reply.id);
and how did you define reply
wait hold on
if i go to that i see this
yes, you need to register a payment method
let eggFoundMessages = new Set(); // Set to store message IDs containing the egg emoji
i dont have that
then you cant do it
but it was free
its free yes, but you still need to register a payment method
because if you go over the free limits, they will charge
used to store message ID's with the egg emoji right?
i asked about how you defined reply
do you know an other way or site? @quartz kindle
like my definition on how I understand it? isn't it the first response to an action in the code?
or how did i define it in the code?
literally the line that made the variable lol
OH lol my bad 😂
no, a VPS is like renting someone else's computer, nobody will allow you to do that if they dont know who you are or how to charge you if you do something wrong
you will either need to run the bot in your own computer, or ask for help from your family or parents if they let you use a card to register, explain to them that is only for registration and that its not gonna be charged anything
and its for education and training for future job
honestly man idk, i may be trying to do more than i can handle 😂
depending on where you live tho, you might find VPS offers that accept other types of payments, for example paypal or bank transfer
so basically, you can simply store the message itself, not just the id
eggFoundMessages.add(reply);
and then you dont need this at all
for (const channelId of shuffledChannelIds) {
const channel = interaction.guild.channels.cache.get(channelId);
if (!channel.isText()) continue;
const messages = await channel.messages.fetch();
const eggMessages = messages.filter(msg => eggFoundMessages.has(msg.id)); // Filter messages using Set
await Promise.all(eggMessages.map(msg => msg.delete()));
}
you can delete all of that
and simply do ```js
eggFoundMessages.forEach(msg => msg.delete().catch(() => { /* do nothing */ }));
ok let me update this
ok so i get an error
saying that eggFoundmessages.map is not a function
says it's a set, not an array
and doesn't have a map
Sets dont have a map function
thats why i used a forEach in my example
if you want a map function dont use Sets, use arrays
if (winner) {
try {
eggFoundMessages.forEach(msg => msg.delete().catch(() => { /* do nothing */ }));
} catch (error) {
console.error('An error occurred while deleting egg emojis:', error);
}
like this?
you dont need the try catch anymore
use the .catch instead
eggFoundMessages.forEach(msg => msg.delete().catch((error) => {
console.error('An error occurred while deleting egg emojis:', error);
}));
if you want error logging for those
keep in mind that it will check for errors on each individual deletion
so your logs will be spammed if many of them error out
i usually dont add error logs to message deletes because the most common error is it was already deleted by mods/admins/other bots, so its not really a real error
and on amazon? @quartz kindle
ok updating now!
i like adding the logs because i’m so new and it kinda help me figure out where to look for the problem
can i buy a small pc that only have the things i need for driving that bot?
you can, but can you sustain the maintenance?
also you'll have to ask your ISP for a fixed ip, which some providers charge extra for
ok tim, need to ask your help regarding browser shenanigans
my game runs pretty fine on chrome, but has a hard fps drop on edge
for some people it's the opposite
on mobile it's neither
is there any metrics or debug tools or anything to find out what might be the matter?
amazon also requires credit card
yes, many people run their bots on a small home server, like a raspberry pi or similar mini pcs
what does the game run on?
webgl?
first thing that comes to mind is hardware acceleration and gpu status
what would you choose?
i have a credit card, i pay for a vps
hatred and lost dreams
but yes, webgl which is what godot compiles to
well that explains things
before i had a credit card, i had a small laptop i would leave on 24/7
after that a friend offered me to use his vps
then i got a debit card and i used google compute engine
a lot of people have hwa disabled in their browsers
because surprisingly, it can cause a lot of bugs
from scroll lag to stuttering and increased battery usage
I suppose discord activities uses the same settings as discord itself right?
ive even seen youtube completely broken with hardware acceleration lol
in which case if hw accel is enable the activities' browser will be too
no idea, do they run in a browser or in the discord app?
in the app, like an iframe of sorts
I didn't test the game on it yet, just asking
not sure how stuff like elecron works regarding hwa
apparently it has its own settings which can be exposed to the user if the author wishes to
so idk what discord set in their app
@quartz kindle is there nothing else free out of my house where i can drive a small dc bot for free witout a credit card?
there used to be glitch.com, repl.it and heroku, but i dont know if bots still work on them
i think they all changed how their systems work so that bots will no longer work
Heroku is no longer free, unfortunately
also, there are a lot of "free discord bot hosting" on the internet, but they are very limited and i dont know if they are safe
only repl.it out of those 3 is still available
glitch will kill your bot the moment it finds out
last time i checked my replit account it asked for a paid plan in order to deploy
it seems it now only runs while you have it open
eh, then they jumped off the "we have free bot hosting" stance like glitch
Always On will be fully removed from the product on January 1st, 2024. After January 1st, Deployments will be the only way to host applications on Replit. For most users, Autoscale & Static deployments will be less than 20 cents per month or included in the Hacker & Pro plans. Static deployments will be free as long as you are within your egres...
i honestly dont see anyone serious using these host platforms like glitch/repl
youd usually have the hardware to do it on your own machine
i only see amateur and hobbyist projects on them and those users are mostly there bc its free
if you take away the free im not sure how many users that leaves them
glitch basically died the moment they took away uptime robot and long lived projects
the forum used to be extremely active now its completely dead
and now glitch sold themselves to some company called fastly and focused on cutting costs so that says a few things
Ain't fastly some CDN company or am I tweaking
but at the same time you have to ask yourself, were they actually making money when they had super popular free services? or were they taking losses from it?
thats what im curious on too
how tf did glitch make money
they did say how but not sure i 100% believe it
unless they were backed by some other company they had no business model
which leaves me to believe they either lost money all the time or resorted to shady things like selling data
a possible explanation could be that they were a startup project and were given funding without the necessary stress of having to cover costs yet
theres not much they could be selling other than shit code as it is
they did a poor job of moving it to become monetized in my opinion
multiple people expressed interest in paying for some sort of premium plan before they even had one, when premium plans came out you could only pay by card and not things like paypal which i saw was complained about a lot (i think thats still the case), their premium tier was quite expensive for what it offered and you got more bang by staying free than going premium
the whole idea of going free for a while to gain popularity is very tricky
one one side it works very well, on another side it eventually backfires pretty well too
wouldnt be surprised if glitch gets shut down eventually
they dont really share how many clients they have paying
but given inactivity on the forum i cant imagine its many people
repl.it has a decent paid user base as far as i know
theyve had paid tiers since forever i think
is it possible to parse something like "4 PM ET" and "Monday | April 1" to 04/01/2024 4:00 PM ET as a date
back in the days we used dyndns
also you dont need a static ip for discord bots
only if you use webhook interactions
i still see routers today with built in support for dyndns lul
of course, they were manufactured in like 2010
its amazing how many routers being sold today are actually old af
now i’m about to call spectrum and cuss them out
most routers are incredibly overengineered as it is
they have entire linux installs running on them
powerful enough to run reasonable stuff
i went through the firmware of one of them once for training and theyre basically entire computers
i would opt in to something more embedded and save costs on hardware if it was me
*this one in particular ran an entire apache2 instance for its control panel
if i have something like "Monday, April 1, 2024 4 PM ET" is there a way to convert that to unix time?
or just a date
you mean bloated
most routers are bloated af
hard to find a word for it really
overcapable maybe
bloated too ig
my electricity is not going to good use
if your language has a date parsing function, try using it, otherwise its hard to find something better
would Date.parse work (js)
in js the ms lib actually does a decent job, but its pretty much hit or miss
javascript said no
it would probably need to be formatted
Date does have parsing capabilities, but only for limited formats
does ms have good parsing
specifically for smth like Monday, April 1, 2024 4 PM ET
if is that specific, youre better off writing your own
for your specific format youd probably need to write your own parser or use one that lets you specify your dates structure
i mean the format could be flexible
or use an LLM to transform your date to something js date can understand
i get the following from user options:
Monday | April 1
4 PM ET
the 2024 would just come from currentyear
ngl thats actually a good job for ai
sorry to keep bothering you @quartz kindle but can you take 1 more look at this and give me some feedback 😭 i promise i’ll leave you alone after this
dont make promises you cant keep
looks good
damn you right, i really can’t promise that 💀
so this should delete all messages with the 🥚 emoji after the game?
i did in the code 💀💀💀💀💀
your promise saying to leave tim alone is this
new Promise((resolve, reject) => {
reject("lol no");
});
💀
his bot’s gonna be working off an event to detect me saying his name and it’ll reply “fuck off mo.”
unfortunately my bot is not on this server
no one said you cant make a user bot
i don't think bots can even send messages here
{ message: 'Missing Permissions', code: 50013 }
nop
it could probably read and dm though
does anyone know if having my site in "under attack" mod on cloudflare would detriment apps' abiltiies to get the meta propertis?
I had it on, and my url would just not embed. removed it, and it is embedded.
which (for obvious reasons) leads me to believe it does have an impact.
if so, is there a rule i can add to the configuration to prevent that?
im not actually sure how cloudflare handles api http requests when on under attack mode
im more inclined to say it shouldnt
but you should test it yourself
but its a difficult problem because to get your sites meta props it needs to send a request and get your websites html
if anything else can do that why cant an attacker do the same?
so what’s the difference between an array and a set? and when should i use which?
except many times per second
depends on what you need it for, i believe sets cannot have duplicate elements while an array can
i think sets are best used when you have a bunch of unique values and need to know if they exist somewhere without attaching any data to it
arrays for everything else
i was creating an egg hunt game that hides eggs in random channels, members find the egg, reply to it with an egg emoji, get the points and it’ll hide more eggs around the server until the required number of points have been reached - to which then the bot will announce the winner and delete all the messages that contain the egg emoji after the game ends
it was suggested to have the bot store the egg messages in an array to be deleted immediately after the game
you can use whatever you want, objects, arrays, sets, maps, etc
depends on how you want to access the elements
use the best tool for the job
idk yet lol
Each storage medium has its use cases
when i tap the start button, it send this message and the command functions without errors but i still get “interaction failed”
would it make more sense to make this a interaction reply?
because i’m guessing the interactions isn’t being acknowledged within the 3 secs?
all commands need to have at least one reply
if the command is fast, use reply asap
if the command is slow or does something that takes a while, defer it first, then do the job, then reply
ahhhh ok i see what you’re saying
i thought that would be considered as an acknowledgement if the interaction
& is there a way to get it to delete the bots egg messages too?
i literally showed you how to do it
more than once
people with administrator bypass these discord-based command overrides, right?
it worked with administrator
but not sure if thats the only perms that can bypass it
id assume so following the logic of channel perms
also - can bots set these permissions by themselves? nvm, they can
Hey guys on the right i got sum extra space left. What can i put there? I actually wanted to put a nice animation, image or sumthing. My overall bot(s) are space themed.
honestly
i would extend the middle area to the right
3-column designs are kinda oldschool, i dont like them too much
but
you could always put ads there and make money
:^)
hmm i see. The ads though 
aboutta chase the bag
ended up filling it with a random ahh chart
fake it till you make it, 100% fake statistics 
lmao
I think that this is my final outcome
Bad
Don’t put something fake there if it’s an important page
It’s not important at all, and I was just joking. For now they are just placeholders, but once my backend is completed I will load the real data in
I am so confused right now
window.onload = () => {
const element = document.getElementById("term-user-input");
console.log(element.innerText);
console.log(element.innerText.startsWith('> '));
}
<div id="term-6" class="terminal-command">
<div class="term-input" id="term-user-input" contenteditable="true">
>
<span class="terminal-caret" contenteditable="false"> </span>
</div>
</div>
Why on earth does element.innerText.startsWith('> '); return false??
I copy pasted the character that gets logged into my editor to make sure it wasn't some sort of weird unicode character, but it's just a regular space
try [...element.innerText].map(x => x.codePointAt())
and see what it logs
my guess is that element.innerText is >\n?
element.innerText.startsWith(>${String.fromCodePoint(160)}) works instead
thanks null
I hate js
or \xa0

though i recommend the regex alternative
chinese
hey guys, anyone knows why this command stopped showing after making it guild only
@commands.hybrid_command(
name="update",
description="This command is used to send update embeds.",)
@app_commands.guilds(discord.Object(id=guildid))
like after adding this part: @app_commands.guilds(discord.Object(id=guildid)) it stopped showing even in the private guild itself.
guys im tryna make my bot work for user apps, i dont really know how they work but like how do i deploy the commands to the user? I authorize it but idk where they should appear, im guessing everywhere right? Unfortunately they dont so can some1 help plz
25 days of waiting for Discord's response but it was worth it, one polish bot advertising all kinds of shops selling accounts and various other morally questionable things less 😊
since when did discord tell you the outcome of a report
I have no idea, but the report's result is visible to the naked eye
Only recently they started doing it. Like within the last month
@quartz kindle on reddit people are getting mad at rossman because he uses the word "rape" to describe what companies do to us
it is the stupidest thing ive ever seen
its worrying people are getting more mad over the choice of words rather than the slow violation of rights that is happening
put a spaceship there. it starts at the bottom and goes to the top as you scroll. kinda like a scrollbar
let message = await member2.send({
embeds: [botInfoEmbed],
components: [action],
});
const collector = message.createMessageComponentCollector({
componentType: ComponentType.Button,
max: 1,
});
does this work on dms? Cuz it ain't working for me, i get the TypeError TypeError: Cannot read properties of null (reading 'id'
strangely it is coming from that js componentType: ComponentType.Button,
line..
@radiant kraken turns out it was a browser issue all along
Tim was correct, browsers don't use gpu by default
So I had to optimize the hell put of it lul, doesn't lag as much now
hello
oh for fucks sake
Since the error isn't coming from the code block you shared, have you checked the djs source to see what the issue possibly could be?
On a note usually nobody takes seriously because it would be a lot of refactoring, consider not using a monolithic library like djs. It's a trap
Or libs that introduce too many layers of abstraction
can you show the full error?
yes move to cloudstorm or tiniydiscord xddd
smh
legit
yeah, i've used tiny-discord before switching languages
Im actually being so fr. I prefer it this way than djs
tim is the goat
i'm using twilight for gateway and tonk's crate for webhook
i wish there's something better for gateway. twilight seems a bit too modular for me. i just need a simple gateway implementation (without having to bother with sharding or reconnects)
Perhaps getting paid would change that
why not use serenity?
dont they have feature flags or something
hmm, never rlly checked
perchance
chief optimizer of the v8 engine
rewrite v8 in rust
v8 is written in a relatively memory safe style so i doubt thatd be a big improvement
and theyve already kinda did that with deno
now we have bun
i wish they gave it a better name because i cannot in good faith answer "i wrote my program in BUN"
sorry in good @sage bobcat
One message removed from a suspended account.
One message removed from a suspended account.
bun is actually slower for me
(the runtime, the package manager is fine)
bun is cooked
it was supposed to be much faster
and i think it is if you use their built in way of doing things like http servers
Because the "benchmarks" bun did in their showcasing of it were biased af and never modeled real world situations
bun focused on "startup performance", and then marketed it as runtime performance
sure, it runs faster than node, at starting up amd shutting down, only that lol
It is also the built-in web server of Bun even though µWebSockets.js for Node.js runs 80% faster than Bun.
idk what they did
lmao indeed
but it sounds bad
👀 so, what cases would bun be better?
Creating/deleting workers or something?
convenience
spinning up instances
like cf workers
run on demand
even then difference is probably gonna be negligible
is that using buns special http servers?
So, realistically not much benefit
👀
The handful of times I've used bun I really didn't notice much experience benefits.
It just was quicker to get started
I mean
it depends on what you do
personally being able to use cjs / esm in the same file without weird workarounds is a life saver sometimes
or just being able to bun run blabla.ts
no tsnode or others needed
it just works
(sitll will use node tho)
The only time I've really noticed this is libraries that dont support one or the other.
But it does help for sure.
i hate when people come up with these new frameworks that provide basically no benefit to existing solutions
absolute waste of contributors time
at least deno adds on a lot to nodejs like typescript support, more web apis, etc
better package manager too
this also applies to people that rewrite existing projects in rust "just because"
even though its been already written in a good enough performance language
No clue honestly but they did just have an update release recently https://www.youtube.com/watch?v=yXTFOeGly9o&pp=ygUDYnVu
Bun 1.1 adds Windows support! Bun is a fast JavaScript runtime, package manager, test runner, and bundler all-in-one. JavaScript is complicated. Bun exists to make JavaScript simpler.
idk if im hallucinating but it seems to cache code or something
like
I update a file
and it does NOT do what the file says
like the array isnt being pushed to
but when I push while adding some random comments it sometimes works
it works fine in node
funnily enough this code they have here looks like its vulnerable to injecting shell code if response can be controlled by an attacker
#remotecodeexecution
so im not convinced this would be fully safe to run
would wanna try it myself
shell commands arent like sql where you can use templates and have values be handled separate from the actual query ofc
would i get an icon hash from the guild object if there is no icon? some of my user's guilds have icon hashes saved, but there is no image stored in discord's cdn for the hash. i tried all image extensions
https://discord.com/developers/docs/resources/guild#guild-object
https://discord.com/developers/docs/reference#image-formatting-cdn-endpoints
exactly like that
Yes I can read I just do not understand how this is possible
do you notice that there are no ()
Yea
Idk what that even is
just a function that is called with a template string
why not indeed
you can also do js const ts = (...d) => console.log(...d)
🎉
i love making unnecessary code 
ˆhow does this even work
😭
I am confused on what js is actually doing here
d is an array of anything passed through
right
not an array
but like
wait yeah an array
then ... spreads the array of whatever you call it
but how does using a template string instead of a normal function call result in this behavior
myheads not working
what is js doing to make it result this way
tbh idk
me and js are in a "if it works it works" relationship
i wish. volty was still here
they're called tagged templates
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals#tagged_templates
it was introduced in ES6
I think I should go to sleep
There’s no public information on that from what I’ve seen and you’d have to find that out yourself by looking at the response headers
Though if anyone knows it off the top of their heads then props to them
not a good idea hard coding it anyways since they can change it at any time
think thats their reason for not publicly stating rate limits
they want you to use ratelimit headers to know when to back off
but doesnt take into account global ratelimits however
Rate limit specific routes don’t conform to global rate limits iirc
this is cursed, i love that
wtf
ghellooo, does anyone here have some suggestions on fixing how the dashboard looks?
idk it seems... ugly for some reason but i can't place it
shift these icons more to the right
aligning it with the line
say less
If anyone is willing to take a look at this, I would appreciate it!
I've created an unscramble game. Been working on it for 2 days now lmao, and I got everything working perfectly. Lobby, buttons, game function, it's all working.
The only issue is when I start another game, it displays the letters of the previous game instead of only the new game.
Any help would be so greatly appreciated.
I am new to this and learning something new everyday so the code may be a little sloppy..
this is discord.js v13 by the way
Maybe try keep the third row cards all the same height it might make a little difference
Information overload. Spread out your info
Look into content hierarchy
Everything feels equally important
Chart has no dimensions idk what they mean
so i’ve boiled the issue down to the handling of the start button.. i think
Kinda feels like your dashboard is your landing page for new users
I haven't read all of this since it's a big snippet, but why is ```js
function unscrambleWord(word) {
// Placeholder for actual unscrambling logic
return word.split('').sort(() => Math.random() - 0.5).join('');
}
This doesn't make much sense
Or perhaps your functions are named poorly and you meant this to be scrambleWord
chat gpt set a few parts of this up if i’m being honest
i just feel like the game is not actually ending
i run the command once, it works great, then i run it again and get a error that the join button has been acknowledged already
it’s like it doesn’t reset after the first game
please dont turn into noob
i know 😭😭
it’s taking me a while to learn this stuff lol i thought it would help a little 😭
sort() predicate needs to return a number, and Math.random() returns a random number/float between 0 and 1
I know what it does, but the function name isn't correct
This scrambles the word, not unscrambles it
it will unscramble a word technically
just not very often
💀
andi get this error with the secondtime i use the command
DiscordAPIError: Interaction has already been acknowledged.
at RequestHandler.execute (C:\Users\Maurice\Desktop\Da-High-Roller-Bot-main\node_modules\discord.js\src\rest\RequestHandler.js:350:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async RequestHandler.push (C:\Users\Maurice\Desktop\Da-High-Roller-Bot-main\node_modules\discord.js\src\rest\RequestHandler.js:51:14)
at async ButtonInteraction.reply (C:\Users\Maurice\Desktop\Da-High-Roller-Bot-main\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:103:5) {
method: 'post',
path: '/interactions/1226838581797195797/aW50ZXJhY3Rpb246MTIyNjgzODU4MTc5NzE5NTc5NzpQa0drVGt5bGowYlA2S0F2emJiNk1TQ0pISEpNQ09Xc2U5dmV3VFZkRThIMm03TG1mMXlQV05XbVdGN3Z0NmNGb0tMc2x2UHNYR28wdnZOMlNuZ0NoOVZkeVFYYm9CY0lOZmdQOTZOZnk2N2NBeTloWm5EZG45MHhib3g2TmRXTA/callback',
code: 40060,
httpStatus: 400,
requestData: { json: { type: 4, data: [Object] }, files: [] }
Thank you so much
Definitely changing the things around and i already like it more than before
I can't lie, designing is like really hard. I love the coding part etc, but i am just not a very creative person. When working as a real web developer for a company, you usually get all the designs already right? Or do the expect you to be a web developer as well as a designer?
missing "narutimate ninja plan"
depends how big is the company
if they can afford separate designers and coders, sure
if not, you do everything
overworked one-man army superstar employee for a startup company
earning minimum wage
:^)
yeah fuck this whole coding journey. Good that i chose a double bachelor being software developer and data science instead of just software 😭
it doesnt matter, youll still be asked to fix tje printer
:^)
😭
Nahhh in data science i will do data sciency stuff such as data mining and.. sorting.. big data.
Annddd
i get to lie and people will believe me
xD
exactly what i am doing as well hhahah
you can choose a certain path to follow as well right?
im stealing wifi from my neighbours because i have no internet at home for 3 days now... still waitig for shitty isp to come fix
Wish I was professionally taught cpp
study all the things only to become a comedy writer
Many self taught programmers, again not everyone, but a reasonable amount don't really use the coding conventions. I also really think that taking cs at university programs your mind in the way you are thinking. But that's my opinion
I cannot get into cpp because getting started seems very hard from the tutorials I've read/watched. Maybe I didn't look deep enough or misunderstood something, but I gave up after that because I'm lazy af
I alr know other languages I can perfectly work in
Unity cs is fun
we got cpp in the first year for imperative programming. It's pretty fun tbh
or you go to school/uni and be taught all the outdated code conventions and be stuck designing amd coding 90s stuff
Java web applets
damn java is my bb girl
jabba
nah fuck allat, i would simply win
I have depression every time I have to do java work
actually I just have that all the time nvm
i have depression whenever i need to code haskell
you know whats funny, i made the first version of my api like 4 years ago, and i was like, ok im gonna redesign this from ground up and make it much simpler and better.
today the new version is 10x larger and overcomplicated
and still not done
i understand that, i kinda feel the same way
right now i am around half-proficient in C++ but i still find 90% of its documentation overly technical and complicated
C++ is probably the most overly technical programming language
C++ would be great if they could revamp it in modern day standards
It’s just very urban-sprawly
Same
wrap it into a function for simplicity

Wild that functionality ain't provided out of the box
await require("timers/promises").setTimeout(1000);
I just use my own libraries in all my projects that include all the utils ill ever need
👍
<div class="row">
<div class="col-lg-6 mb-4">
<div class = " d-flex flex-row" style = "border-radius: 15px; box-shadow: 0px 0px 15px rgba(0,0,0,0.3)">
<div style="border-top-left-radius: 15px; border-bottom-left-radius: 15px; border:none; background-image:url('./192-ai-3.png')" class="card">
<div class="container-fluid w-100 d-flex flex-row">
</div>
</div>
<div class="w-100 d-flex flex-row">
<div class="card-body p-3">
<div class="numbers mb-4">
<p class="text-dark mb-2 text-sm text-capitalize font-weight-bold">Your Metrics</p>
<canvas id="chart"></canvas>
</div>
<div style="height: 2px; background-color:#E60E8D" class="w-100 container-fluid"></div>
</div>
</div>
</div>
</div>
</div>```
can someone tell me how i can move this piece to the top?
I want it to fit, but i use a grid bootstrap system..
you mean fit in that empty slot below the first 2 white cards?
if so, you cant, that's not the correct layout for the task
use flex layout
so not grid layout?
grids work strictly with rows and columns
shi
rows cannot be crooked, as you imagine
neither can columns
you need a layout that doesnt use them, so flex layout
i was able to do it in the end by using negative margins
dont recommend it
it'll invade other elements' space if they have their size changed
and it'll not be responsive, which goes against bootstrap's purpose
Hey there! I'm the admin of a Discord server. I added it to Top.gg in order to be able to bump the server. However, I get a notification saying that the server has been discontinued. That happens when I click on the "edit" button from the server, on my profile tab. When I click on "view" I get redirected to a 404 error page". I would like to know what caused this problem and how I can get if fixed. Thank you!
-servers
@late oak
Servers have been removed as they were getting harder to moderate. For more info, please read: #announcements message
i tried doing npm start which i normally do to start the server but it didnt do anything
then i tried npm install but nothing happens
none of the npm commands are working
no errors, doesnt exit program
Apparently restarting the computer fixed it..
is it windows?
hi
Yeah
can someone quickly help me?
Why are many servers the bot is in throwing this error?
File "C:\Users\ASUS\AppData\Local\Programs\Python\Python310\lib\site-packages\disnake\ext\commands\core.py", line 173, in wrapped
ret = await coro(*args, **kwargs)
File "c:\Users\ASUS\OneDrive\Desktop\jjkb\cogs\utility.py", line 426, in help
await ctx.reply(embed=embed, allowed_mentions=disnake.AllowedMentions.none(), view=view)
File "C:\Users\ASUS\AppData\Local\Programs\Python\Python310\lib\site-packages\disnake\ext\commands\context.py", line 377, in reply
return await self.message.reply(content, **kwargs)
File "C:\Users\ASUS\AppData\Local\Programs\Python\Python310\lib\site-packages\disnake\message.py", line 1997, in reply
return await self.channel.send(content, reference=reference, **kwargs)
File "C:\Users\ASUS\AppData\Local\Programs\Python\Python310\lib\site-packages\disnake\abc.py", line 1655, in send
data = await state.http.send_message(
File "C:\Users\ASUS\AppData\Local\Programs\Python\Python310\lib\site-packages\disnake\http.py", line 415, in request
raise Forbidden(response, data)
disnake.errors.Forbidden: 403 Forbidden (error code: 50001): Missing Access
It's not missing perms for sure, the bot has Admin perms in many of those servers
it's working fine at the support server, and it was working absolutely fine a while back in every guild it's inside.
Now it's somehow giving this error? Even in one of the servers i own it's giving this exact same error
Even tho it does have Admin perms I checked twice
okay it's working fine on the support server but not working at all in any server it's in, odd?
missing access means either the channel is deleted, or the bot cant "see" the channel due to channel perms
It's happening in multiple servers
even tho the bot can see the channel and everything
my bot stopped showing external emojis, is there permission issues going on?
It's working fine at support server. Not in my other server, not at any server it used to work properly. I reloaded it, but it didn't help.
The bot's in about ~3000 servers now
try reinvite the bot
we did
does the invite link have both bot and command scopes?
yes I believe so
I even gave it a role with "admin" perms
at my own server
but that did not help
https://prnt.sc/lA44DkXv4OM8 I made this error output message now so people just get invited to support server whenever this error occurs but that doesn't really solve the issue
i don't get why out of all servers it working absolutely fine at support 
could it be a discord rate-limit
rate limit doesnt cause missing access
does disnake provide any way to log the http request data?
no clue
And it's an autosharded bot btw, i sharded it like a week ago if this helps the case by any chance
yep, windows has those quirks, especially when PATH is involved
i checked there are 3 shards now and it's an autosharded bot as I said before, im uncertain if this is anywhere linked to the error but id just throw this info in
sharding usually does not affect http requests
makes sense
can you log the channel ids the messages are being sent to?
i tried removing autoshard but it doesn't run the bot
and confirm the ids are correct
no no it's legit the help command or etc commands
so the message should go in the channel the command got ran in
it works correctly at support
but then it doesn't work at my other server, i even gave it the highest possible role
okay i tried commands again and again and it worked once and then threw error again? https://prnt.sc/lBE9jUpjDq_d
at a partnered server something similar happened, it worked once and then stopped
what error btw
missing permissions
yes, I mean the message
this one
hm, what's ur current code?
what does that mean
i mean the help commad just throws a simple embed
no connections to database or anything
the bot's code, from capturing the command till showing the embed
my guess is that you're trying to send a message or do something in a channel that your bot cant access, which is locking further commands
no that's not the case
did you try reducing your bot to nothing more than a single ping command that sends an embed?
like, literally just connecting to discord + the command
leme try making a command like that
wont work for testing purposes
u need a clean slate
make a new project
if it does work, then it's what I mentioned earlier
in which case debugging with breakpoints could bring you to the issue
if it doesnt work...well, you'll need a priest
I made this command pretty much
@commands.command()
async def cute(self, ctx):
await ctx.reply("hello")```
it works at support
but not at other servers
and now magically https://prnt.sc/Lk4zCkktGrij
the pull command is working
but others are not in the same server 
did you try with a clean project?
i need to make a new bot and run it?
btw what's in utility.py line 426?
no, just make a barebones project and plug the same token
add a single embed command, dont need to be fancy
wait can i run the same token in 2 projects
yes
just dont use the same prefix
I mean, it wouldn't matter, but just so you dont trigger both runtimes at once
what is view there?
odd naming on that lib
oh also
do you have any links in your embed?
including thumbnails
because that requires another perm
yes
but the bot has admin perms
nvm then
it sometimes work
wait
it fixed automatically
for now at least
i havent checked all servers
better to still chase the issue nonetheless
yes
the worst bug is the one that solves itself automatically
yeh it happened in multiple servers i havent checked all of them yet
it'd work for a few commands and then stop workin and throwing the same error
try the clean slate test, to see if it works 100% of the time
do you mind if I invite you to the support server for once
if it does, you'll need to follow the execution with a debugger
to see where it stops
its hard to pinpoint the problem without http logs
but my guess is either discord is fucking up, or disnake is
https://prnt.sc/kaCrwB-D3onG https://prnt.sc/C6WYf0rkp5wv
Wait someone at support server just mentioned me with this message
could this be it? I mean seems so
that'd make sense
yeh, it was a pretty odd error
yeah
@dusky idol https://discordstatus.com/incidents/1vlhvhz07l6q
Ah okay it was actually a discord side error then
Self ping because I copy pasted their message
is it normal that after some days of uptime, my bot's CPU usage increases a lot?
First day i have like 60% CPU usage
After 7 days it is like 300%
not really no
how many guilds?
This is me with ram ^^, I just reload my bot once every 1-2 days, takes about 5mins to solve it was too lazy to find a permanent solution but it could be smth with catched data
Memory leak maybe
ye usually ram is the first thing to solve
its always caching
most libs are very cache heavy
Tim do you still maintain that light djs?
ye but its pretty much abandoned right now, only works for djs 13
ye even tho we have a 7gb ram hosting it fills upto 4gbs after 3-5 days or running the bot and makes it slow, i just reload it once and it solves everything so I never botheredxd
👏 Get 👏 v14 👏 support 👏 please ❤️ you
tiny-discord has also been abandoned for like a year now
but i will get back to it i promise
good thing it doesnt really need any updates to keep working
ever since they yeetus deleted Structures from djs, my light djs lib has been unmaintained
could inject into the prototype chain
But there's one issue I'm going to face in future, it's the database
When I first started the bot, I didn't know it'd outgrow this much. I mean it just went gas gas and now has tons of users 
I used mongodb while making it, and that's legit the only database I know how to use so far I'm no extremely experienced developer
As it's on free plan of mongodb which comes with 512MBs, it's often slow when there are too many requests or etc and the bot's overall data coveres around 30mbs of storage so far which is too much considering it only stores text.
Soon enough I'll have to either upgrade the database or move to a different one. Well that's one thing I'm always worried about for now.
What possibly is the best solution here? Right now everything is fine but in future changes will be more than needed
oofer gang
im biased because i dont like mongo, so i'd say a dedicated postgres in a dedicated vps
but otherwise you can do the same with mongo community edition i think
get another vps from the same provider so they are in the same network, so requests between both vps's should be 1ms max
id have to re-write the entire code i believe, that's shit ton of work
ye moving from mongo to sql is not that simple
you're gonna be fine with mongo
it just needs a lot of power, so a dedicated vps for it is a good idea
i believe mongo is configured by default to use as much ram as possible, or at least thats the recommended configuration
so its pretty much made to run in a dedicated vps
also, if you dont have any complicated systems and commands, check if your bot would be compatible with a slash-command-only webhook interactions mode
that would singlehandedly eliminate all cpu/ram/sharding issues from the bot itself lol
i just recently moved my bot from mongodb to postgres. I used the prisma ORM so the code didnt change too much for basic crud operations, but I did have to write some custom sql queries for some of the more complex stuff
was using mongoose for anything mongodb
did it make any percievable difference in performance/efficiency?
it made concurrent transactions a big deal faster
Makes sense I'll have to do some research on it then
Well as I mentioned ive never worked with any database except mongo, I'm planning to learn SQL once I've some time seems like a step in right direction
if youre with digitalocean they do managed databases starting at $15/month and itll make the setup and getting started way easier for you
for comparison, my bot is in around 10k guilds
it uses 100-150mb ram
That's doing direct API right?
astrology charts and calculations
Oh interesting
webhook slash commands
Oh?
all commands are sent via webhook and return an http response, like a webserver
there is no websocket at all
For now I'm just learning web development, once I finish it off I can get back to sql
And I do plan on making a lot of projects while I'm at that
nice, keep it up
serenity or twilight
MongoDB FTW!!!!
yes, mongodb fuck the what
mongodb ftw until you get ransom'd
mongodb Fucks The Web
that sounds like it has a true story behind
sounds like freenom
I changed my dashboard
it;s still a sensory fuckton overload
but i like it more compared to the previous one
i mean it's gotta be an upgrade right
mongodb is pure fucking shit
shitlib trying so much to deviate from sql for no reason, while in the end it still uses sql itself under the hood.. shitty and hypocrite how bout that
i don't even know why peole are trying to invent no-sql databases? Like isn't it good to have one database language that can be used for almost all database libraries as sql does? If you learn mongo, that's all you can use. Such a specific syntax etc, you can only stick with mongo.
Just thirteen
The embed upside is the uptime of five days
The embed downside is the uptime of 1 minute
Idk if its weird that im not having too much increase of RAM usage past the days but im having too much increase of CPU
how are you measuring cpu usage?
const cpuUsage = process.cpuUsage();
const cpuUsagePercent = ((cpuUsage.user + cpuUsage.system) / 1000000).toFixed(2);
your measurement is incorrect, so the 200% cpu value is not the real value
process.cpuUsage() is not so simple to use, it does not return any usage values
it returns cpu "time"
and measuring cpu time requires waiting
check this
sigh, did you check it on mobile?
@lyric mountain
Call me mister responsive the way i make my designs responsive at all times
i want to get the steps correct for using better sql3 for database, i have a “schedule post” command.. i would create a new table and have the rows “message” “time to post” “date to post” to save them right?
It's also pretty normal to have a column called "id" with an incrementing value as a primary key
Don't forget about the priamry keys! Especially import when you want to connect it to other foreign keys of other tables.
ok, i’ll try when i get home
coalesce time and date into a single timestamp
also make them all NOT NULL, having the least amount of nullable fields impact positively on your query speeds
bonus point if any of them can be UNIQUE (as that prevents the query from searching for more matches, since it's guaranteed there wont be any)
tho with the columns you mentioned u wont be able to make any of them unique
aside from the PK, that is
don't talk about coalesce. It triggers my ptsd.
Spark RDD's + coalesce = 😭
I once had to work with a commoncrawl crawl that contained 5tb data. We had to shift all data around to spread it evenly over our machines to reduce workload on some machines that were really imbalanced compared to the rest.
Took me a day to execute that coalesce command and it still did not balance it, maybe even increased the imbalance.
how and why is this using 16gb ram on a 10gb file
files are usually compressed one way or another, to transfer/manipulate it you need to uncompress
not what I meant
for example, let's say you have a 100x100 png file
let's say it occupies 1kib for the sake of simplicity
when you uncompress that to bitmap (24 bytes per pixel (8R 8G 8B 8A)) it'll occupy 240000 bytes, or ~234kib
matters even more
as a file full of zeroes will have like 99% compress ratio
since it's a long repeating pattern
but why would it be compressed, and why would node uncompress it without me telling it to
cuz you cannot do anything with a compressed file
you HAVE to uncompress it into ram
tho you should be able to transfer the file without uncompressing it by sending the bytes directly
ik I can in java at least
likely not handling backpressure
maybe you need to do it yourself, not sure if all streams do it automatically
I think they do, however
the issue may be bun
its doing its weird code caching again
my abort listener didnt work
I add a console.log above it
it works fine
the read stream is reading faster than the write stream is writing
if backpressure is not done correctly, there will be no read limit
why would it read 2gb on a 500mb file if that was the case tho
I need to test if this works fine in nodejs
wow nodejs
Error: Cannot find package '/home/robert/projects/rjweb/runtime-generic/node_modules/rjweb-server/package.json' imported from /home/robert/projects/rjweb/runtime-generic/test/index.js
lmao
(I can cat it fine)
bruh
why is it even trying to read
its literally embedded in the bundle
ok so had to rewrite my build process
anyways so aborting works fine now
and the memory leak is gone
wow...
and my headers are fixed
@quartz kindle bun moment
dam
lmfao
are you using bun-specific code? or nodejs code in bun?
bun has their own specific webserver stack
because nodejs likes complaining I used bun to test my generic runtime
I have 2 runtimes
bun and generic
then same issue happens when using bun's http and bun's webstreams?
then the problem is bun's nodejs compat
ye
generic as in what? running jsc/v8 directly?
generic = using the http lib in nodejs
I mean from my tests yes
but I have an abstraction layer above both
so it may be that the bun one is coded bad
(their fault for having a shitty http api)
well, the uws maintainer did say that despite uws being embedded into bun, its still slower than running uws in node
yeah
their api uses new Response() basically
nothing manual
so I basically buffer all the data until I can write
so essentially, bun failed at everything it promissed to excel in
ye
their bundler also still does not support cjs
so im using ttsc,
...which is faster for some reason
idk either my system is cursed or bun is
xD
someone explain is it possible to get a null status code?
I don’t think so no
Unless the status property is part of the actual data object returned by the request
If it’s a header then I think it has to be present
ok so something crashed
LMAO I SEE WHY NOW
Yeah you didn’t await anything
i fixed it!
lmfao
a bit yeah, i do have a fork of it where i tested some changes
beautifully awful
oh you're making ws with http?
yeah I need to implement abstractions for websockets and http to my library
nice
at this point making your own ws/http is some sort of rite of passage to graduate from djs
lmao
uws abandoned their ws client afaik, so they only have a ws server
did they ever have a client? xd
wow
as an optional addon
didnt know that
but apparenlty it gave problems, so they stopped recommending it
then removed it altogether
the uws maintainer also removed the client from uws at some point

because a websocket client is like, whatever, just throw anything at it and it will work alright
a ws server is where the problem is
yeah
because scaling and shit
i only made a ws client for my discord lib, didnt make a server
its not too hard, just too annoying for me to do from scratch
like I need to write my own types smh
the problem with a ws server
is that there are a shit ton of specs variations and extensions you need to support, if you wanna be compliant
there's the whole autobahn test suite
ye
i wouldnt wanna mess with http2
http3 is even worse
the whole http3 draft has been experimental for like 5 years now
lmao
theres like 30 versions
I think uws also still barely supports 3.0
ye
and its not even in the type definition i think
gonna love releasing a major update to my webserver tomorrow and 5min later noticing a billion issues
yeah



