#archive-library-discussion
25217 messages · Page 22 of 26
yeah, about that..

there is many "errors" like this one in the code
should it be fixed or no need? 
import/order eslint error
probably just a version mismatch between your editors eslint and the actual eslint version on the repo, because there are no such errors in the workflows / on my end
alright, thanks :)
I believe you can fix this by setting your “eslint.runtime” to node in your settings.json
It's because of the node version mismatch. Vscode node version isn't >=16.x so it doesn't support node protocol thats why it'll show this error only in vscode and not when running eslint scripts
regarding #7395, shouldn't we update the tests?
Yes
okay then, i missed that when making the pr 👍
(:
Done! All tests passed 🤠
boop
So it doesn't inherit methods, and also forbids constructing it, at least 'til ECMA gets their stuff sorted out:
https://github.com/tc39/ecma262/issues/1036
https://github.com/tc39/ecma262/pull/1321
hey 👋 my pr i just made has CI failing due to tests that i havent touched. https://github.com/discordjs/discord.js/runs/5072673078?check_suite_focus=true
any ideas?
Should be a known issue by Crawl
You can ignore, it was made by a recent failing commit
Alright thanks
This can be specifically useful when working with moving threads between 2 channels.
You can move threads between channels?
And how would a channel url be useful in that scenario?
any particular reason https://github.com/discordjs/discord.js/blob/main/packages/discord.js/src/managers/GuildManager.js#L262 isnt defensive about invalid options being passed. eg nullish values will try and get read, resulting in an unfriendly error
Why are you passing it in the first place?
im not, but someone i was just helping had an issue where null was being passed
makes it quite confusing to debug
had to read the source to figure it out
Are you telling me one doesn't check their input values
That seems to be the bigger issue
it obviously wasnt intentional
they were passing in a slash command ID arg but made a mistake with it, resulting in null unexpectedly
so is this just a case of "not my data not my problem, check your inputs"? or is it going to get changed to be useful
What was the error in the first place? (That was not useful)
TypeError: Cannot read properties of null (reading 'guild')
at GuildManager.fetch (node_modules\discord.js\src\managers\GuildManager.js:280:66)
at Object.module.exports.run {user code}
at Object.module.exports.run {user code}
at processTicksAndRejections (node:internal/process/task_queues:96:5)
It should be clear that the third line there you're doing something wrong, I wouldn't say that is not clear
The problem is that, if we add checks for nullish behaviour, might as well add it across the whole library... and that just ends up bloating it
its clear that something went wrong internally sure
Incorrect, something went wrong with what the user did
That error is only happening because you passed something that was not documented nor typed. That's on you
does that mean that we have to remove every other input check now?
"nor typed" in.. javascript.. a dynamically typed language
consistency would sure be nice
I feel like this conversation has happened before
probably has
wasn't it about checking stuff passed directly to API though?
and not stuff that library blindly tries to access?
both are pretty annoying to deal with
dapi returns pretty nonsensical errors at times
in this specific case, if djs threw an error saying "Malformed options passed", that would go a LONG way to helping people debug things
luckily the lib failed quite early, but if this object had made it more internal it would have been a nightmare to debug
Maybe I see things differently but that looks braindead easy to see what went wrong
to you and i perhaps
isn't this the kind of thing typescript helps with
but we both know djs is used by much less experienced developers
bold to assume the majority of djs users know what TS is and / or its benefits
but yes, TS would have stopped this
when did i assume the majority know...?
if TS would have stopped this, why does the lib need any input checks at all then
the.. the lib isnt written in TS
and can be used by JS
JS obviously has no static typing
typescript prevents bugs, if someone doesn't want to debug they can use ts for that to prevent them, if they don't know how to debug then maybe they should learn that first
"maybe people should learn JS before writing a bot", we all know this is not the case, and we can all hope however unfortunately a lot of new developers try djs because it looks easy
also the sort of people i see who know nothing about programming arent interested in using TS
are the changes you're proposing even going to benefit them if they know that little
do the 23 instances of d.js throwing INVALID_TYPE on input do that?
it would benefit the people they come complaining to with a vague error message
do what
benefit them
i would say so
i see countless people posting about the intents error / the invalid token error
makes helping so much easier
also all the embed checks
even if there was another custom error message for input validation, it'd have to use the proper terminology to be beneficial to the developers that understand them, and then complete beginners would still say they were vague.
i see countless people posting about the intents error / the invalid token error
...which means it isn't helping then? it makes you help them easier, because you know of the error, or if you don't, how to find it
to more experienced people, more abstract errors can be more useful, like the error you mentionedTypeError: Cannot read properties of null (reading 'guild')
with experience you can know where to look or what to look for to debug.
they are helped, be that through their own research or through someone else
wrt the abstract error, i literally had to read the source to figure out what was going wrong since the person i was helping was obviously too new to debug it themselves
https://github.com/discordjs/discord.js/blob/12ffa069aa8b247e945fef16a543f41c2c391bf1/packages/discord.js/src/util/LimitedCollection.js#L22-L23
this here even checks if you passed an object
uh, i mean, if you want it why not you do it everywhere?
you can just make a pull request
i can
and it started with a question about it
i dont know enough about djs internals or design, nor am in particularly interested. i was just interested to see if there was any motive for this design and / or plans to change it
and tbh i assumed it would get rejected so i didnt bother
according to my tests
i had an account with the MANAGE_THREADS permission but not the send messages in threads permission
and the account couldn't unarchive archived threads
so i'd say this code is ok
but the way it wouldn't let me unarchive was weird
yes and how is that not correct? you tested it as well
so what, you're suggesting this.archived && this.sendable && (this.locked ? this.manageable :true)
is it like this for you too when you try to unarchive a thread?
the ternary could be removed with this.archived && this.sendable && (!this.locked || this.managable)
reading the dapi docs, even that's so unclear, but regardless i think you need send messages in threads to unarchive in general
although it still could be a UI-specific issue, api tests would probably be better
#7406 in discordjs/discord.js by PlavorSeol opened <t:1644069908:R> (review required)
Always require being sendable to be unarchivable
📥 npm i PlavorSeol/discord.js#pull-request
isCategory() method? 👀
What about it
I'm not seeing one, how do I request to add?
Weird, alr thnx
In future, it would be better to ask your actual question first
Wdym?
means isCategory() method? isn't a clear question and could mean anything, so ask directly next time 
he forgot the a
no, not quite. and this isn't really for this channel either
how long djs cache the last message id when the last message deleted?
Iirc it deletes messages from cache if they’re deleted
nope, it keep save the last message id for a while, but idk how long is it
That’s sent by discord, so it only changes when a message is sent
it's not cached, it's a property that discord sends
so i guess it stays "cached" as long as discord doesn't send data to overwrite it?

cause when my bot deleted the old message embed that has been edited, and send a new message with same command and trying to edit that message, and wallaaa it crash cause the my bot edited the last message that has been deleted
so i wonder how long the cache is stored and deletd from the memory 
that seems like it would be a logic issue, between using channel.lastMessage.edit/channel.messages.cache.first().edit/interaction.editReply
discord.js updates the lastMessageId when a new message is received
hmmm 
#lastMessageId is not evicted
#lastMessage is a getter from #lastMessageId and directly depends on the cache
we evict messages from cache when we receive a websocket delete event
wait, "evicted" is used in this context?
delete, remove, yeet, pummel, obliterate, nuke, call it what you want
like this
when the new command has been run, the bot trying to edit this embed that has been deleted
you should catch that then, not really a topic for this channel anyway
yep it's not the right channel ma bad and sorry, but i tried to catch it and it keep got error, let's move to #archive-djs-help-v13 / #djs-help-v14
Djs uses null everywhere but in some places undefined will make sense. An example is CommandInteractionOptionResolver#getX, here if a string named name isn't present that means its undefined which doesn't exists. But null is a value which exists but its null. So in these places why null is used instead of undefined?
null means it doesnt exist
a null is an object. null means a variable is declared but no value is assigned. But in this case, the string isn't defined, it doesn't exist means undefined
Using undefined in a lib can get confusing quickly, because js also regularly throws undefined if a method doesn't exist
Documentation suggestion for @vernal rose:
null
The value null represents the intentional absence of any object value. It is one of JavaScript's primitive values and is treated as falsy for boolean operations.
read the first phrase
null shouldn't even be in the language, this does a good job summarizing why https://github.com/sindresorhus/meta/discussions/7
Meh
that doesn't explain why at all
Yeah that's just an opinion which states a list of reasons but doesn't really justify any of them.
- Developers being inconsistent is because they're bad developers.
- Supporting both doesn't complicate input validation because they have distinct use cases, its a symptom of the above, bad developers.
- "Newer JS features like default parameters only work with undefined" yes, because undefined is fit for purpose. Passing null should be intentional and not default. This is #2, again a symptom of #1.
- "I strongly believe it was a mistake to have two have both null and undefined." - purely subjective
- "Using null makes TypeScript types more verbose" - good. Verbosity is a good thing. Stop trying to make code shorter, and usually worse, for no good reason.
This whole things reads as an instance of #1, a developer who used them inconsistently, didn't understand what they were both for, and just wants to eliminate one
typeof null being object is the only remotely valid point but they proposed changing it once and it was a disaster
That's a problem with JavaScript being backwards compatible to the dawn of JavaScript
Why is this in #archive-library-discussion, and why is such a 40 IQ discussion even brought up?
Also, good luck removing nicknames or timeouts without null in Discord 
Yeah that's a little bit complicated to get rid of it
null and undefined don't have the same meaning and both are useful when used accordingly
And for people who don't like (I include myself in this) writing | null all the time they can simply disable the strictNullChecks rule in their TS config instead of blindly enabling all strict options
From where it was started and now 😂
undefined means "no idea" while null is a concrete lack of value
Which is likely why these methods return null when no data can be retrieved
From undefined you can't guess much, but from null you can determine that what you are looking for is definitely not where you asked
Which is probably why (I don't hold the truth) methods in option resolver return null when they can't return an actual value
When setting values, undefined means no behaviour or unset, while null is a reset signal
If #7023 (modals pr) is ready to be merged before v14 is ready to be released, would a release be held off until v14 or would you guys do another semver minor in v13?
We'll have an answer to that in the upcoming hours, deciding internally what we'll do
That PR would never have been v13 compatible, I've just drafted one which hopefully will be
Oh my bad I didn't read the category's name
why discordjs@rest 0.3.0 is not supported? (latest tag)
a newer (dev) version of @discordjs/rest is being targeted now i guess?
isn't the latest tag automatic? that would be why latest points to a deprecated version if that were the case, i'd guess
Came here to second this question. I can't even find the repo for it on github. Is this a new issue?
Not... sure how I missed that, thanks 
asking again 😢
about the setEmoji methods, now only taking an object instead of an EmojiResolvable, is that intended behavior? last i heard someone said it may not be but didn't get any follow-up to that
also should the documentation for the methods list the API defaults as it's own default value?
like https://discord.js.org/#/docs/discord.js/stable/typedef/FetchGuildsOptions this lists limit's default as 200, in the code it doesn't set a default value, it's actually the api default that's mentioned here
Is there a event/way (yes, know the invalidRequest ones...), in order to get informed about 40X errors?
Having one for metrics would be great
we have apiResponse events iirc that you can tap into
@woeful rain @visual hornet @fiery ocean There was an error in deprecating old versions of those packages. All @discordjs/<package> are still supported - the source code have all been moved to the monorepo
I'm running into an issue while making my pr (https://github.com/discordjs/discord.js/pull/7445):
I have modified GuildAuditLogsResolvable and GuildAuditLogsFetchOptions to:
export type GuildAuditLogsResolvable = AuditLogEvent | null;
export interface GuildAuditLogsFetchOptions<T extends GuildAuditLogsResolvable> {
/* ... */
type?: T;
}
The issue is that typescript still allows for T to extend any arbitrary number even if its not a value of AuditLogEvent. This causes the following test case to fail:
expectType<Promise<User | undefined>>(
// @ts-expect-error Invalid audit log ID
guild.fetchAuditLogs({ type: 2000 }).then(al => al.entries.first()?.target),
);
Am I doing something incorrectly / is there anyway to make sure T can only extend AuditLogEvent properly?
Okay 👍
when are modals expected to be available on here?
👍
hey crawl, just realized we can't actually commit like that, can you add it to the config?
Add it in the message body not the title
Crawl told me to put it in the title
so typescript is just stupid: https://github.com/microsoft/TypeScript/issues/30629, so I guess I will just remove the test case
Crawl told you you can also add it in the title 
Which it seems like I can’t, that’s why I asked him to add it or I can pr too
@vernal rose the src folder is published in the package
ic but why like u r publishing the same thing twice right? inside dist src will be in js and again src in ts.
Well compiled js isn’t the same as the source js
but when we'll import anything from djs it'll come from compiled one and not source one right? as main is dist/src
D.ts files don’t get compiled
i'm not saying that. you said src will be published means all **/*.js and **/*.ts files inside of src will be published right? or i've misunderstood maybe?
Yeah and the typings folder is published too
ok so i was saying that dist/src is what everyone will use and src will be published as a root folder but except for typings this src folder is useless means no one will be able to use it. So I think you can add all src/**/*.js files in npm ignore and src/**/*.ts will be published only for typings. Means these source js files don't have any use in npm only compiled will be used
Also, I just realized that if you don't include typings folder in tsconfig it still works as it's a d.ts file that won't go under compilation so you can remove it from include and it'll work fine.
Here's a working example
https://github.com/imranbarbhuiya/pagination.djs/blob/43f3ee804b91db639abd57bb82d3e331290b0d29/tsconfig.json#L19
I think you can’t import from the src folder in the d.ts if it’s not included in the ts project
ok i didn't tested it xD lemme test it.
I'm not seeing any errors when importing in vsc and this file isn't included in the build so idk how can I test it
@dawn merlinok I was wrong I was confused with typing files position. This means what I was thinking as typings will be outside of dist and src is inside and when u said src will be published I thought ./src will be published along with dist/src. But now I realized typing will be present inside of dist and only dist/src will be published.
When the Shard tries to send a heartbeat but it didn’t receive the last ack
The shard is suppose to reconnect but when looking at the code it only calls WebSocketShard#destroy and does nothing else (see here: https://github.com/discordjs/discord.js/blob/861f0e2134662ab64a11d313130aff58b413d495/packages/discord.js/src/client/websocket/WebSocketShard.js#L570)
Isn’t it suppose to call the identify method 🤔
The webscoket code is pretty complex, if you look into it you'll see it does attempt a resume, its just not the way you think its supposed to happen
Just a question, why is https://github.com/discordjs/discord.js/pull/7449 semver major? All options that had their defaults removed are still optional and will behave the same way if the user leaves the parameter out
well, the behavior would change if the defaults changed in the api, so i'd guess that could be why?
you literally noted it as a breaking change in the commit notation with the ! 
hmm that was after the label was added though
yeah ^^ I initially thought it'd be minor
well it's making the behavior rely on the api instead of the library, and whether the behavior changes at all would be out of djs' control, so yeah i'd say that could possibly be a breaking change
aight
On this typedef, the default for failIfNotExists comes from the default client options, which can be misleading because a user might be expecting this to default to true even if they set the client option as false. Should it be removed from the typedef?
If it defaults to the client, you could also just do failIfImLazy=this.client.options.failIfImLazy
Internal discussion
Basically we want the TypeScript rewrite to be done from the ground up, instead of translating everything with the flaws and worrying about the rest later
And our docsgen parses either JavaScript or TypeScript, not both together
https://github.com/discordjs/builders/issues/36 is this being considered? it's been open for quite a while now
I'm not against it, but I don't quite understand the difference between 10 "addSubcommand" function calls, or an array with 10 builders in it
imo it would look "cleaner", but I guess that's something everyone has to define for themselves at some point. I'm sure there's people that would argue that it's not cleaner in any way 
the thing is to make it consistent with the other methods, you'd need to use rest parameter
which brings me to a bigger question which monbrey and i talked about already i think, what the usage of addSingular(obj) now? when they're basically just addPlurals(obj) with one parameter
example: addField(field) is just addFields(field)
Pretty sure most singular adds are called by the plurals
still pretty useless, if we decide to go with rest parameters
yeah there are also some that call plurals internally
it's a mix in the implementation
but not the point, i'm asking about the user's side, is it really useful to keep the singulars?
making that all one method seems more streamlined, if the usage is the exact same, but with one more character
soo, should we remove them?
Getting this error with the v13 modals PR installed but I can't seem to understand why it's happening, is it related to that PR?
version mishap i guess
the only version of discord-api-types I have is 0.26.1
Also this might be more insightful but I'm still clueless
mismatched dapi versions
Yeah I didn't touch those afaik
yeah that's what the errors look like when you miss match versions
means djs or whatever package is using a different version than the one you're explicitly using
it's weird bc I don't have discord-api-types as an explicit dependency in my project
but alright
If you npm ls discord-api-types what does it show
Also interesting, you have a deduped -types and then d.js has its own -types
it was showing 0.26.1 and djs had 0.26.0. I just updated djs and its fine now
Probably needed a reinstall of deps yeah
probably got messed up from changing between monorepo and v13 branches
i'd make a PR for this, but it's feeling pretty crazy pills that nobody else has this problem:
- i try to create a guild emoji, using a web URL
resolveImagechecks it, see it's not adata:
and passes it toresolveFileresolveFileperforms a node-fetchres = await fetch
then returnsres.body- the
body, pernode-fetchv2.x.x docs,
conforms to node'sReadable Streamspec.
it identifies in Console Log as aPassThroughobject - so, what
resolveFilehas returned, is a stream. not a buffer. - the results of
resolveFileare fed intoresolveBase64 resolveBase64's only check is "is this a Buffer" (it is not)resolveBase64gives up, returns the readable stream as-is- that object is stuck, as-is, into the API create emoji request
- this fails, obviously
DiscordAPIError[50035]: Invalid Form Body
image[BINARY_TYPE_INVALID_DATA_URI]: Only data uri strings can be used.
[...]
requestBody: {
files: undefined,
json: { image: [PassThrough], name: 'MyEmojiName' }
}
a minimal repro in a clean dir, under current node 16, takes a few lines and fails. but the code looks like this in stable too. it's an easy fix, but i am sure i am doing something wrong here
otherwise it would be broken for everyone right???
do you have said minimal repro?
$ node -v
v16.14.0
$ npm install discord.js@dev
const { Client } = require("discord.js");
const client = new Client({ intents: ["Guilds"] });
client.once("ready", async () => {
await client.guilds
.resolve("7777777777777777777777")
.emojis.create(
"https://www.bungie.net/common/destiny2_content/icons/eaa17a0ce79c7caa171ce1852ef27569.jpg",
"myTestEmoji"
);
});
is there something preventing https://github.com/discordjs/discord.js/pull/7200 from being merged? even the v13 backport has been, just wondering
well ive been busy
also its been approved by so many people, what's holding it?
All good sorry if that came off a bit blunt
nah that's fine
ok I just saw the comments monbrey left, seems like he was asking for a second opinion
nah he's right, you can never have an APIAttachment so you dont need the type
https://github.com/discordjs/discord.js/blob/988a51b7641f8b33cc9387664605ddc02134859d/src/util/DataResolver.js#L69 is where the conversion happens. It calls resolveFileAsBuffer which create a Buffer from a Stream if it's not already a buffer. Not sure how you're encountering this error
im getting the same error as well as using the docs example and an emoji link; honestly the reason it hasn't been brought up much is probably just this isn't really utilized
i'm surprised, i assumed emoji from urls would be more of a newb's path of least resistance
thank you though @zenith oracle, that explains the difference between stable
i'll drop a pr RQ i guess
ok ill do the changes monbrey requested then
wait what should cache type reducer be changed to then? collection?
Ohh yeah sorry, I didn't realize it wasn't present in main. It seems a bug introduced in the Dev version so, probably that's why no one has reported it yet
just plain collection and messageattachment
Collection<Cached, MessageAttachment> ?
no, Collection<Snowflake, MessageAttachment>
Cached is the generic parameter on the interaction class
the pr has a lot of unrelated style changes on the typings file
and the attachment option interface is not correct
when passing stringified json as the body to REST#post, i get the (python) error Only dictionaries may be used in a DictType from Discord. i'd argue typing RequestData#body as unknown is somewhat misleading because how was i supposed to know you can't pass through a string 
yeah you should probably re-run prettier on that, that should fix it @errant brook
is there a script for it?
it should just run when you commit
don't know how that even happened in the first place?
yarn format
typescript formatter does that
no idea i tried fixing with yarn format
i already did this
typescript formatter?
whats that
inbuilt vscode formatter
its the default formatter that comes with vscode
yarn format didnt fix anything
is your branch up to date? That script runs prettier and eslint
given there are not a lot of changes you could also just get away with rolling back the file and adding the changes back
I heard that discord.js will soon go modular
yeah
At what major semver exactly?
V14 I assume
But that is monorepo, does mono repo means modular?
Or I missed something
if you set it up to be modular then yes?
Essentially yeah many large parts of djs have been split up
can someone PR an update to discord.js's version of discord-api-types please? I don't really know how to update the deps on the monorepo so I'm scared I might mess it up
You've all the dependencies installed? It should format the file when committing or it won't let u commit. But if you don't install them it'll allow u to commit without running git hook
If your code is updated with main branch then default formatter shouldn't work as it's disabled in .vscode
Git revert? Ig you can just use reset --hard to delete previous commit right?
oh yeah it just hasn't been released on dev, my bad
could you release one maybe? Since the attachment option PR was merged
Ah alright
@zenith oracle how does using optional chaining fix that issue?
Whoops I commented in the wrong PR lol sorry

two tests actually, should be fixed now
Thannnnksss
Which style guide does discord.js follow ?
is it possible for someone to rerun the publish dev action? https://github.com/discordjs/discord.js/actions/runs/1840892663
is the plan for api v10 to be used in v14?
tis my hope
I don't see why it shouldn't
especially since it'll release so close to v9 deprecation date
will v14 be released before the message content deprecation day?
30th april I think
because if so, and api v10 is used, wouldn‘t that mean that bots that dont have access to the message content will be restricted as soon as they update to v14?
Don’t see how it matters?
v13 is on v9 which is not decommissions but only deprecated.
You can still run on that
Whether v14 is out or not
yeah it won‘t be a problem, just something worth noting rather since people might be wondering after updating why they dont have access to the message content anymore even though it‘s before april 30th
We're not doing those things for last day because it can result on many users realising they need the message content intent, which can lead to a large influx of requests for it, which... at the last day, is far from ideal
By doing so now, they'll notice and start applying over time, that way it makes the transition easier for both us (since they'll have an alternative) and for Discord (since the intent requests will be more spread out)
okay sounds good
I can already imagine the response to this but I’d honestly like to discuss this
Why don’t we undo the switch to builders?
Yes, maintenance overload by having to maintain the same thing in two places, fair, but discord.js will always need classes for every discord structure because it was built like that. Having those specific ones depend on a different package that uses snake_case has caused way more hassle than it could’ve solved (judging by the sheer amount of fix PRs that have been made since). If we just stick to one style (discord.js one) and keep the old classes, all this hassle would be gone and we could focus development on those classes only and not need to worry about complicated fixes for them. I personally don’t see a point in having builders at all but that’s personal and I won’t get into that. I think discord.js would gain a lot more by keeping its classes streamlined than having things all over the place with quick and messy fixups, but I’d like to know your thoughts
You think too much of discord.js and less in sub-packages
what about sub-packages? The hassle so far has only been in discord.js, the other ones are fine as they are
That’s been our sole goal for the last 6+ months
Having sub packages that make up discord.js
And we won’t go back
Why don’t we undo the switch to builders?
I think the major problem with builders is that it's almost entirely useless. Embeds, Formatters, etc. are exported from discord.js so there is next to no reason to even use builders in the first place. Add on slow zod validation and it's pretty bad for now.
that goal seems reasonable but I think you should look at the hassle that that has become. There are ways to do that properly, having all these inconsistencies and dirty patches is surely not one of them, so something should be changed IMO to improve maintenance overload while keeping functionality. It seems like the only goal you wanted to achieve with this has been the only thing this didn't achieve
I don’t even know what hacky or dirty things you talk about
But the ones exported from discord.js are the builders
They can be used outside the djs core for packages like rest or any other rest wrapper for that matter
Yeah that’s what I mean with most of you think too much in “discord.js”
Because that's the package we use and that's where the issue lies
Not in v14, Embed is a wrapper for builders' Embed and Formatters are identical.
Unsafe is fair, the getters were a good improvement after we’ve seen some usage
And allowing camelcase was always planned
So..?
We don’t reexport formatters in djs
I can’t remember if we use them
Wrapper for builder's Embed means its the builder's Embed
The wrapper only exists to add back camelCase support, maybe .equals() too
Tbh that should be replaced with the builders formatters
As much as I do agree with your initial point because I personally don't like builders, I dont see what's wrong with these PRs. Theyre just iterative development
What I'm trying to say is that there's been those 3 PRs so far to fix stuff, now there's also https://github.com/discordjs/discord.js/pull/7464 open which brings 2 more deps and another hack. Not to mention you currently have an extended class from builders on every component & embed, which by itself doesn't ease much of the maintenance cost
don't get me wrong, I'm not saying those PRs I'm bad, I'm simply referring to the fact that we needed those 3 and now a fourth one that is open to get things working like they were before, with a bunch of hacks
None of them are hacks either
that was my point 😛, by re-exporting them with minimal changes it makes having builders almost pointless.
Then your point is bad
they're fixes disguised as refactors, all of those PRs would be fine with the fix scope lol
of course something like equals could be handled by the user as well by extending the class
no it shouldn't
This is a very disingenuous argument, and makes an assumption that the builder was "broken" in its original state
why not? genuinely curious
No it doesn’t because builders still can be used without djs at all, which is a valid use case for any other js lib that isn’t djs.
it wasn't broken if it was meant to be used alone. If it's meant to be used in discord.js then yeah, it was very much broken
Its just iterative development
does another lib use djs builders?
Build something that can work alone, add additional features to bring up to parity
This happens all the time in the enterprise world where the 2.0 version of something won't have feature parity in it's initial release, but what it does have is done better
Because quite a lot of other properties have those methods and the point of semver is to only have to adapt your code to work properly on semver major changes. If you have an equals method in your code you will have to update it on every minor version that adds a new prop
thing is this isn't done better at all
it's better now
And I feel I need to remind you that you aren't using a semver major stable release yet
but it's still far from perfect
I think there are a minimum of people who use @discordjs/builders outside of discord.js
If these PRs were 14.0.1, 14.0.2, 14.0.3 because we released something broken, you might have a point
I know, dw
subjective
The point is that they can be used outside of djs.
that also means we can use them in other packages without importing the entirety of djs
then they should only be used outside of djs, and not inside, because they were not made with that intent and don't have the same features and requirements
using them internally is fine imo.. but to re-export them without the api consistency is different
👍
They’re raw classes built for extensions there’s no point in use writing code we’ve already wrote
I'm really starting to lose understanding in these arguments
But djs extends them with additional functionality to work inside, without breaking the standalone package. Problem solved, good design
They're re-exported in djs versions, if you dont want that version you use the standalone one
problem solved for the user, but you lost the point of easing maintenance overload which was the initial reason to make the switch as far as I'm aware
No we dont
In object-oriented programming, the open–closed principle states "software entities should be open for extension, but closed for modification"; that is, such an entity can allow its behaviour to be extended without modifying its source code
you don't if that new PR gets merged, which adds 2 more deps
actually builders work internally without the additions, the additions are for the user only
right now the only addition is to accept camel case which djs doesn't use
Well yes, but to work "inside djs" should also mean working for the user via a consistent interface
Something Rodry was particularly vocal about lol (and I agree)
Nothing wrong with dependencies
but its not consistent fully - djs accepts both camel case & snake case but builders only accepts snake
yes my bad
Guess what
They always did that
MessageEmbed always accepted both in its constructor
they're unnecessary and only used in 1 place, I'd be fine with deps if they actually served a purpose in helping things across the library, but users usually like tend to like a package better the less deps it has
They do serve a purpose
MessageEmbed was also used internally when an embed was received from the api
however it won't ever receive camelcase
Users who think less deps = better are not our concern
Never were
The argument is silly
Yes it does, when a user constructs one
I was mostly referring to the api
The library is an interface between the user and the api you can’t ignore the user part
You can when your point would be entirely wrong if you didnt though, apparently
why? More deps means more things to fetch when installing them which means longer install times as well as a bigger size overall when compared to the alternative that could be integrated within djs (and is rn in main). Not to mention the simplicity of the code which is much higher in the current version than the proposed version in the PR with the new deps
I thought it was pretty clear I was referring to the api only 🤷♂️
Which is only half the picture
and it would be 1 or less otherwise. These ones in particular might not be an issue but if you keep this mentality and keep adding new deps they will start to build up in size
not when builders are installed with discord.js and can be used by themselves
can be yes
If you really are concerned about size, add tsup to transpile the modules we use, tree-shake them, generate a source map and have djs be 1 file
Wouldn't it be preferable to add camelCase support to builders and then there would be no need to extend these classes in the lib itself?
And... https://github.com/discordjs/discord.js/blob/main/packages/discord.js/src/util/Embeds.js#L65 there is test instead of text
^ fixed by https://github.com/discordjs/discord.js/pull/7464
No, because builders are not camelCase, as a standalone item they mirror the API conventions
Within discord.js however, the extension adds an interface consistent with the rest of the library
I want to reiterate builders is open for extension. That means providing the minimum viable idea of what a builder is in its source package.
If all you need to do to add compatibility is wrap the constructor, I really dont see how that's an issue
That seems to be the overarching issue here - people with a different opinion on what a builder is than what it actually is
If you build logic into a base class that logic is hard to take out when extending
I personally don't like them but I still don't see the arguments made as valid ones
I also never use builders i always use json.
But I can certainly understand why it’s setup a certain way
same but once v14 is released any change will be semver major so might as well argue about it now
has duplicate properties with setters been discussed
I'm not expecting it to as that isn't how you guys do it from what i've seen
It would be inconsistent to say the least that we’d be moving away from modular packages.
Why are you guys so set on thinking we'll use Zod forever? lol
I'm not, but until the change is made it's still a valid point
Aren’t you using unsafe builders anyways?
I'm using json
But you were the one who pushed for unvalidated builders, right?
yeah
I saw something that would hurt dev ex and hopefully pushed for a better alternative 🙂
What's this, 1984? I have a project that needs to fetch a grand total of 34000 dependencies (thanks front-end!) and barely takes any time thanks to caching in yarn v3
I also have a project like that probably with less deps that takes about 4m to build from the ground up
More deps also means less code that needs to be built in the project, which means builds are faster
And what will you use? shapeshift, myzod or nothing?
Shapeshift
Well yeah but at the time you I brought the alternative of json for embeds and you stated you were already used to using embed builders. Idk ig I assumed wrong.
djs isnt TS yet but even when the change happens, builds on the library's side will always be faster than dependency fetching, you can't really compare the two
Without the outliers, Shapeshift is 3rd fastest, and the util.inspect overrides makes errors very clean and very easy to read, so no more "wtf is a ZodError"
I was at the time, but once validation was added I moved from them. This is a bot from august 2020 so it definitely had some old odds and ends in it
How often are you fetching dependencies rodry
Furthermore stack traces are also a lot smaller since Shapeshift uses iterations over recursion
Just out of curiosity why didn’t you move to unsafe builders
on my bot? Every time I push to update it on my host, which already takes 5 minutes and is close to the size limit (for other reasons of course, but I still wanna avoid making that worse)
I moved before they were a thing
I had one place where Embeds would be built and after that I just needed time to convert the rest
would you have used unsafe builders if they were available at the time?
I don't know tbh. Probably until I could convert everything to json
Don’t you have puppeteer installed on your bot?
Like that’s pretty big, that’s more of the issue than djs
I do yeah, that's the main issue, but still the second point stands, I don't want it to get worse
also how did you know 💀
eslint & typescript eslint is about 75% of my dependencies
Or prisma
Eslint is a dev dep anyways, but then again this is server side software, not a website
You don’t have to worry about page load times and things of that nature
And eslint installs lodash anyways
Kinda the reason people are moving to SSR so they don’t have to worry about bundle size
In fact there are so many packages using lodash, and the packages haven't seen a release in so long, chances are very high your package manager already has them in the cache
If you use yarn, which installs packages correctly, it's basically zero overhead in most cases
Even if they didn’t, 16kb like come on
Imagine complaining about 16kb, but not complaining about Chrome using half a GB of disk space
in my case chrome is essential for a big part of my bot, and like I've explained previously, the issue isn't in the 16kb alone, it's in the "dependencies are fine" mentality that adds up space over time when it can and imo should be avoided most of the time
I mean I don’t think anyone feels like writing another case-converter when one already exists and is battle tested
your "case converter" is just an object with properties in different casing
The art has already been perfected by people who aren’t us
Rodry, one thing
You know what's one flaw of the current converters? Like the object mappers we have rn in main, before the lodash.snakecase PR
I do 
I don't, what is it?
They use a lot more memory 
Because all properties are defined even if you pass a partial set of them
more memory than a function as complex as lodash's?
They're also incredibly deoptimised because they're megamorphic, unlike those transform functions
Oh I was thinking because they can cause a bunch of unintended overwrites when spreading
Right now, Embeds after getters use less memory than v13's MessageEmbed
But if we mapped every single object in Embed's constructor just like we do in djs main, they would use a lot more memory
Simply because it's an object with all the properties
but when you pass them to the builders class all properties get created either way
Whereas the transformer respects the input's partiality, and doesn't transform what isn't passed
They aren't
Not after the getters PR
Anyways what changes do people want to see out of builders? Asking for it to behave like the older builders wasn’t ever out of the picture, it’s just been an iterative process
Embed#addField to not take an object
also speaking of the getters PR, surely this isn't correct, right?
Embed#addField to not exist at all when we have Embed#addFields
sometimes you only need one
Which is entirely supported by addFields
It is but it can be done better
in an object form
Theres no >=2 constraint on rest params
but builders doesn't support camelCase ?
but it's much nicer to be able to do .addField(name, value, [inline])
I disagree, I like objects
It names your params, drops the need for a specific order
huh? I'm so confused now
wasn't the whole point to be just snake_case? Why do the classes exist on djs now
the specific order makes sense here because name comes first, then value, both required, then inline, optional
The classes just override the constructor to accept camelcase
Never said it didnt make sense, but I like objects anyway
What doesnt make sense is having two methods where one just calls the other one anyway
Yeah I’ve personally found objects to be better here
it does, for ease of code
Its easier to know one method adds fields to an embed
Objects are more portable than parameters anyways
And not have to switch between two fundamentally identical methods with different interfaces
Sometimes it would be a good idea to make a global vote and not just make a decision because you like it.
I mean that in a general way, because users and their opinions are also important.

That can be used as input but it wouldn’t be the final say
Also things like that neglect the maintainers pov
Theres a team of core maintainers, there's a large team of contributors, its one of the best open source projects I've seen, and these channels exist because discussion is welcomed
But its not a democracy
You can discuss, the core maintainers dont have to agree or adopt suggestions if they dont want to
it's not the best open source project if outside suggestions are alienated by core maintainers almost constantly
It's important to listen users too (you can't always do that), but with the addField thing, for example, I think it's perfectly fine as Rodry said.
Certainly, as I have already said, you cannot take these votes everywhere, but you also need to take users opinions and ask them.
Sorry you feel that way
I think we have a very vocal minority going against certain changes, the majority of them are very well received
It is open source because you can fork it if you feel otherwise
I've seen countless amounts of people saying they're scared of submitting feedback to discord.js for that same reason, so maybe sometimes that "vocal minority" might not be as much of a minority in reality
observations like these prove my point
I totally agree, I’m open to opinions. I just want to make to it’s a change that works for more than one person
I could make exactly the same claims in reverse though
Every time we get a complaint about something we changed people refuse to listen to the reasons for doing do, be it performance, consistency, easy of maintenance, whatever the reason might be
Theyre just mad that it changed
I didn’t mean that as a way of dismissing you I’m just saying the essence of open source is that’s it’s not exclusively owned
If it were up to users we'd probably still be on v8 syntax
Because any major change would be voted against
I understand that, that's why I said you can't always do a global vote.
some do, that's true and those don't really have a point most of the time. I think that because of those users, usually the first response to any suggestion is very hostile and poorly thought, because they assume it's gonna be one of those users and that it's not worth even thinking about it. The whole energy around PR reviews also isn't the best when compared to other repos I've seen (smaller than discord.js, I'll give you that), but there's a lot of room for improvement if they wanted to
What "energy" is that? Its the same as here, differing opinions. There's a lot of poor quality issues/comments/reviews too though
Never heard of something like public votes on something in the OSS space
Yeah sure, someone prs something
And there’s a discussion why they think it should be that way, but votes..? 🤪
not votes, but maybe PRs like this shouldn't be merged
which PR is that
I mean I don’t wanna be super political, but you know that most topics lately in politics go the same trend
But still get applied and go through
Case in point if we only listened to users we wouldn’t be able to move forward at all
Embed builders switch
it's kinda inconsistent tho, bc my components PR only got one thumbs down
the only difference is that in politics, people are elected. I think you would be able to move forward even if PRs have a high dislike count as long as they also have a high like count but I mean... that one is 15 to 1, it barely has any likes at all
yours was already halfway through the process so it's understandable and Embeds are more widely used too
Also keep in mind this is before unsafe builders were ever considered
Yeah but tbh it’s as rodry said, this isn’t exactly a democracy
We have our own design decisions that we take and move forward with
And sadly 99% of our user base doesn’t understand half of the things we do
it doesn't have to be as linear as "if it has more dislikes than likes then close", but for that specific scenario, maybe it should've been reconsidered or more opinions should've been heard
you shouldn't assume your user base is stupid, even if some seem to be
They only build bots and barely succeed in doing so, I don’t heavily trust the opinion of a beginner to make a good design decision for the long run
many of the dislikes on that PR aren't from beginners
This doesn’t have anything to do with stupidity but inexperience
I see what you mean but then again, only 1 person liked it
there's both sides of the same coin
It’s not like everyone uses that feature
Do you see any of us maintainers likes on it? You could easily add another 7 likes then
I do sometimes yeah
Then it’s 8:15, much more closer
but you're also slightly biased, it's good to hear external opinions
And we can disagree with those
Some of those arguments sound like we just do whatever lol
As much as I do tend to argue in this channel, I hugely prefer this discussion where people often make a case for/against a change rather than just object to it because they don't want to have to rewrite code
Or change their code style slightly
Which is how a lot of people react by 👎 on a breaking PR
Discussions like this just further deter me from engaging in others because it’s always the same outcome anyway because of the above mentioned

You can explain as much as you want, all the good reasons, make sure you get to 1:1 parity as much as you can and still get some dumb feedback because now it’s suddenly “unnecessary” and “hacky” and “a maintenance mess”, yet we don’t think it is any of this at all lol, and for us it should probably matter the most if something is harder to maintain than before
if you make an argument and the other side ignores it and continues saying stuff you've already explained it's fine to assume they just don't like it because it's breaking but not every breaking change gets negative feedback, so all I'm saying is that sometimes it's worth looking slightly more into the cause of the outrage
our past record of breaking changes begs to differ with that
Yeah I don’t understand the current outrage sorry
As much as I try to read into it
The embeds will have pretty much 1:1 parity with a single place to be maintained
is it known/intended that rest stable docs dont work? (failed to fetch docs file from github)
and https://discord.js.org/#/docs/rest/main/typedef/RESTOptions does not have the defaults
REST doesn't have a stable release, so yeah, intended
https://github.com/discordjs/discord.js/releases/tag/%40discordjs%2Frest%400.3.0 is not marked as a prerelease
looks like https://discord.js.org/#/docs/rest/@discordjs%2Frest@0.3.0/general/welcome also doesnt work
so there seems to be no way to view the docs for the release version
and ive already encountered a situation where the release version differs from main 
you mean files :)
but yeah, 0.3.0 was released before monorepo IIRC, so the docs build for it isn't in the right place
interaction?.message?.interaction?.commandName on SelectMenuInteraction as interaction works but commandName isn't documented
i mean why wouldn't it work? it's not going to error, just return undefined or some other value; what exactly is the issue, what's interaction, what does commandName give
the commandName for the interaction
theres no commandName on the SelectMenuInteraction object
and what's interaction? an instance of SelectMenuInteraction? in that case that should be normal
yeah
interaction !== interaction.message.interaction
I don't understand why thats normal
Yeah. I'm aware
hence why I have to use interaction.message.interaction to dig deeper for the commandName
the interaction and the interaction of the message aren't the same, commandName is well documented https://discord.js.org/#/docs/main/stable/typedef/MessageInteraction
well, you're going away from whatever problem you may have had then
how?
look I'm not going to debate semantics back and forth, I'm just reporting a problem
interaction has little to no influence on interaction.message.interaction
if this is what you had to "dig deeper", what was the original issue
Yeah hold up, lets not argue this one
I think the only issue here is that MessageInteraction#commandName should be nullable
right?
Because it wont be defined unless the interactionType has a name
Nah Im confused sorry, I dont understand what the issue is
should have commandName in the dropdown
I went into debugger and it is there
What's the type of message?.interaction here though?
I dont see APIMessageInteraction anywhere in the codebase
I'm on ^13.6.0
and I installed a few hours ago
Okay, yeah. That's because it's not a property of both types, so Intellisense wont display it
If you assert the SelectMenuInteraction as being from a cached guild, either by casting as SelectMenuInteraction<"cached"> or typeguarding using interaction.inCachedGuild() it should be detected
PSA:
Intellisense is not documentation. It displays most of the stuff found there, but don't forget that it isn't a full index of everything, but stuff that fits your current variable, especially in TypeScript.
Don't know if you're aware yet but the most recent dev release is deprecated
@tacit crypt since you approved, what's your opinion on this suggestion? https://github.com/discordjs/discord.js/pull/7320#discussion_r790155072
The move channels one? Its very..wack, setting positions has always been an annoying thing... I can sorta see the benefit for a shortcut but personally I'm neutral. Idk what the others think tho
Feels like you could create a base guild channel manager with those methods
Put set positions and fetch active threads on it
Have the guild channel manager and category children one extend it
But I don't really like where that is going so
The reason I didn't add it straight away is because it serves no purpose really and it can lead to misleading behavior since you could move a channel that isnt in the category to it
and I don't think that's the point of that manager, it's to manage channels inside that category only
that wouldn't work because the methods aren't the same
wouldn't help much
If the methods aren't the same then don't do it at all
don't do what
I'm personally against it as well, that method isn't even aware of its children
Wrong channel, @indigo bison.
whats the right channel?
None, I don't think we allow those things due to some issues in the past
yeah alright, will resolve then
Seems the stuff in that pr is documented as GuildChannel, should there be a new JSDoc for that without category channels?
For example, the create method in that new manager @returns {Promise<GuildChannel>} which includes a category channel, but that's not possible
I don't really understand how discordjs work
But it don't show me when it is triggered
What do you want to edit from it?
The problem with this event is that it only fire when we delete the event before it start
But it is not triggered when we press the button "Finish Event"
When it has been started
That's as-is from Discord, it's not a problem with us
You can verify your findings by using a debugger on line 8 of that action, for example in VSCode: https://code.visualstudio.com/docs/editor/debugging. With this, you can check if we're omitting messages or some sort due to a check failing
When you do that you’re not deleting the event, you’re finishing it
Is there any event for that ?
GuildScheduledEventUpdate (aka the same, but Update instead of Delete)
Ehh I could, is it worth it tho?
What would we call it
Do both classes take the same type arguments, @outer raven?
I assume they do, but I want to make sure
Well, I guess CI will tell us
they do, I tested it
also don't ask me why it says app, I typed apply suggestions from code review lol
that would require a class too
because the holds of that manager is GuildChannel which is also technically incorrect
if you wanna be 100% accurate that is
@outer raven definitely not doing a Kyra LGTM moment but... line 7 in the manager isn't right, it doesn't store their cache
Should I say holds instead?
computes?
Or just don't mention it at all
I think that entire thing needs rewording if we want to mention both things
I just copied the style from other managers
Because by itself, it doesn't compute the cache when the class is created, only when the getter is called
Could the test folders be renamed to tests? Having the tests show up at the very top of a PR isn’t very useful IMO, ideally you’d wanna see the changes first
If tests are being changed it should be reviewed too
It doesn’t matter
And tests and mocks are a sort-of standard folder name for those
Thanks discord
Not sure what standard that is because I’ve never seen any library name them with underscores. Also I didn’t suggest removing the folder, just renaming…?
I’m saying you can’t possibly review a test if you don’t know what’s changed
Seen them plenty out there
Probably not in good libraries then because this way you have to keep going back and forth in the code to understand the tests
That's because it's Jest's default, lmao
It's a weird Python-like convention, I have no idea why it's adopted in the first place
I agree, there is no point looking at the tests until you know what actually warranted the change
can't commit because of these errors even though I didn't touch those files, is there an known issue about this?
move into the root package and run yarn build then yarn install and see if that works
apparently just running yarn fixes it but I've done this 5 times today without deleting node_modules once so idk why this keeps happening
yarn v3's link command seems to be very complicated and isn't working for me properly and I also cannot find any documentation online. Could you guys make some sort of document explaining how to test a PR locally now? I used to use yarn v1's link just fine but now I'm stuck
npm link works for me
but it doesn't work with a yarn project does it
If you checkout a pr you need to make sure to run yarn install again or yarn build additionally
Because links or deps could have changed
I did, my issue is in the link command
I have no clue how it works and everything I try errors
Just link npm link usually
tried now and its saying the deps aren't installed even though they are
You just run link in the first directory you want to link. And then again in the one you want to link it to
You could probably also just try npm link
You wouldn’t have to use yarn to link I guess
I did ^^
From yarns documentation it’s just link + destination module/folder
do I run that on my project with the destination being the path to my djs clone?
Yes
the issue is that I'm using yarn v1 globally and the only project that uses v3 is discord.js therefore I can't link that way
That is indeed a problem
and I don't plan on switching because the new version doesn't seem any better to me than v1
would it be impossible in that case?
Could be
But it is better
Just use the node-linker mode instead of pnp
Now it’s basically yarn v1 but faster and more competent
what's that?
Yeah it did when I was testing v14
well it didn't for me cuz all dependencies appear as if they're not installed
Sorry for a dumb question but you are linking from the package dir and not the root right?
I am yeah
For npm link you go into the discord.js sub package
Run npm link
And then your project
Run the same command
the typings file is correct but full of errors
same tho, yarn 2/3 utterly sucks i wasted half a day trying to link djs dev branch, and it would link ok but every yarn install/add it would try to install djs deps to the remote folder's nested node_modules (despite --flat??) and then stop itself and fail
and npm module resolution chokes on those workspace: protocol deps. just an unfun mess. totally solvable but ugh.
The contributing guide says to run yarn --immutable which hasnt failed me and I have no idea how to use yarn, I always use npm
Im literally just following one instruction
@outer raven if you feel like it, you can take over https://github.com/discordjs/discord.js/pull/7448
since you moved it already
Do you wanna go forward with that though? I don’t really see a point since the name is always required when creating a channel and nothing else
Yeah probably if I'm honest
Theres rarely a case where you want a channel and no other options to it
True but usually the options object in djs is for optional stuff except some rare cases
this would be one
I could take a look at other methods like that and move all of them in one PR then
I understand moving the name into the options object, but not reason, because the name pertains to the channel/whatever while the reason will only be used for audit logs and is not related to the channel/whatever options
(Look at the edit() methods in that pr)
No, I think thats ok
Now that I'm looking at it there are other methods that are already doing that, so I guess for consistency reasons the other ones should be changed too
I'd vote for the others should be changed for consistency too
Psst @solemn oyster webhook handlers?
Changed to which?
Including reason in the JSON params
Ah yeah alright
Yes, what about it?
Isn’t it websocket?
We talk about webhooks more than websockets tho
True lol
@slate nacelle since you commented on https://github.com/discordjs/discord.js/pull/7472#issuecomment-1041330271, do you know how to fix the error? For some reason, PartialGroupDMChannel doesn't have partial set to true so I can't replicate the test. Could the type of partial be changed to this is PartialDMChannel | PartialGroupDMChannel?
also for some reason Channel#partial is typed as strictly false when it can be any boolean
it is false because partials structures have their own type, with partial strictly true
Isn't that test to ensure that the partial dm channel is included there?
I'm not really following what's going on in the PR and said test though.
I thought that AnyChannel was supposed to be all the channel types so that it can then be extracted from to create other types which is why I made the PR but that test specifically is checking for the type of lastMessageId in PartialDMChannel which isnt the same on PartialGroupDMChannel
PartialGroupDMChannel has no text capabilities.
The issue(?) there is that TextBasedChannel can't be a PartialDMChannel when not included.
So should I keep that interface and just add groupdm?
I think so
Alright, will do
Since more PRs keep appearing to v13 are we allowed to make PRs to backport semver minor changes before the next v13 release?
Sure
Yes
alright
I had these on a list that should probably be backported
I believe I saw a few others too, I'll take a look
Is it normal that Message.crosspost() RateLimitData (when using rejectOnRateLimit) returns 10500ms timeout instead of actual timeout (which is up to 1h)?
Is it actually one hour though? Or is 10500 accurate
When you normally hit rate limit and click Publish on Discord manually, it tells you for how long you can't publish (1h if immediate), RateLimitData will return 10500 regardless, I don't know where it gets that number from
It should be from the headers
I tried manually sending crosspost request and headers return actual timeout in data.retry_after
Though it's in seconds there for some reason instead of miliseconds
Oddly enough, when crosspost request is not rejected (but queued instead), it automatically publishes that message after the correct period has passed
The correct period being one hour?
It's 1h since last successful publish (since you can publish 10 max per hour per channel)
So if you try to publish another message 30 mins after the rate limit on that channel is already triggered, it will delay that one for 30 mins
Thats not how a rate limit should work to my knowledge
10 per hour, but if the last one is at 59 minutes you shouldnt have to wait a full hour for the next publish
I mean, I meant that above, just used 30 mins as an example
It won't wait 1h, but 30 mins in my example
Anyhow, I still don't get it where it gets 10500ms in RateLimitData from
It's possible, they definitely changed the timeouts with v9 because with previous API versions it returned retry_after in ms, with v9 it returns in seconds instead
Could be they changed more stuff with that
Yeah just thinking out loud
It even surprised me why they would return retry_after in seconds all of sudden (when sending crosspost request manually)
When I manually send the request, 2021.647s is about 33 mins
timeout in RateLimitData (in ms)
Manual request would be correct as that's also what client would show me
Okay i too am confused now
How come MessageAttachment is still MessageAttachment and not just Attachment?
Like the docs don't refer to it as message attachment
And with attachment options
I'd argue that's not really attached to a Message
Yeah now it makes a lot of sense to add to builders 
or it could just be left alone
But they can be used with slash command builders if they’re in the builders package
you can add to builders without removing from djs
It goes out the pattern too, like this is probably the only case where the Message prefix isn't being dropped right?
then you don't need to add UnsafeAttachment or whatever as well
We've done it already with the others
Why not with this? Why exactly should we leave this one alone?
Then we’re maintaining two classes with duplicated code
you have to maintain 2 classes regardless and i don't think attachment needs much maintenance
also would builders' attachment support Buffer/node streams?
when I made the undici pr the data resolver stuff was some of the most annoying to deal with lol
an extension of a class with most of its implementation already defined is much different than maintaining 2 of mostly the same class from the ground up
I can't check earlier commits but since the monorepo change 1 change has been made to MessageAttachment which is a jsdoc change
it's not really a structure that constantly changes
idk why im arguing because the unsafeattachment would be good anyways
im just wondering if it would support djs features
That’s beyond the point we want to be able to use it multiple packages without duplicated already written code. For example an HTTP interactions library.
I’ll have to investigate but if it can it should
also please support Blob and other new things please 🤞
Is blob in node now?
const { Blob } = require('buffer')
Ah ok that must be new bc I swear that wasn’t present before
since v15, backported to 14.18
it's very useful when using fetch, ie ```js
const r = await fetch('something');
const blob = await r.blob();
new MessageAttachment(blob, 'name.something')
Well yeah considering that standard fetch uses a blob
Will the undici merge add Formdata to the node scope?
Epic
it might be worth supporting blob like classes too, if someone is using node-fetch for example
${blob} === '[object Blob]' should be good enough to check if a class is a Blob
We’re still using node-fetch so 
ah right, mostly talking about v3 since they use a dependency for blobs
idk what v2 does, I assume Response.blob doesn't exist
I think it does
oh cool, they have their own blob implementation
So does that mean we can use node Blob without worry?
Well for our use cases at least
yes - I implemented in my original undici pr actually
I also took a jab at mocking with undici, and oh boy it’s a mess
I was hoping you made a little more progress than I did, but it definitely doesn't have the best api available
The ideal situation would be for nock to abstract their primitive interceptors to support both http stacks
But that’s a large refactor for them
I'm not holding my breath for nock support tbh. I think over time (and maybe some more interest?) the undici mocking will get better, but it isn't there quite yet
also with my latest pr the timing test in /rest failed again
It’s a flaky test if it happens I usually push an empty commit
Can't you re-run the action
You can push an empty commit to trigger it again
it'll be flagged in v16 as far as I'm aware
we aren't using performance on all the tests yet, maybe we should fix that
Took a quick look at this, we don't ever send the retry-after timeout in the rate limit data for some reason
Looks like this is being treated as a sublimit (which it kinda is I guess) and Discord returns normal ratelimit headers for the normal limit + retry after. Explains the weird queueing working properly behavior you were having too.
the test that failed on khafra's pr is already using performance
i believe a pr was made to use performance on those tests as they were flaky which is why i brought it up again
Also @golden mortar if you want you can try to take a stab at refactoring the message attachment builder
I don't have much free time until the weekend but I'll look into doing so 👍
@dawn merlin how should I handle files uploaded by people? should I just add a property to the class?
wdym uploaded like local file paths?
if someone has a Buffer/etc they want to upload
as it's not part of the attachment object but djs combines both functionalities
oh, well it's multipart form data I think it should ideally toJSON would generate that multiform data so the actual data should be in the class. Or at least have a reference to the data, and resolve its buffer in toJSON
since #7490 (raw message data) is a thing, could the message constructor be changed to public?
it can be really useful for extending the message class in a non library breaking way, and as easy to do as just new ExtendedMessage(client, message.data)
I don't see any issues with that 🤷 but idk what the others think
I don't know if this would work as Attachment also needs to send the actual attachment's data in toJSON, unless you mean to combine both of them? I'll see what I can think of as I work on it
If you look at MessagePayload#resolveFile you can see how it resolves the payload
I plan on returning a blob when resolved so it's spec compliant (formdata only accepts blobs and strings)
ah
idk how node-fetch's form-data works tbh
so more of toData rather than toJSON?
that could work, yeah
toJSON for the APIAttachment, toData for the attachment data
read my mind
does anyone know the max description + filename length for attachments?
thanks 🙏
using UnsafeEmbed or Embed on latest dev doesn't work, seems as toJSON is never called on the embed class
doesn't happen on 14.0.0-dev.1645056357.dee27db, just latest
like it's never called by djs?
or calling toJSON doesn't do anything?
I think I see the issue with unsafe embeds but regular embeds should work
neither worked for me, I didn't play around with it much
it was on djs' side
maybe I didn't use Embed? I don't know
Well the error is that it's checking instanceof Embed but UnsafeEmbed doesn't satisfy that
luckily Embed is a subclass of UnsafeEmbed so it should be an easy fix then
it should be isJSONEncodable(embed)
Shouldn't there be more ClientOptions alike failIfNotExists? It'd be interesting for the exception layer to be more customizable by the consumer
oh, didnt knew that. Thanks!
We do have a little bit of similar stuff in the RESTOptions for v14
https://discord.js.org/#/docs/rest/main/typedef/RESTOptions
e.g. the rejectOnRateLimit option
Which makes rate limited promises throw instead of queuing
So I think generally yeah we'd be open to more things of that style if its not disruptive to how djs needs to work
Coming back to this...
#archive-library-discussion message
I've noticed that the rateLimit event also fires with the same 10500ms timeout instead of full timeout
I wish if Discord add feature that if the message button expire time was ended up, it replies with ephemeral message "This button is expired"
Buttons don’t expire
I mean collectors
Usually when a collector expires I remove the button from the message so it can’t be clicked anymore
Similar to what I've done, but like uh.. forget about it
whats the reasoning for typing getters as readonly instead of getters?
Wdym? Getters are read-only...
right but why don't you make them actually getters
That notation didn't exist when the typings were made and there was no reason to switch is what I think.
Is there some advantage of switching?
correctness, i suppose. denoting them with get tells us that it will return an evaluated expression, which isn't necessarily the case with readonly
There may be a readonly property out there that isn't a getter but maybe those are typed differently so if that works you could probably change it ig
and I just did the test and seems like some properties are typed wrong and having them typed as actual getters will tell you that
When I was adding commit, I saw git hook is running format test in all the files, which takes a few seconds. So I'm asking why u don't use lint-staged and only lint the files which were modified instead of checking all files.
Won’t work in our setup
Same problem, was going to be a simple fix until I realized there’s a bigger issue at hand here
I see. If there is some other way I can help you, let me know
I will make a pr then
is this undocumented for a reason?
I don't think so.
Any reason why Partials is an enum? It's only used as strings so I think it could perfectly be an array? Would also make it easier for us to specify all partials
It’s pretty inconsistent to accept the gateway intent bits as an enum but not partials
no it's not because those two aren't related at all. Intents is something from Discord, they only accept them as flags, while Partials are something from discord.js and is only used as strings, the numbers don't mean anything (and if you provide numbers it will error out)
Yeah but we’ve moved away from using strings as representing a subset of values. Just because the api doesn’t use partials data doesn’t mean it’s not inconsistent with the rest of our library api
but there's no such thing as a partial flag and there doesn't have to be. You moved away from strings because discord uses numbers. If partials are made up, there's no reason to make them hard to use
They’re not hard to use at all
makes input much longer and there's no way to add them all at once
We moved away from strings because we didn’t want strings
Just to correct that statement
well that's not true yet, lots of things still use strings on the library, but you're not benefiting from using an enum in partials at all
other bitfields are resolved from an array of flags into a single number and partials are still used as an array
so checking if an array includes a number or a string is the exact same thing
- the numbers have no meaning, 0 could be User or Channel
That’s why you don’t use magic numbers
exactly, that's why you don't use magic numbers
Yes hence enums
did you read what i just said or
you're not benefiting from using enums in this particular case at all
so checking if an array includes a number or a string is the exact same thing
It’s the same thing it sounds like?
And the magic number argument still doesn’t make sense
the only reason you are moving away from strings in other places is because discord doesn't use strings, they use numbers
so you have to transform them
discord is agnostic to the existence of partials, so you can use whatever you want
Idk why you decide that for us rodry
I don’t want strings in the lib
I will say it till people get it
but why don't you want them
No matter if it’s OUR Interface or discords
isn't it for the hassle of converting them back and forward
partials isnt even a class
its just an enum
it's impractical to use
Because if you use 90% of enums to interact with discord, and then 10% strings, you might as well have a consistent interface
It’s basic api design
right now you don't have a consistent interface
Also the only reason we use strings is because some bitfields have bigint values which can’t be used as keys in objects
Not “all at once”
there was a PR to convert them "all at once" but alright, I'll do sth else then
Which PR was that?
So the PR before the other 4-5 prs changing things to enums?
that pr needed like 5 more to fix all the stuff it broke
Even then it was expected that pr would have bugs and we were ok with that since it’s in dev anyways
Otherwise it would’ve been stuck in rebase hell
Seems like we can no longer provide an object to SelectMenuComponent#addOptions or setOptions, can this be fixed?
Should’ve been fixed by:
#7466 in discordjs/discord.js by suneettipirneni merged <t:1645142675:R>
feat: add missing v13 component methods
nope, it isn't
actually seems like that was fixed but it isn't in the latest dev release for djs
Should be, the latest version has the same git hash
discord.js has these versions in its dependency list and for some reason they don't resolve to the latest dev release
I currently have 0.13.0-dev.1644797188.0dfdb2c installed
Probably due to cache
how could I update them then?
You’ll have to use resolutions
how?
I'm using yarn v1 on my project so it should work?
