#development
1 messages Ā· Page 61 of 1
i hate doing rewrites
it wasnt hard but it was just so much
its been 3 years since i started my api rewrite and its still not done
I wanted to cry before I started and then I started and enjoyed it 
and its constantly eating me in the back of my mind
Implementing slash commands, djs lib update, switching to postgres and cleaning up the code + adding extra features.
It was actually fun
I like doing rewrites, allows me to apply newer techniques which could never be used on the old codebase
I just wish I had someone else to help me migrating the cards
1000+ cards, each done manually
one day I'll finish

me?
Yeah
well, it's a tcg, so attributes and effects
like "When summoned, destroy the card ahead"
Hello š hope everything is going well with you all today

how long does it typically take for a new bot to be approved? patiently waiting and keep updating the description every day as i add more features lol
-upto
The average up-to-date approval times are stated [here](#support message).
This does not mean it will take the same amount of time someone else's bot took to be reviewed and does not mean your bot is guaranteed to be reviewed within that time frame.
There is no exact time for how long bot approval will take.
There is a queue and you're not first, nor are you last.
Read more about our reviewal process here
sweet thanks
oooh, that simple thing took me a while lol, thanks
Integrate your service with Discord ā whether it's a bot or a game or whatever your wildest imagination can come up with.
Hello everyone, i have a question. My bot can help someone leave a message to another person. So, what happen if someone use this feature to sending a scam link, does my bot going to be banned by Discord?
not sure why it would
Id suggest a strong TOS or something so your not reliable when something like that happens
if said content is provided by your bot in a direct message for example, yes
not banned
but at least you're held responsible for that
Even if he makes a TOS and cant control it?
Yes, I'm trying to replace the link with ***
a TOS would partially solve that
though the best solution is also to only allow sending these messages to people who specifically opted in
don't try, it's impossible
attempting to censor any kind of text is a lost battle, they will find ways to bypass your filter
true
A filter that is too sensitive is annoying, a filter that isnāt is useless
Thereās usually not a great middle ground tbh
I have add a warning message below the main message, hope it's work
Don't Jixi yourself
since I update my bot to djs v14 I have this err I don't know the err is because of canvas or djs any idea?
are u checking for type of image?
the error is pretty clear: you're trying to open an unsupported image
new EmbedBuilder.from(message.embeds[0].toJSON()) returns TypeError: (intermediate value).from is not a function
Discord.js 14.6.0 
can't remember where i saw .from but it was deffo in the docs
you can't do new Embedbuilder.<anything>
ah
they can
remove that new when using .from
lmao u just literally contradicted urself (itz)
oh
I didn't saw the new in your message I thought you said you cant do Embedbuilder.<anything> š
lul
well u can do EmbedBuilder.from(message.embeds[0]) too
no
meh this works so im sticking with it
const background = await Canvas.loadImage(backgrounds[style]);
canvas doesn't support all image types, u need to check that beforehand
all of them are just png files
are u sure those images are all valid?
yes I check them 5 mins ago and also they are works great when use another command with exact same canvas code for test
but in the event...
show how ur doing in the event
exact the same code
do u want to see full code?
when did discord lower the emoji limit on servers?
they did?
used to be 50 normal 100 with lvl1 boost but not its only 25 normal
my discord is nor broken
woop wring image
see the code I gave u in DM
for my emote repos it's the same limit
perhaps u lost a tier
brb, gonna eat
i mean the last time the server was boosted was 3 years ago the gif server pfp finally stoped working like a week ago
had the same on my server
took like a year and a half to realize it had no boosting level anymore
though level 1 boost is still 100 emojis and 50 for non boosted server
bruh guess im gonna have to delete some
DJS or Eris why?
Eris is no longer being maintained properly.
So for now djs is the best lib on js?
I mean...
Its a good option, but I wont say its the best.
The best option will depend on you, and your goals.
In all reality its all user based. In my opinion it is but for say woo could say its not
I mean, I'm writing a bot using DJS right now.
I was using you as an example š
I wonder if Tim's lib is done.
Its a bit more advanced, and seems like an interesting way to go.
djs or?
He was writing a library for larger bot devs, or even other lib devs iirc.
It was supposed to be a lightweight and fast library that simplified the discord API, but didnt hold your hand and gave complete freedom unlike DJS.
*IIRC, its been a long time since I last saw him talk about it.
ah
im back
@stiff dust
there are no dynamic pngs (well, there are, but discord doesn't support it), and I'm not sure canvas supports gif
djs-light iirc
yep
that's another one then
nah. That's the lib he was working on from scratch. djs-light is just a cursed djs addon
djs-light is dead i think.
š
those benchmarks though
Tim gave me some code that just works so exceptionally well since I make my own discord libs
wait, detritus is slower than djs?
Its heavier isnt it?
It has more features, like the built in command handler and other stuff.
what does that benchmark?
events per second
it will be png at end
also I am using same code here
it doesn't matter what u put there if ur expecting an animated avatar
can u reproduce that error consistently?
yeah im still not sure if i will make it for v14
i mean, if multiple people ask for it i will, but so far nobody really asked for it lol, there is an open issue on my github about it
most of it is pretty much done, the only things that are missing is voice support, built-in caching and a built-in sharding manager
theres still some minor internal things i want to rework a bit but it shouldnt really change much
wdym?
I really have no projects that can use it.
Someone like Mac would probably like tiny-discord though.
the detritus authors said that the culprit is likely how they organize their classes, it seems having lots of "class extends class" is still a bit slow in js, but also the fact they use asynchronous zlib makes everything slower if you use compression
do u know how to make that error happen again?
someone join into one of the servers
can u run that code locally?
try running with the debugger attached to that event
thoughts on astro?
astrobot?
astro what
yajsf
yet another javascript framework
how?
does the app preview actually show the right categories?
ping
brothers does anyone know whats wrong here
is fs the same thing as node:fs?
does anyone know if you can create options within subcommands uwu
yes, the node version of it is built in so you do not have to install it anymore
A subcommand is a normal command just being categorized in the UI
So yes command options are possible as it is a normal command
tictactoe bot -> Best I can do is moderation category
I am wondering as mine was categorized as āGamingā āUtilitiesā
In the preview
machine learningā¢ļø
Well at least for me the categories match my case
Just donāt know if the preview represents the final app site
Thing is I canāt just use app discovery as like anything is the checklist is red
Why is Pylance saying that this def can't be accessed?
@commands.command(name="beta-help", description="Shows help about a command or the bot (Beta version)", aliases=["help-beta"], hidden=True)
@commands.is_owner()
async def help_beta(self, ctx, *, command: str = None):
@lyric mountain Any ideas?
Checked that and no change
How do I do that?
@commands.command(name="beta-help", description="Shows help about a command or the bot (Beta version)", aliases=["help-beta"], hidden=True)
@commands.is_owner()
async def help_beta(self, ctx, *, command: str = None):
fuck
Lol
fuck
New line
but you get what I mean
Unexpected indentation
i give up, am on mobile
Lol, I'll wait
as far as I understand annotations, these should be in the same indentation as the actual def
@commands.command(name="beta-help", description="Shows help about a command or the bot (Beta version)", aliases=["help-beta"], hidden=True)
@commands.is_owner()
async def help_beta(self, ctx, *, command: str = None):
there
or whatever you call the @ stuff lmao, can't remember what's it called rn
damn we back with the scams
beta_help is within the scope of the normal help
make sure these are indented into the correct scope, aka beta_help should be in the scope of the class, aka on the same indent as the class constructor
python would try to access the beta_help through the class itself, even though if the indentation would technically cause it to be help().beta_help()
I indented one too far, lol
probably something like
arrays_array = []
count = 0
temp_array = []
for item in base_array:
if temp_array length at least smaller than 10 (aka 0-10)
add to temp_array
else
add array to arrays_array, clear temp_array for another 10 iterations
pros being, you could make as many arrays as possible by this, as long as it's dividable by 10 if the arrays need to all be the equal size
also this is just some pseudo code
not a python guy srry
sounds like a skill issue, become one ez

Who the hell would wanna do that
pfft
any gpu would realistically suffice, just more is developed for nv
the basic concept is just the supremely parallelism GPUs offer
you
@lyric mountain Hi, well still I have that problem with canvas... do u have any idea? 
const page_number = interaction.fields.getTextInputValue('page')
const high = myregex[3]
const low = 0
let zerotest = page_number.startsWith('0')
let number_test = +page_number
if (page_number > low && page_number < high && zerotest === true && number_test === NaN) {
console.log('No');
} else {
console.log('Yes');
}
Why do this give me 'yes' everytime
What I'm doing is getting a page_number value from modal and then checking it that it shouldn't have 0 as first number (from left) , it's a actuall number and not a text , it's number between two values (numbers)
your whole condition gets screwed up by zerotest, since you're checking if the page numbers starts as a string based 0, not the integer 0
Can you give an example of values provided by these variables
aswell as their type (using typeof)
Which variables? myregex[3] gives out max number from range low is 0... Page number is modal value and yeah
typeof of what?
all the relevant variables on your if condition
so page_number, low, high, zerotest, number_test
aka their values right before the condition is checked
Isn't this what you wanted?
well if page_number is a string, aswell as high being a string (likely same applies to low) then theres your issue
lose typing
make sure to convert the numbers to actual integers, as it would cause something like that
bit better visualized the difference on the results, thats why I asked for the typeof the "numbers"
https://i.imgur.com/Yy6nxJA.png
also
Hmmm.....
oh nevermind thats correct on the last one, that returns the numeric version of the string, would be NaN if thats not a number
still ensure the variables are actual integers if you're using them in logical operators
Should i convert all numbers to integer?
yes, since you're using these all in the if condition
at least page_number and high
- does the job actually, like you have done on number_test
so +high for example would give you the numeric version of it, if it is a valid number
Oh
term is Unary Operators btw https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Unary_plus
I converted everything into int now it give .startwith isn't w function
correct, as page_number isn't a string anymore
what is the purpose of zerotest? checking if the number is zero essentially?
numbers cant "start with 0", for example "052" when converted to a number becomes 52
a number can be 0 or not be 0
if you're using that zero as some kind of marker or flag then you have to use strings and not numbers
I removed zerro test and made everything integers but it give yes in bot of casses no matter a number is greater
let page_number = interaction.fields.getTextInputValue('page')
page_number = +page_number
let high = myregex[3]
high = +high
const low = 0
//let zerotest = page_number.startsWith(0)
let number_test = +page_number
console.log('page_number =' + typeof page_number)
console.log('low =' + typeof low)
console.log('high =' + typeof high)
//console.log('zerotest =' + typeof zerotest)
console.log('number_test =' + typeof number_test)
if (page_number > low && page_number < high && number_test === NaN) {
console.log('No');
} else {
console.log('Yes');
}
Is it because of let
@rustic nova
print the values of everything before the condition
name checks out
can we all agree that djs is the worst at breaking changes
š
they moved everything to pascal case
u didn't do what I told u to
attach a debugger, step over until you find the line that errors
you cannot do comparison with NaN
NaN is never equal to another NaN
instead you can use Number.isNaN(number_test), but actually you dont even need that, because NaN cannot ever give true for < > operators
you dont even need half of your code tbh
// i prefer using Number() than stuff like +number because its easier to understand
const page_number = Number(interaction.fields.getTextInputValue('page'));
const high = Number(myregex[3]);
const low = 0;
// you can remove these afterwards as well
console.log(`page_number = ${typeof page_number}`)
console.log(`low = ${typeof low}`)
console.log(`high = ${typeof high}`)
// you dont need to test for NaN because NaN will always return false when used with < or >
if (page_number > low && page_number < high) {
console.log('number is between low and high');
} else {
console.log('number is not between low and high');
}
I'd argue that > should be >= tbh
if they want inclusive yes
const client = new Client({
shards: Cluster.data.SHARD_LIST,
shardCount: Cluster.data.TOTAL_SHARDS,
intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMembers, GatewayIntentBits.GuildMessages],
partials: [Partials.Message, Partials.Reaction],
allowedMentions: { parse: ["users"] }
});``` Bot isn't replying to messages

d.js v14.6.0
nvm im just absolutely stupid, please ignore that

I just applied my another bot for topgg verification, can any moderator pls check it out :-{
they will check when it's time comes
š« okiz
Anyone have a good guide on how to set up a public repository on github / how licenses work / basically just how to make things look profreshionalā¢ļø
create a new repo, add a readme.md file and a license.md file
licenses depend on how much freedom you want to give people
most stuff today is either MIT, BSD or GPL
or apache
what should I be putting in my readme?
Anything you want honestly
Normally for private projects i use it as a todo list
Just keep in mind that readme will show up for others
idk what its for but maybe say what it will do?
maybe some common bugs or planned feature update?
Maybe how to use whatever this is?
sounds like a good place to start
title followed by a slogan or a short description, then an introduction about the purpose of the repo, what problems it targets
then a presentation of the repo's core features and advantages
then a practical introduction , code examples, docs
thats usually the kind of things i do, and also what most repos do
thanks!
WTFPL tho
you can also check out some templates out there, like https://github.com/othneildrew/Best-README-Template
GPL (giant penis license) > WTFPL > GPL (gnu public license)
also, if you need help chosing a license, check out https://choosealicense.com/
Non-judgmental guidance on choosing a license for your open source project
todo should be in a separate markdown file like TODO.md imo
also i just found this, looks pretty awesome
can also be a section in the main readme, thats what i do
generally if i were to write a library, i would license it under MIT; and if i were to write a standalone program, i would license it under GPL
does gpl actually stand for that

yeah most my stuff is MIT except for one thing that is LGPL
gnu public license
no
lmao
banned for suggestive message
there was a joke license called giant penis tho, but i think only one or two repos actually use it and its main website is offline
WTFPL based license ngl
there's also dbdpl
Do webhooks in a thread work when the thread is closed?
i like this one very much tbh
perhaps, since webhooks aren't limited by permissions
is this the equivalent to mit or something
I guess so
relicensing all of my libraries under dbad rn
lul
lmao there is a license that forbids all use until after death
This software may not be used directly by any living being. ANY use of this
software (even perfectly legitimate and non-commercial uses) until after death
is explicitly restricted. Any living being using (or attempting to use) this software
will be punished to the fullest extent of the law.
this license basically forbids copypasting code without citation
so that license doesn't prevent automated tools
Protestant Public License: modifications must be published by nailing the complete source code to the door of a church, without permission
lmao
there are some really good ones lmao
seems like a bunch of made up licenses
All licenses are made up.
Its not something that you need to have a lawyer to write one for you(although recommended).
I more meant like ones that are not meant to be taken serious
that's their point
its dumb lol
the dont be a dick license is a good one
this one tho
lmao
adding it to my python projects
its on a archive.
https://web.archive.org/web/20180403083715/https://witches.town/@Ontploffing/3544280
WTFPL best license
i know
no, Why The Fuck Would You Even Do That Holy Shit Public License is https://git.sr.ht/~boringcactus/gotbruh/tree/main/item/LICENSE.md
WTFWYEDTHSPL
Some actual good ones are on there too.
https://prosperitylicense.com/
free for non commercial , 30 day trial for commercial.
how can I make canvas (s: canvacord) use all my threads to draw the image? (nodejs)
you cant
Does anyone know what the replacement for interaction.component.setLabel() is in djs v14?
it seems to be removed 
new ButtonBuilder().setLabel()
to use an existing button as a template you can do new ButtonBuilder(interaction.component)
and how would I replace the clicked button with this new one?
By editing the interaction response
Just provide your new components
If you donāt pass embeds or content as option then both will not change
all types of edits require replacing the entire message
so you have to edit the message with a new message that contains a different set of buttons
One message removed from a suspended account.
No?!
At least not with djs
Which is what heās using regarding the methods and classes I saw above
Passing just the content as option when editing your response, only the content will be changed
Not so additional embeds, components, etc.
Maybe djs internally fetches the message once you edit it but itās not required to edit the entire message
I mean, they are technically using all of their thread lmao
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
well yes, some fields are ignored if not passed, but for example to change one button you have to basically send a whole new components array
nodejs and webjs implement a worker_threads module that spreads the load across all of the cores
so a nodejs app can make use of every logical processor a cpu can offer
One message removed from a suspended account.
node canvas is a native module so it can technically make use of threading in C/C++
but i dont know if it does, likely not
but you know that the v8 engine dies if you mix v8 stuff with native system threads right
it doesnt die lol, unless you're doing weird shit
it does for me, the only way for it to work for me is to use libuv which utilizes node's event loop iirc
afaik it should be done like this: js calls cpp main, cpp uses threads to do something, return something to cpp main, return callback to js
if only it was that easy
even if you use worker_threads in js, cpp should always return to js from the main cpp thread
ie js worker threads still call to cpp main
js workers cannot use cpp threads directly
at least thats what i read somewhere
threading is indeed difficult
JavaScript functions can normally only be called from a native addon's main thread. If an addon creates additional threads, then node-addon-api functions that require a Napi::Env, Napi::Value, or Napi::Reference must not be called from those threads.
When an addon has additional threads and JavaScript functions need to be invoked based on the processing completed by those threads, those threads must communicate with the addon's main thread so that the main thread can invoke the JavaScript function on their behalf.
every language is single threaded until you use the threading functionality
just press the f29 key
No, f69 is superior.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
JS is a safe language even with threading (for the most part) where segfaults are really hard to pull off as memory spaces are separate
but the option is still there
yeah but js threading is like running stuff on containers, they can only communicate via messaging
One message removed from a suspended account.
One message removed from a suspended account.
while other langs have more access
SharedArrayBuffer abuse
^or that
which was disabled for some time due to some exploits some time ago
lmao
lmao
One message removed from a suspended account.
One message removed from a suspended account.
OwO
One message removed from a suspended account.
anyway ig2gcya
One message removed from a suspended account.
this is why i use napi.rs 
it makes most of the pain to disappear
Ah thatās what U mean ⦠yeah
When I make a slash command require the admin permission within discord's new apps interface, it totally locks every non admin from using it (without a server admin changing the permissions ofc), right?
I want to make sure I don't give everyone config access, as that would be... awkward
Youāre speaking about the default_member_permissions field, right?
This will unfortunately lock the command to members with the exact same permissions, yes
anyone have a document or know how I can give a role to someone via buttons? discord.js V14.6
The button triggers an interaction event which holds the guild member object (if used in guild) you can use to access roles and do whatever has to be done
interaction.member.roles.add(ā¦);
ok, so would it be interaction.member.roles.add("roleid");
Make sure to check if it is a guild interaction
if(interaction.inGuild()) ā¦
I guess add() takes any role resolvable
(also an array of resolvables)
ok ill give it a shot and let you know
Iām close to be sleeping but sure, I will respond later
ok
const fs = require("node:fs");
const { REST } = require("@discordjs/rest");
const { Routes } = require("discord-api-types/v9");
module.exports = (client) => {
client.commands = async () => {
const commandFolders = fs.readdirSync("./src/commands");
for (const folder of commandFolders) {
const commandFiles = fs
.readdirSync(`./src/commands/${folder}`)
.filter((file) => file.endsWith(".js"));
const { commands, commandArray } = client;
for (const file of commandFiles) {
const command = require(`../../commands/${folder}/${file}`);
commands.set(command.data.name, command);
commandArray.push(command.data.toJSON());
console.log(`Command: ${command.data.name} loaded!`);
}
}
const clientId = "1004251517957701652";
const guildId = "1026670787152842802"; //Razer Hangout
const rest = new REST({ version: "9" }).setToken(process.env.token);
try {
console.log("Started refreshing application (/) commands.");
await rest.put(Routes.applicationGuildCommands(clientId, guildId), {
body: commandArry,
});
console.log("Successfully reloaded application (/) commands.");
} catch (error) {
console.error(error);
}
};
};
Any ideas?
U can't get commands from client because it doesn't exist yet
I'm shitting my pants. My bot's VPS is unreachable, but another VM in the same datacenter is. Ping just shows request time out via both DNS and direct IP

BDSCRIPT is underated?
bdscript is actual hell
And� 
What are you worried about?
Donāt u have proper backups? 
I agree
commandArry
commandHarry
how do I create a new column after another in postgresql? In mariadb I used this but it doesnt work anymore, alter table userinfo add column uvars int default 0 after email
Can anyone help me with modal box in d.py2.0 cogs ?
help with what exactly
most if not all vps services have a recovery partition
simply access the server throught it and undo whatever u did that locked u out
probably bad firewall configuration
the only thing that's wrong is after email
the rest is normal standard sql
how can I still do something like that though?
I'm not able to do it. It throws me error
File "/usr/local/lib/python3.10/tkinter/init.py", line 37, in <module>
import _tkinter # If this fails your Python may not be configured for Tk
ImportError: libtk8.6.so: cannot open shared object file: No such file or directory
it didn't find libtk file
But I don't know what tk is and can't seem to find the lib
well u installed tkinter apparently
hmmm... It seems like a dependence from something i installed
I'm just trying to achieve pop-up box with Modal
check tkinter install guide to see if u missed any step
I think I might know now, I just noticed few extra lines are added, I'm thinking its the VS doing when I misspelled something
Thanks for the help
yw
Thank you! Let me check
does anyone know how to generate a rsa and/or gpg key in c#, from a set seed?
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
That doesnt appear to support seeded key generation
One message removed from a suspended account.
One message removed from a suspended account.
the only create function that takes in any options other than the generation method, takes in RSAParameters, which does not include any option for seeding
looking rn to see if maybe one of the generation methods includes it
One message removed from a suspended account.
that's fine, thank you
One message removed from a suspended account.
I think i'm probably just going to use esdca keys instead
why are u doing that btw?
the recov partition also wasn't accessible
then contact support
because u literally cant fuck up recovery partition
since it's recreated on demand
what's this topic about recovery partitions?
on a VPS for example?
if it isn't available, you might need to mount it manually
this was often the case on my previous dedicated server, as the recovery partition was actually a physical partition that didn't get mounted itself
they're locked out of it
for some unknow reasons, they cant ping nor access it in any way
nah they need to manually mount it, doubt they'd just lock partitions
can't remember what the command is, but they should check the available drives
lsblk or smth
they cant access the server at all
usually there's a button or smth to create a new recovery partition
they are locked out of the server, not the partition itself
it got fixed after 2h
just trying to get any response from it failed. No ssh, no pings, nothing. Even with recovery partition
yes, that's what happens if u sever connections to the outside
then the network access is dead, though recovery modes often have different credentials provided after changing the mode
including the IP as I have experienced
though think that's only something on virtual servers
yeah nothing like that through the interfaces they gave me
same ip, default port 22, password of my choice
support replied after 3h after it alr fixed itself and they said everything was fine essentially
we investigated ourselves and found nothing wrong

Hi!
I applied my bot 2 days ago, but till yet I got no reply
-upto
The average up-to-date approval times are stated [here](#support message).
This does not mean it will take the same amount of time someone else's bot took to be reviewed and does not mean your bot is guaranteed to be reviewed within that time frame.
There is no exact time for how long bot approval will take.
There is a queue and you're not first, nor are you last.
Read more about our reviewal process here
@next storm
.ok
Hi so I am making a website for a school project and we need to add a "webshop" basically a way to show the products on the website but you don't have to implement a payment system just a way to show the items in stock found in a database but ofcourse with the database credentials being safe and not being able to be found in the source when inspecting element how do I do that?
by having a backend API that the website reaches out to
that backend API then talking directly to the database, having the credentials only internally
you could also directly go with template-based Webservers such as ejs or on python, flask
or even php
if your goal is really to only dynamically display the inventory on load and not live
My bot just got verified :)))
I donāt know entirely what that means but itās cool
Means it can be in more than 100 servers
I knew that but I thought there would be more
Nah I donāt think so
Dang well the check mark is cool
verification is basically a way for discord to get your personal information
so they can hold you accountable for your bot
its basically like registering a business, you get permission to operate and sell, but they know everything about you and can hold you responsible for what your business does
You get some perks of being verified. I think you're ratelimits are less strict and like Tim said.
Nope
The only things u get are being able to go above 100 servers and be listed in app discovery
Idk why I thought I heard something about rate limits
ĀÆ_(ć)_/ĀÆ
Maybe a old feature.
What u heard is special ratelimits for very big bots
Ratelimits can increase if you ask for that.
But you need a valid use case and to be quite large of a bot.
(Or application)
Ahhh
When I had a almost verified bot I checked and it said that ratelimits eould be less strict, perhaps I read it wrongly.
They are already pretty relaxed.
The only difficult part I had it was caching users.
But that was my problem to be honest.
Most bots in hundreds of thousands of servers don't go near the ratelimits.
I had a 60 - 70 servers and I always would hit the cache limit.
Cache limit? š¤
there is no cache limit lol, the limit is how much ram you have
hey guys, i'm with a error:
skill issue
I had a lot of ram. It simply ran and it would cache 40k users and then it wouldn't cache more.
lol
It's was pretty weird.
Hmm that doesn't really help specially when you don't show the error.
I just see 40 errors.
Not any specific error.
burbur sent me this, but taking this out, it's a error in the console
wait i'll send it
Error: Login sessions require session support. Did you forget to use `express-session` middleware?
smh
https://github.com/OnBeat-Project/OnBeat-Alpha/blob/40bcac2e9066437be9c326b27162d6e6505c094d/server/index.js#L33 @indigo cobalt
Check this issue comment
Maybe it will help
ok
cache is entirely dependant on the library
some cache less, some more, some dont have a cache at all
Weird then
also depends on configuration, for example members and presences intents influence how many members you receive when you login
and to get all members you still need to manually fetch them with the members intent enabled
otherwise you will only have online members
when i do if (!list) return i just get list is not defined instead of it just returning
why does that happen
i know list is not defined that why im trying to filter it out
list is not a variable
yeah cuz its not defined
how would i return when list wasnt defined
cuz thats what i though you had to do
yes you haven't assign any value to list like let list;
i know
so why doent it return
thats the point of the if statment
cuz list may or may not exist
then add let list; first before the if statement
but i dotn want it to exits though
why
You need to understand the difference between undefined and non-existing
then why are you adding the conditional then lol
yeah if(!list) would only work if the value is like null or undefined or false
^
if it doesnt exist at all then it gives u an error
so ive got to reformat arguments so i can pass them through to child prosses which results in list but if there are no arguments list wont exist but i need it to run the command with no list
because if you dont write the variable in the first place, it will never exist, the code wont write it for you
unless you're using weird eval shenanigans
āshenanigansā 
probably cursed
ah
but it should work
i know
it wont exist outside that block
yes
it still looks like you're doing redundant stuff
you could just do const list = something || args.map(...).join(",")
he seems to be adding single quotes to each item
why though
so if i ran the command im trying to run in the command line of my server would look like this beep -l 375 -f 392 -n -l 750 -f 523 -n -l 463
idk, formatting?
but child prosses needs it to look like "beep", ["-l 375" "-f 392", "-n", "-l"]
or something like that
there are lots of parsers that do that for you
i have no idea how that works
afaik Node.js has one builtin
yeah
the reason im doing this and not just making the useres manually add the formatting is some of the arguments can have alot of elements
or use @earnest phoenix's parserā¢ļø
I find it funny when bot devs cannot make console applications
when bots are basically console applications but remote
i find it funny when
Honestly looking back at the parser I made (Opteric) I realized that it's not actually "standard" (well there's no actual standard, but doesn't behave the same way as most parsers do)
It also considers single-dash flags as options when there is content after them, and that it collects everything after an option instead of something with no spaces, it should collect the whole expression when a string is present
I'm gonna make a standard one just for fun I guess
bruh it works fine i just want to have use of arguments
i just suck at coding
i have the beep package installed on my server means i can been the bios buzzer
got that to run fine however you can controll the length duration frequency and amount off beeps with a long list of arguments
there are scripts on the internet that you can just past into a cli and it will make the server play a little tune on the bios buzzer
want to beable to just past it into discord thats all but i need to get it all formatted to work with child prosses
bruh still cant get this crap to work
the code works fine i mean its just i cant make it output the right formatting
Command.spawn("beep",["-n","-n","-n"]) works
however Command.spawn("beep",[args]) where args = ['-n','-n','-n'] does not work
how will the beep even work?
huh?
didn't u say it's a command to make bios beeps?
yee
except the code will be ran nowhere close for anyone to hear
my server is under my computer desk
its just a gimmic that im putting too much effort into
but its bugging me now
the only thing that works is if i do only one argument
why dont u just use node built in argument parser?
show what ur writing
what as the bot command?
yes
-beep is the command and i just write the arguments like they would be in the cli
resulting in something that looks like
-beep -n -n -n
which makes the thing beep 4 times
or should do
-beep -n works
I wanna see what ur writing, exactly
it beeps 2 times
bruh but then how does hard coding it work then?
using child prosses to do this
Command.spawn("beep",["-n","-n","-n"])
runs perfect
input.split(/\s+/)
what does that do?
i know im tyred
i have that in and that works now
however i still need each "arg" to be indevidual things to input into child prosses though
i know but child prosses needs all the commands in an array or some crap unlike in a cli where i can just type it as a string
i can split it again and iterate it into an aray like the way i filter the args for commands
then pass it in an array
true however the data from the msg args is already in an aray and that doesnt work
are u using a pre-made command handler?
because there HAS to be a way to message.content
i have that
in the handler to get the args i have this
const args = message.content.slice(prefix.length).trim().split(/ +/g);
that makes it an array
and in the commands files i have message though its named msg
what's the issue again?
Voltrex when his project/contribution does not comply with a standard:
ok so child prosses need to have stuff in an array or something like this
Command.spawn("beep",["-n","-n","-n"])
that works fine
now i need a way to get arguments from a command and translate it into that
however nothing works and idk why
it works fine with just one argument leading me to believe that its treating everything as one argument instead of multiple
Well yeah, standards are extremely important
-beep -n -n -n -n -> .split(/\s+/g) -> ["-beep", "-n", "-n", "-n"] -> .shift() -> ["-n", "-n", "-n"]
I'll make you comply with my standard
I'll rewrite your standard
my comp sci class actually went over expressions and parsing them
I was surprised
evaluating and converting between infix, postfix, and prefix expressions
It doesn't have to, standards can be modified in anyway without having to comply with itself

I'll sudo rewrite it, mmm 
It doesn't matter! It must comply with my orders
that just returns -beep
because you're getting the value of shift
you're supposed to simply discard what shift returns
bruh
its 2am
sry
ok so it is now a proper array but i get an error from beep saying
beep: invalid option -- ','
meaning it is still being sent as one big argument
Show code
since , should never be seen by the beep program
one sec
let conditions = msg.content.split(/\s+/g)
conditions.shift()
console.log(conditions)
let errs = Command.spawn("beep",[conditions])
the errs stuff is just to i can log the stderr from beep
arrayception
bruh lemmy remove the [] and see if that helps
it will
see
thx people
@earnest phoenix replace Opteric with the Node.js builtin version when
the reason it was an array in an array is cuz i was doing it a difernet way originally
but it works now
theoretically i can just use the args from the commands handler instead of remaking it
Soonā¢ļø
The parseArgs() method is in the node:util built-in module if you're interested
propose it to be renamed to opteric
bruh i hate the fact that basically 2 hours of my life went to making somthing that finally works with less than a line of code
Command.spawn("beep",args) is all i needed
reeeeeeee
"code stuff for fun i thought"
"it will be fun i thought"
the internal screaming intensifies
You said you're tired, you're better off resting instead of writing code because you mostly won't be able to focus, so you'll just keep running into more issues than you initially did
pov: you're trying to debug a segmentation fault in c++
true but if it bugs me im motivated and if i go to sleep it becomes a "tomorrow problem" and tomorrow as we all know never comes
unless it does but then my crappy bot is the least of my worries at that point
don't write code sleep deprived
you'll struggle to pick up where you left off, because you won't remember your thought process
get a good night's sleep and return in the morning or whenever you have more time
true however i cant remember my thought prosses at the best of times
but atleast i can now play a segment of the mario theme song over a crappy buzzer from discord
You really should be documenting the goals first anyway.
You don't really need to document it, you just need to have the goals and how the code would work in mind
i code when i'm sleep deprived all the time
Documenting all this stuff can be really essential when working with groups of developers.
It's good practice.
But he's working alone
Hopefully not forever ^_^
._.
It's also nice for working on projects you haven't touched in months.
I try to keep a Readme file for every project.
More detailed than I need though.
Every project literally has a readme lmao
is there a good guide to using slash commands in discord.py? I wrote a bot before this feature existed and I'm a bit confused on how the new system works
am I going against the grain trying to subclass Bot instead of instantiating it and defining commands there? that whole paradigm seems weird to me
Hello, so Iām making a website for a server and wanted to make the background of the website a gif. I googled for some cool gifās and chose one. The issue Iām facing is when loading the gif, the gif always duplicates into these small little boxes. Iāll send my code in less than 24 hours (due to school.) but for the time being, itāll be highly appreciated if someone is able to provide me with the proper code
This is for CSS
Bad idea
Idk how old you are, but around 2005-ish we had an era where the internet was flooded with gifs
Needless to say it wasn't only awfully slow, but also extremely polluted
Gifs are heavy, like, really heavy, use them sparsely and definitely not as a background image
If you, however, really needs to have an animated background then re-encode the gif as webp, it is way more optimized for web usage, as the name suggests
Not really much of an issue in 2022 anymore as caching nowadays reduces the request load quite a lot
And waiting for loading a website the first time aināt that much of a big deal
The real issue is to bring the gif into a responsive state to have a nice animated on any resolution
Which requires you to use media queries for example and multiple gif files in diffrrrnt sizes to prevent stretching or generally confusing pictures
Nowadays might make more sense to work with a gradient background animated via css
If necessary needed 
Oh damn
Alright thanks for letting me know
Feels like the same when there were people adding background music to their website 
im thinking i can develop this simple example i created into a standalone addon lib for D++ for reporting to top.gg api.... https://dpp.dev/making_a_http_request.html
thoughts?
what are the requirements for an api lib for top.gg?
is there a minimum level of supported functions required?
you should DM a team member like Mac
Hello, I have a very big question, so I'll start.
I would like to use sharding in my disocrd bot, but there are some things that I don't know how to solve.
At present, for the first time in my life, I want to deal with sharding and I don't know how to approach it.
which I am asking someone to give me directions for, since I couldn't find a precise guide/description on the internet
so there is a webdashboard that establishes a continuous connection between the user on the dashboard and the bot, which runs rather smaller data, such as whether he has a right or when he wants to create a statistical channel, the dashboard uploads it to the database and I tell the bot to update it via socket the statistical rooms will then be downloaded from the database to the specified server, but only those that have the create type and will be created
the second floor is the data base, the bot is 99% exposed almost everywhere and I don't know how I can easily use it in shardin, because of course there are as many connections to the db as there are shards, which is not advantageous even with a socket, but the port is already reserved, isn't it?
so how would that be possible
postscript: my English is very bad
I would probably suggest a central internal API for that, having your shards request to that central API to get and update data, then having that API make the changes on the database
your webdashboard could then use that database too
depending on load, would also suggest to deploy some caching between your dashboard and the API calls
dont have your shards touch the database directly imo, as that could first, cause the " because of course there are as many connections to the db as there are shards" aswell as be slow
i used to maintain a Top.gg C++ library, and it had autopost and basic information fetching like discord bots and users
and maybe you can give me an example or a description for this
was thinking about sketching that yeah
oh hey look https://github.com/top-gg/cpp-sdk this was updated an hour ago 
The official C++ wrapper for the Top.gg API. Contribute to top-gg/cpp-sdk development by creating an account on GitHub.
hello,
i have deployed my website on firebase but the javascript is not working
yes, this was created for me
i'll make something this weekend that depends on dpp as its lib
thank you very much and I would be very grateful for it because then my current biggest problem would be solved, which is that my bot can work in sharding and I can continue working on the things that my bot will need
because its the biggest lib and it makes posting to http a very simple thing
as opposed to having to pull in some dep like curl or cpphttplib
when the majority of cpp bot devs are already using dpp, would be like a js lib depending on discord.js
fair
yes, and it sucked
Not a guarantee that it will solve your problem, but thats how I personally would approach it.
Caching is optional, just incase you might pre-plan on more usage
good thing most browsers started preventing audio autoplay
- Shards being able to talk to the Internal API
- The Internal API making necessary changes and/or obtaining relevant data for any shard from the database
- The dashboard obtaining data relevant to the users using the dashboard
so essentially you need a separate api that the shards can call e.g. url and the api manage the database and dashboard data display and database data editing
if I understood correctly
that would avoid each shard to connect to the database, aswell as allow you to expand regarding load-balancing on the Dashboard
Thank you very much, I will try to put it together and hopefully it will solve the problems
is pointer dereferencing big-endian or little-endian?
please don't tell me it's inconsistent across systems

my approach was originally to do this, but without a lot of caching resource to throw at the internal api, it can be hard to scale
instead i ended up just scaling up the db instance, and having all shards connect to the same database
ofc it is
its architecture dependent, this is why we have ntohs() and ntohl() etc
to convert them to a consistent network byte order that isnt different from system to system
however, every system you see in the real world outside of big iron is the same endienness now, arm and intel are all little-endian
because in the bad old days nobody could decide on architecture standards
you can safely assume little endian so long as you dont support anything strange
hp-ux, ibm z-series mainframes or sparc are big endian
everything else in the "real world" is little endian including arm, intel, amd, mips
yo i got a question
this is the context
ie a server selection page for a dashboard
what would be the
visually
best way to denote a guild that the bot is in vs not
wait
api how to call shard/bot ? (Realtime process)
greyed out when bot is not in the guild and other one normal
and when you hover over a greyed out guild you can "Invite"
Realtime process
websockets
the question is still how the api addresses the bot/shard
and I answered it
for realtime communication between the api and the bot you use websockets
ok but how in sharding
there, how can I talk to the bot in realtime?
how would i get all the info about a user by their id?
because I can send a send request in vain, but how can I receive it?
long time since ive coded
it doesn't matter sharding or not
you apparently don't know what a websocket is
I work with this under the socket io system
client.guilds.members.cache.get(USER_ID).then(member => console.log(member)
)
some are not in my guild tho
You can't then
socket io is...a different case
you can only retrieve it if you are in the guild where the bot is
sorry, I didn't know that
while it does use websockets (most of the time it uses polling) it's probably not what you'd use if ur looking for optimization
they're in the same guild as the bot and the bot has their id
then what would be the solution??
websocket
like, it's kinda a wrapper that uses websocket or polling based on certain criteria, but it's not the best if u want performance
yep
so then you asked which guild the user is in and now you ask for an example of this, so I don't know it off the top of my head
it will be funny because I don't even know how to start
so i basically just need to get the user from the guild cache that the user is in?
cache operations aren't async
uff
in principle yes
wait shard port err
?
you'll make a single websocket server and have your clients (shards) connect to it
oh oh to have ws out of bot
yes, you need ws on both sides
then u just need to store the connections in a map so you can target a specific shard from the server
if u need to broadcast simply send the message to all connections
then the bot connects to the external ws and the web also connects to the external ws and can communicate that way
true?
dashboard <--> server <--> bot
dashboard would just a client in the ws server
you just need to send a header so you can differentiate between the dash and the bot shards
OK now I understand and
then I think if I also send the guild id to the bot, I can use it to find which devices it runs on
yes
thank you very much, you helped a lot
I hope this solves it
just a little detail, make you you make a periodic check to reconnect websockets
they by default don't attempt to automatically
I think there is something for it to automatically reconnect, but I will try several methods and see which one is the easiest and best according to my own knowledge and can be easily developed
since a lot of data will flow through this ws because the site and the bot monitor a lot of things to ensure that everything is in order from a security point of view
that's pretty much the idea
Hey! My "application wont respond" to a certain command. Why is this?
a. Offline
b. Error in code, read console
Online, nothing in console
how do u know it?
because its the only "thinking" part of the command
the others is just getting something simple from my db and creating an embed
programming doesn't allow suppositions to be made
explain in english
you cannot "guess" that's the part that's erroring
you are definitely guessing unless the error message points there
there is no message
Stop fetch the entire member list but fetch the member using his ID instead
My gosh

so await userGuild.members.fetch(user.userID);?
its not
A property userID doesnāt exist
Well then⦠whatever, as long as itās the user ID
alr
Which makes your line getting the member from the cache obsolete
alr ty
TypeError: Cannot read properties of undefined (reading 'members')
let userFtchd = await userGuild.members.fetch(user.userID);
Make sure userGuild exists
let userGuild = await interaction.client.guilds.cache.get(user.guildID);
The user in your database could be in a guild your bot isnāt part of anymore
if(!userGuild) return; or break; in your case
Same goes for fetching the member
The member could have left the guild already
does it just skip that member then in the for loop or does it stop the whole loop?
You need to catch the fetch call as it will error with a unknown member if he isnāt part of the guild anymore
If you wanna skip it, then use continue
Also it would be more efficient to push the member IDs into an array, then fetch em outside the loop passing the array of IDs
Instead of creating at least 10 requests
Your member var is not called userIn anymore
I assume you havenāt updated your embed field line
function getCooldownByRole(member) {
let staffRoles = [
"971739561707311194", //admin perms
"709613582186315868", //admin role
"885716138753916998", //senior mod role
"870785251868295168", //game mod role
"709613208704647171", //server mod role
"894395598529237013", //trial game mod role
"832061911600070686" // trial server mod role
] // No cooldown
let highLevels = ["894416612466237471", "894416560192630805", "894416479393574993", "894416418081222737"] // 1 hour cooldown
let mediumLevels = ["894416251106001017", "894416191022571540", "894416089524633650", "894416023061684265"] // 2 hour cooldown
let lowLevels = ["894415882275680366", "894415413738340372", "894415132782903296", "894413922445164575"] // 3 hour cooldown
if (member._roles.some(role => staffRoles.includes(role.id))) return 0;
else if (member._roles.some(role => highLevels.includes(role.id))) return 3600000;
else if (member._roles.some(role => mediumLevels.includes(role.id))) return 7200000;
else if (member._roles.some(role => lowLevels.includes(role.id))) return 10800000;
else return 21600000;
}
getCooldownByRole(message.member)``` I'm going crazy here, why isn't this working?
I tested by returning member._roles, it returned roles which ARE in staffRoles and highLevels
response of member._roles
discord.js v13
gambiarra at it's finest
ooo shards ??
how to work??
client.shard
.fetchClientValues('guilds.cache.map')
.then((guild) => console.log(guild));
res
[null]
how to using?
Bun smh
i updated it, but same result
hmmm



WHY