#archive-library-discussion
25085 messages · Page 19 of 26
Was on the todo list in march this year
if you can't wait for it feel free to PR
#7053 in discordjs/discord.js by ImRodry opened <t:1638287834:R>
Add Message#awaitEmbeds method to get URL embeds in a message
I suggested this method should reject in case no embeds are added in X seconds but that may not be a good idea do I’d like to know if the managers think it should always resolve or if it should reject when there are no more embeds to add like I suggested
I’m fine with both since I understand the argument for both which is why I’d like to hear more opinions
To clarify: should awaitEmbeds reject the promise when it can't find/or resolve embeds or should it instead just return an empty array of embeds?
(Or an array with the already existing embeds for that matter)
well, is there even any guarantee that the embeds would load in x seconds/ms?
i think there should be an option for how long to wait for (as a maximum i guess, if that could be checked) to reject if no embeds are found (or resolve with an empty array)
There's no guarantee that it will load in x seconds (it's the halting problem). But if it doesn't resolve in x seconds should it reject or spit out an empty array? I'd say spit out an empty array, because chances are if the client can't resolve them then the embeds don't actually exist, hence an empty array.
yeah there can be an option and a default, but usually URL embeds resolve in a few seconds
hello, may i bump this PR please? it's been stale for a while now and there is already 1 approval https://github.com/discordjs/discord.js/pull/6647
@copper laurel did you say you dropped your builders buttons pr?
Kinda. I wanted to redesign it and haven't had time. Not sure it even needs to be in builders tbh
Components could go into builders, sure
Djs has a builder for them tho what’s the point
Migrating and consolidating builders in one place I guess
Pls don’t remove the existing builders from djs though 
But that's the whole point of builders
lol
They don't need to be in djs at all
They’re integrated nicely with the library and work just fine unlike builders which often bring up issues like snake case and having to do .toJSON() all the time
Why can’t we keep the current ones like this though?
I mean... yes, I've expressed frustrations with incompatibility between the modules and core djs before too, but that's irrelevant to the overall design of builder classes being separated
Because "current ones" is nothing more than a legacy after the decision was made for them to be separated really
The snake_case compatibility issue is planned to be addressed, and "having to do toJSON()" is a weak argument honestly, make a necessary function call
It looks like no one cares about builders rn tho
Well with djs classes you can just pass the class itself
Conceptually I'd like it if djs could accept the builder class object, I agree
it has some PRs that have been open for a while with almost no attention despite the comments of people asking for it
I don't use builders nor do I plan to do so but from looking at the github feed this is the impression I get

¯_(ツ)_/¯
Please make sense if you try to say something
A blocking PR was merged yesterday, which pretty much blocked all the others
And they need rebases now because of that
Theres only 3 open, 1 has requested changes, 2 needs a rebase, 1 reviews and another draft
https://github.com/discordjs/builders/pull/53 this has been open since before the initial PR to replace ow was created and has a lot of people waiting it seems
there even was a second PR by that same guy to add autocomplete that was closed for some reason, then they opened that one
Which makes no sense to merge it because it would need a rebase either way and people couldn't use it without the ow replacement
well nvm ig
Hi, just bumping to see where this is at?
Just out of curiosity, what versioning system does discord-api-types follow?
semver
Technically semver, practically it looks like Zerover
yeah that's what I was thinking 
When will 1.0.0 come, if ever?
Whenever Discord as a company dies and stops releasing new updates
aka not in decades
oh really
so it is zerover 
alright thanks
Problem with bumping 1.x, is that it'd require us to bump new majors every time Discord decides to break something
I thought they only broke stuff on api version bumps (or when a feature is experimental ofc)
things may not break actually but we're going on documentation that sometimes isn't accurate, so the types can change in a breaking way based on a mistake there
Yeah makes sense
I mean you can always call those patches if it’s only the types that break but the values are the same
that works for djs, and technically since discord hasn't changed their values it is a patch I suppose
I've rebased it
could the default for position in GuildChannel#clone be changed to this.rawPosition instead? that would make a more accurate default regarding the position but it still wouldn't be perfect i guess
it would be sending the same position discord gave back to discord instead of sending the position calculated by djs
Sounds reasonable
i feel like there should be some kind of note to this in the docs, but im not quite sure how to word/structure that part
i guess i'll submit a pr and mention that?
welp forgot to mention it because i was trying to get the fork to work properly but nvm now i guess
Hello, for the GuildScheduledEvent PR, wouldn't it make sense to add a SubscriberManager? because i don't see any, which means if we want to know if a member is subscribed we have to make a request (or keep a cache of our own).
I think it would make sense because you could have cache, and move fetchSubscribers() to subscribers#fetch() (and even userCount to subscribers#count?). The cache could be updated through the GuildScheduleEventUserAdd/Remove actions
I believe the idea is to create at least a good base right now, because the events you listed are actually documented as experimental and not officially supported... so would rather wait to see if it sticks around before making a manager for them?
ah I see, but the PR won't be merged if the two events are still experimental, will it?
I think it will be because only base support is added and nothing more
gotcha
but then the creation of that manager would require a semver major
I think the initial implementation should be the best possible and the idea of a subscriber manager is nice because the events will stay almost certainly
might change of course but they will exist
No it wouldn't
it can easily be made a sem minor
deprecate fetchSubscribers and make it call subscribers#fetch
voila
eh ig but more deprecations
at this point we could use a deprecation manager lol
Unless you magically work at Discord and are giving us insider info, we don't know if those events stay or not soooo 
I don't see why they wouldn't?
not a manager but something similar to the error handler where you simply call it and pass the message and it checks if the warning was already sent and sends if not
Because it's useless for their clients? Because they don't want to keep them?
It's experimental
it's not useless for clients because the clients have to display the users
And it can just fetch a list
instead of caching them
And this is turning off topic fast
¯_(ツ)_/¯
Those two dispatches you're referring to were introduced relatively late in this feature's development. When the docs say "experimental" here, it more means that this is a "beta feature" since we're actively monitoring to make sure these dispatches are performant at scale. If we notice issues, we may rework when these dispatches are sent and what data they contain. That all said, we haven't seen any signs that we're going to have trouble with them, so if I had to make a guess I'd say they'll stay as they are right now. But we're not giving the complete green light yet just in case.
For XCollector.endReason, why are max[X] options treated as [X]limit?
Shouldn't they be max[X] just for consistency with the option that triggered them? Or at least be documented?
https://github.com/discordjs/discord.js/blob/main/src/structures/MessageCollector.js#L103
https://github.com/discordjs/discord.js/blob/main/src/structures/ReactionCollector.js#L164
https://github.com/discordjs/discord.js/blob/main/src/structures/InteractionCollector.js#L189
also why doesn't endReason seem to acknowledge the time and idle end reasons
is the SessionId property of VoiceState supposed to be unique to the connection->disconnection event? That is to say, everytime you connect to a voice channel a new SessionId is generated? I am not seeing that currently (#archive-djs-help-v13 message)
I'm just going to cheat in the meantime and use channelId to detect online/offline states
but this seems to be an error with the sessionId not being deconstructed during the disconnect state update
about https://github.com/discordjs/discord.js/pull/6957#discussion_r761979364 @tacit crypt when voice channels get messages (since that was seen in datamines) should isTextBased() return true on those?
Well...yeah... Shouldn't the check cover it tho (return 'messages' in this)?
We don't control the session id, that's on Discord, so at least I can't give you an answer to that
I was gonna make them all uniform so they check if the type is in TextBasedChannelTypes so my question was if the voice channel types would be added to that array
I don't see the point
usually if there's messages they're text based
so then the correct way to detect "connect" and "disconnect" events to a voice channel would be channelId changes being null or not
feels like a weird means to detect those changes tbh
well isn't every channel gonna have messages then? Except store but that's being removed soon
Categories?
Correct
right yeah
aight ill keep the messages check
for voice, should I keep the bitrate check or use the types?
Probably bitrate?
aight ill keep that too then
@outer raven also stage channels will not have text (at launch, at least)
and forum channels
Ah right
Forum?
Yeah, datamined stuff, you'll see when it's ready
It's just like a text channel, with threads, but no messages (in theory at least, I haven't seen it)
why are the .toJSON() methods not documented?
like Message#toJSON() and such
Why are there no methods to edit individual properties of an ApplicationCommand like there are for every other structure? Does Discord not allow editing 1 property only?
Probably an oversight?
I'll test to see if they work and add if they do
if it's a patch endpoint it should support that
yeah it does indeed work, will PR
Is it possible to edit the type of an application command? Apparently this is documented but I tried and it doesn't seem to work
probably another PR should remove that documentation because the API seems to just ignore type conversions and Discord doesn't document them
Highly unlikely
Yeah I won’t PR because of the types since we’d need to make new interfaces and idk how to do that with the current type guards
@remote wasp the guildScheduledEventDelete event doesn't seem to get fired when an event is over and goes away from the events list, how is this meant to fire?
when you delete the event
when an event ends it doesn't get deleted
it just gets set to completed
It seems as of b6b4570, stuff is typed as never when the passed type to the API call is imported from discord-api-types:
import { AuditLogEvent } from "discord-api-types/v9";
const audit = await <Guild>.fetchAuditLogs({
type: AuditLogEvent.MemberUpdate
});
const entry = audit.entries.first()!;
const test = entry.action; // Never
const test2 = entry.actionType; // Never
const test3 = entry.extra; // Never
const test4 = entry.target; // Never
const test5 = entry.targetType; // Never
Is this acceptable? This is fine via the passed type of <GuildAuditLogs>.Actions.MEMBER_UPDATE imported from discord.js, though
Probably a typescript moment where it doesn't recognize the numbers because they're from different enums
Try casting the type as const..otherwise, You might have to use the d.js constants object
I was aware of the issues in jsdoc, since they were making yarn test fail locally, thank you @opaque vessel
And there are two issues, the one that's making CI fail, and the fact I can't document getter-setter pairs
But yeah, thank you for letting me know about that PR, I was about to check 😅
@wild flax can you do a new docgen release? So we can use this bugfix https://github.com/discordjs/docgen/pull/15
I want to create a pull request and while npm test I get this err. how can I fix it?
Edit: Got it
hi hi, if you wouldnt mind divulging a bit of internal knowledge here, what's the difference between the idToBinary function in the Util class versus just parseInt(id).toString(2)?
That util has been removed from the main branch (and 13.4.0). Also, it's actually BigInt(id).toString(2), but it's useless.
well, as you might see in the function, there's a high and a low section of the id
due to how numbers are stored, the highest number that can be reliably stored (Number.MAX_SAFE_INTEGER) is 16 digits
which is why it's been changed to BigInt as kaira mentioned
Snowflakes can't be converted to numbers, since they have a precision of 16 digits (and snowflakes typically have 18).
i see now
when you say "Snowflakes can't be converted to numbers" do you mean "number" as in number the primitive type or literally like a numerical value
number the primitive type / Number the wrapper
wait that second reason doesnt make sense, snowflakes are already a numerical value 
ah yes i see. so that's why kaira mentioned BigInt.
but even then it's still useless? how so? you don't get a timestamp from the first 22 bits of the snowflake?
that's why the function was removed?
we use bitwise arithmetic for that in SnowflakeUtil
interesting! i'll take a look
thanks <3
also curious as to why the lib uses 0 as the process ID when generating snowflakes and not the actual.. process ID
but i guess it doesnt matter that much does it
Pretty sure only the date portion of the snowflake is taken into consideration for paginated endpoints
see this is like the third time i’m hearing about paginated endpoints but i have no idea what that means
ah wait never mind i might have an idea
never mind this is outside the scope of the library lol
I mean, we should do that, gonna PR that
@lusty bolt updating on above, I created https://github.com/discordjs/discord.js/pull/7079, however, this is a semver: major update, see the PR's description.
For Permissions, the only way you can tell if a permission is set to default in discord is if both values are false in the allow and deny. Why not set the values to null if its default? So we won't have to go through allat hassle 😪
Because it's more computationally effective, and also because that's what Discord sends us
Anyone else feel this is a bit off where the warning precedes the type? Would have thought it would be on the same line or after it, like it is with others such as ThreadAutoArchiveDuration or BufferResolvable etc.
You're right, wanna tie with Rodry placing the warning below?
@outer raven I'd say, feel free to PR equals to builders
oh really? Alright then I'll bundle that with the others too, didn't think it would be appropriate to be in that package tho
Not sure what the other contribs think about it, but I have no problems with that myself, might be useful to have them in slash command builders (and in turn, also the rest of embeds), cc: @wild flax @tacit crypt
Having built a method that reports all differences between two api datas (so, builder returns), equals is NOT nice to implement
well equals just returns a boolean, not the differences
Yeah, so better have them where they're at, than implementing them everywhere else we use them at
And that
modules?
#equals isn't used by the lib itself (although it could) but it's pretty useful in my code at least and having to make and maintain a function to do that myself is annoying
could it fit in Util? (something like embedEquals)
I don't think so, at least not in the main lib
we have nothing to do with raw data
equals is not about raw data
So... you're suggesting to have @discordjs/comparers or something?
me?
Crawl, with this ^
yeah something like this
idk what do to about the type-guards either
I can do that I suppose don't know what tie means in this context though
I’d say put comparisons and type guards into one module since they’re both similar in scope
wouldn't that defeat the whole purpose of having typeguards?
Wdym
how do you use type guards from other packages
You import them?
but how does an imported method serve as a typeguard for another class
and some typeguards are useful even in js like the interaction ones
It’s a function that takes a class as a parameter and tells you if it’s a certain type or not
but how can an external function cast the type of another class?
What?
There’s no casting
I think the questions are getting confused here
So rather than Interaction.isCommand(): this is CommandInteraction
Is it possible to do Typeguards.isInteractionCommand(interaction: unknown): interaction is CommandInteraction or something like that?
idk how it works but that seems to be whats being implied
Because just getting a boolean true back doesnt help
yeah that was my question
and even if that's possibly it still seems unnecessarily complex
I think we should just move all messageembed methods to builders, including equals
yes, that's how it works
although that particular function is not included in the pr
I mean, that seems a method that should be included in the class, I don't see what's the advantage of having it in a different package
that's true, the package is kind of confusing and doesn't include much so it's hard to figure out what it's actually supposed to be doing/how you're supposed to use it
Yes this is what I was going for
This seems weird to me, doing comparisons on builders makes less sense than comparing the output they give. One hasn’t been finalized yet while the other has
Comparing json objects rather than having something be put on a class also seems to have a lot of utility, take /rest and Dapi-types as an example
thing is the equals method compares embed instances too and, personally, that's what I use it for in my code
Ig my question is does builders output a instance version of embeds? (IE one that isn’t a buildable state)
Oh btw about this, I looked at threadarchiveduration before making the PR and tbh I thought it made sense for it to go before since it’s explaining the next line, not really a major thing but it was a conscious decision
Ah I see thank you
I just noticed there's not one, but two Promises here in GuildAuditLogsEntry's constructor to resolve an invite. Isn't this... bad? I'm pretty sure one shouldn't be executing tasks in a constructor, right?
https://github.com/discordjs/discord.js/blob/6e57b65e99389eb8cbc8c2112281a9c1b7d3783a/src/structures/GuildAuditLogs.js#L504-L518
I'll change it then :eyes:
is there already a PR for guild banners?
Yea
for... what exactly? guild banners aren't exactly new, they've been supported at least since v11
I believe they mean animated banners
no profile per guild banners
What you're saying and what you mean are two different things :P but no
yeah sorry
didnt know what to call it
No one has made a pull request about it to Discord's documentation yet either
The API doesn’t have that field either
It’s an experiment
It’s very much live on canary
That doesn’t mean anything
Well it’s more than an experiment at this point
It's on stable as well.
Ah ok
There is a feature request to include banner for member(s): https://github.com/discord/discord-api-docs/discussions/4217 🤷
Yeah I’m on stable and my client has it lol
That doesn’t indicate that it isn’t haha
Well it’s not exclusive to the experiments tab that’s what I meant
Yeah almost no experiment is
There’s always a tiny rollout almost
Server profiles has been in a tiny rollout for ages before they decided it’s not an experiment anymore
Server banners and bios are barely starting to rollout
Everyone seems to have access to them now
But yeah it’s not on the api so nothing we can do
For #7091 (removal of deleted getters), instead of iterating theough every entry to set the deleted field to true on a XXDelete event, can’t you just check if the parent was deleted in the getter? i.e.:
Message: In the ChannelDelete event, where it checks whether or not a channel has messages, then iterates through all of them to mark them as deleted.
Then can’t you make Message#deleted returndeletedMessage.has(this) || this.channel.deletedor smthg? So you don’t have to update it
will this come out soon?
It's not released yet, but yes, we will support it.
Even if you could do that, many other drawbacks still stand.
In reality, we'll most likely get rid of partials in favour of near-stateless data, and this will make those getters suffer even more.
Got it, thx
Suggestion: explicitly require setTimeout/setInterval/setImmediate from node:timers wherever .unref() is used
Reason: browsers dont understand unref, so using djs13 in something like, electron renderer prcess, throws error
D.js should not be used in render process
why not?
Cause it's not rendering anything?
Well, I need it in the renderer process
setting up IPC for everything is a lot of work
Then just get the data from the main process
there are a shit ton of restrictions on what can and cant be sent-
you need to .toJSON everything before sending
that messes up with a lot of properties-
Then don't send entire d.js structures but only the data you need
I need entire djs structures-
Do you?
Mhm
probably use REST instead ?
What do you do
Tryna use React and djs together to build a GUI for my bot
...and hiw exactly does that require full structures instead of just data?
or just make an api of the bot and transfer data from that api ?
... Eg: instead of sending an IPC signal to main process to fetch data and then a response back with all the data, its way simpler to call it in the renderer process and update state when the promise resolves
That's a roundabout way of achieving same thing, moon
You see
D.js should not be used in renderer, because as you have noticed, it's different environment
too much work
my solution is literally requiring node:timers in a bunch of files
there was actually djs webpacks, not anymore
If you absolutely decline the proper use, feel free to make your own fork of d.js
And probably expect more stuff to not work in the renderer process
I cloned the repo and edited out all the files where unref was used
and it works
just wondering if it could be implemented with the main code
everything else works tho :)
"everything"
I did
I gave you the reason why it most likely won't
probably not, cause not anyone use it as a renderer on electron
Hmmm, true tho
Alright then, I'll publish it as a separate package and use it for my project 👀
ok yeah, maybe not everything but atleast it doesnt crash on start
Yiu don't have to ping me with every message
but as you said, I'll make my own fork and work on it 👀
My bad, its a habit, sorry
Then don't reply either, i am capable of understanding that you were talking to me
kk
This seems to be fixed on the dev branch: https://github.com/discordjs/discord.js/commit/25b84912351617f42de055ff0351286a0c9425da
It doesn't matter regardless
Using d.js in the render process is unsupported and youll likely encounter other issues
Set up proper IPC
damn, thanks
Welp, guess I'll have to do that
Was going through some of my todo's and found
// TODO: remove once native check is implemented
function isGuildTextChannel(
channel: TextBasedChannels
): channel is TextChannel {
return channel.type === "GUILD_TEXT"
}
```Was there any plan to add a native check? I'd like to follow that issue but I couldn't find it
#6957 in discordjs/discord.js by ImRodry opened <t:1636284465:R> (review required)
feat(Channel): improve typeguards
📥 npm i ImRodry/discord.js#feat-channel-typeguards
i believe this is what you're referring to?
Thanks! I didn't think of checking for the word typeguard
There was also a convo about it in this channel, but search is down
You could probably search for "isStrictText" when it comes back up, i remember that was mentioned, that probably hasn't been used for much of anything else
discord.js's change log pull request links no longer work... found this... so in case a release is done soon and this still is the case, might wanna edit the links before publishing :eyes:
https://github.com/github/feedback/discussions/8623
That discussion also seems to suggest that /pull/num works for issues, so maybe use that everywhere instead?
Idk yet that seems like a bug
And not a conscious decision?
!777 oops, accidentally typed this and just noticed lmfao
he just didn't update it on GitHub?
What is the best handler for a discord.js bot? Like which many js bots use? Glob/builders?
this is moreso a question for #archive-offtopic as this channel if for conversations about the librairy itself
Is there any preference for the use of toString() over ${var} on the library?
I would think toString() when being called on classes that have that method, ${} if actually string-building is fine
it seems like doing ${var} is faster though, and toString is actually only used in a handful of places
By that I mean return this.thing.toString() is probably preferable to return ${this.thing}
This is the test I ran btw
That looks like a monstrously flawed benchmark.
Try a class with that, there are some optimisations going on in there, because both have the exact same semantics.
oh yeah with a class they're both equally fast
well nvm that I guess
Some servers have access to the timeout on Discord. Is there a draft PR to use it with bots?
#6949 in discordjs/discord.js by ZeldaFan0225 created <t:1636196794:R> (review required)
feat(GuildMember): Added communicationDisabledUntil property
📥 npm i ZeldaFan0225/discord.js#main
this?
No, this PR adds the property to know if the user is timeout or not but not all the functions to timeout a user from the bots :/
My bad
I didn't see the end of the modification, thanks 👍
np
The feature is still not released from discord and is not available through the API yet
Even if the bot is in a guild that has access to this feature he can't us it ?
the bot doesn't know the guild has access to the feature. as far as the bot is concerned, it may as well not exist.
If the only problem is whether the server has access to the functionality or not, then it is not a problem ( Servers are not selected randomly ) 😉 The only thing I needed was to know if the bot could use this feature (thanks to the PR) if it was in a server having access to this feature. Now that I have the PR I could test
The feature is still not released from discord and is not available through the API yet
@opaque vessel for your PR I was requesting the interface for GuildMemberEditData be updated for the new field
Isn't this right?
export interface GuildMemberEditData {
nick?: string | null;
roles?: Collection<Snowflake, Role> | readonly RoleResolvable[];
mute?: boolean;
deaf?: boolean;
channel?: GuildVoiceChannelResolvable | null;
communicationDisabledUntil?: Date | number | null;
}
oh I missed the diff in ur PR, ignore me
Haha, no worries! (:
It's released... As I said some servers have access to this feature (screenshot made by me few seconds ago), when I say something I have a reliable source behind it (I hate to assert something without proof) 😅
Never-mind, this channel isn't made to discuss if a feature is released or not. If other people are interested in the answer to my question here is an answer with tests :
Bots can use this feature in servers that have access to it (I'll let you discover how to know if they have access but it's pretty easy)
not merged on DAPI docs -> not released, for all we care
this is still in a pre-release phase and could potentially still change in usage and API documentation, hence it won't be merged yet, until the API is set, confirmed to be set and merged on API docs.
You'll receive a missing access error since it's only released for partnered servers.. and it's not fully released yet as all the contributors said.
Yes, I understand 🙂 but that didn't answer my original question which was whether there was a PR going on and whether a bot in a guild with access to this feature could use it
I know that don't worry 😉
Yes there is
They are waiting for discord docs to be updated first
Is v12 gonna be deleted any time? Or is it gonna stay?
it will just stop working eventually
¯_(ツ)_/¯
so? ._.
I don't quite get what you are asking
like yeah I didn't make a release, because nothing noteworthy happened there anyway
you've replied me even if you didn't get the question ._.
no, if the server has access, bots can use it (oh u said that later)
all servers with the PARTNERED feature have access
as well as certain others
this does not need to be discussed any further here
as long as it isn't merged on DAPI docs it's not going into the library
Add the allow and deny objects to the permissions property for creating a role 😪
that's unfortunately not how role permissions work.
guild level permissions can only be granted or not granted
the only input for role creation that makes sense is the granted ones, which is exactly what it takes at the moment
which version of Discord API is discord.js v12 using?
._.
v7 technically doesn't exist
so whenever v6 goes down, so does v7
why is it that in almost all structures with timestamps the *Timestamp property is obtained by doing new Date(...).getTime() and the *At getter is just new Date(...)? Wouldn't it be more efficient to make *At a property and *Timestamp a getter that returns <At>.getTime()?
probably yeah
although actually
*Timestamp (and or *At, its been a while so i forgot) is sometimes assigned in initial construction
it would probably be more efficient to use Date.parse(x) instead of new Date(x).getTime() unless that gets optimized
isn't the *Timestamp sent from discord though? why would that need to be a getter?
discord sends an iso8601 date string, not a timestamp number, so discord.js converts it
ah, i misread rodry's message as them both being getters, my bad
wouldn't *At be modifyable if it wasn't a getter though?
wdym?
*At properties are Dates, and you could modify them with the setX methods
wait, none of the objects are frozen, are they
so every thing else is modifyable?
the only thing that is modifiable is the timestamp, the getter then changes based on the value of the timestamp, idk what you're on about
i mean if all the other properties of the object are modifyable then the date being modifyable doesn't really matter
i was referring to if *At was the property and *Timestamp was the getter
the only way you can modify them is through the edit method ?
reassignment...?
like modifying the object directly
but... why?
Just to the end user, if the object gets modified directly such that the data is incorrect
I was thinking about that, but i realized that all the other properties are modifyable as well so it doesn't really matter
tested this and Date.parse is indeed faster but only by 5-10%, is it worth it?
I'm already working on it 
don't see a reason not to change it
aight
Because Dates store far more data
So they take a lot of space in memory
ahh that makes sense
well then ig the only thing to do here is use Date.parse instead which is a great idea and I didn't even know about the method
same tbh, I looked it up just because of this discussion
I've been testing with some events for my bot, and it seems like whenever I kick it from a server, it tends to trigger both guildDelete and guildMemberRemove events instead of just the guildDelete event
is this supposed to happened ?
I believe so? Its not a bug so to speak as a member is being removed
if it does happen it would be an api bug/issue/behavior, not a djs one
like the phantom guildDelete
fair enough
@vivid field I did some tests and using the ternary operator seems to be faster than using && for when dates are possibly null, should probably change that too in your PR maybe?
are you sure? it's almost identical for me, even a tiny bit slower
oh after a few runs it turns out to be faster, but only by 0.8% max
not sure if that's worth removing simplification of code
It’s not
I got 1.8% but yeah still small
There are lot of other things to make the libary faster such as converting the caching system...
?
hm?
Saving whole nested Structures vs saving raw data.
I was intending to solve bigger "problems" rather then complaining on small things.
what are u on about
^
Just forget it lol.
I am talking about other factors, which are more relevant for a "faster speed".
I mean we have an issue ticket for storing raw data it’s planned to be added
tomorrow I will tell more, currently falling asleep. I made a list...
About the workflow of releasing versions, is my understanding correct that each version will be released when the relevant milestone is completed?
ie 13.4 when the 13.4 milestone gets completed, etc
In theory
But the milestones themselves are subject to change too
I mean if there was a critical security patch then I hope the maintainers will release the next version pretty quickly, without the milestone necessarily being met
Has that ever happened....?
I don't think so, but it definitely could in the future
I just don't see how it's relevant to the question about our milestones. Of course we can make other releases as needed
Expedited releases are usually a result of a regression
Security patches are not roadmapped milestones in the first place
Same for discovered bugs and regressions, yeah
We'll just make another milestone and move everything that was planned and didn't merge to it, @real jetty
So if there was a security patch release, only the patch would be released, and not the other bug fixes, is that correct?
We do that a lot, in fact we did that recently for 13.3 > 13.4
We'd just release whatever is on main
And the version depends on the semver from the commits, if we just landed bugfixes, dep updates, or docs changes, we'd just release a new patch
This is definitely not the correct place to ask this question
there is #869652447881207858
public reply: (options: string | MessagePayload | InteractionReplyOptions) => Promise<Message | APIMessage | void>;
// reply func
const reply = async (options) => {
if (!await interaction.fetchReply()) return await interaction.reply(options);
else return await interaction.editReply(options);
},
I fixed it by adding the GuildCacheMessage<CacheType> type which according to discord.js typings returns editReply. Isn't there a bug in the docs then?
https://github.com/discordjs/discord.js/blob/main/src/structures/interfaces/InteractionResponses.js#L130
Types: https://github.com/discordjs/discord.js/blob/a0fe0acbf1c0134d88d9fc519506cf33116288cc/typings/index.d.ts#L1580 | https://github.com/discordjs/discord.js/blob/a0fe0acbf1c0134d88d9fc519506cf33116288cc/typings/index.d.ts#L348
I fixed it by adding the
GuildCacheMessage<CacheType>type
I'm a bit confused by this, don't those links you provide already include them?
I have
// ˇ Without error
public reply: (options: string | MessagePayload | InteractionReplyOptions) => Promise<Message | APIMessage | GuildCacheMessage<CacheType> | void>;
// ˇ With error
public reply: (options: string | MessagePayload | InteractionReplyOptions) => Promise<Message | APIMessage | void>;
public static createWithInteraction(interaction: CommandInteraction | ContextMenuInteraction, command: Command): CommandContext {
return new this(interaction.client as GClient, {
...(super.createBaseWithInteraction(interaction)),
interaction: interaction,
command: command,
commandName: command.name,
arguments: new ArgumentResolver(interaction.options.data),
reply: async (options) => {
if (!await interaction.fetchReply()) return await interaction.reply(options);
else return await interaction.editReply(options);
},
editReply: interaction.editReply.bind(interaction),
deleteReply: interaction.deleteReply.bind(interaction),
followUp: interaction.followUp.bind(interaction),
deferReply: interaction.deferReply.bind(interaction),
});
}
When I had everything but GuildCacheMessage<CacheType> in the type, it threw the error shown in the screenshot. So do you guys happen to have some error in the typings there? Because in the documentation there is Promise<Message|APIMessage>
File: https://sourceb.in/R4iFs4v1xH
Full code: https://github.com/Garlic-Team/GCommands/tree/next
It's... never a good idea to supply such a huge block of code or your entire codebase to reproduce an issue, you should create a bare minimum reproduction sample
ˇ
I don't really know how to fully explain it. I simply have a reply function, and there I have used the reply and editReply functions. When reply isn't there yet, it gives reply, when it is, it already edits. I have typings that the function returns Promise<Message | APIMessage void>;. But, when I just have this in the typings, it throws me an error which is shown in the screenshot. When I clear editReply in the function, it works. However, when I want the editReply to stay there, I look more and find that I have to add GuildCacheMessage<CacheType> there as well. However, the docs don't state that editReply can return a GuildCacheMessage<CacheType> type.
This is not a MRE... there are so many unknowns in there...
The issue isn't that type... that makes no sense, GuildCacheMessage<CacheType> is Message | APIMessage. Looking at your error, it states that APIMessage imported from @discordjs/builders isn't compatible with that of APIMessage from discord-api-types/v9. So... there you go. This just means there's a change in the exported type, and you're comparing cross-versions that are not compatible
If you scroll down in the error you screenshotted, that is the reason why
I import from discord-api-types/v9
|:
Maybe @discordjs/builders's discord-api-types dependency should be bumped @tacit crypt
Feel free to PR it if it wasn't already
You guys should setup dependabot or renovate or whatever else to bump the dependencies automatically
The issue is that we might run into some type incompatibilities, that require more than just bumping the dep
Pretty sure you can configure the bots to not update the dependencies if it's a major version difference
Prs can still be modified before being merged 🤨
With my pr switching d.js to undici, it seems it's getting held back by whatwg streams + blob being experimental and I don't really understand why this would be a deciding factor? I just wanted to ask here to see the reason
@remote wasp Any thoughts on the 3 other comments on the events PR? 
Why does guild.bans.create() possibly return a snowflake? Cant you try to resolve the guildMember and if that fails, return the GuildBan which has the user object?
The api gives an empty response when creating a ban
Is it possible to fetch the last ban and return it in that function they made? That way it'll always return some sort of User object
Also the GuildBan can’t exist until it’s created
That would require another api call
I gotchu
Wouldn’t be the first time where an option is added to do that, or where that’s simply done without an option
Would ppl actually use it tho?
I think so because returning a Snowflake is the least useful information you can get from creating a ban
Could make it a partial user
I think the GuildBan would be the best way to go tbh
But isn't Snowflake the absolutely only thing you need to fetch a user? if you really need to have the user object that for some reason wasn't given, you can use it to fetch. + This way you have clear way of controlling if you want to cache the user upon fetching, where the ban option would have to have its own sub-option to allow that control
And while true, you don't have a full GuildBan from that ban in that case, what exactly (apart from User) do you not have at the moment of creating the ban, given how it's your bot that created the ban?
If you'll like, I can make it return the GuildBanManager for next major ^^
To be honest, if you banned a user, you should at very least have the User or the GuildMember beforehand, unless you're banning on sight without any validation whatsoever. And since you'd normally do, d.js returning User, GuildMember, or their partials, is completely useless
From what I see tho, managers return the least amount of data needed, while structures return more, and I personally like that
Doesn't it throw a rejection if the User is Unknown tho?
If you pass a snowflake that isn't a user id then yes... nothing to build there, just invalid
Well yeah I was thinking about catching the rejected and have users enter an ID. If its invalid then itll send a message letting them know, with the resolved tho I can see who got banned instead of having to fetch. Also, my ban command bans users who arent even in contact with the bot so instead of me having to fetch the api, this would be helpful
When I ban a user I often don’t have the guildmember or user objects, I just have an ID so it would be useful to get the user afterwards to craft a response with their name or something like that
^
Btw when is server banner being added? Like GuildMember#bannerURL n stuff
and how is Snowflake not useful to achieve that
It is, but a User is even more useful and having a method return 3 different values isn’t properly useful
When it gets out on the api and documented on the docs

wdym 
we don't release stuff that is not documented in the api docs
Ik but ian ask for tht, I asked when, thnx for the info tho all cool
When it gets out on the api and documented on the docs
"When do u go to the store?" "When I go to the store"
Ofc it needs to get documented
we are unable to give you a date you could use in your calendar, simply because it is not in our control. the answer you got is as close as possible
Thanks
So... you're telling me you ban right off the bat?
Without any validation whatsoever?
doesn't API handle passing invalid id anyway?
you save a request trying to fetch the id just to ban it and never use it again
I mean, many bots have something like a ban command where you can supply the ID of the user (for example if you want to ban a user who is not in the server) and returning something like "Username was banned" is common. So, we can assert on our side that the ID is actually a valid snowflake but we don't want to fetch it from the API to see if it's a real user ID because we don't want to do 2 API calls and we don't need to... When we ban the user the API checks it for us and returns an error in case.
But in order to display username (as well as create a moderation log, which also many bots do), you need to fetch the user 
Would people be opposed to adding a fetchUser option in BanOptions, which fetches the user object after successfully banning? Akin to how interaction replies have a fetchReply option since the response is nothing
Could always assure the return type is User then, even if uncached
I knew it'd come up to this, it's basically a big can of worms
We just allowed the fetchReply thing to go thru because it was very highly requested and a lot of people wanted it, but in turn, it has also increased the development cost of that method, and brought this very proposal Jira is proposing
I still don't get why we should fetch/create a user object if you pass in an id..when you can do that yourself if you want
Hence why I'm saying we should change that to return the manager, Vlad
Like many other manager methods do
Returning the manager is useless too, what will you do then?
We don't return the managers for delete calls for instance
Yeah, fair enough, but since returning a Snowflake is totally useless (as I surely already have it if I ban a user) shouldn't djs return the cached user, or a partial one if none is cached? Because now we need to do something like this:
const id = interaction.options.getString("id", true);
await interaction.guild.ban(id);
const user = await interaction.users.fetch(id);
interaction.reply(`${user.username} was banned`);
You could use a user type in that example
Since that'll resolve for ids too
Other methods return the manager? :thinking:
Some do, some don't, some return what's created.. it's not consistently defined
Discord doesn't return anything? We shouldn't try to make up something. What if Discord decides to return something that isn't compatible with what we're returning? We'd need a semver-major to change that. While that wouldn't happen if we return void, because changing something to a promise that resolves to a void (always ignored), to one that resolves to non-void (may be ignored), is technically not breaking.
I'd argue the implementation of that example is wrong in the first place. If you are passing an id, use a USER option
For all we know, Discord could change that endpoint to return a ban object, or a partial guildmember, and not a user
or could do nothing
The fact the possibility exists, and we're making up stuff that Discord doesn't give us, is troublesome
And we're also trying to move away from requiring cache so much, plus, any extra operation in the managers will slowdown the operation of the structures that call them and do return this;
I'd say return void and call it a day tbh lol.
These days people use slash commands... if you pass an id, it'll resolve to the user object and congratulations, you have that already. Nothing else you need to do (and you even get the guild member object if they're in the guild)
The people who don't fetch the member/user before banning are people who aren't aware anyone could pass an ID to it and literally ban *anyone*, even those with higher roles than them
Its completely senseless providing data back, when Discord does not give them.
"Just because the Users are to lazy" is not a valid reason.
• The User has to be fetched before banning the Person, in order to validate if the User exists and if the Permissions are below the executor user
The user doesn't have to be fetched before banning, guild.bans.add doesn't rely on cache, but it has to be fetched for permissions
This is exactly why Discord returns nothing, it's beyond useless. If you're banning somebody, you should always have the user or the guildmember beforehand, because you're supposed to check permissions to not get a 401 back, or banning users regardless of the hierarchy or any protection (e.g. mod role protection) the bot should have
Wait, did I meant this?
Sorry, was talking about dev-side validation
It uses resolveId, which returns the ID as-is when you pass a string
Meister meant that on the bot dev side the user must be fetched
Not on the lib side
^
Anyways the points were made preeetty clear from what I see
- you ought to fetch the member/user yourself to check for permissions and hierarchy
- we shouldn't return data for things you can fetch yourself because of lazyness
Of course, the last point has the asterisk of interactions fetchReply or w/e (but I'd argue that one is fine due to the nature of the interactions api, and is a common enough requirement that makes sense to add)
So do we agree to return void on manager methods where discord returns nothing? So that we can remove the mess of return types that is guild.bans.add?
What if the user doesnt share a server? We'll have to fetch from the api
So do it
Fetch the member, if it doesn't return a member you can freely ban, else check hierarchy, ban if possible
Why not have it return a User or GuildBan instead? That way we just have to resolve and boom we good
Have you even read any of the messages?
We've already discussed why we shouldn't fetch after the ban, with the clearest reasoning being that Discord doesn't return anything right now, and should they choose to, it'll require a breaking change and a major version
Alr
Alongside that:
- Calling fetch will check caches first, which, if you don't sweep said caches, means super fast returns
- An API call to fetch a single member or user is super fast too, and isn't as ratelimited as chunking members, you don't need the GUILD_MEMBERS intent, etc, and gets cached once fetched
I gotchu
How is GuildMember#User nullable?
partial probably
Gotchu
Theres been a lot of talk here - if theres an issue with the ban method returning inconsistent values then arguably you should reduce it to the maximum one that can be guaranteed
Which would be for it to always, only return a Snowflake
Then the developer is free to use that to fetch any additional data they wish - either a User object, or a GuildBan object
or void ?
Can snowflake not be guaranteed?
it can, but why would it return a snowflake if discord doesn't
that's the least useful piece of information
and it's something you certainly already have
returning void is just so much more consistent
As long as we don't end up like this... https://github.com/discordjs/discord.js/blob/main/src/managers/GuildMemberManager.js#L346

With the V13 update, did the library change anything with the privileged intents? On v12 I was having issues trying to get my bot to show the actual full user count of my bot. It would only show the cached user count. However, after getting privileged intents, I am able to start my bot and it shows immediately my actual full user count (80K) users. But when I switch to my V13 branch, I’m having once again the same issue. It is only showing the cached users as my bot user count. So did these privileged intents get changed? And if so is there a way I can fix this? I want my bot to start and immediately show the actual # of users my bot has, not the cached user count. I have the same exact intents and partials etc. the client is setup exactly the same. So with the v13 library I’m not sure what changed this. Can anyone input on this?
your premise is already wrong.
if you rely on client#users or guild#members (accumulated) you have never received the "actual" user count. to do so you'd need to fetch all members of all guilds at ready (which we heavily recommend not doing because of the massive memory overhead, time and availability reliance). a good estimate (though it includes duplicates) is to accumulate guild#memberCount instead, over all guilds in client.guilds.cache.
with version 13 discord.js does not send all possible events in the identify payload anymore, meaning you will have to specify each intent you want to receive in the client options (https://discordjs.guide/additional-info/changes-in-v13.html#intents)
So this is the same code I am using on v12 and v13, but on v13 like I said it won’t show the 80K users
const intents = [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_BANS, Intents.FLAGS.GUILD_EMOJIS_AND_STICKERS, Intents.FLAGS.GUILD_INVITES,
Intents.FLAGS.GUILD_MEMBERS, Intents.FLAGS.GUILD_MESSAGES, Intents.FLAGS.GUILD_MESSAGE_REACTIONS, Intents.FLAGS.GUILD_VOICE_STATES];
const client = new Client({ intents: intents, partials: ['GUILD_MEMBER', 'REACTION', 'CHANNEL', 'MESSAGE'] });```
you don't receive all guild members on large guilds on ready, never did, no matter the intents
I had to apply for user presence and once I got that approved I was able to show the full user count. Before this it was only showing the cached users
that's a misconception. even with the intent you rely on cache and user data that hasn't arrived yet will not be included
it's just that you get more data due to GUILD_MEMBER_ADD and GUILD_MEMBER_UPDATE events with the GUILD_MEMBERS intent
as for presences: yes, that is necessary to get the initial members (again, not all members) on ready with the initial guild data
I’m just confused because I was using those exact intents and I was only able to show cached users. I applied for user presence intents and now I am able to show full user count on startup. So that intent i was approved of fixed my issue. If I disable the user presence intent, I go back to only being able to see cached users
it is not the full user count, as much as you want it to be, you are always only seeing cached users, because that is simply how the library works
we cache data as it arrives through various websocket events or requests you make
intents just mean that you get more events, more data, faster cache fill (or data to cache at all, depending on the type of data)
Well then my question is, how with the user presence intent I can see 80K users on startup but without it I can only see 20 users then it grows slowly? Those 80k users weren’t cached.
Those 80k users weren’t cached.
well, yes, they were.
the presence intent controls if you get guild member data for guilds on start-up (on large guilds: online/idle/dnd only)
the user data for any members we receive through that are cached.
Okay, so if they were cached then how come with v13 they aren’t being cached? I’m sorry if I’m being ignorant. But I spent so long fixing this for v12 and then updated to v13 and now that fix isn’t working.
Try limiting intents on v12 and you’ll produce the same results
So do I need to add more intents to have this outcome I want?
Because yes when I disable my privileged intents for user presence I only get the cached users starting from 0 and growing onward
The only reason you get more users with the presence intent is bc the presence update event comes with the user object, which d.js caches
So with the difference from v12-v13 why is this not caching all members?
v13 is forced to use intents
v12 is using an older api version, where it got added as an optional property for backwards compatibility
Okay, so I just won’t be able to show all users on startup with v13? I’ll have to just update via cache?
Presence intent will only cache non-offline users
I believe you still need the guild members intent to initially receive all members if the guild is not large
I do have the guild members intent
50 members is the large threshold by default
You can increase it up to 250 members
Okay, well thank you both @copper garden @unique axle I appreciate all the clarification and advice. Thank you, I do appreciate it. I’ll start trying to figure out how I can change it. I appreciate your time ❤️
you could just sum up Guild#memberCount with only the GUILDS and GUILD_MEMBERS intents as mentioned before.
Yeah that’s not recommended though as souji suggested and I agree, that’s not the best way of going about it
wait, other way around, i recommend that
it includes duplicates but it's much less straining on your caches
the fetch on ready was the one not recommended?
Oh, I got that mixed up my b
there's just not really a great way to go about it while also getting perfect results though, those 3 solutions each only tick one of those boxes
Yeah unfortunately. Well thank you all again. I’ll try the suggestions you have given me. Thanks again!
So if I did something like this?
var userCount = 0;
client.guilds.forEach(g => {userCount += g.memberCount})
Need the nullish coalescing in case of unavailable guilds
Okay
you can just use Collection.reduce on the cache. there's a tag for it, check #app-commands
got it working! Thank you all client.guilds.cache.map(guild => guild.memberCount).reduce((a, b) => b + a, 0)
that iterates on the cache twice btw
you have a more convenient way you can provide?
there's a tag for it, check #app-commands
Ah thank you!
Am I on the old docs? Lol i jus click the redirect
That's how the collection docs are now, and also #archive-site-discussion for developing the docs btw, this channel is more for the functionality of the lib
Ohh alr

seems like your djs and/or djs/collection versions are outdated then
and can you just stick to a single channel
Gotchu, imma see
My fault, I heard they for specific reasons n stuff lol ain want the mods on my head
It's not released yet
I'm on v13.4-dev and its just not there peko
Gotchuu
oh huh i do recall using it though in old code. well that's odd, my bad then
Reverse was merged 20 minutes after the last release so u gotta wait for a new one
Hopefully when the other pr is merged
that is somewhat comical
Why is this enforcing the void return type for callbacks?
Does djs even do anything with the callback after its called?
bc that's the correct way to type our callbacks, you don't return values in a callback that doesn't use them
Guess that's fair, makes everyones code a bit messier though.
Just add the void keyword
Both these upstream pull requests were intentionally closed:
https://github.com/discordjs/discord.js/pull/7122
https://github.com/discordjs/discord-api-types/pull/271
Theres an error wit djs returning a collection of members when fetching only 1 btw
how so
Please be more descriptive
hello if i wanna add a new type of option to command option types what all do i need to check
I just check more into it, if the value passed is undefined it returns the whole collection instead of a rejected promise, dont think thts supposed to happen righ?
Thats not an error
Of course it is
members.fetch() and members.fetch(undefined) are identical in Javascript
You couldnt have the first work if the second didnt
Thats interesting, it didn't do that before so I thought it was an error
the more yk I guess
I promise you it always did haha
Yh I probably was trippin or sumn lol
If you were to pass something that isnt undefined, but also isnt a valid ID, that would error
Alright, Lemme try
Is there anyway I can get undefined returned? To make the code shorter
Really not a library question anymore, but please remember that shorter code does not mean better code
Wasnt meant to be a reply to you sorry
I gotchu
ah np
Off the top of my head, util/Constants will need it defined, CommandInteractionOptionResolver will need a getAttachment, and the typings
Depends how different it is to other option type
"and the typings" you mean discord-api-types?
No, I mean the discord.js typings
where do i find those?
Though possibly api-types too if we pull those from there
i added it in api-types
all i need to do now is add in djs tuypings and constants like you said
thanks!
how does this look? https://github.com/discordjs/discord.js/pull/7123
That’s not what they meant…
???
lol it's my pr i know what im making the pr for XD
@outer raven i updated the pr, can you have a look at it again?
I can but keep in mind I'm not a maintainer
that's fine lol you just seem like you know stuff so i asked you
why did MessageAttachment#_patch not patch filename ?
i know that but why was it not in MessageAttachment#_patch tho
like all other properties are being patched in MessageAttachment#_patch then why not name
Because it's seperated out from the data object as the second parameter in the constructor, as megatank mentioned
it's for convenience when making your own attachments to send, why wrap it in an object when you have no other data to provide
why would the name of an attachment ever change
I doubt we patch nested objects, if only, we re-create them
i wanted to create a MessageAttachment from an APIAttachment
Shouldn't this be done as Message#attachments? (https://github.com/discordjs/discord.js/blob/5ec04e077bbbb9799f3ef135cade84b77346ef20/src/structures/Message.js#L161)
new MessageAttachment(attachment.url, attachment.filename, attachment)
ok yeah that makes sense
ill do that
does it trigger userUpdate event when changing profile banner?
and does GuildMemberUpdate get triggered when changing in-guild profile avatar/about me/banner
No. This is more of a question you would ask in discord.js's support channels, not here (or test yourself)
Is there a reason why <ApplicationCommand>#transformCommand() is private & static (https://discord.js.org/#/docs/main/stable/class/ApplicationCommandManager?scrollTo=s-transformCommand) instead of it being moved to the Util class?
In the scope of djs, what’s the use for it?
In djs it's used internally for converting applicationcommanddata into something useful for the DAPI
I think it should be moved to Util though because its a useful utility if you're already using the ApplicationCommandData type for creating your slashie objects. I personally use it for deploying without having to be logged in to discord.
But it’s transformed internally anyways
Yeah, using this function. https://github.com/discordjs/discord.js/blob/stable/src/managers/ApplicationCommandManager.js#L118
Yeah that’s my point lol, it’s run for you anyways when you pass an object in
Why use webhooks instead of embed for answer at slash commands?
We can't use custom emote in webhooks
I dont quite know what you're asking here but
A) Webhooks can have embeds in them, they are not mutually exclusive
B) Webhooks can also have custom emotes in them, as long as the @everyone role has USE_EXTERNAL_EMOJI permissions
C) Discord designed slash command responses as webhooks, not us
Why everyone need USE EXTERNAL EMOTE and not only the bot?
It's not practical to have to give permission to everyone
Webhooks aren't in your guild - has nothing to do with your bot
You'll have to take that up with Discord then
Someone told me that it's because Slash command answers are webhook and not embed and it's why everyone need custom emote perm
Any link for I ask it?
Your bot answers through the webhook which isn't exactly attached to any member so you can't give it perms directly, it just takes the default (ie @everyone) perms
Interesting
Yes, they are webhooks. Embeds are nothing more than a part of a message and that has nothing to do with them being webhooks
Your bot user doesn't need to be in the guild at all for slash commands to be provided, hence, response are webhooks
Why are we allowed to modify a guild's features on Guild#edit? Does the endpoint actually support adding/removing any features?
yeah I know it's there but does it actually work?
For ones that obviously won't, yes... you can for example remove the community aspect of a server
oh I thought bots couldn't do that
alright
and is there a way to obtain all available features? It doesn't seem to be exported in constants
@opaque vessel could you say something about the currently unresolved reviews on the timeouts pr pls 
Well for the first one, looks like two members of discord.js decided against for renaming the helper method, so that's a resolution
export type TimeoutDateResolvable is pretty harmless, but no core maintainer has said anything yet
I have nothing to say about "Why does this method not support TimeoutDateResolvable?", ckohen already said my reasonings too
So... I have nothing to say to any of them
Well for the first one, looks like two members of discord.js decided against for renaming the helper method, so that's a resolution
I genuinely don't understand why, and people only reacted, no one actually said anything. I replied to your comment and I genuinely think it makes sense, so I'd like to understand your POV on why you think that name makes sense here but not on other situations
I have nothing to say about "Why does this method not support TimeoutDateResolvable?", ckohen already said my reasonings too
I mean it doesn't hurt to support it does it
is there already a PR for the timeout feature?
They are literally talking about it one message above :^)
A: Yes there is
is there or not
Keep the channel on topic
wdym its channel topic
PRs are literally a part of developing discord.js
#archive-sharding message
Is this a bug of the action handler? Seems to cause a crash of the Process. Should they create a issue?
They just need to update to stable
Can you add like an errors option to MessageComponentCollectorOptions, so the end event will only trigger by time or whatever we specified?
Should already be there, not sure why its not documented
Should be in the base CollectorOptions
Oh nvm, I know why
Errors are only relevant to the promisified versions
Collectors dont have error events, they just end with a reason
Right right, thats why we use .catch() ain it?
Well not on a collector no
Hmm, I mean like .awaitMessages and .awaitReactions, are the errors not rejected promises?
Well that doesnt use MessageComponentCollectorOptions, it uses AwaitMessageComponentOptions
And that already only errors on time
So, we won't be able to have it end by time only for MessageComponentCollectors?
It only ever collects one component, or runs out of time
Thats the only conditions it can end
You don't need error to be able to specify time
I gotchu
component - resolved
time - rejected
Makes sense
It was designed that way (single collection only) because Discord requires you to immediately respond to the interaction
Not sure if this is the right place, but any idea if it will be possible to place multiple users on timeout at once? like for example:
await guilds.disableCommunicationsFor(Array[Targets], {options}):
Options being duration in ms and a reason for audit log.
Nah not specify, my component collector doesnt end on time only it ends on both time and component if u get wut I mean
Unlike reactions/messages where you can apply extra error conditions like ending on a max number etc
Yh I get that
..
No I doubt it ever will be
The API isnt designed that way, much like you cant multi kick or ban
true, thanks for the quick reply.
Well yeah, but the component is the successful end, and time is the error end, right? The promise is designed in a way that time is always the only error, so theres no need to specify any others
Gotchu Gotchu, thnx
@opaque vessel api docs for timeout has been finally merged 🙂
https://github.com/discord/discord-api-docs/pull/4075
hope your pr for timeout get merged to the library 🙂
I think jiralite is well aware lol
@dawn merlin a few days ago you PR'd this change and now I'm not getting types on my created channels when not specifying a type (defaults to text) and I'm getting the store channel deprecation, could you look into it?
it always falls back to the last overload
There’s a type test for this and it seems to be passing
oh and intellisense only gives me GUILD_STORE as a possible type
wait are you sure it's supposed to default to text?
I am yeah
and that was not accounted for in the tests
if I specify the type it does work, but I get no intellisense
#7132 in discordjs/discord.js by suneettipirneni opened <t:1640041398:R> (review required)
types(CategoryChannel): createChannel should default to a text channel
📥 npm i suneettipirneni/discord.js#types/default-category-channel-type
@dawn merlin shouldn't there be more?
no, these are the valid options:
export type CategoryChannelTypes = ExcludeEnum<
typeof ChannelTypes,
| 'DM'
| 'GROUP_DM'
| 'UNKNOWN'
| 'GUILD_PUBLIC_THREAD'
| 'GUILD_NEWS_THREAD'
| 'GUILD_PRIVATE_THREAD'
| 'GUILD_CATEGORY'
>;
right you can't make threads
alright then that works like a charm, thanks!
I mean, shouldn't GUILD_STORE be suggested?
It's hard bc it's an overload that comes after it, it still works, but it's deprecated
oh right yeah and if you remove the exclude it doesn't get marked as deprecated
alright then I guess that doesn't hurt anyway
@outer raven what do you want me to test?
with no options and with options but no type
the checks pass, but just to make sure they dont break in the future
done
@woeful rain there's no disableCommunicationUntil method
ah, i mean communicationDisabledUntil get property
my bad
is this in djs v13.4.0 beta yet?
ping me if u got answer
there is no beta
Its not merged into -dev yet
You can install the pr, that’s pretty much it
i meant dev
not yet
ah
will it be in djs 13.4.0?
the official release
yeah it should be
alright
thanks man
will the timeouts PR override the user's permissions getter to remove the permissions that it's taken from them (send messages, connect to vc's etc.) or does that have to be implemented on our side
Not sure if that's something that should be done. They technically still have those permissions, they're just timed out. Maybe you should check if they're timed out before doing whatever it is you need to do with them in that state
it feels more like a convenience thing - I'm happy to do it on my own getter but I think it could be nice to have within the lib as during the timeout, they can't in fact do those things
members lose the permission to join vcs, send messages and add reactions on all channels so that should be taken into consideration
and maybe you could also add a moderatable getter just like kickable and bannable?
also VoiceChannel#joinable should take timeouts into account too
I can leave a review on the PR with all the info if u need
Their permission bitfield remains the same from the API if someone is timed out. I'm not really sure discord.js should modify that?
A quick look at other libraries reveals they don't factor this in either
Ah wait you mean the helpers not the actual modifying the bitfield. Read the wrong initially... guess I could do those
Yeah only the helpers, not the actual permissions
So BaseVoiceChannel#joinable I added the check in
GuildChannel#manageable too - this accounts for the .deletable property also
VoiceChannel#speakable has the check too (stage channels don't have one)
Message#deletable has the check too
It seems there is no helper check for reacting on a message or sending a message, so I did nothing there
You can still edit a message and pin a message when timed out, so did not alter those properties (no idea why)
Did I miss anything?
I mean it was literally just released so maybe it's not been considered at all yet
I read wrong, disregard that
Ah yeah, no I definitely didn't mean actually modifying the bitfield, that would be bad
what about say ThreadChannel#sendable for checking if the client is timed out? or can bots not be timed out?
oh wait i brainfarted on that last part those checks wouldn't be necessary if bots couldn't be timed out mb
so yeah sendable
I don't believe you can edit a message while timed out actually
Well I've tested it and found it to be the case - have you?
Huh, you're correct. must've confused losing channel perms with that
seems like you can still manage channels if you have sufficient perms
same for channel and message deletions, both of your own and others' messages
Such as? I'm not able to change a channel's name with manage channels permission
I'm not able to delete other people's messages when timed out
im testing with admin perms and highest role
Timeouts have no effect on administrators
can't send messages (nor reply) with it so i don't think that's fully true
although as an admin i still can do the other 2 actions listed here
You can't send messages when timed out with administrator?
not through the ui, no
This is strictly the bot API, doesn't matter what the UI does
guess that's a negligible inconsistency then
if the api allows sending, anyways. (and it does)
that's actually a client bug iirc
Huh what's the bug? Not being able to send messages when timed out as admin?
yes
you can do so, the client just doesn't show it
crosspostable?
it seems you also can't pin messages when timed out
Can you double check your permissions? I was able to
Escalated this to the team ty
Didn't even know this existed, will look at it
Will look at this too
all the permissions it has. it can't publish/pin messages when timed out
create_instant_invite, kick_members, ban_members, manage_channels, manage_guild, add_reactions, view_audit_log, read_messages, send_messages, send_tts_messages, manage_messages, embed_links, attach_files, read_message_history, external_emojis, change_nickname, manage_nicknames, manage_roles, manage_webhooks, manage_emojis, use_slash_commands, request_to_speak, manage_threads, create_public_threads, create_private_threads, external_stickers, send_messages_in_threads
Ty just verified that
Why are there so many helpers
permissions.has(Permissions.FLAGS.ADMINISTRATOR, false)
is the second param you put here really necessary? or is it just more of a standard internally?
not really significant but just noticed and was curious
GuildMember#bannable : no changes needed, accessible in API
GuildMember#kickable : no changes needed, accessible in API
GuildMember#managable : no changes needed, accessible in API
Invite#deletable : no changes needed, accessible in API
Role#editable : no changes needed, accessible in API
ThreadChannel#editable : 50001 Missing Access
ThreadChannel#joinable : no changes needed, accessible in API
ThreadChannel#managable : 50001 Missing Access
ThreadChannel#sendable : 50001 Missing Access
ThreadChannel#unarchivable: 160005 Thread is locked
ThreadMember#managable : 50001 Missing Access
There's more? Oml
yeah im just going through the typings file lol. pretty handy.
I'm kind of scared that some of the above things (verified myself btw) are still usable... like, what if they're oversights and will be patched in some future API deploy and this library has them hardcoded
i'd.... hope that would fall into a semver patch.
It probably wouldn't be a priority to release either
Hai hai @solemn oyster, do you think the library should account for the client user being timed out for the permission helper checks above?
Or would you say that's something for the developer to account for?
@opaque vessel about this?
I just did that cause it's done everywhere else internally... not like that extra parameter does anything though in that specific case
the only other place (afaik) where has(admin) is used is at GuildChannel#memberPermissions (https://github.com/discordjs/discord.js/blob/main/src/structures/GuildChannel.js#L199) and the false isn't provided
don't have the repo downloaded so can't really be sure if that's all
Something related to channel permissions allowing you to set the ADMINISTRATOR permissions without any validation from Discord, which in turn would result on permission leaks if not checked correctly, iirc
Why not? Otherwise we'd end up with inaccurate permission helpers
I suppose, alright, ty (:
Permissions#has (and also BitField#has) doesn't really do any validation though, it's just a bit check, so i don't really see any reason why ADMIN, false would be different to ADMIN/ADMIN, true
checkAdmin false -> BitField#has(ADMIN)
checkAdmin true -> (true && BitField#has(ADMIN)) || BitField#has(ADMIN)
the admin permission can be set in a channel overwrite, it has absolutely no effect on actual permissions, so you must ignore it, server wide admin is already split out
Speaking in voice channels is totally unrelated to timeouts, you can’t even join the channels to begin with
Did you make the moderatable helper?
...but Permissions#has doesn't check for that at all? that would be checked elsewhere i guess, but im only referring to the Permissions#has call
@opaque vessel you still haven't checked your "add necessary checks to permission helpers" is this done already though?
Thread channels has some left, like sendable
alright, thats the last thing thatd be blocking the merge then
so whenever you get to it, or need some help
Should now all be done (:
@outer raven i dont get what you are asking in your latest comment
it already returns true if you have admin, regardless if you were muted
🤔
are you talking about speakable?
yeah i mean
some people might not check joinable
¯_(ツ)_/¯
you could be dragged into it you know
so youd only have to check speakable
But given that you joined the channel, you're allowed to speak in it if you're timed out, but you're not allowed to join any channel to begin with unless you're admin
you'd have to be in a vc to be dragged, which is impossible when timed out without admin
¯_(ツ)_/¯
I don't think it matters much
I just think that helper shouldn't be touched, along with most others
the only ones that should be changed are joinable and sendable, everything else is not affected by timeouts
imo itd be kinda dumb to have joinable return false
but speakable true
lol
but that's how Discord designed it
you can't join, but if for some reason you do, you're allowed to speak
like theres a lot of edge cases for admin anyway
I think that's the only one isn't it?
but semantically itd be confusing
being able to speak when timed out could be (and imo should be) considered a bug on Discord's end, but if they allow it for now, we should too and only change later if they do change this
i dont think so
well then it's your call
what about manageable though?
im not a huge fan of implementing discord shenanigans
and deletable on messages
id rather have some coherent system
while you technically (even though you cant join) speak
it doesn't make sense since you cant join
so I can safely say you can't speak for the helper method
it just makes things less confusing
I mean yeah I don't see a scenario where someone would time a bot out if it has admin
but for big bots that might be something they gotta take into account
or an admin another admin
¯_(ツ)_/¯
but ^^
what about it
why was that changed in the timeouts pr?
why do you ask me
idk you seemed to agree with it
id rather want to know why you dont
instead of playing this back and forth game here lmao
actually I got confused because you can edit a single property on a thread (default auto archive duration) but not anything else on any other channel so I guess that's another bug, ignore
however you can always join threads regardless of timeouts and perms
cc @opaque vessel
this is something we can talk about
:D
yeah sorry for my confusion earlier, joinable seems to be the only helper that doesn't need to be touched
Also could you please add a moderatable check that works similarly to kickable and bannable but with the new perm? 
did you test with the api on this
Please read the rest of the conversation
ah my bad i skimmed over and missed the last few messages
I get a missing access error trying to edit the auto archive duration of a thread channel when timed out, are you sure?
Hey haha where would this go? On the guild member class?
I only checked on the client side, didn't try that one on the API
yep, next to the other 2 getters
Yeah there's a big difference between the client and the API side. The client won't let you do it though (visibly it will, but the request also errors out)
actually, this was either a visual bug on my client or it has since been fixed because I can no longer do it
How would this getter work? Just check if the guild member is timed out? Lil' confused on that one
moderatable would be
return this.manageable && this.guild.me.permissions.has(Permissions.FLAGS.MODERATE_MEMBERS);
Ah right a check to see if you can timeout a user
Interestingly it looks like a bot can still timeout a user if they're currently timed out (lol)
isn't guild.me always defined?
Nah
People may alter their user cache to remove all users (it can be set to 0)
That includes the client user
is that supported?
Apparently yeah
then that ?? false should be applied elsewhere too
It's also in other permission getters:
const permissions = this.permissionsFor(this.client.user);
if (!permissions) return false
'Cause the only way that is defined is if you're cached in the guild
It should yep, I noticed the other two above it didn't have it. I think that's something to add separate to this timeouts pull request though
Anyway, that should all be done now [:
i haven't done a pr in a while, might do that lol
[:
It's already throwing an error
oh bruh
blind 
I don't need to touch these examples do I
I say examples are fine
There's an edge case on kickable and bannable where if the client user is the owner of a guild but not cached, the getters will crash the process though
check my review if you haven't
I'm gonna apply that same logic to these
If you modify the getters to throw a defined error, you'll make it semver-major, since the error will change
but it's still an error, how's that different?
I've done this same exact thing before and it was semver patch
You're changing it from a TypeError to an Error, so yeah...
You're changing the behaviour in there
how can I make this patch then
Also please re-use guild.me, no need to run the getter twice
You can't, gotta wait for v14
It'll come out soon, so don't stress much on it
wait soon?
other getters don't do this, should I do it for all?
Over the 50% of the open PRs are semver-major
Actually https://github.com/discordjs/discord.js/pull/7129 changed the error from a DiscordAPIError to a DjsError and was merged...
7 of which were created within a month of 13.0.0's release
We shouldn't leave them sitting for any longer, we're aware of that, and we're working towards a v14 quite soon
oh alright 👀
probably an oversight if I had to guess
Anyway, that should finally be it for the timeouts pull request [:

and events seems to be done too so v13.4 soon™️? 👀
Yup, hopefully before the Christmas break
aye
Also Rodry, you can update https://github.com/discordjs/discord.js/pull/6957's typings to use the new types from my typings PR
So you don't have to use base types (which aren't really strict typed)
didn't I just do that?
@dawn merlin when I reviewed your PR this was returning a TextChannel promise like it should, why'd you change that?
that PR didn't fix anything it seems
oh wait this was because of the rebase
im gonna try to fix it
this method should never return that type union anyway
I think this was from the make channel types stricter PR
CC @solemn oyster
I don't fully understand that PR but shouldn't TextChannel stay as TextChannel?
Not necessarily, dm and group DM’s don’t count
what?
I don't think I changed that
gonna PR
You can’t create a dm or group dm channel in a category
that's not what I said
a TextChannel isn't a dm channel
Hi there any idea when the new timeout feature will come to djs?
when its ready
soon ™️
it will be in discord.js@dev <t:1640217600:R>
Ok noted thx
Wdym? In an hour it will be available?
*citation needed
why?
But how do i access discord.js@dev?
What is it even?
you install it with npm
Oh ok
npm i discord.js@dev
I probably shouldn't meme in here, never mind lol
Rodry taking everything literally smh
i genuinely didn't get it
Sorry haha
Any reason why these structures are required here instead of at the top of the file?
BaseMessageComponent#create btw but this is done elsewhere too
Circular imports
hm?
Every component imports BaseMessageComponent. BaseMessageComponent imports every component
The import is thereby circular
By having the import scoped to the case block, it avoids the circular import since MessageButton imports BaseMessageComponent
Of course, the other solution would be moving them at the bottom, but it's not the prettiest view
oh so if they were at the top it would error?
Yeah you get weird constructor errors at runtime iirc
ah alright
I will come back to that command this weekend then haha
Would it make sense to add the MessageEmbed getters from discord.js (like hexColor and createdAt) to builders?
couldn't you just import djs to reexport its MessageEmbed at that point
#7067 in discordjs/discord.js by kyranet opened <t:1638830136:R> (approved)
refactor: switch to /builders Embed
📥 npm i kyranet/discord.js#refactor/switch-to-embed
@visual hornet ^^
oh. well then yeah i guess
although im a bit confused on the naming of createdAt tbh, but other than that i guess yeah if you want to keep those properties
yeah it seems like it's just the timestamp and not when the embed was created
and I don't think knowing when the embed was created is useful, but maybe a unix timestamp instead of an ISO string would so that could be made into a getter
is the new timeout feature already added to the library?
npm i discord.js@dev
ty man
this might be a naive question but why do the require statements for node libraries use require("node:events") rather than require("events")? My jest unit tests freak out because it can't resolve the require statements in the discord.js source code that start with node:xxxx,
https://github.com/discordjs/discord.js/pull/6710 see linked nodejs/node issue