#djs-in-dev-version
1 messages · Page 7 of 1
So is that a "should only runtime-check function parameters"?
The falsehood check in equals() is a bit strange – doesn't really seem to fit any specific paradigm, and just prevents falsy values from throwing at runtime, which probably decreases debuggability if anything
Well, an equals() method should never throw imho. It should accept any type and simply return false if wrong. So sounds like correct design to me🤷♂️
if so, then it should handle truthy objects that don't have Map properties/methods, n'est-ce pas?
And all methods expecting a function as parameter check for it being a function before trying to call it.
not all of them though, as mentioned sort doesn't do that, toSorted doesn't either
Because <Array>.sort does it for us nvm, it doesn’t
ah, makes sense then
yeah it does
node 20 though, not sure what the lowest supported version for collection is
or well it also says it accepts undefined which isn't a Comparator
I don't think it's an issue though given compareFunction has a default value
But we don’t actually pass the compareFunction to <Array>.sort there. So it won’t ever error with that
ig it got ignored, can't blame anything for it; there's also a reference in GuildManager but its in listeners so it passes
Can you clarify on your reasoning for that first sentence? The second one was indeed already discussed internally and we‘ll probably make the ping getter return null instead for before we got any latencies from gateway
There are events being attached to ws in shardclientutil, but ws itself is initiated after shard, so it errors
Right, would you mind opening an issue on GitHub? That’s indeed an oversight I made
Ok, sorry I didn't open initially because I thought it's for stable releases
As long as you state it‘s about the dev version/main branch it‘s okay to open an issue
But I‘ll probably draft a PR to fix that tonight anyway
Comments on commits are indeed not the right place for these kinds things though. Either here or an issue
My apologies, I'll come here
shouldn't these follow the "A manager for the X" format? similar as other djs objects
the current descriptions make them sound like they're collections or maps
Was it fixed/unmerged/rerebased/whatevered?
Iirc that's the one that got merged unintentionally early
#10553 in discordjs/discord.js by almeidx merged <t:1728684717:R>
fix: rebase fail
It was
Ah 
oh yeah looking now at main
it's actually a mix of both now lol
channels' description got reversed but the others were applied
(the original pr did change channels)
Half of the change to channel‘s description went through though. Only the change on the first words didn’t
Sorry to labour the point. It sounds from your description of what this method should be, that its semantics are along the lines of equals(collection: unknown): collection is Collection<Key, Value> (accepts any parameter and returns whether it's a Collection with equal contents), rather than equals(collection: ReadonlyCollection<Key, Value>): boolean (assumes that the parameter is already a Collection, and just checks its contents)?
The documentation doesn't currently suggest this, so just wanted to clarify
This is mixing two different things though. One is the types it accepts in ts. The other is about the values it accepts in runtime.
I'm using TS type notation there just to convey the idea
@meager crag a few things regarding your Collection PR:
Thank you for the * -1, I got surprised to see that, although I’d probably include in the PR’s description that it’s to avoid accidentally promoting 0 (SMI) to a double.
I haven’t double checked with the spec, but does new Array(n) create an array with n holes (aka .length is n) (also internally tagged by V8 as HOLEY_VALUES, same as before, which is undesirable) or an array with a capacity of n (PACKED_*, very optimised and desirable)?
Regarding the slices, can’t we make it a combination of skip/drop to the start, then pick/take the amount of items until the end? It can be implemented spec-compliant like this.
I haven’t double checked with the spec, but does
new Array(n)create an array withnholes (aka.lengthisn) (also internally tagged by V8 as HOLEY_VALUES, same as before, which is undesirable) or an array with a capacity ofn(PACKED_*, very optimised and desirable)?
It creates the array as sparse, ie. withlength: nbut with empty items. The only way to create a PACKED array here is to useArray.from(), but that's significantly more expensive for the reasons alluded to. HOLEY arrays still do have access to many fast paths, and I wouldn't imagine (but have not tested) that any onward performance difference in consuming the array would outweigh the 10-20x longer it takes to create it, in the majority of usage cases.
Regarding the slices, can’t we make it a combination of skip/drop to the start, then pick/take the amount of items until the end? It can be implemented spec-compliant like this.
Are you referring tolast()? In which case, this actually turns out to be slower.
By definition, a manually iterating process forlast()has to iterate over every single element in the collection (first to skip over the unwanted values, then to grab the wanted values and append them to the output array). However, running iterable-to-array on the builtin map iterator returned bythis.values()appears to be approximately twice as fast as this in V8. I ran a few tests, but it seems around 50% quicker just to perform the iterable-to-array and call.slice(), rather than hand-cranking the iterator.
If you're able to find a trick that I haven't, then I'm all ears!
The only way to create a PACKED array here is to use
Array.from()
Should have said "the only way to create a PACKED array of sizen". It's obviously possible to create an array of length 0 and then sequentially define its elements – this was the original approach I took, but on testing, it's around twice as slow as starting with a length-nsparse array, presumably because it has to updatelengthwith every new element added.
Just curious, may I ask how you benchmark your code? @meager crag
I find it a bit suspicious that drop+take would be much slower than making the entire thing into an array and then slice, or in the case of .last(), just dropping (hand-cranking) until this.size - amount and then spreading the rest of the interator into an array.
There is a fast path for spreading built-in map iterators (https://v8.dev/blog/spread-elements#spreading-strings%2C-sets%2C-and-maps) so it's perhaps not too surprising.
Oh, I don’t remember reading that one
I'm just using benchmarkjs to test these over collections of size 100-10k.
The other side of this is that there comes a point where first() is actually faster if it just generates the iterable-to-array and .slice()s it – this crossover appears to be roughly amount >= this.size / 2. I didn't think that conditional paths were necessarily a route worth going down, but it's interesting nonetheless
why
tag suggestion for @tight delta:
Errors such as ECONNRESET, ConnectTimeoutError, SocketError: other side closed indicate a network issue
- Free or shared hosting providers often come with significant limitations
- Another indication of these issues are 'Unknown Interaction' errors.
Also not related to the dev version
What should I do
nothing we can do about it
Check your DNS
Is there a way to forward a message in dev version?
No, I think that might’ve been something I missed in my PR haha
well, as long as the api supports it, there is always the "make the rest request" approach you can take
if you want to use a feature a lot throughout your code base, you might want to consider wrapping it in its own function and swapping the implementation of that once there is an official release
if you use client.rest you will share the rate limit handler with your client instance and should be fine
-# not applicable here, but as a general caveat: functionalities that are not documented by Discord may be removed or changed at any point in time without prior warning or respecting semver. this is why we try to not prematurely merge PRs and recommend you thread with caution.
-# also note that we are unable to help with custom implementations, unless you specify and show said implementation
Is there a function to check if a user has forwarded a message? I want to create an anti-link system
are you using the dev version?
Yes
#10559 in discordjs/discord.js by TAEMBO opened <t:1729060706:R> (changes requested)
feat: forwarding messages
it hasn't been merged yet, you can follow the pr
Message#messageSnapshots @main
The message associated with the message reference
I think this would be what's being looked for. If its size is greater than 0, then it represents a forwarded message
oh there were 2 different pr's for it, mb
^
@tawdry mantle what do you think about event maps for BaseClient et al? It would peg users to @types/node versions since EventEmitter was made generic (about a year ago iirc) so would probably have to be a major version change
yes, not yet. Next release of main will be a major at this point. It's been in since very end of Feb. The problem right now is that we can either leave types/node where it's at and support TS <5.6 or update and I think break everything <5.6 (the iterator changes appear to cause some issues, at least when testing, it may not be a real issue in user code) Apparently the person testing didn't notice the new namespace for iterators, using that is the way
The only reason I want to wait is to ensure that the new changes are stable (not logically, but because they are a bit controversial) and probably your refactor PR to merge.
Aye, the iterator changes are backwards-compatible with TS <5.6 but make it very difficult to override iterator-returning methods downstream (which fortunately isn't necessary if using an event map).
Related, those static method overrides from #10360 now break the latest @types/node, so probably need to be removed for v14 as well
I proposed adding instance methods to BaseClient to provide a strictly typed way of calling events.{on,once} without clashing with @types/node, but there's not much of a case for having them once those functions work as expected.
Might be that the simplest option is just to remove the overrides now and accept un-narrowed types for those functions until v15 (or whenever)
#10584 in discordjs/discord.js by Qjuh opened <t:1730377338:R> (review required)
types(discord.js): bump @types/node version, use EventEmitter generic
guys, there's no event called "SUBSCRIPTION_UPDATE"
what does that event refer to?
when to subscribe and cancel
where is it documented?
I don't think so..
are you talking about entitlements?
discord just talk about it in their changelog
yes
Are you talking about in the Discord API or in d.js?
this comes from the discord api, but I would like to know if it exists via d.js
(event) Client#entitlementUpdate @14.16.3
Emitted whenever an entitlement is updated - i.e. when a user's subscription renews.
We alr have it in stable
#10541 in discordjs/discord.js by sdanialraza opened <t:1728310595:R> (review required)
feat: add subscriptions
Still being worked on ^
exemple
When a shard resumes saved session, is it supposed to emit a clientReady? in my case, it only just logs that the shard resumed but it is not responsive thereafter
are you actually using the dev version
yes
im trying out the integration of the /ws library in mainlib with worker sharding strategy and the session saving methods
right, ok. i dont remember exactly what we did with the client events
@steel haven
this is not reproducible with the microservice using /ws so i guess this is a flaw on mainlib?
are you resuming on a fresh started Client or is it just a resume of a client that was logged in before?
and /ws itself has no clientReady event, so of course it's not reproducible with that
do we handle the former
we might indeed not do that, now that I look at the code
i feel like i looked at this before but forgot to say anything
or did but forgot and no one saw
this might need a rewrite of parts of the login logic though, because some shards might resume while others need a fresh connect... ugh
hm? why's that an issue the shard itself decides what to do
don't we have a tracking problem at-worst
we have a bigger issue. Guilds don't get sent on resume, so the current notion of Client#guilds has all guilds the bot is in when clientReady emits would fail us
latter
then the clientReady would've already emitted and the client should simply remain ready, what did you expect it to do that it didn't?
it did not emit though
but you said the client was logged in before, at that point in time it would've emitted, right?
the shard that resumed from the saved session is unresponsive for some reason
sorry i may have misunderstood your question
the former
i was multi-tasking sorry
i did not read the question properly
walk me through what your code did when you started it. You call Client#login(), and it (tried to) resume at that point in time with a stored session? only for one shard or did all shards have a stored session?
that is indeed an issue with current dev version of mainlib, yeah. see the above discussion with DD. and it would need some thought on how we'd approach and handle that
riiiight
we're screwed i think
was there a reason why OmitPartialGroupDMChannel<> wasn't added to the parameters of messageUpdate?
It's already there on main, so your question is outdated
ah, okay
That’s an error with your file paths, and not related to the development release of djs at all. #1081585952654360687
shit do u know any sloution
Ask in the mentioned channel. Not here
where
The only channel I mentioned: #1081585952654360687
Hey, i found that on discord, is it available on djs ?
That would help a lot for invite loggers, avoiding any error
bots do not have access to the members tab
I recently changed to a dev version of discord.js (15.0.0-dev.1728475516-c36728a81) due to the lack of api support for forwarded messages in the stable release. After proceeding with an upgrade of the dev version, from 15.0.0-dev.1728475516-c36728a81 to the current latest dev build 15.0.0-dev.1732017912-98153baf9 I have encountered the following type discrepancy:
Code
await interaction.deferReply({ ephemeral: true });
Error
TS2769: No overload matches this call.
Overload 1 of 2, '(options: InteractionDeferReplyOptions & { fetchReply: true; }): Promise<Message<boolean>>', gave the following error.
Object literal may only specify known properties, and 'ephemeral' does not exist in type 'InteractionDeferReplyOptions & { fetchReply: true; }'.
Overload 2 of 2, '(options?: InteractionDeferReplyOptions | undefined): Promise<InteractionResponse<boolean>>', gave the following error.
Object literal may only specify known properties, and 'ephemeral' does not exist in type 'InteractionDeferReplyOptions'.
Did I miss a change in how the ephemeral flag is passed to the defer request?
interaction.deferReply({ flags: MessageFlags.Ephemeral }) would be the correct way now
Yes, that works. Thanks a lot for the quick response.
is v15 gonna be the TS rewrite?
There's no specific version for TSR
It's unlikely to be v15
maybe vX, X → ∞
Sounds like a mathematical problem which we have to solve
can we just put the Ephemeral code ?
and what are the differences between 14 and 15-dev ?
I don't believe there's a comprehensive change log for dev yet
Feel free to check out the commit history
mb
It’s fine. We generally don’t make the list until it’s closer to release
In-development guide
https://v15.discordjs.guide/additional-info/updating-from-v14.html
What made you all decide to remove ephemeral completely and now you have to specify the flags instead? This seems like a strange decision since just specifying ephemeral seems way easier
Everything else is great though
Is there that much of a skill issue gap between ephemeral: true and flags: MessageFlags.Ephemeral? 🤭
Specifying ephemeral means discord.js would do MessageFlags.Ephemeral internally. They both achieved the same behaviour. You can use it right now in version 14. However, since ephemeral is just one possible flag, it may set a precedent that all possible flags should be booleans, e.g. ephemeral is here, why not suppressEmbeds too?
It also begs the question of what happens when you're using both flags and ephemeral. Which one takes priority, especially if you're dynamically/conditionally using those properties? Don't think you'd know that off the top of your head without testing it out. It's better to just have one simple way of doing it, and flags is the correct way of doing it instead of listing every option out as a boolean
I think it’s a qol thing rather than anything else, but you do give a great example of priority, I guess I can’t argue much further
#archive-offtopic message <- and this is also a possibility lol
Thanks for responding, and great work on everything
as much as them adding selects to modals at this point 
StringModalSubmitInteraction
It also begs the question of what happens when you're using both
flagsandephemeral
um, the same thing that happens when you're using bothcontentandembeds? they get added together into single thing?
it may set a precedent that all possible flags should be booleans, e.g.
ephemeralis here, why notsuppressEmbedstoo?
yeah, why not?
um, the same thing that happens when you're using both content and embeds? they get added together into single thing?
this makes no sense / is a null comparison. they target diff. properties on the underlying prop sent to the API
yeah, why not?
not great when new flags are added, inconsistent with other APIs, sending viaflagsis already easy enough
in general my sentiment is that methods that make API calls should do less magic and instead we should have more tools to help build the payload where complexity is high (like our bitfield helpers in this instance)
no magic props that don't actually exist, no props that influence other props within the method's body, etc
this makes no sense / is a null comparison. they target diff. properties on the underlying prop sent to the API
they are placed on the same message. sure, they don't collide with each other, but how many people here even know ephemeral is a flag to begin with? like, i don't understand why having everything be additive into the resulting message so far would suddenly makeflagsandephemeralexpect people... what? to not be additive now?
what happens if ephemeral is set in flags but you pass ephemeral:false?
Can you not do that already though? I don’t think I’ve seen one case where anyone has had that problem
-# regarding ^, do people know flags exists?
I’m still on the side of keeping ephemeral purely for qol, but I do understand why you removed it
ultimately this is a case where I think by metrics I consider to be objective, this change improves the code you write, even if you're "missing qol"
and I'd reckon everyone else that pushed for this feels the same
if you only care about quickly prototyping changes like this suck as they add up, yes
I’m not too sure, I do feel that we’d get a decent amount of people running here complaining.
but fundamentally discord bots are usually large and complex, so its good that we do those things
yeah but this is what I'm saying, I don't care
this is more correct, so it should be this way
I guess if that’s how you feel then there’s no point arguing, since you ain’t gonna budge because you don’t care about qol
sometimes we make compromises, but those in internals know I've been an advocate for removing send(content: string) too
I'm all in on the "lets make it right" side, there's counterbalances/people on the "lets just keep it high qol" side
in this case the former won out
yea but thats the cool part, its not about me
if enough people decide we should actually keep it it'll get reverted
i'm just voicing my position
then why say you don't care instead of we don't care (as in: peopel who pushed for it)
Make a poll 🤷♂️
because its.. my position? the people that have pushed it could include others that have changed their minds
Removing .send(“hello world”) makes hella more sense, as well for internals. Removing ephemeral, idk, to me doesn’t seem as reasonable
they are both qol properties/overloads that differ from actual API representation though. I'd argue the opposite: if any of those two should be removed ephemeral should be first before send(string)
send string makes more sense, djs can just throw an error if you don’t send an object. Ephemeral, I’ll go back to my point before, I don’t believe anyone has come here before saying it doesn’t work because they sent both flags and ephemeral
The reason for that is probably because the second most used flag is usually done via a helper method in an edit
Message#suppressEmbeds() @14.16.3
Suppresses or unsuppresses embeds on a message.
That's really interesting, my first time seeing this
what flags are there? and can you set multiple at once? 
I guess you'd just put them in an array?
you could. but in the end it's a bitfield. just like permissions, intents, etc. so you can also just use bitwise or | to combine them
I see. So it would just be something like this? 
interaction.reply({ flags: [MessageFlags.Ephemeral, MessageFlags.AnotherFlag] })
oh man. that's a
moment
some cool changes in there! looking forward to the breaking changes
that would work yes, but unrelated to this channel, as it also works like that in current releases
I'm surprised I haven't seen anyone use this 
I'd have switched over to that a long time ago if I knew ephemeral: true would be removed
because there's only 3 flags at the current moment that you can set
Ephemeral that exists for years, SuppressEmbeds that only ever gets used as an edit to a message (personally i wrap urls with <> instead, if i send any), and SuppressNotifications for a silent message which is relatively new
will
interaction.deferReply({ ephemeral: true });
also be changed to
interaction.deferReply({ flags: [MessageFlags.Ephemeral] });
?
Not sure how these flags function in relation to deferring, so asking to make sure.
Yes of course.
🙏
when will ths happen
v15
fair
Is there a general vibe of when v15 will come out? Obviously its early days but trying to get some type of idea of when I'll be able to use Deno since the ws@2.0 stuff is only going into v15, just wondering if we're looking at 6+ months or if theres some specific feature thats going to be the holdup or if its just a "whenever it feels right" type of thing 
The general vibe is always "when it feels right" but given that we've already started work on a v15 branch and a change guide, I wouldn't expect it to be more than 6 months.
But we never know 😄
does @discordjs/voice is compatible ?
Compatible with what?
v15-dev
Maybe. It's development, it can just change
Might be that recurring gateway voice dispatcher type error thing or whatever it is
okk ty
is the ready event different in the newest dev ver
is there a particular reason you ask?
its clientReady now..
there is also https://v15.discordjs.guide/additional-info/updating-from-v14.html you can reference, it should be mostly up-to-date
its not there
Thank you both appreciate it
(i did say mostly
)
@uncut kelp
Ahh. Looks like the documentation needs a quick fix? It still says ready
https://github.com/discordjs/discord.js/blob/bd7a99571793dad699acd3b6fec74109c04b3242/packages/discord.js/src/util/Events.js#L15
mmmmh
i cant really remember when we did this
i'd imagine qjuh's big PR that got rid of the compat layer for ws
was probably missed back then
yup
Yeah so just purely dev version. Just needs a quick documentation fix and a guide note. Thank you for clearing that up (':
its even in the list in the commit body
I thought I could get away with just referencing the pull requests, but obviously not (':
message.guild.roles.cache.get(r.role) can u no longer fetch role like this?
you have never been able to .get() anything without using the id
This has not changed in the dev version
is guild.bans.create() gonna be removed?
That's the main way to ban a user
Why would it be removed?
i vaguely remember seeing somewhere that it is gonna be removed
Seeing someone saying this has to be true
It's not
-# (Should be ironic)
Voicing my opinion on this: I believe this should be reverted. Overall, I don't think the flag pattern is great.
In IDEs, it's easy to see what you can and cannot do when it's a property on an object. Hiding it in a flag array does not positively enhance the developer experience.
But that's just my opinion, you can cancel me for that
What you described as easy for you is not maintainable. That logic then follows booleans should be made for flags everywhere. Perhaps it's something you should adjust yourself to. There's always documentation too.
Also, flags is a bit field
Also, flags is a bit field
Flags (which are indeed bit fields) are set on a bitfield array - Which is what I am referring to.
I don't understand why a level of abstraction of which flags are applicable to what is a bad thing here.
See my image below: are all flags applicable to (e.g.) an interaction reply? If not, which? How do we know?
In an interaction reply, only Ephemeral, SupressNotifications and SupressEmbeds are valid (if I am not mistaken).
Why is having that as an abstraction unmaintainable?
It's the same level of maintainability as specifying the types for the flags. Here's an example of the InteractionReplyOptions
Flag options are manually typed, based on which are applicable to a specific interface's flags.
export interface InteractionReplyOptions extends BaseMessageOptionsWithPoll {
tts?: boolean;
ephemeral?: boolean;
fetchReply?: boolean;
flags?: BitFieldResolvable<
Extract<MessageFlagsString, 'Ephemeral' | 'SuppressEmbeds' | 'SuppressNotifications'>,
MessageFlags.Ephemeral | MessageFlags.SuppressEmbeds | MessageFlags.SuppressNotifications
>;
}
It's the same level of maintainability as specifying the types for the flags.
it's not, hope this helps
it's less than half the work
"intellisense is miss-leading me" is also not the strongest point here
Yeah, that was not at all the point
Either way - I was voicing my opinion, as was welcomed earlier on.
In my opinion, Discordjs should try to abstract more, rather than actively devolve by removing abstractions that are widely used.
You could always do this if you don't want to use MessageFlags
Sure. Still not a fan of the "flag-pattern" - But that is indeed better
I think I've made it pretty clear that our goal is not to remove abstraction, I just believe that it should be introduced in a way where we aren't lying about the inner structures of the API. Resolving from more convenient types into the actual payloads is an okay transformation, but straight up taking in propeties to an API-call method that aren't actually on the payload, is IMO, a no-go.
Why does the structure of the abstraction need to adhere to the structure of the API?
But perhaps we just disagree about what level of abstraction Discordjs is/should be.
Sounds like you’re saying it should be a thinly veiled wrapper on top of the Discord API. If that’s your mindset, then I can see where you’re coming from - despite the fact that I disagree.
not at all, @discordjs/core is the thin one
the reason is simply because we can ultimately do it without much compromise (e.g. this prop removal is imo, deeply insignificant) and in the past we've been hurt by not doing it multiple times, often in ways that couldn't be resolved without a major version
I also just think it encourages you to write better code (being friendlier to the ecosystem and newcomers (in terms of the API) as a whole, for instance) and also helps you in the long run
if our standard becomes to adhere to the API where possible, it becomes pretty unlikely for us to change those interfaces on our end over time
those are benefits I can name for the user end, for us internally, there's more
It's a deeply insignificant change to you as a library contributor, because you have a deep understanding of Discord's API and Discordjs.
It's vastly beneficial in terms of QoL, especially for new people that are just starting out, and exploring the library.
How is it vastly beneficial? How would someone new to the API even know ephemeral messages are a thing, if not from our docs/guide to begin with, that has been/will be accordingly updated to specify how you do that?
seeing it as an explicit option for example
right now the only reason the word ephemeral even exists on docs for the flags is because we're either doing in-place extraction out of MessageFlags to extract the 3 settable one of out however many there are, or because for the exact same reason on old docs we are kinda obligated to say that you can only set those 3 flags in an info block.
current docs show the entire in-place type, while old docs just say MessageFlags
"intellisense is miss-leading me" is also not the strongest point here
I understand that you don't like intellisense, but it's massively beneficial when you're just getting introduced to a new library.
Seeing ephemeral as an explicit option that you can use on thereplymethod - I'd even argue forsupressNotificationsandsupressEmbedsbeing added
Sorry, meant reply
but they can have the other 2 flags
adding those as well would polute the type way too much imo
Would it? I think it'd be fine.
it's not like they'll be the last flags discord will add though
they aren't individual fields in the api, they're in flags, so I'd argue they know why is that and it's not that unreasonable to move it there to be more consistent with the api
but rn we're already mingling into that a bit
there's also the conflicts that were mentioned, eg what would be the expected behavior if ephemeral is false but it's set in the flags
we are extracting the 3 currently settable ones out of them all, with an in-place, unnamed extract
i'd argue for naming that extract and using that as the type
yeah it'd be better if it was named imo
I seriously think the conflict thing is a non-issue.
If flags really need to be kept, then that should take precedence as that is the more specific one.
But flags are bad
"bad" why
what if it's explicitly set as false though, not just non present
For a non-core library I don't believe it lends itself to any good abstractions
But what I think does not matter. I am just voicing my opinion
well, wouldn't that mean that we would need to replace all bitfields with just objects with boolean props?
admittedly, not like you can set user flags, but those, as well as member flags and permissions, are just bitfields
intents are also a bitfield
we do abstract over the bitfield itself
but by allowing you to do more with it, not completely changing what it is
I don't see the issue with abstractions tbh, at most it's more verbose but it isn't hard to understand
your issue here started with a bit misleading intellisense, and i'm arguing right now for a way to fix it - taking a narrowed SettableMessageFlags or however that would be called, instead of the entire MessageFlags
that would solve your original issue without having to use string key names of the fields (which we resolve for you in such cases)
additionally, note that we also allow passing arrays of bits*, you don't have to do bit operations yourself. that's for an example of how we do some abstraction
* bitresolvables, more precisely. which the string key names are
I'd also argue that it's better to have it in an array, since there's only two states for it, it's either set or non set
an optional boolean makes it three possible states, true, false or non set
in this case false and non set are the same thing
so we might as well just follow the way it's designed in the api which doesn't have that issue
i meant "spreading out" the props out of the bitfield into the outer object
so like new Client({ guilds: true, guildMessages: true, messageContent: true }), like in the case of reply({ ephemeral: true })
-# (though this example is kinda bad, there's no way we wouldn't wrap those into their own intents object, at which point...)
Hello guys, i'm here for latest update asking - we still can't not use bot to forward a message to a User or Channel correct ? The reason i prefer Forward more than crossport/publish or basically fetch and resend the content is that the Forward giving the receiver the message link for user to come directly - which is super useful for message that have button
there is a PR for it, so it will be added in the next release
Can you share a link ? i tried Ctrl + F the "forward" keyword but can't find anything to confirm anything
PR stand for Post Release right ?
pull request
So it 100% will be added or just hopefully will be added ?
#10559 in discordjs/discord.js by TAEMBO opened <t:1729060706:R> (changes requested)
feat!: add ChannelManager#createMessage()
this is said PR, but is for v15 afaik
so i'm currently using discord jsv14 - if i want to use the .forward - i would need to update the whole codebase right ?
Minor versions don't have any breaking changes, so you wouldn't need to rewrite anything until v15 is released
And afaik message forwarding is getting released in 14.17
It hasn't been backported yet and no pr has been made
It hasn’t even been merged yet, so ofc it’s not backported yet
you should make js message.reply easy to write for not mentioning users in replies,
arguments
In the options
No, we tend not to and are continually shifting away from helper shortcuts that don't reflect the actual API
ik, but still
if most of your bot's replies should have pings turned off you can also just put it in your client constructor
are there any actual docs for the main branch? looks like the ones on the site are outdated, e.g. they still have WebSocketManager
which site
No they dont?
docs autogenerate, theres no reason they would be outdated unless that was broken, and it doesnt seem to be
ahh, yeah not sure why individual pages exist
what to fetch bot banner? like
interaction.client.user.displaybannerurl```?
You should refer to the docs, not guess
ClientUser discord.js@main
Represents the logged in client's Discord user.
alright
Please excuse me for necroing this issue, has there been any internal elaboration since?
yeah, we can't do anything at this time
the library is fundamentally built on the reliance that all guilds are cached, and with stored session info allowing a resume from a different process all-together, we cannot populate the guild cache
its a symptom of a problem that is incredibly difficult to address as things are
How regrettable. Thank you for your time.
Since you know if you resume or not (if you have a session or not) you could/should refactor your code to instead rely on the shardReady event in those cases and (if you rely on guild cache being filled) fetch all guilds of that shard there
How reliable is this?
very, but "fetching all guilds" is a little iffy
the API endpoint for it is kind of a pain
You mean i would have to handle its pagination ?
that's one part of it, yeah
if you can find an alternate way of filling up the cache that'd also work
I do not think this is feasible for us
i.e. you could listen to the raw dispatches from the websocket manager the client uses
and store guild API data in like, redis or whatever else
and "trick" the library into caching it back on startup

i sort of expected that there would be no viable solution for this in mainlib until TSR so i made a microservice with /ws and /core and /brokers to just avoid doing this 😭
Alternatively use await client.guilds.fetch(id) everywhere you‘d usually client.guilds.cache.get
i wrote /ws and /brokers and chimed in on /core specifically to support stuff like this
like, that was my whole thing in becoming an active contributor here
unfortunately, we work as a team and there is..... a lack of experience with a codebase of such nature
i see
i have been experiementing with this setup for quite a while
and its proving useful
I wouldn't say there is a big skill gap from switching to discord.js to @discordjs/core+ws+rest. It'll probably open their eyes a bit
well, I think if you're still learning everything it can be a bit of a shock to break out of like, the one thing you're used to
and start having to work with the API docs more and stuff like that
perhaps? everyone has their own way of accommodation
indeed, this is one of the concerns 
*+ we still need cache, the microservice has yet to acheive it so this is a part of it too
just do caching yourself
its a bit of work at the start but you get there
simplest way if just JSON.parse/JSON.stringify
easiest step up is msgpack since json strings kinda suck for storage efficiency
this
and at those stages its still trivial since those dynamically deal with whatever you throw at them anyway
i never considered JSON due to perf reasons, but then again a xms difference is irrelevant in such a language
personally I'm running some completely custom stuff that originally kyra built
and I patched up and modified a bit
okayyy that looks like some really cool low level stuff, since it is kyra who originated it... i suppose it is with maximum efficiency in mind?
export interface CachedGuild {
icon: string | null;
id: string;
name: string;
owner_id: string;
}
export const recipe = createRecipe({
icon: DataType.String,
id: DataType.String,
name: DataType.String,
owner_id: DataType.String,
}, 200);
more or less I mean
the idea is just storing stuff as the computer would 
you define a memory layout
and then recipe.encode(someData) just straight up returns raw bytes that follow that layout
the first N bytes are icon string, the next N are the id, so on
for numbers there's sized types, i.e. I32
the main overhead is for some safety the type is still embedded inside the data
like, if you wrote a string, the first byte tells you that a string is coming up
which tells the decoder the next byte is the length, N, and the next N bytes are characters
but you still tell it to decode a string, and if the byte type is miss-matched, you get an error thrown
with that recipe system I wrote (which Kyra didn't originally have)
that extra need for safety is kinda redundant
but it has its own overhead
either way, its not a perfect system and I'm still experimenting with it when I have time 
how big is your bot
which is negligible i assume?
113k
who knows
the actual real API is is very fast though
looks something like
new Writer(200) // pre-alloc 200 bytes
.string('some string')
.i32(123145)
.dump();
``` and you just get back a Buffer
and then decoding
const reader = new Reader(buffer);
const str = reader.string();
const i32 = reader.i32();
this is what I meant with the safety byte, if you called i32 first on accident, thanks to that mechanism it would error
otherwise you'd just read whatever was there and treat it like a number without knowing any better
also, i noticed the redis broker uses redis streams, i personally have never extensively tested redis streams, so i just nabbed the interface /broker uses it and integrated kafka with it
what i mean to ask is, are redis streams reliable for a larger load?
I'm honestly not sure
my prod still runs rabbitmq on some older broker code I wrote years back
generally I've been told that it should be completely fine, redis is pretty performant
if you wrote different brokers on our interface though, you should consider PRing it too
do the subpkgs still follow OO patterns?
mostly
you just have to implement the last 2 interfaces https://github.com/discordjs/discord.js/blob/main/packages/brokers/src/brokers/Broker.ts
pub/sub and call/response patterns
i mightve..... sort of.... used evt instead of the aee
so the code doesnt follow OO in the way one would think

if you are actually using the dev version, yes, otherwise #djs-help-v14
i don't really know what version i am using, i am just beginning to code/script a discord bot
then #djs-help-v14
alright thank you!
whats currrent version of dev release?
It changes every 12 hours. If you have a regular version number without the word dev in it it’s not a dev release
ohh
https://github.com/discordjs/discord.js/blob/9fea0698af79fe2bb31e4ba3ff9b921362310c05/packages/ws/src/ws/WebSocketShard.ts#L446
is the second check for ImportantGatewayOpcodes.has(payload.op) necesarry (i am trying to understand discord websocket connections and was reading the code and wanted to ask this sorry if i am wasting your time)
To me it seems unnecessary since the above code returns if it does
Inconsistency perhaps
yeah thats an oversight from when I refactored the send logic
Is there an intended behaviour where LimitedCollection is instructed to set a new value beyond the maximum size of the collection, but keepOverLimit returns true for all existing values? The current behaviour is that the new value is set anyway, growing the LC beyond its maximum size – can't tell if that's deliberate or not.
If I'm understanding your question yeah, that makes sense to me. A caching system should be getting rid of its older values and keeping new ones. keepOverLimit isn't a filter on new items, its a filter on the sweeping of existing items.
So a new item would come in, get stored, it checks what it should remove, but you've told it not to remove any existing items, so it wont
is keepOverLimit a functionality of LimitedCollection or sweepers though
does that mean that LimitedCollection has no means of being Limited then?
ever since it was made i was pretty sure that it would simply remove oldest element if adding new would make it grow beyond set limit
oh, so it is fucntion of LimtiedCollection
When setting a new item, it FIRST checks it's contents to see what it should keep if it's over its limit, and deletes
Then it will ALWAYS add the new item
So if you set it up to keep all existing contents, yes, it effectively breaks its size limit
#8832 in discordjs/discord.js by Syjalo opened <t:1668176239:R> (review required)
feat: Rename interaction methods
could i ask why this change would be necessary?
"Necessary" is subjective, but the reasoning why it's been proposed is right there in the PR
Having said that, it's been open for two years with basically no discussion
just asked, naming sure is opinionated; especially for something like this that people use most often, i think current names are at least intuitive enough
so this isn't getting merged any sooner right?
Hey, will resuming come in v15?
like resuming the ws connection so that I can keep my bots voice channel connection alive if my vm would reboot
so resuming ws or resuming voice?
both would be nice
one might be a bit more tricky to do than the other
Which one is tricky
The main issue with resuming mainlib discord.js in a new process is that guild cache won’t get filled but many functions of djs rely on guild cache.
You‘re free to PR the ability to use a custom cache in discord.js. That’s … and apparently you don’t actually want to know
Which branch is dev?
main
Ok
Good evening all,
After anothing recurring exploit where users manipulate what a bot says in order to ping everyone
I am wondering, would a good change be to require the user to pass a “everyone ping allowed” in an interaction object?
if so, ill get to it! Please let me know
it's already a feature
ClientOptions#allowedMentions sets a default for BaseMessageOptions#allowedMentions
is the default for the bot to allow everyone pongs by defualt?
yes, because that is the default of the discord api
unfortunate
and djs package has no security policy so I didn't know where to report this so I just came to here.
Undici is the vulnerable package here. No, it's not updated to resolve that, but it's open-source, so you're welcome to try
okay then
We use 6.21.0, and it's fixed on 6.21.1, so it should be no problem updating it
yeah just saw on here
I make pr then*?*
Sure
done
Did you manually edit the version? Gotta update the lockfile too now since it's out of date, and update Undici everywhere else
Not to mention that that vulnerability doesn’t affect us as we never use the functionality that was vulnerable
It would also be very helpful if the version bump was backported to a 14.x release
It will—it's not a breaking change
why npm audit fix downgrading discord.js to v14.14.1?
were you using the dev version to begin with?
no, I'm using latest stable..
then you're in the wrong channel, as this is for people using the dev version
is dev version get updates daily?
releases are done every 12 hours (see the topic)
so is you have canary/alpha or beta version which get updates les frequently?
as I want to try new features first but updating library every 12h seems... Not good
You don’t need to install the update every 12h
then..?
whenever the update with a commit or pr merge of interest is released
do consider that dev builds aren't guaranteed to be stable, I wouldn't recommend using them in production
even new releases tend to have bugs that are hotfixed asap
-# probably because nobody runs the dev builds 🥴
zlib-sync isn't installing at all on newer node. But from what I understand, you switched to node:zlib? I would recommend removing this dependency from the docs if its no longer necessary.
Hey @meager crag, regarding this PR, I came across this proposal (specifically the motivation part) and wanted to know what you think about it
Hey! The TC39 proposal regarding rescinding subclassing behaviour for builtins won't affect userland implementations (Symbol.species would be retained, and the explicit rationale put forward is to allow userland to continue to use it for that purpose). Map doesn't actually use any builtin subclassing behaviour in its own methods, and although the Map[@@species] getter would be removed, there's nothing to stop Collection from re-implementing it, and there wouldn't be any backwards compatibility issues with doing so.
From what I understand, that proposal is a long way from even reaching stage 2 – TC39 doesn't have precedent for reverting existing language features
Yeah, it's still in stage 1 so that'll be a long way off, but I was referring to the mentioned issues with it, do you think those are relevant in this case?
The issues motivating the proposal only apply to under-the-hood engine internals, particularly for array methods, as it messes with path selection and whether the constructed object is an optimisable builtin data structure or not
Got it, thank you for clarifying
if zlib-sync cant be installed on newer nodes i'd bring that up to them
and we didn't switch to node:zlib, we also support node:zlib
we don't have perf benchmarks to compare between em
It hasn't really been updated in 8yr so I doubt it'll receive anymore updates. If you want to keep it ig I would suggest forking and fixing it, otherwise you'll be stuck with a broken dep in the foreseeable future
It has though. Any time an update was needed. Just because a package receives no update doesn’t mean it‘s not working anymore. But I see you left a similar comment on that repo a week ago too
I just removed it without a noticeable difference but you might've wanted to know it's not installing anymore
src/util/Components.js appears to be missing from the uploaded files on npm https://www.npmjs.com/package/discord.js/v/15.0.0-dev.1740679933-8a37b7b93?activeTab=code
It'll be resolved in the next development version
thank you!
Hey guys quick question would 16kHz PCM, uLaw work for a discord bot when developing? this is for testing purposes
Or like does discord purposely not work with this format
Doesn’t sound related to developing the library discord.js. You can ask in #998942774994927646 assuming this is about playing sound in voice channels
My issue is that my bot says its speaking but I don't hear any sound in vc
I'll proceed to put a req in djs-voice channel
I see that ChannelManager#createMessage() exists now, maybe it's just me, but wouldn't it make sense for it to be ChannelManager#send()? Because even for the UserManager, it's send() not createMessage(), so I thought maybe consistency-wise, it could be changed?
the opposite is the case. createMessage is the method that's in line with API naming. The send() methods now are merely helper methods internally calling that createMessage() method
Ah ic, then would it make sense if UserManager also used createMessage(), or is it just considered a helper
It's just a helper
got it
since in the end it's also a createMessage() call on the DMChannel with the user
yeah I figured, thanks
What new features does the dev version have? I know its a broad question, but if theres a list i can check out
There should be an updating page on the guide repo
Thank you
I went to the guide and i barely see any changes. So for example on main branch on djs docs i see AllowedMentionsBuilder class so like where do i find what it does?
It's a builder, like others, but for allowed mentions
Yes but like so i dont bother anyone with the questions is there like a website or a resource i can look at?
Actually i just realized best way to find new discord features for bots would be thru their documentation im sorry
also not all the changes are implemented in the guide yet https://github.com/discordjs/guide/pull/1595
Jira just pinned the guide here
does anyone know when discord.js 15.0.0 will be officially released?
No
when it's ready™️
and what percentage of it is already done?
counter question: what do you expect v15 to do that you care?
because I'm curious what will be added in v15 that is not in v14
we don't "add" stuff. we implement what the API supports. v14 and v15 both currently cover all documented API
okay
tbh if you ask me currently discord is not adding much on bot side so discord.js wont be adding much features unless discord themselves do. discord is focusing more on sdks currently, but maybe i can be proven wrong, who knows
Maybe 👀
Out of curiosity, has a caching system that uses Redis ever been considered for djs?
#9541 in discordjs/discord.js by didinele opened <t:1683485405:R> (changes requested)
feat: @discordjs/redis-gateway
Interesting
Guess it isn’t been used as cache though, only as broker
But with /core you can make your caching system any way you like
Replacing the caching system in mainlib discord.js with something else is not really feasible at the moment
Yeah, and It's what I plan on doing. I like discord.js but sometimes you don't want that much abstraction, and I'm glad /core exists and has minimal abstraction
Hi, just switched the discussion to this channel instead
#djs-help-v14 message
Funnily enough for GuildMember that already is the case
yikes, so only User
#10819 in discordjs/discord.js by louiszn opened <t:1743173242:R> (review required)
fix: missing displayName property for json data.
I created the pull request :3
I don't know if we want to have getters in toJSON() as it'd make sense for it to match the API, discussing internally
getters have been added to json data for a while. Isn't it would be more accurate if we use api data instead?
That’s exactly what Danial was hinting at, yes.
mhm, what do you think about setting this.data and removing .toJSON()?
toJSON() is not something we invented. It‘s what’s literally used by the js engine if an instance gets handled in JSON.stringify(…). So fully removing it makes things worse actually
ah... so instead of using custom function for it, returning JSON.stringify(this.data) will be good right?
it's already raw data with no extra members
No. Just return this.data or however the actual data is stored. What we wouldn’t want is doubling all data by storing it additionally as a data property, because that would double the memory storage needed
what do you think about using getters instead of making new properties like the current method?
Huh? The current method does bad things by returning redundant data imho. And getters don’t really cause API data to get returned
I mean to solve the doubling memory storage, I think using getters would help.
e.g
public get username() {
return this.data.username;
}
seems like you're figuring out the structure of the /structures module, one message at a time 
https://github.com/discordjs/discord.js/pull/8417
we can also make the data can only be accessible by naming the property as #data, so users can only access data through the getters
well yeah that's what I mean
Where’s the code for djs in dev? Is it another branch?
It’d be in the main branch
Cheers
are components v2 useable in @dev version?
They aren’t even documented yet
i heard they aren't experiment-gate locked anymore so wanted to try them and see if i could get them to work
You can check out the PRs we have for them if you‘re in such a hurry
they should work if you use direct rest calls
i wanted to try the builders to directly see how their JSON looks instead of just relying on the types by discord-api-types
Huh? But the builders will produce those exact types
i wanted to use the builders to see how the lib sent them cuz when i tried with just the types, i was getting an error about the types
now i found out the issue is that i wasn't putting the components v2 flag
Can vouch for this
https://discord.builders/ can help if all you want is checking the JSON for a set message
already got it working yesterday, was just missing a flag
What’s components v2?
more components you can use, official announcement and docs about it should be released somewhere coming week
Did the link that Yareaj provided similar to it?
kinda, but that is if you want to use raw api calls, d.js does not have it implemented yet to their public releases (they also probably wait until the official announcement is sent by Discord API devs)
I see. Thank you ^^
could be a week could be a year, never know with discord tbh, cv2 soft launch was delayed after all so
someone who is close to the dev team of Discord (he worked as intern last summer at Discord) said the announcement should come this week, so I think I can rely on that
d.js already have their PR ready and they now just wait for Discord to release the official docs
could be, I just used that example hoping they were convinced enough 
The docs now have an official PR so it will be soon™️
Didn't they have it for months
Unofficial ones yeah

So turns it out was today
Yeah because people were just talking random shit
are components v2 planned to get backported to v14? yes i know the v15 pr isnt even merged but im asking because its dapi types release is a breaking one which makes me think it can't
by v15 pr i meant the components v2 pr to main instead of the v14 branch
<- me waiting for the d.js release
Please keep this channel on topic with actual questions. Discussion is welcome in #archive-offtopic
oop sorry, forgot that channel exists 😅 thank ya for the redirect
There is a components v2 builders PR to main and a similar backport PR for builders v1. And then there is a v14 PR for mainlib discord.js.
ah nice
is there anything new in v15 that is not in v14?
it's about what's new in djs and dapi
given how v15 exists merely as a dev branch right now without much of, if any, ETA for its release, there's no reason to gatekeep any features discord adds from the only currently stable and supported v14
v15 might get them separately and/or differently due to it being a major version which explicitly means breaking changes in comparison to v14, but both the dev branch and the eventual minor/patch release of v14 should get the same things
okay
you can see an ongoing doc on what's changed on https://github.com/discordjs/guide/pull/1595
Is it correct that builders v2 doesnt export ContainerBuilder? Seems like a bug to me but this is the first time for me looking into components v2 so just wanna check
@boreal knot^
I can confirm it's not there yeah
https://github.com/discordjs/discord.js/blob/abc5d99ce89bad64d0ad0d7d68310e610efdca76/packages/builders/src/index.ts#L23-L30
sure sure ill have a look
#10844 in discordjs/discord.js by SammyWhamy opened <t:1745514504:R> (review required)
fix(builders): export container component
Thank you <:
Np!
Also curious, whats the reason theres methods like setPrimaryButtonAccessory
since you end up needing to do .setPrimaryButtonAccessory(new PrimaryButtonBuilder()) instead of .setButtonAccessory(new PrimaryButtonBuilder())
Try using the callback .setPrimaryButtonAccessory(primaryButton => ...)
What im trying to do is something like
.setButtonAccessory(
enabled
? new DangerButtonBuilder().setLabel("Disable")
: new SuccessButtonBuilder().setLabel("Enable"),
),
If i use the callback it is nice i dont have to do new ...ButtonBuilder but i wont be able to use the ternary in the builder i dont think
or i mean of course i can later, but i cant use a chained function with ternary
Methods return the builder, it's not a problem:
declare const sectionBuilder: SectionBuilder;
declare const enabled: boolean;
(enabled
? sectionBuilder.setDangerButtonAccessory((button) => button.setLabel('Danger'))
: sectionBuilder.setPrimaryButtonAccessory((button) => button.setLabel('Primary'))
).addTextDisplayComponents();
declare let sectionBuilder: SectionBuilder;
declare const enabled: boolean;
sectionBuilder = enabled
? sectionBuilder.setDangerButtonAccessory((button) => button.setLabel('Danger'))
: sectionBuilder.setPrimaryButtonAccessory((button) => button.setLabel('Primary'));
sectionBuilder.addTextDisplayComponents(...);
@boreal knot don't suppose you think there is any "cleaner" way to do what they want?
You don't need to override the let
You can just call the builder...
declare const builder: SectionBuilder;
if (enabled) {
builder.setDangerBlah()
} else {
builder.setBlah()
}
I'm confused, that's what I just said
Yeah okay, there you go then!
👀
Yeah i know thats possible too ofc, but i just like having the single chained function
I feel like adding a setButtonAccessory would be nice but if its not something you guys are looking to add i can work around it of course
I just went off of how we do it for action rows too when it comes to setting buttons
Cc @silent hedge thoughts?
Also noticed that builders doesnt re-export discord-api-types, for example the SeparatorSpacingSize used by the separator builder, you cant import that from /builders (but you can from /core). Is that intended?
Yes. Only discord.js re-exports other sub-packages and /core dapi-types additionally
Ahh i see
just a general question, anybody know the character limit for text display component?
documentation suggestion for @midnight stirrup:
Component Reference - Text Display
read more
it doesn't seem to say 😔
yea i'm in the process of migrating to components v2, was hoping someone would have a documented answer before i started testing
ty anyway!
The upper limit of text characters is 4000 in total.
also this is for the in-dev version, either v15 or unreleased v14, the former doesn't even have cv2 iirc and the latter doesn't exist because there's no new commits to the v14 branch since release
and ddevs should be a better place to ask for api questions overall
aight will check it out ty
Does v15 have CV2 yet?
#10847 in discordjs/discord.js by Qjuh opened <t:1745604424:R> (review required)
feat: components v2
v15 doesn’t exist yet, so no
the main branch is not v15?
The main branch is the dev version. Which will one day lead to a release of v15
ahh
getting this error for some reason TypeError: polyfillDispose is not a function
You're outdated—we removed all instances of that
i just installed the latest version of djs today
anything i should check?
i donenpm i and updated djs thats it
Well the question is are you using discord.js@dev or discord.js@14.19
djs 14
"name": "dis",
"version": "1.0.0",
"description": "",
"type": "module",
"main": "src/index.js",
"scripts": {
"dev": "nodemon index.js"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"@aws-sdk/client-sso-oidc": "^3.686.0",
"@aws-sdk/client-sts": "^3.686.0",
"@citizenfx/client": "^2.0.6497-1",
"@citizenfx/server": "^2.0.6497-1",
"ascii-table": "^0.0.9",
"axios": "^1.7.9",
"discord.js": "^14.19.1",
"dotenv": "^16.1.4"
},
"resolutions": {
"discord.js": "14.11.0",
"@discordjs/builders": "1.6.3",
"@discordjs/collection": "1.5.1",
"@discordjs/formatters": "0.3.1",
"@discordjs/rest": "1.7.1",
"@discordjs/util": "0.3.1",
"@discordjs/ws": "0.8.3"
},
"overrides": {
"@discordjs/builders": "dev",
"@discordjs/collection": "dev",
"@discordjs/formatters": "dev",
"@discordjs/rest": "dev",
"@discordjs/util": "dev"
}
}
``` this is my package.json.
Remove all the resolutions and overrides - you only need those if you're on discord.js@dev (and then run npm i again)
i think it worked. but now it throws this SyntaxError: Unexpected token '{'
``` thats the line
well that's just your code #1081585952654360687
alr,thanks for the help
when will the guide for components v2 be released?
How can I use the v14 branch in my project?
v14 is stable, just do npm i discord.js
the main branch is the beta development branch that you install by doing npm i discord.js@dev
v14 branch has some commits not released yet as stable, so thats why I was asking
ah in that case you can't as far as i believe
i think v14.19.2 is planned to happen soon though
ah
hey, <GuildMember>.inviter is still not available on djs ?
discord doesn't provide that data
oh sad, thx
improve container builder to be setup similar to embed builder as i and maybe most ppl find it quite hard to setup containers I especially do
It is very similar to embed builders
Containers are simply more complex because they're more powerful
I think we just need documentation on discord.js guide to show what they are and where they can be used and examples and etc….
Is MessageComponentsV2 supported in discord.js@dev?
Yes, and in stable!
src/interactions/slashCommands/test.ts:42:17 - error TS2769: No overload matches this call.
Overload 3 of 3, '(options: string | MessagePayload | InteractionReplyOptions): Promise<InteractionCallbackResponse<boolean> | undefined>', gave the following error.
Type 'ContainerBuilder' is not assignable to type 'APIActionRowComponent<APIComponentInActionRow> | JSONEncodable<APIActionRowComponent<APIComponentInActionRow>> | ActionRowData<...>'.
Property 'type' is missing in type 'ContainerBuilder' but required in type 'ActionRowData<MessageActionRowComponentBuilder | MessageActionRowComponentData>'.
Overload 3 of 3, '(options: string | MessagePayload | InteractionReplyOptions): Promise<InteractionCallbackResponse<boolean> | undefined>', gave the following error.
Type 'MessageFlags.IsComponentsV2' is not assignable to type 'BitFieldResolvable<"SuppressEmbeds" | "Ephemeral" | "SuppressNotifications", MessageFlags.SuppressEmbeds | MessageFlags.Ephemeral | MessageFlags.SuppressNotifications> | undefined'.
42 interaction.reply({
~~~~~
node_modules/discord.js/typings/index.d.ts:259:3
259 type: ComponentType;
~~~~
'type' is declared here.
I got this error, when I try to build
I was wrong, due to PR fuckery it's only in v14
Okay. Thank you.
why doesn't the topic use formatted timestamps for the release times anymore? (<t:1746878400:t> | <t:1746921600:t>)
It would require updating twice a year to be accurate for those who go through daylight savings
wtf discord lol
Actually, it's a user issue. Take this timestamp for example on 31st October 2024 00:00:
<t:1730332800:t>
If you're in BST, for example, this would display as 00:00. That would be correct!
But it doesn't look correct for right now, 12th May 2025, because it's a misuse of timestamp markdown
yeah fair enough
also pretty sure we got some questions about the date that is inevitably tied to the timestamp even if you format it to display only the time
what difference would it make though? doesn't discord add the offset for DST?
It needs updating the date. The timestamp points to a datetime. 2025-01-01T00:00Z would be 00:00 and 2025-06-01T00:00Z would be 01:00. Without updating the date it will show 00:00, but 00:00Z is 01:00 with daylight saving.
isn't it always 00:00 utc tho, and utc doesn't follow dst?
UTC is always the same
Take Eastern Standard Time and Eastern Daylight Time for example
EST is UTC-05:00, but EDT is UTC-04:00
They change between UTC offsets twice a year
If your timezone doesn't use DST, you won't see any difference in the time. But if it does, there will be 1 hour difference in here.
<t:1735689600:f>
<t:1748736000:f>
but the release cycle doesn't shift for daylight saving
00:00 utc is 00:00 utc regardless if it's june or january
do i need to bump djs builders either to use cv2 in djs dev
you didn't need to install builders separately
discord.js includes multiple sub-packages, installing these separately can mess with internal code:
[0;31mnpm [0;0muninstall discord-api-types @discordjs/rest @discordjs/builders
[0;34myarn [0;0mremove discord-api-types @discordjs/rest @discordjs/builders
[0;33mpnpm [0;0mremove discord-api-types @discordjs/rest @discordjs/builders
has the way to attach files changed in djs@dev?
const { AttachmentBuilder } = require('discord.js');
const attachment = new AttachmentBuilder('./files/attach.png', { name: 'file.png' });
await message.channel.send({ files: [attachment] });
i have no clue why this code throws the following error:
TypeError: Cannot read properties of null (reading 'byteLength')
at Object.pull (/home/ubuntu/test-bot/node_modules/undici/lib/web/fetch/body.js:63:20)
at invokePromiseCallback (node:internal/webstreams/util:172:10)
at Object.<anonymous> (node:internal/webstreams/util:177:23)
at readableByteStreamControllerCallPullIfNeeded (node:internal/webstreams/readablestream:3145:24)
at readableByteStreamControllerPullSteps (node:internal/webstreams/readablestream:3254:3)
at [kPull] (node:internal/webstreams/readablestream:1201:5)
at readableStreamDefaultReaderRead (node:internal/webstreams/readablestream:2269:39)
at nextSteps (node:internal/webstreams/readablestream:493:7)
at async writeIterable (/home/ubuntu/test-bot/node_modules/undici/lib/dispatcher/client-h1.js:1437:22)
what version of node are you on
huh
but that's not how it's supposed to go
you should need the override for whatever latest dev djs rest is
the latest version of uncidi used in djs/rest@dev is causing this ig
├─┬ discord.js@15.0.0-dev.1747095234-aa533efe2
│ ├─┬ @discordjs/rest@3.0.0-dev.1744589650-5c0b71455 invalid: "^2.5.0" from node_modules/discord.js
│ │ └── undici@7.8.0 deduped
│ └── undici@7.8.0
i once added the override exactly because of that lol
but now it works without overriding rest
I got this error too last night @silent hedge on 15.0.0-dev.1747008876-4f5e5c7c1. Haven't looked into it yet, but here's what my overrides are:
"overrides": {
"@discordjs/builders": "2.0.0-dev.1747008877-4f5e5c7c1",
"@discordjs/collection": "3.0.0-dev.1747008878-4f5e5c7c1",
"@discordjs/formatters": "1.0.0-dev.1747008873-4f5e5c7c1",
"@discordjs/rest": "3.0.0-dev.1747008873-4f5e5c7c1",
"@discordjs/util": "2.0.0-dev.1747008873-4f5e5c7c1",
"@discordjs/ws": "3.0.0-dev.1747008874-4f5e5c7c1"
}
Node.js 22.13.1 btw
hmm okay
This reproduces it for me:
(client.channels.cache.get(CHANNEL_ID) as TextChannel).send({
files: [
new AttachmentBuilder("https://cdn.discordapp.com/avatars/618976181026422814/1f341400799da66e593f58e2e4bdf066.webp", {
name: "test.webp",
}),
],
});
Seems related to Undici—was not able to reproduce on 6.21.3, but was able to reproduce on all 7.x
https://discord.com/channels/222078108977594368/1370887431846498374 same issue here, but 14.19.1
Probably another instance of undici (or undici-types) exporting its own Buffer type differing from the one in the NodeJS version causing an instanceof Buffer check to fail
@jolly pike when we pass FormData (the native one from NodeJS in our case) to undici.request() we face that error 👆
investigating I found that this is the case because util.isFormDataLike() is true here https://github.com/nodejs/undici/blob/2ed2a8a1393b0da3215997e9941ec3a92a93f3d0/lib/dispatcher/client-h1.js#L1021 but webidl.is.FormData is false here https://github.com/nodejs/undici/blob/2ed2a8a1393b0da3215997e9941ec3a92a93f3d0/lib/web/fetch/body.js#L120
I'd call that an undici bug, do you agree?
undici 7 specifically doesn't accept cross-implementation FormData etc – importing the undici implementation should be all that's needed
but isn't the one in NodeJS global the same? since fetch() comes from undici after all? this is rather confusing and/or annoying
import ... from undici won't result in the same object instances as Node's built-in fetch globals, even if the npm undici version matches that used in the loaded Node version
so basically, you need to use the global FormData etc. if also using global fetch, or the imported one if using fetch from a node_modules undici import
The repo fails to build under node v24... it's zlib-sync again. https://gist.github.com/Renegade334/5fc4c984b3c0ad3a45897f7a651df289
in theory this might be fixed with a dependency bump if and when a new version of nan is released, but just out of curiosity, what's the state of the consensus regarding zlib? obviously there's now been support for zlib-native for some time, plus zstd emerging - is the intention still to continue to support zlib-sync?
we hate it 
Is there a specific reason as to why the actual discord.js lib is the only one not written in typescript? Seems like it's overdue considering everything else has already hopped on that train
Because if was written in js, newer projects were specifically written in TS. Rewriting the mainlib to TS is not simple or quick, and it hasn't been a priority
That and the fact that mainlib is fully typed, so the benefit of it being typescript would only be for the maintainers of the library, no benefit for the users of it
There would still be benefits in that, no? You wouldn't have to work with typedefs/jsdoc comments, and frankly Typescript is superior when you look at it from any standpoint.
Also, it really wouldn't be just the maintainers that benefit from it. There are people who maintain custom forks of djs, and most of them have typescript codebases. Why not give the "power users" something less to worry about?
I mean, I'd be more than happy to give it a try if you're looking for people that could do it
"Maintaining a custom fork" makes you a maintainer. And if you as end user use JSDoc comments and typedefs or not is your choice. djs is fully typed so you can just write typescript and be happy
Fair point I guess. I don't know. To me it seems kind of odd to keep your main library written in js when everything else is already on typescript, and I'm sure I'm not the only one that believes a typescript port would be a good thing
It will be rewritten in TypeScript soon™, we're not simply porting to TypeScript but actually rewrite things, using /structures for example: https://github.com/discordjs/discord.js/pull/10900
A 1:1 port would literally benefit nobody while being a lot of work for those who do it. All the other packages you see that are already typescript are actually part of the typescript rewrite. They are all pieces of the puzzle, what you ask for is already happening. It's just not something that happens over night with a project at this scale (and contributors doing this in their free time instead of being employed to do so)
speaking of rewrites, considering requiring esm modules is a thing now is it planned to eventually move to esm
dual publishing is nice but its essentially double the package size
The size that shows on npm shouldn’t matter. In cases where size matters code should be tree shaken anyways by a bundler.
some packages on npm will ship their whole src/ folder
It just works with both esm and commonjs, so what you ask for has no advantage for anyone. But only the disadvantage of not working with cjs anymore (or then needing dual publish)
i'm talking about the packages that aren't mainlib
do you not know about require(esm) it was unflagged in node 23 https://nodejs.org/api/modules.html#loading-ecmascript-modules-using-require
i'm not suggesting djs moves to esm now, requireing esm modules isn't stable yet after all, but i've heard they want to remove the experimental tag quite soon
I see, you referencing the "rewrites" made that not clear at all. There won't be any need to rewrite the other packages, it would simply be a change of settings of the tooling. And would be an option once the minimum node version we require is one where require(esm) is stable
alright
does @discordjs/builders@dev account for https://github.com/discord/discord-api-docs/pull/7534 ?
We don't count them

@uncut kelp if possible, please ping me with a dev release because we use this in prod and rely on the validation messages
@discordjs/builders 2.0.0-dev.1751293691-536a54651 got released with https://github.com/discordjs/discord.js/pull/10959 merged
thank you
<:
Please use channels for their intended purpose. Wait for a response here #djs-help-v14 message
it looks like it already supports a node version that has unflagged require(esm) 👀. it was unflagged in 22.12.0 (and stopped emitting a experimental warning in 22.13.0) and every package from the monorepo happens to require node >=22.12.0. should i open an issue, or is it better to wait until they stabilize require(esm) (which i've heard they want to do for october's node 25 release). require(esm) is currently in a release candidate status
Hi guys, was wondering if there is an option in dev branch to get gradient colors from roles?
#10961 in discordjs/discord.js by sdanialraza opened <t:1751404981:R> (review required)
feat!: role gradient colors
😃
put it outside the container as a text display - this is not related to developing the library or in-progress PRs
sorry for putting it wrong channel, btw thanks
also not necessary to do that with components v2, as you can mention inside the container (compared to embeds which couldn't)
Is there a version of the npm package which includes the enhanced role styles PR?
(I know it's on main but hopefully that's still relevant here)
If you know it's on main, what's the question here? O_o
if you're asking whether there's a v14 version, no
Would it be on discord.js@dev?
there's only latest (v14 branch), which is latest stable v14 and dev (main branch) which is going to be v15 eventually and has breaking changes/maybe bugs
Okay so @dev is main branch
prs are usually merged to main and then backported to v14
yes
but again, if you're currently using v14 then it's going to have breaking changes in your code
Yeah I understand
Its coded all very recently so probably not too much to change
imo only use it if you want to stay on the edge™, not just for one feature
Is there a better way?
waiting 
seems like color is still being returned by the discord api, and not colors
Can you elaborate on where color is being returned and not colors?
based on their docs you'd think it return
sure give me a sec
What is your discord.js version?
That's a tag – not a version
"^15.0.0-dev.1752538515-5a611be8d",
wouldve been installed between these two commits
I would say try a clean install (nuke node_modules) and try again I guess but haha
Quick question, how do you get your role there? Is that via an interaction?
And uh, do you have any other discord.js stuff installed or discord-api-types? If so, you shouldn't
It's from Guild.roles.fetch()
Interesting how would that impact it
I'm thinking it could cause conflicts somehow. You'd do this #djs-in-dev-version message instead of installing them in your project
Okay that makes sense and I'll try that
Although I couldve sworn I saw colors defined for Role in the declarations file
My other thought is that you have a dependency that uses a non-dev version of discord.js and it's not figuring out which one to use
But yeah either way it looks like some kind of issue in the setup here rather than discord.js
I think so yeah
Don't think so, I can show my package.json
"dependencies": {
"@prisma/client": "^6.11.1",
"discord.js": "^15.0.0-dev.1752538515-5a611be8d",
"dotenv": "^17.2.0"
},
"devDependencies": {
"@types/node": "^24.0.13",
"prisma": "^6.11.1",
"tsx": "^4.20.3",
"typescript": "^5.8.3"
}
Oh okay, maybe not then. Yeah I have no idea, that looks like it should work to me. Maybe your node_modules or your lockfile is outdated... try deleting them and reinstalling
after making a fresh container, guessing it worked
That's good. NewsChannel is quite an old change (was renamed to AnnouncementChannel)
ah thanks i was looking for what it turned into
and perfect it works
just needed a fresh restart likely due to the dependencies in package-lock as you said
Does anyone know how to use @discordjs/structures?
Its not even finished
They're basically just classes. What is it you want to try using it for?
not exactly a question related directly to what djs does, but more of how the repository does it.
I was checking the published npm packages for various djs packages. How do the dist files have single index.js,mjs,etc files with ALL the code from that repo in one file? what are you using to do that? is it esbuild? do you have a link to the config files for this setup in the djs repo handy so I can have a look at it? (i'm trying to publish packages myself.)
we use tsup
https://github.com/discordjs/discord.js/blob/main/tsup.config.ts this is the primary config, each subpackage may extend/override some of those options for various reasons
Thank u. I’ll check it out 
I would like to use it instead of using objects to transform the API; I would like to use ready-made classes.
Then what would that package be used for in this specific case?
When do switch from tsup to tsdown?
I see that certain projects are already using it as an alternative to Tsup.
i dunno?
why fix something that aint broke
so long as tsup is maintained and meets our demands we'll never move
structures is mostly a library for libraries, so to speak
they can be a valuable starting place for building an abstraction, but its a lot of work to fully implement on top and its full of opinionated choices
Does the fetchInvite function not return the number of members on the server?
Only if you instruct it to
is there any doc for builders v2?
noticed that SlashCommandBuilder has renamed to ChatInputCommandBuilder and its methods also has updated but couldnt find any migration guide
and why does <EmbedBuilder>.setDescription(null).toJSON() throw an error even though embed's description is optional
because it's optional. not nullable
setDescription doesn't even take null in terms of types
use clearDescription() instead
thats kinda strange as the below code worked before the release of builders v2:
const { EmbedBuilder } = require('discord.js');
const embed = new EmbedBuilder()
.setTitle('Hello')
.setDescription(null);
channel.send({ embeds: [embed] });
has the logic or design changed then?
yes, this is why it's a major bump
null is not a real value the API accepted, it was handled as a case by the lib to "clear" the value, but this was deeply inconsistent with fields that did accept null but also supported clearing
now clearing is always an explicit method and a lot of places that previously accepted null do not anymore
I see.. thank you for the assistance
Just to clear here: there has been no release of builders v2, you're using a dev build
i get null
Well, that response isn't particularly helpful
What did you try? What version? Code sample? Are you actually instructing it to?
const invite = await client.fetchInvite(inviteCode);
console.log(invite.memberCount)
``` returns "undefined"
Your code sample is not even correct JavaScript. Provide what you are actually doing
Hello everyone, I was wondering if there was any documentation on the development version? 🤔
Choose main in the version selector to see it on the website
Oh, okay? And there is a list of changes? (example for the release of v14 we had a v13 -> v14)
it isn't finished so there isn't one yet
there's a pr that was keeping track of some of the changes in the guide repo
The list of changes for the dev version pretty much is the commit list on the repository
Thanks for your replies, I'll look at the commits 🙏
They have documentation for 15.0.0-dev.1754006526-8f5ac55d8 (the latest dev version).
?
@patent zephyr
Ok
But since I know it's new and that it doesn't
sorry, I don't understand what you mean
How do I know what has changed, what has been added, and what has been removed?
you don't yet, documentation documents the current state, not changes
there are other ways though, read the whole conversation I linked to you
will djs switch to BigInt for Snowflake IDs?
Not by default, no, because the need to convert between the two usually outweighs the benefit of storage
I think if we can convert it once and reuse it, it can be somewhat better in both speed and storage.
Oh wait I forgot about json requests also require string :P
To add to the above, there's no benefit to them being BigInts really because they arent used for calculations. Number isn't a particularly useful format for Snowflakes
I dont know what "speed" you're referring to there
Will we see major changes on discord.js or we will keep going with v14.x?
For now, everything seems fine so far, I would like to know if there’s going to be breaking changes
There are major changes coming yes
- Is there an ETA?
- I have checked docs but all I see are main and v14. I am not sure main means development as branch on website so yeah. Is there a website/wiki that we can follow up the changes?
the commit messages are the changelog
So main is actually dev branch?
Then release… alright, thanks.
People rename their default branches to whatever, but that's not the case all the time if that's what you were asking
Select main in the website to see documentation is what you need to do yeah
the main github branch releases as discord.js@dev, yes, if that's what you mean
which can also get breaking changes very frequently, especially when it gets closer to a major release. so we recommend pinning your version to a commit and only updating after reviewing commits you will apply with that update
(granted most devs will not realy have a benefit from using dev in the first place)
what styles djs docs? the docs website, not the guide. I'd appreciate a link to the repo for it :)
no, that's a legacy thing that im not even sure why its still around
we use an api-extractor fork, its in the packages folder in the same repository as this
Old documentation site still exists
and why is that still around
lmao
i'll check out api-extractor thanku
We use both. The ae fork uses the output of docgen as input
ooooo
i am using the dev branch and i cannot figure out why the SuppressNotifications flag appears to not work? am i doing something wrong? im gettin yelled at
or does it just show the channel red indicator + highlight without sending any desktop/mobile notification?
i.reply({
content: `<@${user.id}> linked to the role <@&${role.id}>`,
flags: [MessageFlags.SuppressNotifications],
});
yes, as the flag tells you—the message will suppress the notification
ok that's what i thought, so false alarm then, thanks
If by "gettin yelled at" you mean "I am still mentioned", you wanted allowedMentions, not that flag
oh... indeed, thanks 😅
This is released now!
It isn't possible to test the select modals with discord.js is it?
select menus in modals are not yet publicly available
they're currently being tested by library and large bot developers before a public release in ab. 2 weeks
I know, I meant for testing
sorry if this is a stupid question 😅
I just thought maybe I can install the branch
no, it's API gated and only available in a test server owned by discord that's not open to the public
oh, you're in the test 
Uh, I just asked advaith for the invite and he gave it to me
you can install the PR https://github.com/discordjs/discord.js/pull/11034
alternatively you can use the raw payload as documented with Client#rest
I think it's not possible because discord.js crashes while processing the request?
Unless the is a way to tell it to ignore modal submit interactions
or is it like a whole different package?
There's only a pull request for @discordjs/builders and discord-api-types right now
It's not really ready for testing unless you use them
There's nothing handled yet for discord.js (the package itself)
i'd recommend waiting for a public release
if you want to test it now to play around with it, you can use a separate @discordjs/rest REST instance to send raw payloads and see what it looks like
Alright, thank you, sorry for bothering you
your production bot won't be able to use it anywhere but that server anyways, so a small test app will likely fit that exploratory phase much better
👍🏻
just asking a curious question, can each section contain it's own thumbnail?
k thx, but I'm using it too (dev version), where do I ask then? in #986520997006032896 ?
hmm, well... i'm trying to add the thumbnails, but it's not working, djs is ignoring it
show your code
const buildPromotionsContainer = (content: string, promotions: any[]): MessageCreateOptions => {
const container = new ContainerBuilder();
container.addTextDisplayComponents(text => text.setContent(content))
for (const promo of promotions) {
const sectionBuilder = new SectionBuilder()
const description = `Disponível até <t:${DateTime.fromISO(promo.end, {
zone: "America/Sao_Paulo"
}).toSeconds()}:F>\n${promo.link}`;
// Add game title
sectionBuilder.addTextDisplayComponents(
new TextDisplayBuilder().setContent(`# 🎮 **${promo.title}**`),
new TextDisplayBuilder().setContent(description)
);
if (promo.img) {
sectionBuilder.setThumbnailAccessory(
new ThumbnailBuilder().setURL(promo.img)
);
}
// Add link button
sectionBuilder.setLinkButtonAccessory(
new LinkButtonBuilder()
.setLabel("🌐 Abrir no Navegador")
.setURL(promo.link)
);
container.addSectionComponents(sectionBuilder)
}
console.log(JSON.stringify(container))
return {
components: [container],
flags: 1 << 15
};
};```
You cant have both a thumbnail and a button
you get one accessory, so the button is replacing it
also I'd strongly recommend against using any
that goes against the entire purpose of using ts
and you can use enums instead of raw numbers
wait they're releasing this officially? that's huge and gonna totally change my bot. thanks for the info
Please update this lib (discord.js) soon to receive select strings inside the modal
I believe the Pr is already in place
#11034 in discordjs/discord.js by Jiralite created <t:1754556886:R> (review required)
feat!: Support select in modals
Of course. We always do support new features.
will there be more types of selects? type of channels, roles, users
In phase 2
and when can we use it? because now the select inside the modal does not respond
discord js first needs to get its update
just wait till it will get announced
Please update quickly please, we bot/app creators will be very grateful

v10: MessageFlags