#archive-library-discussion
1 messages · Page 9 of 1
I just changed that to 'pretend'
Would it be possible to add a VoiceState.user property that represents the User object of the member that state is attached to?
I know it's possible but would it make sense to do so?
No
And why not
Because users can be connected to multiple voice channels across guilds.
Yeah but almost every class has both the user and member properties, I think it makes sense for consistency because you often need properties from the user object
And how would you solve the aforementioned problem
yeah I know I can use voicestate.member.user but it could also be added imo
Oh, I misread that, I though the other way, whoops.
Where do we put users where we also have members consistently?
If you are referring to msg.author and msg.member, those are a bit of a different case
same thing goes for interactions, I can't think of a class that has member and doesn't have user besides voicestate but i could be wrong
iirc thats the case because it comes with the actual payload
Also that there might be no member (i.e. interaction in dms)
So far there are no non-guild voice states, I think even for instances you get "member", although I could be wrong here
yeah true but it's just as a shortcut, the same way that client is present in every class as a shortcut
we don't really do shortcuts anymore
we used to, but at one point you just ask yourself "but why doesnt this have one, or this, or this"
fair enough
Thatd prolly fall into the same category as why we dont have permission getters for every single permission you might want to check
btw crawl can you explain exactly what is gonna change in regards to the .send and .edit PR? (enforce the options object and when exactly we're gonna be able to not use an object)
true, although there are a lot of permission checkers still
Yeah but thered be a shit ton more if we fully comitted
Uh, not much really
You can just check the issue thats linked to it
the 3rd codeblock
ye but I saw you comment about .send(embed) and how that would work but it would be undocumented? Maybe I misread that
I said that it would be undoucmented, that was unintended per crawl
but that means it would throw an error in TS right
yes, its been removed already anyways
can't you just keep that 1 exception though? I believe a lot of people send their messages as embeds whenever they can and thus they use that method
I explained why not
is it because of interactions and webhooks?
yes
you could keep that for messages though, they don't exactly need to be consistent
Yeah I did, I just don't understand how "too much flexibility" is an issue
I understand it could be confusing from the library's side, but it's much easier for the end-user
yeah when converting from sending messages to interactions it can be confusing and I totally agree with the change for interactions, but as long as the docs mention specifically that you can't use .send(embed) it should be fine right?
although some people like to not read the docs but that's something else
Imo the more consistent you are, the least confusing you are (thought hard on this one)
Issue with .send method & co. is that people (especially new programmers) might think they can pass absolutely anything they want inside since most of things they will usually pass (content, embeds and for some attachments) will produce the expected result
Now, is it too late? No idea but if this change gets pushed I think this server will need a bit more of 2 general help channels to absorb the flow of people coming for the same errors
we have tags for that
It's better then people just having no idea what overloads are valid and which aren't, the amount of (embed, options) I'm greeted with in support is insane
@slate nacelle when you get the chance, can you reply to this? i believe its all thats holding it up: https://github.com/discordjs/discord.js/pull/5566#discussion_r645761452
Is it intentional that Interaction. fetchReply (Webhook.fetchMessage) returns raw webhook data in when the channel is a DM (on master)?
Is there a reason to not use channels.fetch here instead of a get?
The library generally never does any internal fetching
Would it be a good idea to add typedefs for methods that take an object as option? For example the method for fetching audit logs: https://discord.js.org/#/docs/main/master/class/Guild?scrollTo=fetchAuditLogs. options.<something> doesn't look that good imo. I have seen more of these in the docs. It wouldn't be a big change because we will only be making change to the documentation.
Should it be used in this case anyways for ease of use?
This will delay the Promise, even if it's ready, only without an element
Can we change MessageActionRow#components to a collection of buttons mapped by their customIds or url in the case of link buttons?
I don't think that would be very beneficial
would be easier to find a specific button since (I believe) all buttons must have either a customId or a URL
For most useful commands you save custom data inside the buttons custom id, so it would not really be easier retrieving them
The key being a URL also seems like a bad idea
Let me just retrieve the button for ban:237812371237878:12938712932819389
seems like a terrible idea
oh I didn't know that was something that was done, I just name mine after the action they represent
usually a word or two
How do you know who to ban with that, for example
In case you make some confirmation action
I guess you'd have a variable with the member object that you pass initially through the interaction
So what if 2 mods issue 2 bans
Which button is for which interaction?
If they are both named the same
you'd have button collectors and each one only fires for a specific message
That works if you exclusively use collectors
yeah which seems to be the easiest and most accurate way
That doesn't matter in this case
You can't just make one use case the "correct", and the others barely possible anymore
eh fair enough
@outer raven there is no point in asking for merges
Vlad said he would wait for the feature to be released, I was just asking if now was a good time or not
vlad doesn't speak for all of us
generally speaking we only merge when general availability hits and all reviews have been through
Ah didn’t know it was only on general availability then my bad
I assume the new thing with the buttons is going to come in the next update?
yes, it already merged into the dev release
Epic.
https://discord.js.org/#/docs/main/master/class/MessageActionRow?scrollTo=spliceComponents
the return value listed doesn't have a type linked to it
is this intentional?
The code returns this, so I would assume it's not intentional and the class was renamed
hello awesome community ;). So i have some concerns about discord.js interface for Message Embeds. I am developing a bot and when i wrap a text into a code block, i get a different appearance on desktop and mobile as seen below.
My question is: Is there any way to develop something like "media queries" and render different messages in mobile (with different formatting), cause as it seems, code blocks arent working as intented in mobile.
No
None of this concerns us as a library
It’s all discord’s doing how things are displayed
hmm i see, thats what i thought. Thanks anyways.
for djs devs: are you planning on adding a further layer of abstraction for the discord buttons api? It seems a lot less organized than I think people would like it to be, with buttons being added on messages, but implementations of the button functions being done in a completely separate place.
Can you further elaborate on this
You can stash them in an array of arrays if the actionrow bothers you
currently, we would add buttons to an actionrow and set a customID for it. however, we would only implement what the button would do on the interaction event, which i think is not as organized as it should be
I don't understand the problem you are proposing, what exactly is bothering you?
I guess, the separation in declaration and implementation is bothering me
You can create the buttons anywhere you want really. It doesn't have to happen in a specific "event".
Or any specific place inside of your code.
If thats what you are saying
yes, but implementing the function for the button needs to be done on event
You can just create a componentcollector for that
Have a kind of array of buttons with a function associated to them
When a button gets pressed, see which item of that array it corresponds to and execute its corresponding function
You can use message component collectors too, which is suitable for a lot of situations, and would not require you to listen to the interaction event
the collector does listen to the event and forwards it so to speak
You can also have a function that listens to "componentType 3" and off-load everything there.
And split that up further however you want.
We don't make any assumption as to how you write your code.
But if your question is to have something like other modules, an event named clickButton which you can listen to, I do not think thats the right approach at all.
hmm ok i think collectors are what i need
in ClientApplication#flags, are the flags supposed to be Readonly<ApplicationFlags>, because they're never frozen in the ClientApplication._patch
It seems to break consistency with other Structure.flags in terms of typings and functionality since everywhere else is Readonly<*Flags>;
Sounds like an oversight, it should be frozen.
textChannel.clone() says that options.name is optional but it uses it in https://github.com/discordjs/discord.js/blob/master/src/structures/GuildChannel.js#L584, can't it just default to this.name?
I noticed that discussion and put in a pr for it since it seems like an unintentional byproduct of another change
cool to know, can you send its link?
For the pr? This would be it: https://github.com/discordjs/discord.js/pull/5804
ty
Reading through src and I'm a little confused.
https://github.com/discordjs/discord.js/blob/master/src/managers/GuildApplicationCommandManager.js#L116
GuildApplicationCommandPermissionData has no declared property id. Was perm.command meant to be used instead or am I missing something?
Im not quite sure what you mean
oh nvm I see
Yeah I think that typedef should say id
it probably should, but that reduce operation is occuring on fetched data from discord, where it is perm.id, so nothing wrong there
Yeah the typedef is still wrong
so, the typedef should say id instead of command?
The map is being called on the method param command as Array<GuildApplicationCommandPermissionData>
Alrighty. Awesome
oh, its being done twice, the one you linked is returned from discord, but it happens before with passed data 
I can actually handle that in #5729...done
I tried it on djs and found this ->
when i disconnect the bot from vc it still shows channel id which should be null but when i disconnect other user or bot from channel it shows channel id as null
I am not sure if this is djs thing or api thing
okay so it's fine from api side. It is happening when i am using erela.js for voice when i connect using erela then on manully disconnecting via discord interface it shows channelID. But if i connect the bot to channel and restart the bot then disconnect from vc manually it shows channelId as null
also to note when i use erela.js player.disconnect() function it shows channelID as null
However if i have one more instance of bot running the other instance shows null which this one still shows the channel ID
i guess so
Got redirected here from #djs-help-v14, so it seems like the PR https://github.com/discordjs/discord.js/pull/5565 introduced a bug that wont let you add permission overwrites to channels/etc. without supplying a valid PermissionResolvable to both the allow and deny parameters (which should be optional by default).
I tried to modify the resolve method of PermissionOverwrites structure shown below and it works but i dont know if this is a worthy PR fix.
/**
* Resolves an overwrite into {@link RawOverwriteData}.
* @param {OverwriteResolvable} overwrite The overwrite-like data to resolve
* @param {Guild} [guild] The guild to resolve from
* @returns {RawOverwriteData}
*/
static resolve(overwrite, guild) {
if (overwrite instanceof this) return overwrite.toJSON();
if (typeof overwrite.id === 'string' && overwrite.type in OverwriteTypes) {
return {
id: overwrite.id,
type: OverwriteTypes[overwrite.type],
- allow: Permissions.resolve(overwrite.allow).toString(),
- deny: Permissions.resolve(overwrite.deny).toString(),
+ allow: Permissions.resolve(overwrite.allow ?? Permissions.defaultBit).toString(),
+ deny: Permissions.resolve(overwrite.deny ?? Permissions.defaultBit).toString(),
};
}
const userOrRole = guild.roles.resolve(overwrite.id) || guild.client.users.resolve(overwrite.id);
if (!userOrRole) throw new TypeError('INVALID_TYPE', 'parameter', 'User nor a Role');
const type = userOrRole instanceof Role ? OverwriteTypes.role : OverwriteTypes.member;
return {
id: userOrRole.id,
type,
- allow: Permissions.resolve(overwrite.allow).toString(),
- deny: Permissions.resolve(overwrite.deny).toString(),
+ allow: Permissions.resolve(overwrite.allow ?? Permissions.defaultBit).toString(),
+ deny: Permissions.resolve(overwrite.deny ?? Permissions.defaultBit).toString(),
};
}
we can trigger the same actions on webhook_events as well as schedule right?
because i was wondering why djs uses 2 different workflow
wdym
Should be fine as it would reproduce the former working behaviour for this case
I'm not seeing any other places where it would be required (the two other files Permissions.resolve is being used in carefully check if the given data is defined before)
djs has u different test runs
one that runs every 12 hours
another which runs on push and pr
@copper laurel can you fix this line in your MessageSelectMenu PR? I believe it should return MessageActionRow https://github.com/discordjs/discord.js/blob/master/src/structures/MessageActionRow.js#L64
when updating from a master commit before 2f5424bdac7c97d0a371dd72084ac02d5e774f1a to this one or later I noticed that all GuildChannel#permissionOverwrites are empty
I think the issue is that in https://github.com/discordjs/discord.js/pull/5796 the permissionOverwrites get set to an empty Collection in the constructor (https://github.com/discordjs/discord.js/blob/93b0a4e005b5b1d371f7936238556db2e36cc982/src/structures/GuildChannel.js#L40) after _patch from within the super call already populated them with the data from the API, removing this line restored the previous behaviour
Ohhhhh
I was just digging into what was causing this, and yes, that'll be it I think
Good spot -- https://github.com/discordjs/discord.js/pull/5823
Will v13 support changing a guild’s vanity code? I’m pretty sure that still exists in the API but is just undocumented
We generally don't implement non-documented features
aww okay
If you're talking about publishing dev which runs every 12h, then it's supposed to be like that. Doesn't make much sense to release 4 dev versions whenever you merge 4 PRs in a span of 2 minutes
@ornate topaz I understand that. But what about the test-cron.yml
what about it
https://github.com/discordjs/discord.js/blob/master/src/structures/APIMessage.js#L145
embedLikes never gets reffed later on in code. It can be safely removed
same with: https://github.com/discordjs/discord.js/blob/master/src/structures/APIMessage.js#L225
Might be an oversight, but flags does not exist on type MessageOptions as far as the docs are concerned
https://github.com/discordjs/discord.js/blob/master/src/structures/APIMessage.js#L166
Yeah, because as far as I know we don't directly support passing flags. The only two end user usecases are supressing embeds, and ephemerals, both of which have their own options/methods
@fringe temple any reason why you didn't make the second argument just BroadcastEvalOptions<P>? because as is the context is always unknown
I guess because of the shard option, but take could just be another generic type
it felt unnecessary to introduce another generic type there
right, however, the type is incorrect
How so
Oops!
feel free to PR a fix for that, otherwise I'll make one later today or tomorrow
will do
https://github.com/discordjs/discord.js/blob/master/typings/index.d.ts#L494 why do these cdn endpoint types have Snowflake | number for ids?
If there isn't a reason for that I could remove them in #5696
default user avatars
ye thats for the default user but the others need snowflakes right?
in fact ill change the id param to discriminator since thats less misleading
and the type for that can never be a snowflake
that makes no sense though
I don't see whats wrong with the current approach
those endpoints will only work with snowflakes afaik and the defaultavatar endpoint only works with numbers 0-5
so the typings are technically incorrect
Stop putting stuff into your PR that has nothing to do with your PR
make a new one if it bothers you that much
lol ok
on another note though, a new default avatar was added but I haven't been able to see this on any user. The link is https://cdn.discordapp.com/embed/avatars/5.png and idk how this would affect discriminators ending in 6-9
it's not used
but it will be right?
We don’t know
so far nothing indicates that it will
hm alright
omg, I love that one
Hey i just needed to sync the permissions of a channel with its parent channel, and it took me a long time to find it because i was looking for "sync" (which is the word discord uses), but it turns out it is "lock".
Is there any reason why it is called like that? What about renaming it to "sync", to make it perhaps more clear? because afaik it does not really lock them, then can still be changed right ? afaict it just overwrites the existing ones with the parent's ones
can't because discord uses "lock" for syncing in api
technically yes, and due to how discord handles that, that will sync permissions with parent
wdym
the naming of the api uses lock
yeah, it's just like saying change "guild" to "server"
also technically speaking, discord can take the liberty and change names like that on the client all the time
well, there is no "lock" param or anything like that for editing a channel. only lock there is is for moving to a parent
if we would constantly switch around naming as they do on the client, wed be in for a bad time
Yea i see, but i did not mean « use the same naming that in the client », but rather maybe a clearer and more explicit name, so you can understand and find it more easily
Not a big deal anyway ig
btw this is just about make it clearer, so ig it could also be added to the doc, because i really find "lock" to not be explicit at all : i had to check the code to be sure that it indeed synced the perms 😅
Since the required value for ApplicationCommandOption is set to undefined by Discord when it's false, can I make a PR so that it defaults to false?
a lot of bots are gonna break due to this new change to the old channel.send(<MessageEmbed>)
Yes
A lot of bots are also going to break because of hasPermissions to permissions.has
i think permissions.has already exists in v12, since i've been using it for most of my permission checks.
It did, also v13 as itself is a major breaking change. So, it is expected that users will have to update their code in order to not break it
Alrighty. Was going off of the JSDocs for APIMessage Constructor options which only included MessageOptions and WebhookMessageOptions instead of also including MessageEditOptions and InteractionReplyOptions and/or InteractionDeferOptions.
@outer raven yeah I honestly don't care enough if its used both ways
I was just thinking it might be for only sending
which you could argue you might be sending a useless prop because the default on discords side, if the key is not provided, is false
I guess you get my point
But if its also for saving it on our side, it might be more beneficial to have it an explicit value
Yeye I know. For my bot I prefer having it always set explicitly so that we know what is required and what isn’t
But I just thought of an edge case that I’ll need to fix when I get home, which I commented on the PR about
yeah I saw your comment
it was initially used in the rebrand but they removed it because they didnt want to change people's colors
afaik there are currently no plans to use it again
should be fixed now, let me know what you think of my approach
Hi, I have a question, why does the Client class has setTimeout/setInterval and setImmediate (with their clear version) methods ? 🤔
It will kill the timers when the client is destroyed
Oh yes, logic, thanks
would be very useful if RangeError [EMBED_FIELD_VALUE]: MessageEmbed field values must be non-empty strings. said which field had the invalid value
^would be useful for all errors where possible 😅
also would be good to not log full image data when its logging the request body lol
that's actually fairly easy to do and I hope its the last place in the library left that doesn't?
very minor inconsistency that doesn't effect anything; types want a userresolvable, whereas docs want a guildmemberresolvable (https://discord.js.org/#/docs/main/master/class/GuildChannel?scrollTo=permissionsFor), once again its not a big deal because a GuildMemberResolvable takes in a UserResolvable anyway. just thought I'd point it out
Maybe you should also add verification methods in Embed class, in a utility library I implemented this (in a BetterEmbed extends MessageEmbed class) and it's fairly useful
you could open a PR to fix that
doesn't really matter how small it is
What's the progress on #5692? Is it going to be merged soon-ish?
#5692 in discordjs/discord.js by monbrey opened 16 days ago (approved)
feat(MessageSelectMenu): droppybois
📥 npm i monbrey/discord.js#droppybois
Aren't select menus still in private beta?
oh sorry, I saw a linked api docs pr that was merged and thought that was it
Unsure what you're referring to, I haven't linked any API docs to that one
Why is the patch function in Message.js called patch instead of _patch like in most other structures?
oh, I'll fix it. 👍
Everything else looks fine to me 

umm, I just realized since we are building the _data object here, we do have to check it this way. In the earlier case we were passing the param directly.
shouldn't these error codes be in Constants.js? A lot of them are missing so idk what the criteria is really
No criteria, just nobody PR'd them
so they should all be added?
Yes
well that's gonna be a fun job
An option, though, is that we re-exports discord-api-types's enum
Since that's always updated, and sometimes faster than d.js itself
wouldn't it be better to just import them from there and not have this export?
cuz this is clearly heavily outdated
I'm willing to make the PR adding all of these btw, just wondering if it's worth it or not
@remote wasp sorry, i haven't looked into it at all, but i noticed https://github.com/discord/discord-api-docs/pull/3120 was merged and that you do stage instances
just a note to make sure you are aware of it/it might even already be done in the PR
yeah, I saw it too. The current PR is already done tho. Should I add this to it or make a new one? 
Can someone run the publish action once this round of merges is done pls?
Is that what the invite_code property on the instance is for? 
@remote wasp I unresolved the comment about update because upstream PR in API docs, btw
yeah, saw it. Should I change the update to edit now?
I'd wait for the docs to be reviewed, tpcstld is on it
okay
lmao, that was fast 
Yeah, I asked them before making the PR, and told me to ping them back once the PR was created
aight, I'm on it 
okay 👍
Shibi~
I just noticed a small thing, sorry 😓
StageInstanceManager#24, missing final dot
@remote wasp ^
Wait, it's a property
but that's same for all mangers, I checked and none of the manager have dot at the end. 
Yeah, properties don't have final dots, my bad
lol, it's okay 
I thought it was a typedef because they're blocks of docs without any code below them
oh
Approved 

Is there a pull request (and if not is it useful?) to compare the local command with the registered one (name, description, arguments, required field, etc...) in order to update or register the command only if necessary
For now, there is no method to compare an ApplicationCommandData against an ApplicationCommand (in the library)
But that's quite simple to do (check name, description and defaultPermission and make a recursive check on options)
Yeah this is what I do but if everyone does that maybe we can make a PR to implement that 🤷♂️
I think generally the consensus is that's what belongs in a framework, not the core lib
Hello everyone! i have tried to run discord.js in chrome extension. this is the boilerplate i've created and im using right now https://github.com/fxnoob/browser-extension-boilerplate. i'm using webpack 5 so its asking for the polyfills. when i am requiring web build of discord.js, its giving me 403 on console.
I've read in the github issues that due to cors web build is not working but its not the case for browser extension. they can do cors fetch from background pages.
Is it possible to use the Discord.js in chrome extensions background pages? is there webpack config for webpack 5 for this project so that polyfill error can go away?
discord.js is meant to be ran in node.js
I don't see any use case that would require discord.js to be used in a Chrome extension (or in a web browser in general)
If you only need some API requests I think it'd be better to directly interact with the Discord API
discord has dropped support for webpacks
there are plenty use cases if you see from a browser extension dev perspective.
take an example of Save to google Note, save to google images, save to google contacts. where you right click on the image/contact or any stuff on a website and context gets sent to those services.
That would only require REST API, discord.js would be "too much" for this usage
basically i wanted to create something like this. Save to Discord. where i would right click on the image and they get sent to respective channel
Would this be an extension for you alone?
oh ok. can you guide me to those apis please? though i've hooked the logics before directly in the apis but gets messy
Because you are not allowed to request a users account or their token to send the message from their user
This would fall under the "user bots" category which is not allowed by ToS
flow is like this -> admin adds bot to the server, then everyone in the server use that bot to post in the server by interacting with it from browser extension. is it against TOS?
It would not be
That too will not work by just making the call from a browser. You'll need to create a server as a middle man to which your extension will talk to and that server will in turn make the request to discord API
But its surely not possible with our library
How would you make sure the token you distribute is secure?
What shibi suggested would be the proper way to handle this 👍
ahh right. thats not secure with simplest implementation i thought in my mind. yea shibi is right i need to go server side and implement the logic there. too bad i just want to create a free helper for everyone that would not free for me if i go server side.
You can look into CF workers
what does cf stands for ?
great! 100,000 requests per day is nice perk! will see if i can use this service. thanks
Whenever you feel like it.
But then again, you might as well switch to the best discord lib: discord.py.
Oh, I was assuming you were memeing.
There is no reason to switch to Eris to be "worth" anything really.
Yeah people have been saying that for years now. Its a dumb circlejerk.
Benchmarks have shown that there is no significant difference between those 2 if used properly.
And big bots run their own forks of eris too, don't be swindled.
Big means >50k here btw.
Yes, 50k+ servers.
What about it? Are you looking for some numbers or something else?
Depending on what your bot does, @rich igloo runs on this server only, which sits at around 50k people. With a lot of cache, uses around 130MB of RAM.
Which is a joke really.
No.
Eris is not matter. It doesn't matter what they will tell you.
The only difference I know for a fact by now is that Eris is behind when it comes to features quite a bit compared to us.
So if you need interactions, buttons, select menus, threads. You will get them faster with us.
Could I recommend https://github.com/discordjs/discord.js/issues/5372 for closure 🙂
Sure
nah, there isnt a big difference.
see the orange and blue one
Eris is not in TS, and it has worse typings.
lol
Also that graph isn't saying anything about our library
This is why I hate graphs like this.
The following test is a ~3 hour run (each tick is 10 minutes), with ~3700 guilds total (4 internal shards), with all intents enabled (including presences), and with message caching disabled (messageCacheMaxSize:0).
No one would enable all intents on their bot.
The introduction of intents also made that light fork completely obsolete.
Hey Crawl,
I accidentally pushed one commit to my pull request that I meant to have in a separate pull request...
Do you know how I can undo the most recent commit?
Might as well rename the PR and description
Instead of making 1 line changes in so many separate PRs
also less overhead for us to review
Thanks for the help 👍
yeah, right, but assuming that on the Eris libary everything is enabled too, then you can see less differences....
"Big Bots" such as Dyno would use nearly every Intent
they would use the Intents...
They wouldn't use all the intents, no.
let us say, that they would use the "heavy" intents, which requires caching
like member comparing on Guild Members Intent
They don't :D
Realistically, at the scale they operate on, they would have custom almost everything, from cache to who knows what else
@icy trout I requested a change, just an easy copy+paste fix
more intents
-> more websocket events
-> more data that gets cached + bandwidth used
with intents you control which ws events you want to receive
discordjs.guide results:
• Popular Topics: Gateway Intents
• Popular Topics: Gateway Intents
I hope you know we don't endorse discord.js-light as it's not official
Pretty much the only benefit of light is customisable caching, although I have no idea how it works and how might it be more memoy efficient than what we have
However, by using it, you also lose the benefit the official discord.js ecosystem gives you, such as more active support, up-to-date features, etc
Well, it's a bit to be expected, discord.js's review and maintenance process is pretty good
And is something forks and alternatives don't get. In most of the libraries at least, I see 1 or 2 people reviewing, of course that's going to slip in more messy code, here we have 4 people, so even if it takes longer than 1 or 2 people, the overall code quality is just a lot higher
👍 done
ESLint, you left trailing spaces
shut up
I made it a suggested change so you can commit it from the browser
You don't have to continue in this channel do you?
Thx for the constructive critic, when you think that eris does something better than discord.js, then you can provide me the info on my dms.....
I just made a git compare and must structure and file names were similar. "looks like", that was my opinion.
But let us move this in an another channel.
that's because, if i remember right, eris started as a fork of d.js v8 or something
Eris actually started when Abal left the discord.js development team back in v6, about 5 years ago, because he did not like the class-based/OOP direction hydra was heading towards.
thanks, and with that, back to topic and away from djs history lesson, thanks 
So I have an issue with GuildChannel#permissionsLocked -- if a channel parent permissions update, this then causes a permissions update to the channel itself, and it also appears as if permissionsLocked has changed because the parent has changed at the same time? Not sure what the best solution to this is really
I was thinking maybe having permissionsLocked be an actual method instead of a getter, so you can pass an updated parent into it for the calculation if needed?
I noticed BaseMessageOptions now includes the files field, but does not include the embeds field. Is there a *Options T that doesn't accept embeds?
I looked through and only found ReplyMessageOptions which should be incorrect as it routes through TextableChannel.send which accepts embeds and not embed
Not anymore I believe, PR 5860 seems like a great candidate to fix that, feel free to make a comment on that.
Can't the event listeners' return types be Awaited<unknown> instead of Awaited<void> so we can do things like return message.reply({ content: 'Unknown command' })?
there was a PR to do that, but it was decided against that
however, as far as i'm aware, that's going to change to accept void | Promise<void> after we switch to node 15 or later
since uncaught promise rejections are a throw on there
seems like a pretty harmless change, there's no way to access the return values anyways
while true, consensus was that such type would indicate that library handles whatever you return for you, in some way
while the library takes nothing
Do you see absolutely nothing wrong with returning a promise inside an event handler?
Because they can not be caught
Oh, didn't know that
Yeah, thats mainly why we did it
A lot of libraries allow it, but in this ecosystem I think a lot of people also don't understand the fundamentals of this stuff
Not saying we are clearly superior, but if we find something could definitely backfire on the user, we try to fix it and make sure they don't make that mistake
Alright, thanks
I don't know if it already exists but wouldn't it be interesting to add a property to the Channel and Message object to get the link?
For example when you have a TextChannel object you will be able to do <TextChannel>.url and you will have https://discord.com/channels/222078108977594368/682166281826598932
Message already has one
though not sure what would be the purpose for the channel one, as well as why add it; you can't really get one in the client, as far as i'm aware, without taking message one and removing message id
url gives no benefits over mentioning the channel, both inter-server and cross-server
I use channel links when my bot sends a DM to a user so that the user can click on the link and get to the channel quickly
you can mention the channel instead
as i said, there is exactly 0 benefit of using an url over using a channel mention
I thought the channel was not found in DM so impossible to mention, my bad.
I still have to change my DMs because I was using LINK buttons for some channels 😂
Thx ❤️
for voicelink: fastify is good but keeping the types on each route in sync with the JSON schema is very annoying to maintain
i strongly recommend you find a schema builder library in typescript which can output valid JSON schema (which fastify consumes) and also a TS type (which the RouteOptions generic accepts)
and it really should be a schema builder library, don't try writing .d.ts files and compiling those to JSON schemas, the community tooling is very lacking in this area
The schema here is mainly for swagger honestly
I don't do any real validation with it, because its just a perf decrease
that's still the same issue
documentation is getting duplicated in every route and still needs to be manually kept up to date with the types
Yeah but I wouldn't need any library for this really. VoiceLink is rather a done deal after the initial footwork is there, since if you look at the LavaLink repository, there isn't really a lot of code.
It's really just a wrapper around discords voice sending capabilities as a server
So the chances of us updating it a lot is very minimal
And my experiences with that kind of stuff aren't really on-par either.
I have used joi a lot, but I don't think joi is applicable here
Since thats more of a validator than json shema
yeah if this is never getting changed again it's reasonable to leave it as-is
I'd argue probably 80% of the routing code will stay the same after the initial MVP
Though I wish fastify had some good 1st party fs-routing capabilities 
nextjs api routes win again
I like doing my routes in the file system as /[id].ts etc
yeees
unfortunately the venn diagram of good validators for typescript and ones that output json schema are basically 2 separate circles
plex just made their own schema lib in their mongodb lib, interesting read https://link.medium.com/6hd7089KZgb
How does the ratelimiting work in discord.js?
I understand that we have the parent class, RESTManager. It has a global count that gets scheduled calls to reset it (this seems to be handled by RequestHandler right?), this makes sure we don't hit the global rate limit. RESTManager also has a collection of routes (for example /channels/id/ right, including methods?) to RequestHandlers.
That gets us to RequestHandler, it has a queue of promises (so requests that want to be made) and ratelimit information. That is, each RequestHandler represents a Discord API bucket correct?
When the request is to be made, it first makes sure we're not ratelimited by checking the global info (the count is 0 and if a reset has been scheduled) and local info (remaining is 0 and if a reset is scheduled). If any of those 4 are true, it will sleep until that is to be safe. Then actually make the request, and use the ratelimit information retrieved to update local values.
Does this mean discord.js does not use X-RateLimit-Bucket to for example differentiate the endpoints/routes that share (or don't) buckets across the methods they use? Additionally, am I right in that this implementation disallows concurrent requests (which is an acceptable drawback)?
Does this mean discord.js does not use X-RateLimit-Bucket
afaik yes that is correct
djs-next's handler uses buckets
^, we also need to update REST to catch up with the new features from v13's
I have a request about the buttons, please use the npm package discord-buttons as a guide so that the code that was written with this package still works
I hope it's the right place for this^^
No
discord-buttons has never had, and will never have official endorsement from us
Also guides stuff should go to #archive-guide-discussion, not here
i think that was more of a "write in in the way that package is done so i dont' have to rewrite"
Buttons is already complete, it will not change to match an external package
Not happening
Ok, I didn't know this
Kinda your fault for using a third-party package knowing there was an official one on the way, tbh
(And if you didn't know... I'm pretty sure support members have been pretty persistent about it, so it's a bit hard to believe)
Ah, what is that? Like a complete rewrite (v14?!)
No specific version but yes, a TS rewrite
Additionally, am I right in that this implementation disallows concurrent requests (which is an acceptable drawback)?
Yes? Concurrent for different buckets, sequential for the bucket itself
if that makes sense
Yes I get what you mean. You cannot make concurrent requests that use the same handler
Is v13 changing alot to break v12 code?
Yes
like, for example i believe message.channel.send() will break
:/
thats like - everywhere!
For the better
What is it getting changed to?
Something more consistent
well its not completely breaking
its still staying message.channel.send, but it might stop working for you depending on how you're using it
Ohhhh, i see.
so is it gonna be user or author? (for emojis and stickers)
what
different conversation from earlier
Ah.
User def
I know the user object from messages is called author on the API's side but wouldn't it be better to call it user to make it consistent with everything else?
does the lib have some kind of utility function to check the language of a codeblock?
for instance
const num = 2;
the codeblock has js highlighting to it, so I was wondering if there was a function that would return the language of a codeblock that has syntax highlighting to it?
ofc I could just do this with some simple string manipulation, but was wondering
No
ok was thinking of making a pr that would add something like a Util.containsCodeBlock() function, idk if it would be necessary tho
Being consistent with the API is our usual approach
Can d.js v12 no longer delete other people’s link previews?
I’m getting this error: DiscordAPIError: cannot edit a message authored by another user
msg.suppressEmbeds()
It’s been working okay for 10+ months but about a week or two ago it started giving errors and not deleting the previews
I've just opened a PR
Though thats a v13 issue, not v12
I'll try again on v12
Okay yes, I do get that
Fixed in master then, I guess
For v12, it relates to this bug: https://github.com/discordjs/discord.js/pull/5807
PR already open for that one
Thanks!
Would a Util.codeblocks(text) be a necessary method? Essentially, the method would be used to get all the codeblocks of a message, which syntax it was highlighted with, and then the content inside it. It would return an Array<CodeBlockData> | null
Where CodeBlockData would be an interface like
interface CodeBlockData {
content: string
highlightedWith: string: //I would add better types for this
}
And null would be returned if the text contains no codeblocks?
To be honest, that sounds more like something you would do yourself in your code.
There's no CodeBlockData from the Discord API at all
Also why should it return null instead of an empty array if there are no code block
However I don't see any implementation of this. Why would djs use this?
couldnt people just use regex?
yeah probably
Yeah, util methods don't really exist just for end users - they all have a specific purpose that the lib uses I think
Ah ok
Is there still a discussion about a deep comparison between registered and current ApplicationCommandData for automatically updating if there are spotted changes? Last i heard of it was #archive-library-discussion message or did it conclude that it should be left for the user to implement?
The automatic updating would be up to the user to implement, but would an ApplicationCommand#isEqual(data: ApplicationCommandData) method make any sense to have?
It would make sense to have, it would be hard to implement
@slate nacelle what are the types for these properties? https://github.com/discordjs/discord.js/pull/5862#discussion_r654957308
name -> string
attachment -> buffer, string, stream
file -> buffer, stream
ok ty
btw does the name MessageFile for the typedef sound good?
Shouldn't this say discord.js@dev on the master version? There's also links to the WIP guide so I think it would make sense
I thought so too but this is there
Yeah but that will generally stay
The “this is still for stable” I can’t remember anymore
But probably shouldn’t be like that
Not that it matters rn, since it’s already like that
I think at least that should be removed cuz stable will be v13 once it's out
but yeah fair enough
@solemn oyster there aren't that many types to update but I can import them from discord-api-types and add them, want me to do that?
Is there a reason why embeds field aren't in BaseMessageOptions ?
it seems more that it's an oversight
since bots weren't allowed to send multiple embeds before, so those wouldn't be in MessageOptions, but would be in WebhookMessageOptions
Oh a little PR to make 🙂
But I don't know how to do it if someone want to "correct" it :/
aren't errors of type DiscordAPIError?
?
#5902 in discordjs/discord.js by iShibi opened 53 seconds ago (review required)
docs: move embeds field into BaseMessageOptions
📥 npm i iShibi/discord.js#embeds-field
I was also wondering, why there is no BaseMessageOptions type in the index.d.ts file?
P.S. thanks shibi for the PR 🙂
Because it's not needed probably
can we change all collections that hold ApplicationCommand's to be mapped by their names instead of ids? Most of the time we know the name of a command and not it's id or at least this is the case whenever i need to access an ApplicationCommand
I know it's a sort of rule to map everything by it's id when it exists but I feel like this scenario would make sense
its not a great idea, especially when you can have a sharing name between guild and global ones, and although they're in different CommandManagers if someone decided to merge them somewhere, there would be a conflict
Or just log & store the ids when you create them
how would you merge them and why?
that's not very practical in the long term imo
But with global commands, deploy, save, sorted... don't know how it's not "practical" ?
Plus, I would be assuming that you'd be storing some kind of per-server config if you're going to be deploying commands per guild instead of globally, otherwise there's gonna be a lot of commands getting overwritten repeatedly (on the assumption servers can effect the functionality of a bot based on slash command input).
So when setting the status of the bot we can use the setStatus method (or the status property with setPresence) and the string passed must be online | idle | invisible | dnd (PresenceStatusData), but when accessing the status of a user, with <User>.presence.status, we can receive online | idle | offline | dnd (PresenceStatus). Why are these types different for the offline option? Why is called invisible in the first but offline in the second. Wouldn't it be better to use the same word for both?
there is a semantic difference in offline and invisible
bots can not receive invisible for other users (so you can't discern it from offline)
bots can also not set offline, but just invisible

its very confusing tho
like when someone says "how can I set the bot's status to invisible?" people supporting could trip up and say client.user.setStatus('offline')
bots can not receive invisible for other users (so you can't discern it from offline)
meaning if someone is offline but still on Discord, the client receives it?
you receive both invisible and offline as offline, you can not receive invisible
bots known when you are offline and when you are "pretending" to be offline would be a terrible idea privacy wise, you only ever receive "offline".
and adapting the setStatus to accept offline would be a bad idea as well, semantically offline is - offline, not able to participate or read conversations, where as invisible means the offline indicator but still being able to interact with the app
naming two fundamentally different states the same would be a terrible design decision
that's why it's offline in PresenceStatus
but invisible in PresenceStatusData?
oh wait I see now
so invisible users are in cache, but offline users are not? or is it that all invisible users are not in cache even tho some are still able to interact w/ the app?
i don't understand how this is so hard to discern
offline: you close discord
invisible: you set your status to 
as a user you don't want people to know when you are offline vs. when you want to be shown as offline, so discord sends out "offline" even if you are "invisible"
For some reason, User#system is always null is the user isn't part of the urgent message system instead of being false. This is due to the fact that system doesn't come in the User object from Discord and d.js checks for that. Should we change this so that it's declared as false instead of null?
A similar thing goes for User#bot where it's always false for partial users when it should be null because it's checked if typeof this.bot !== "boolean" and then a boolean is created from that value. Since this.bot is undefined, it becomes false. Should this be changed as well?
didn't user#bot get a lot of changes to work properly? does it still not work?
partials are the only scenario that I found where it doesn't work as expected
this is what I was referring to btw (https://github.com/discordjs/discord.js/blob/master/src/structures/User.js#L59-L65)
I have a fix for this so just let me know if I should open the PR for it or not
iirc jake said any null/undefined/non-existent-key value that is supposed to be a boolean should default to false on those cases
if true isn't being sent
cc @unique axle

yeah but I'd assume not for partials right?
because you don't know who the user is in a partial, so saying they're not a bot could be incorrect
almost everything in a partial is null so wouldn't that be the point?
We don't know if it wasn't sent because it's partial or if it wasn't sent because it wasn't sent by Discord
We've have to start adding isPartial to all our constructors to know where/why the instance was being created and stuff.... which is eww
Thats the logic I couldnt remember hence directing the convo here
Well I’ve never seen the system property in user objects whether they’re partials or not so I just assume it’s missing from all of them except when it’s true. You can fetch the API yourself to see
exactly
So we set it to null, because if its missing, we dont know if its a partial for a system user or not
What will happen after v13 is released? like, the master branch will work for a new version? Will be there to fix bugs and add feat to the actual v13? And what about djs next?
Nothing really changes, yeah. The stable discord.js version on npm just gets updated to v13. Bugs will get merged into stable in the form of minor or patch releases. Major breaking changes will wait for a v14.
djs-next has nothing to do directly with the version numbers, its a separate TypeScript rewrite.
Okk, thanks!
just to clarify, this is a system account right?
but not this
I believe so
643945264868098049 and 669627189624307712 are the system users
this is a channel following webhook
Yeah so just by fetching their messages I can see that system is true for the first and not present for the other
nope, it's enabled by community settings
ik what it is, that feature is powered by channel following
ah alright
then when does the first user send messages?
i only got one when i enabled community on my server
the discord system user only sends dms
the community updates system user is for whenever there's something for just one server
I mean you can see in your screenshots that one has a SYSTEM badge, the other has a SERVER badge
ye ye ik
hmm that's actually a bug
should be system without a checkmark
The checkmark doesn't hurt
but yeah so I don't think system being present or not depends on whether it's a partial or not so it would be safe to set it to false when it's not there
unless it's a partial
so vlad wants me to add sticker.fetch but we disagree on how to implement it
so theres a /stickers/:id route (implemented in the djs pr as client.fetchSticker) and a /guilds/:id/stickers/:id route (not currently implemented as I didn't add a GuildStickerManager in the pr)
i don't see how this is significant for discord.js library devlopment
(re: system)
I assume that to get sticker.user, you need to use a guild id route, and you need the manage emojis permission (edit: has been confirmed)
vlad says that if the sticker is a guild sticker, djs should always try to fetch it with the guild id, and just error if the bot isn't in the server
imo it should just call client.fetchSticker(this.id), or the user can optionally choose to fetch with the guild id if they want
Let discord error if the bot isn't in the server
yeah
if you do not have manage emojis, these two routes are identical except that the second requires that you are in the server
@copper laurel just to confirm, on https://github.com/discordjs/discord.js/pull/5906 Interaction#channel can still be null if the partial is not added right?
cuz if so, the typings need updating I think
Iirc it's null when the interaction is in a DM, with the DM Channel not cached
thats what this PR fixes so that its only null without the partial
Yes, why would that change typings
Because they never had null to begin with for some reason
Which is actually how I found the bug
Yeah exactly but you can add it to that PR
This is probably about CommandInteraction which narrows the type down to the text based channels:
https://github.com/discordjs/discord.js/blob/master/typings/index.d.ts#L506
| PartialDMChannel | null probably needs to be added.
Whats the new activity type competing ?
competing in (whatever)
Nice that, ok bro
I was looking at the CommandInteraction types like space said ^^
btw why is it readonly?
getter
Was there a reason we didnt make ApplicationCommand an extendable structure?
soo does anyone have an opinion on this
Is this in the works? https://github.com/discordjs/discord.js/issues/5855 If I recall correctly it also happens on v13
or is this feature discontinued
#5886 in discordjs/discord.js by monbrey opened 3 days ago (approved)
fix(Message): flags not being parsed on some edits
📥 npm i monbrey/discord.js#fix-message-manager
will the fix come to v12 master?
v12 master?
v12 isnt master
It will come to master
Its up to the maintainers if we continue patching v12 or not
ignore the "master" part of the question xd
lol, Crawl just merged the v13 fix
niceee. is it also a v12 fix?
this is a separate PR
oh 😔
Theres different bugs and different reasons they happen in each version
The suppressEmbeds one is not related to editing out embeds
For discord js -next
Since I know it’s supposed to be vastly different from discord js
What are some ways it could be different? Like how could we create a new instance of client and stuff? I know kyra had some good ideas
afaik -next doesn't even have any shape or form yet
No, it wont be significantly different for the end user as far as Im aware. The intention is to rebuild the internals, not the externals
That’s why I was hoping to spark some sort of discussion where others could pitch in ideas
But its not going to be "vastly different"
getting back to this, is it worth opening a PR to fix this?
@outer raven not sure what that thing has to do in your PR https://github.com/discordjs/discord.js/commit/e0efcc6ab0e3f060e30438c0d990c9465c6134df#diff-86252c6a5caa00d9f8fb12018a8cf70659bc19a5fc2a95f9944c7a2c3e781d96L215-R215
but we all missed it, and it pretty much broke all bots
lol
oh shit
yeah noted, sorry
I thought that was transforming the type into a string, not the other way around
That method is for getting the data to send to the API, so needs to be an int
yeye got it now
On a completely unrelated note though: what do you guys think of merging sub command options into the main interaction's options? Let me explain:
When you run a command with a subcommand or subcommand group, the only option in the main collection will be the sub command that you ran, so if we manage to merge them all into the first there should be no issue (unless an option has the same name as one of the sub commands, which i don't know if it's possible)
merge how?
you still need to know which subcommand was run, are you proposing moving that property up to CommandInteraction#subcommandName or something
no, the subcommands would be kept. What I'm suggesting is adding the options that would otherwise be nested in the subcommand to interaction.options
I dont like the idea of breaking the hierarchy, no
imo it made sense since you'll never have more than 1 option with sub commands and groups but sure then
hmmm actually yeah maybe
I think the part I'd find awkward is that if the subcommand is kept, you'd be getting it essentially like a boolean option I guess? Just checking that its... there, and then you know what the other options are?
When you have multiple subcommands you'd be checking which one the user ran. I usually do this with interaction.options.find(o => o.type === "SUB_COMMAND")
why is code option in #5918 being removed? there's no other clean way to do it without manually writing it into the string
yeah thats why code was very useful for me
but why is adding \ an issue?
not that you would need to read a lot from a bunch of slashes
you can even put that in multiple lines if you prefer
for the codeblock to be formatted properly, you need a single newline after language. no matter if you use ` or ', it has to be there
however, template strings (`) have a bonus of being able to be multiline themselves
We'll have a util available for it
It just wont be a message option anymore
yeah it will just be a function you wrap your string with
will that be included in that PR?
no
We talked about adding that in /builders and then re-exporting in d.js
getting back to this, can I open the PR?
alright
If there's only one possible sub-command at a time, why make people find it as an option when it could be bumped up to a property though
I feel like you could have
interaction#commandName
interaction#subcommand
interaction#subcommandGroup
and then just the options or something
yeah that could work
I'm actually having a hard time figuring out a smart way to merge the two collections since the main interaction.options is only built after the inner options are
so maybe remove it all together would be a good idea and much easier
actually nah even then I have no clue how to do this in a smart way since I'm not familiar with the way djs patches stuff, could you try to do this?
https://github.com/discordjs/discord.js/issues/5855 this issue is closed. Is it fixed for v12? If so, do I just update discordjs or are there extra steps?
AFAIK, there are no additional releases for v12, so you'd have to install from dev. npm i discord.js@dev
The suppressEmbeds bug is different to the empty embeds bug
sort of
It probably shouldnt be closed though
Yeah we have no more releases for v12 planned.
@vernal atlas what are your plans on https://github.com/discordjs/discord.js/pull/5132?
Are you gonna do the largest rebase ever before continuing a lot further? Or split the changes in smaller PRs?
well i was at first going to rebase and continue, but now im thinking that splitting the changes is a good idea
Yeah, smaller ones are also easier to review and merge
@slate nacelle why the confused emoji? https://github.com/discordjs/discord.js/pull/5923#issuecomment-868373891
I wouldn't call the bot property being invalid expected behaivor.
Or at least hope it's not.
Well yeah but the user object I got from fetching an audit log had every property it should and thus it wasn’t classified as a partial so I don’t know any other way to get this information, unless we check for all properties inside the object to determine if its a partial or not
Patching with partial data should not invalidate the state of the object.
If you are not sure a change has to be made, make none.
alright I did a few more tests and I found a solution that worked for me, let me know if there are any other issues
I think I'm missing exactly what you think is incorrect here. You kinda lost me right from the start when you told me you were re-assigning properties to things they aren't meant to be. The identifier on a custom emoji will be its name:id format, while on a unicode emoji, it will be the unicode. It's not ever meant to be the id, which yes, will be null on unicode emojis.
The ReactionEmoji class is kinda like a partial guild emoji, eg when the reaction came from a guild the bot isn't in so it can't get full data I think
yes, but it wont have an id if its unicode
If you need to store them in a database for whatever reason, const unique = emoji.id ?? emoji.identifier
Because it is the identifer at the time
Youre just misusing the property
Its not supposed to be a primary key for a database
#5929 in discordjs/discord.js by SkyFlags opened 1 hour ago (review required)
fix(Message): Make author of referenced message nullable
📥 npm i SkyFlags/discord.js#master
Is there a reason for skipLibCheck being set to true in the tsconfig.json?
Would it make more sense to set that to false to catch errors in the typings?
I have never tried but... I suppose we could add a stub augment
Something likets module '@discordjs/voice' { interface TheInterfaceWeRequireFromIt {} }
If the module is installed, then it'd merge an empty interface with the full one
That way we can use that interface from a module that's otherwise missing, without getting compiler errors
That must be inside declare module 'discord.js' {}, btw
cc: @tacit crypt @fringe temple
Why do we even have @types/ws and discord-api-types as dependencies now, but not @discordjs/voice?
Typings are currently broken on master because there are interfaces imported, that don't exist in the used discord-api-types version.
And with skipLibCheck: true that could easily be missed.
What interfaces exactly?
typings/index.d.ts(142,5): error TS2305: Module '"discord-api-types/v8"' has no exported member 'APIActionRowComponent'.
typings/index.d.ts(147,5): error TS2305: Module '"discord-api-types/v8"' has no exported member 'APIMessageComponent'.
typings/index.d.ts(1634,12): error TS2416: Property 'options' in type 'ReactionCollector' is not assignable to the same property in base type 'Collector<string | `${bigint}`, MessageReaction>'.
Type 'ReactionCollectorOptions' is not assignable to type 'CollectorOptions<[MessageReaction]>'.
Types of property 'filter' are incompatible.
Type 'CollectorFilter<[MessageReaction, User]> | undefined' is not assignable to type 'CollectorFilter<[MessageReaction]> | undefined'.
Type 'CollectorFilter<[MessageReaction, User]>' is not assignable to type 'CollectorFilter<[MessageReaction]>'.
typings/index.d.ts(1640,12): error TS2416: Property 'collect' in type 'ReactionCollector' is not assignable to the same property in base type 'Collector<string | `${bigint}`, MessageReaction>'.
Type '(reaction: MessageReaction) => Promise<string | `${bigint}`>' is not assignable to type '(...args: any[]) => string | `${bigint}`'.
Type 'Promise<string | `${bigint}`>' is not assignable to type 'string | `${bigint}`'.
Type 'Promise<string | `${bigint}`>' is not assignable to type '`${bigint}`'.
Oh that's intentional I think, it's going to be released with the next version
They exist on discord-api-types main so probably.
But I personally think that they shouldn't be ignored in the CI, like they are now, so they don't get missed.
Please add better documentation for FriendlyError and CommandFormatError in Commando 😦
I really want to use something that lets me customize the command format error but there is no clear documentation
Like add use cases and examples
Commando is currently unmaintained
why are snowflakes not just bigints?
Because that's how the api sends them
you can't serialize bigints
that's unfortunate
How does Discord.js achieve seamless ESM-CommonJS interop?
It's not 100% seamless either, as explained in https://github.com/discordjs/discord.js/issues/4670
thanks for this. I think I'll be fine if all issues are that obscure. have you ever considered just dropping CommonJS support?
pretty much everyone uses commonjs though?
but why? I guess that's my real question. why have we not fully embraced ESM?
we meaning the node.js ecosystem
Because requiring cjs inside of mjs is problematic
Or rather the other way around
So our lib couldnt be used outside of mjs anymore
Which is rather problematic
We would have to supply cjs builds
And lets just assume we have a big typescript userbase, the standard tsconfig.json tsc generates does not set the compilation target to ESNext by default either
So we would get daily questions about that 100%
Thats not to mention all glitch/replit users
is it problematic for reasons other than that?
node esm doesn't support json
No, but I would argue this is a big problem indeed
other than users not knowing how to switch, I mean
which is why I've tried esm multiple times and have had to go back to cjs
Yeah, some things are still experimental
hmm can't you read the json the normal way
JSON modules are stage 3 but node doesnt have them yet
theres a lot more cons here: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c
Its a lot of work honestly that is not very clear
tempted to copy this readme
I don't understand this. you can read json files. you just can't abuse import to do it. the normal way is not significantly more work
I still really dont see any reason to just drop support for something that is still in such widespread use
thanks for your answers, my questions were not rhetorical
since discord deprecated Message.stickers and is switching to Message.sticker_items (presumably to not break .stickers), should d.js keep using Message#stickers (with the .sticker_items data) or use Message#stickerItems or similar? (sticker_items contains partial sticker objects)
(personally I like Message#stickers and think Message#stickerItems sounds dumb)
Agreed, we can still make breaking changes to Message#stickers so go for it
also unfortunately the Sticker#fetch discussion is still happening
re https://github.com/discordjs/discord.js/pull/5867#discussion_r658874457
if there's gonna be Sticker#fetchUser to get the user if it's a guild emoji, then what should Sticker#fetch do (since it'll be needed for the partial sticker objects)
vlad says that if it knows that the sticker is in a guild, it should try to fetch with the guild route (which will only work if the bot is in the guild) to try to get sticker.user
I say that it should just run Client#fetchSticker, and people can use Sticker#fetchUser (or GuildStickerManager when that's added) if they want the user
Is it possible for the bot to have/receive a sticker without being in the guild
yes
in messages
or by fetching with the non-guild route (which works for all existing stickers)
itll probably not be in the sticker's guild most of the time
and I think Sticker#fetch should work in that situation
what message would it receive if its not in the guild? or are they like emojis and can be used globally?
latter, if the user has nitro
right
u can already use them if u have android alpha
yeah while it might be nice to be able to have it know where to fetch from I think that would introduce inconsistency in the expected behaviour
Since people will need to call fetchUser anyway?
well if the bot is in the guild and it did the check, you could just do (await sticker.fetch()).user and it would work
but the sticker.fetch() would error if the bot isnt in the server
but it should fallback to the other fetch right?
vlad seemed to want it to let it just throw the DiscordAPIError
but ig we could fallback
Is there a difference between using the @readonly tag or making a type Readonly<> in the docs?
I think only with the tag @readonly this can be showed
Readonly is a typescript type, not something jsdocs would understand
Readonly<T> means that all the properties in T are read-only, but the object can still be 'overwritten' to put it simply
Should this be changed from Record<string, string> to
interface RequestData {
// ..
headers?: {
[K in keyof RequestHeaders]?: RequestHeaders[K];
}
}
I thought for type safety/intellisense. What additional headers are used other than these three?
Makes sense, thanks
the thing is some types in the jsdoc comments have Readonly<> instead of @readonly, should I open a PR to fix this?
As sugden pointed out, @readonly means that the property on the class can't be overwritten, Readonly<T> means that the returned object itself is frozen
So they're not the same
and how can we tell those two apart in the code?
Tell apart where exactly?
Which ones should have @readonly, Readonly<T> or both
Readonly<T> when you use Object.freeze() or a similar method
@readonly usually when you have a getter without a setter
Alright. I just found this odd because Readonly seems to be the only thing the docs don't link
is it worth linking this to ts docs maybe?
😦
Why don’t I get the proper intellisense for ColorResolvable
type ColorResolvable =
| 'DEFAULT'
| 'WHITE'
| 'AQUA'
| 'GREEN'
| 'BLUE'
| 'YELLOW'
| 'PURPLE'
| 'LUMINOUS_VIVID_PINK'
| 'FUCHSIA'
| 'GOLD'
| 'ORANGE'
| 'RED'
| 'GREY'
| 'DARKER_GREY'
| 'NAVY'
| 'DARK_AQUA'
| 'DARK_GREEN'
| 'DARK_BLUE'
| 'DARK_PURPLE'
| 'DARK_VIVID_PINK'
| 'DARK_GOLD'
| 'DARK_ORANGE'
| 'DARK_RED'
| 'DARK_GREY'
| 'LIGHT_GREY'
| 'DARK_NAVY'
| 'BLURPLE'
| 'GREYPLE'
| 'DARK_BUT_NOT_BLACK'
| 'NOT_QUITE_BLACK'
| 'RANDOM'
| [number, number, number]
| number
| string;
``` it doesn’t show these color names with intellisense, maybe it’s just a problem on my end
had a similar issue before, I think it's bc of the | string. Not sure tho
It is
Yeah that’s what I was thinking too
Fixing that rn
#5950 in discordjs/discord.js by kyranet opened 19 seconds ago (review required)
types(ColorResolvable): change string to #${string}
📥 npm i kyranet/discord.js#typings/strict-type-string-color
@sharp wigeon @fallow crater ^
thank you
np 
perhaps something similar to https://github.com/discordjs/discord.js/pull/5144/files#diff-9c03fb4d8c1b03db876641d3900a9c08f5a3a30be8d8a3b9840018507243c284R1477 would be an idea
Why can’t we just link it like a promise or an object?
i guess so
although im not sure because most people don't use typescript (mostly beginners) so it might confuse them
and readonly is pretty self-explanatory by itself
so ill let that be for now
but for future reference this would be the link https://www.typescriptlang.org/docs/handbook/utility-types.html#readonlytype
there should be a way to view the old design of the website
I find it easier to navigate
Won’t be a thing
for threads
Error [GUILD_CHANNEL_RESOLVE]: Could not resolve channel to a guild channel.
at GuildMember.permissionsIn
i sent this to ckohen over a month ago, looks like its still unfixed in master?
Assuming this happens when you pass a ThreadChannel?
Yeah this needs a bit more info
totally forgot you sent me this, I'll fix it in a thread fixup PR that I'm making now
Why was it decided to create the thread channel types with _ instead of the camel casing that is used basically all across the library?
Talking about public_thread, private_thread and news_thread which could be publicThread, privateThread and newsThread
the only places I see _ being used are in full caps names that usually come from Discord's docs
cc: @ruby terrace ^
Also it would be relatively easy to switch to a date-based version number for dev releases. Can I open a PR to change this so that dependabot starts working again and people stop getting confused when they install an old version with npm up? @wild flax
this is my proposal (YYYYmmddHHMM)
No
The hash is handy because it prevents duplicated releases (aka releasing the same commit twice)
And it also helps identifying the commit in GitHub as well
Github tells you on which commit the action ran though
It's extra steps, and also refer to the first point
Ye I know but that doesn’t happen very often since a PR is usually merged every x hours
And even if it does it’ll be once and doesn’t hurt that much
It’s just that I’ve seen way too many people in #djs-help-v14 saying they have the latest version when they don’t because they used npm up
That could also be fixed by deprecating outdated dev versions automatically
Which they are
Are they?
I still do but it should only have 1 not deprecated
At the moment yes
Well yeah but that doesn’t seem to fix the npm up issue unfortunately
Nor dependabot
It did work for me in a test environment Nvm, installing an outdated version and then running npm update won't update to the latest commit
ah ok cuz I was testing and it wasn't working for me
is it really that big of an issue if a "duplicated" version is released? Imo the pros outweigh the cons here
Its also easier for the user to know when the version they have is from
Which they can get from the commit
They have to go on GitHub and find the commit
No, just paste the hash
Way more complicated than looking at a number and getting the day from it
e.g. https://github.com/discordjs/discord.js/commit/5ad83a6a65e5944ceb3a41fee2df40ba1f5b03e4
Yeah it’s still more complicated than looking at a date
Looking at a date is unreliable because GH shows local time while GHA uses another when releasing
There can be several commits on the same date so it won't be unique too
Only 2 unless it’s manually ran
And the date is the least relevant, the day is enough and accurate enough as well
We do multiple releases a day sometimes, tho
The CI runs twice and Crawl sometimes runs it manually. I’ve never seen more than 3 releases in a day
make it 7 SHA and a unix timestamp and I accept it
But that doesn't offer de-duplication, Crawl
13.0.0-dev.7_SHA.UNIX
Fine by me
thats fine, don't care enough, as long as this whining stops
And not like the UNIX timestamp is readable at all
I could find the date a commit's from faster than getting the full date from the timestamp
Wait yeah why not a date
I prefer keeping the system as-is, maybe reduce sha to 7, but that's all
But you can have both
Or none
My proposal was YYYYmmddHHDD but you can add dots in between
yeah but if you do 20200628 you might as well do a unix timestamp
its not for the user anyway
Why not?
its to fix npm
I really don't want to discuss this, its a temporary thing anyway until we have proper pre-releases
Will there be dev releases after v13?
I'm not going to heavily invest into a system thats gone in less than 6 months
Possibly for v14
It’s not a hard fix tbh, just trying to make it more readable I guess
Fine then, I’ll try to find a way to get the unix timestamp and PR
So this is good right
sure
aight, will open rn
so should I change it
aight
what does --verify do?
alright, will commit then
wouldn't it be a good idea to create some guild webhook manager in master, just like how <Guild>.fetchBans() and BanInfo were removed and replaced with a GuildBanManager in v13?
maybe same for invites, integrations, templates, etc?
A new dev version has been released with the changes.
hmm npm up doesn't seem to be picking up on it but it doesn't downgrade either, lemme try dependabot
alright can confirm dependabot is working again, thank you!
@ruby terrace The example doesn't seem to match with what is documented above it here: https://github.com/discordjs/discord.js/blob/3174507d57d9f6011e97b4f3209f42179e050f9b/src/managers/ThreadManager.js#L89
The example says it will create a public thread but it is missing the startMessage param, which according to the docs above means that the thread will be private
I have no choice in this matter, the channel types are lower cased at creation of the channel and constants are UPPER_CASED
Forgot to remove the extra tidbit yeah
only docs for startMessage need to be changed
But this isn't determined by Discord. In fact, channel types in Discord are UPPER_CASED so I think we could change that just to be more consistent across the whole library
there are not many places that I'm aware of where lower_casing is used
We're fighting two different library conventions, parameters are typically camelCased, whereas Constants are UPPER_CASED. I think the lowercaseing of channel types may have been an interesting (unsuccessful) attempt at ensuring camelCase for the properties. Not opposed to changing it, its just a very large whole library refactor
Wait, where are we using lower_case instead of camelCase?
channel types
more specifically news_thread, public_thread and private_thread
channel types get .toLowerCased so I used that for all _thread types everywhere
Yeah I don't blame you and I know it's a large change but so was changing to camelCasing in v10 or whatever it was so, for the sake of consistency, I think we should go for it
just so you know, I'm going to do something about this, don't know what yet though, should have a PR within a day though
Moving here from #archive-interactions since it's probably more relevant, it looks like the typings for followUp on CommandInteraction was removed in https://github.com/discordjs/discord.js/pull/5831, I can't tell if this is intentional or not but I would assume it wasn't?
Looks like it got removed accidentally in the last rebase
Seems like the changes in that PR weren't applied to that function too, unless that function wouldn't need them, I could potentially PR a fix though it may be easier for someone who already has an environment set up
I just fucked up a rebase there and deleted an extra line. Add the type back
That function doesnt need the changes
Alright, will do
can't you simplify that https://github.com/discordjs/discord.js/pull/5976/files#diff-d6774c7fcd0485bec7c183ecf1749f65eea85a05999935ddf4aa7b331ddb4826
with ```js
exports = { ...exports, ...require('@discordjs/builders') };
Not really, because we're exporting ButtonBuilder, EmbedBuilder, MessageBuilder, and a few more, in later PRs to /builders
Which we'd like to expose separately (and outside Formatters, as they're different things)
An alternative, though, is to namespace them in /builders
But that might be bothersome if you use it directly
I was testing thread creation to decide how to document the params and believe me I had to bring out my notebook to write down all the possible ways in which startMessage and type param can be combined. I would share it but it looks horrible. This mess can lead to a lot of potential issues in the support. The solution I want to propose is to have two seperate methods for thread creation just like there are two seperate endpoints for them. For eg: ThreadManager#create and ThreadManager#createFromMessage or something along that line. This will remove all the issues that arise due to possible combinations of startMessage and type param.
It could work, I highly anticipate people to never start a thread from a message using that function, instead using Message#startThread(). That paremeter exists so that can work.
all the possible ways in which
startMessageandtypeparam can be combined.
What do you mean by this though? They can't?
Yes correct, they don't as passing one specific param will do nothing in a particular case as it acts like a noop because something else will get passed no matter what you pass as value for that param. Which is where the issue is. The behaviour is weird because that params will matter sometimes and won't sometimes. We are mixing two endpoints into a single method and hence why this behaviour. I know I'm not making much sense here so I'll make a table to clear what I'm trying to say.
https://i.imgur.com/J4mfNr5.png
As you can see in the table the type param only matters when startMessage isn't provided. This means that type affects nothing in the other three cases. As you pointed out Message#startThread doesn't even talk about type because it takes the type from the message there and that's why it is much more clean. I was thinking about doing the same for manager. A method that creates threads from message and another that creates using type (just like the endpoints). This will seperate these two params into two different methods where their presence/absence does affect the result.
The news _ + type column is wrong, its always news thread
right, my bad
you see the problem here? type really only matters if provided on a text channels thread manager, and technically news_thread is an invalid parameter.
If you create a new function, createWithMessaage for example (cause I think it would be the less used one, called internally mostly) then you still have much of the same issue with create, always creates news in a news channel, but can have errors etc in text
Technically speaking doing this could make it much more type safe for ts users though since news doesn't extend text in that case. You just can't separate it in the actual code
With that, I say do it, adding something like
export class ThreadManager<AllowedThreadType> ... {
public create(options: { ... type?: AllowedThreadType };
}
export class NewsChannel {
public threads: ThreadManager<'news_thread' | 10>;
}
export class TextChannel {
public threads: ThreadManager<'public_thread' | 'private_thread' | 11 | 12>;
}
to make it very type safe
it'll be hard to do for docs, but for ts users? worth it
So, just to be clear you want to:
Restrict values for type depending on type of channel the ThreadManager is on ✅
Want to divide the thread creation on manager into two methods 
Is that correct?
I’m against 2 methods too
It kinda of goes against libraries design
We tried so hard going in a direction where we have a nice single method style
Throwing that overboard seems like a bad thing here
All right then restricting the values for type is what we are going to do
By all means, give a shot to making the docs more clear too, I definitely understand it being confusing but I couldn't think of a better way to document it, the warnings being my best attempt.

