#archive-library-discussion
1 messages · Page 7 of 1
When this is approved: https://github.com/discordjs/discord.js/pull/4879 does that mean this can be approved?
Once v8 api lands, if interactions pr is done we can review it, and merge it after reviews are done
and provided discord doesn't decide to just... annihilate it with changes, because after all it is still a beta
those prs dont really have anything to do with each other
one won't be happening before the other, that is as far as "having anything to do with" goes here
We mentioned several times that interactions won’t land before the v8 upgrade
So yeah, the v8 upgrade is a blocker for a lot of PRs
https://cdn.mbr.pw/SV43dgQ.png could this small fix I accidentally added to the banmanager PR stay or does it really have to go in its own PR? lol
completely out of scope of that PR
aaaight
well discord is discord
what delay?
Is there any plans to make partials per-event, not globally?
I remember someone talking about it a few months ago but don't remember what it concluded with
isnt that already a thing?
I mean, its not per event, but per Structure
I dont believe so, no
I'm a bit confused, prune method for GuildMemberManager throws on L166 (https://github.com/discordjs/discord.js/blob/master/src/managers/GuildMemberManager.js#L166) but does Promise.reject on L174 (https://github.com/discordjs/discord.js/blob/master/src/managers/GuildMemberManager.js#L174)
whats the rule here? lol
Is it possible to develop following function: When I am in an audio channel, I can invite easily someone to join my channel. Would be nice to do this by rightclicking on an user of my server in his context menu. Second would be nice, when he gets this invitation like a call, with ringing etc., and then he can join my channel by accepting this "invite-call" by accepting it with one mouseclick.
If this is not possible by rightclicking, it would be ok to use this function by text command.
This server is for the discord.js library. For Discord feedback, visit https://dis.gd/feedback
I’ve been benefiting from discord.js for a while now, so I’d love to contribute. I’ve looked through some open issues, but I’m not familiar with what’s being prioritized
Would anyone want to point me to an open issue or something you need implemented? If so, I’d be happy to submit a PR
Would it be worth changing the functionality of Guild#owner to fetch the owner if it isn't cached? The current documentation and implementation allows for Guild#owner to be null, but it feels like a nice-to-have for users, especially since it appears to be a common question in this server and on stackoverflow
The user can easily just fetch the owner themselves using Guild#ownerID, which isn't nullable
.. Guild#owner already yields a partial guild member with the guild member partial enabled, afaik
Yep. You're both right. Do those reasons still justify not doing this?
If we did this, it wouldn't be a getter anymore, but something like Guild#fetchOwner, as it'd have to fetch the member, which is also not feasible per say with intents
auto under-the-hood fetching could be unwanted for few reasons as well
Seems like you've all thought through this and have some good reasons not to do it.
well, just like "it appears to be a common question in this server and on stackoverflow", it also happens to be brought up as to why it is that way 🤷♀️
Yeah I've seen the pattern of having lazily-loaded, memoized fetches for properties before, but it's possible that's an anti-pattern and I think with your partials param the current functionality is fine, even if it results in some people initially making a mistake because the owner isn't in the cache
In that case, I'm still happy to contribute if someone with a bit more context wants to point me to an open issue that is worth addressing. Otherwise I'll just keep my eyes out.
I wouldn’t mind if someone wanted to look over my list of getters to be removed in g#5287, maybe add some more
@frank turret I took a look. Caught a small mistake in the current iteration of removing VoiceChannel#editable from index.d.ts but not removing the actual method from VoiceChannel.
Looks like there is a lot of contention around whether you should actually move forward with removing these, so good luck attaining consensus
I haven’t removed voicechannel#editable at all so far
@frank turret That's why I called it out. It looks like you unintentionally removed it here 🙂
https://github.com/discordjs/discord.js/pull/5287/commits/1a04c4ee78619a582c6a66e34c380b44e721cf9a#diff-4f45caa500ef03d94d3c2bfa556caa1642df95d4e2b980d76b876a8fd2e8c522L1611
oh, good catch, yeah i'll resolve that next commit
i dont really agree with removing them
yeah there was a whole secondary discussion abt it in hydra land. Debating whether to close the PR as it seems as though the move peeps are into is expanding the amount of getters to cover all bases, instead of removing them
why exactly can you set replyTo in Message#reply 
you should probably use __Channel#send if you want to specify replyTo
It’s so you can use this feature ^ and set what message your bot is replying to.
I think the point is when you're using Message#reply, you'd be replying to that message, otherwise why reply to that message
the replyTo is hard-coded to this, as it should be. There can be a new option type in place of MessageOptions, which won't have the replyTo field. As having option to set replyTo doesn't make sense here.
It was definitely intentionally added, I believe that is because the optional parameter is set to none usually, but for replies it is defaulted (by passing in the extra object) to this
also how r we gonna handle https://github.com/discord/discord-api-docs/pull/2572
I was just looking at that
I think best option is to add to MessageOptions something like forceReply (that name is not great, I'll think of something better).
Since message_reference isn't anywhere but APIMessage, that should be pretty easy to handle and easily ignorable if there isn't a replyTo specified.
I'll make a PR later if it hasn't been done already.
why is User.lastMessageId and User.lastMessageChannelId a thing when User.lastMessage returns a message object?
Because we need to store the channel and message id somewhere, so said getter can return the message
https://github.com/discordjs/discord.js/blob/master/src/structures/User.js#L136-L139
It's a getter to not keep deleted channels and guilds in memory forever (since it's likely you'll never see those users again).
ah
what's the point of having a cache system for things always cached? like guild roles, guild channels, guild emojis
what exactly are you asking about
the cache is locally, on your system
not discord's cache, they have one too, but discord.js has it's own local cache
we dont need to make requests to discord's api if we already have the resource locally (unless we think it might be outdated, in which the .fetch method exists)
does that make sense?
yeah ik djs has it's own cache, I was saying what's the point of having fetch method and a cache manager or something that's always cached?
api coverage I believe is one reason
out of the three you specified, only the RoleManager has a fetch method which would be there for what Pyro said. That and there still needs to be a manager because just cause structures are always cached doesn't mean there aren't other api methods that can be called on them.
guildemojimanager has a fetch method, and the emoji cache can be outdated so it may be needed
can't quite find a fetch method on it disregard, was looking at stable
it's always cached because you received it from api, not because you hardcode the information into your bot before you start it
it's just that unlike other data, you receive every channel, role etc upon logging in
hm yeah it isnt in stable
what?
.
oh
what does the core(*) mean in commit messages?
It's chore. It describes what kind of change the commit introduces. The * is a placeholder for scope, meaning that the changes were made in a lot of places and not just to a particular thing. This will help: https://github.com/discordjs/discord.js-next/blob/master/.github/COMMIT_CONVENTION.md
Is the <GuildMember>.id getter gonna be removed at somepoint? afaik it's just an alias for <GuildMember>.user.id.
no
Unlikely
No reason to, plus, that'd break a lot of internals
#archive-djs-v12-deprecated message
#archive-djs-v12-deprecated message
edit: this ended up being the problem however the user only reported the error in that first message link happening very occasionally. #archive-djs-v12-deprecated message
looked into that the other day, and it can't really be coming from where they claim it does.
if it were an array (doesn't look like it) it'd enter the set branch https://github.com/discordjs/discord.js/blob/stable/src/managers/GuildMemberRoleManager.js#L88 and filter dupes
if it's not an array it doesn't even call GM#edit but goes to a put route directly https://github.com/discordjs/discord.js/blob/stable/src/managers/GuildMemberRoleManager.js#L96 which can't return that error (even if the member already has it)
FaffsToday at 05:58
seems to be a library issue, not correctly checking if a value exists before adding it to the set
That is precisely the point of passing it through the set constructor - removing duplicates. The relevant code concatenates the current roles with the roles that should be added (with duplicates), passes it to the set constructor (removes duplicates) and spreads the set values back into an array.
_ _
the only point at which that might theoretically fail is if even after resolving roles (which happens in L.83) for some reason the equality check goes wrong - which i currently don't see as possible to happen, since it should at this point quite definitely be an array of strings, for which the equality op === (which uses the same comparison mechanisms as the set equality check as per es2015) quite definitely works
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set#value_equality
is there a reason message references haven't been added in like a minor patch?
they're there..?
are they?
Oh, don't know.
I think that's available in the discord.js latest
latest as in latest release, or latest master commit
master
master already has some breaking changes, so that's not really a good suggestion
there won't be another minor release, so we decided to replace Message#reply with the new inline reply functionality for v13 instead
("minor patch" makes absolutely no sense, minor (release) is _.x._ and patch is _._.x https://semver.org/, for completions sake major is x._._)
ah gotcha
@ruby terrace mind elaborating on
but that poses the problem that the library doesn't expose message_reference whatsoever.
Message#reference is a thing
and i'm not too sure what that has to do with:
This means that MessageOpitons#failIfNotExists has no indication that it is reply specific other than the jsdoc string.
Ah, I mean on the sending side. message_reference is essentially named replyTo when passing options to APIMessage, except that parameter currently only sets the message id obviously.
And for the second part, if failIfNotExists is the parameter name in MessageOptions - instead of say, MessageOptions#reference as would follow Message#reference - then there's no indication that this parameter does absolutely nothing when replyTo isn't specified.
might be worth nesting that one further then, grouping together the reply related keys into its own reply options, which then hold failIfNotExists and messageReference/reference keys
I'd agree with that, that keeps MessageOptions much more similar to the API then
.send("...", { reply: { messageReference: <MessageResolvable>, failIfNotExists: <Boolean=True> } }) something along those lines
I like that, would we want to call reply messageReference though since the API does that? so something like this:
.send("...", { messageReference: { message: <MessageResolvable>, failIfNotExists: <Boolean=True> } })
i think "reply" is more verbose for the option, while also keeping the messageReference and fail* fields true to API naming (which are essentially shifted to top level)
That's fair, I'll go ahead and make those changes.
The MessageReplyOptions also needs to be changed now. I think it will have the new reply field with only failIfNotExists field, because messageReference gets set to this. Will wait a few days until we are okay with the changes that have been made to MessageOptions.
in the api, fail* is inside message_reference
so maybe
.send("...", { reply: { message: <MessageResolvable>, failIfNotExists: <Boolean=True> } })
or
.send("...", { reply: { to: <MessageResolvable>, failIfNotExists: <Boolean=True> } })
Shouldn't this use Promise.reject? i would PR but I don't have a computer on me
</github:805111231349653544> query: 5132
^ makes react() async so that also gets fixed
ah, gotcha
https://cdn.discordapp.com/attachments/223867697312694272/809043798008397864/unknown.png why did this behaviour change?
(channel as textchannel)
That does not do the same
And also wonder why the ChannelType enum was introduced, what channel property returns a number that maps to the right ChannelType?
this was never truly fixed iirc, but it will be in the future
Since channel types are numbers in the API, and you can use numbers in the edit function, thats why it exists
ah okay thanks
I think it would make sense to introduce a channelType property on channel so that the enum can be used
the enum is more less a misc thing defined in our current types to have a consistent type in options and such
I think it would be better if InviteScopes was an enum like ```js
exports.InviteScopes = {
ApplicationsBuildsRead: 'applications.builds.read',
ApplicationsCommands: 'applications.commands',
ApplicationsEntitlements: 'applications.entitlements',
...
};
also, documenting the uses for all of the scopes seems unnecessary on the lib side, why not just link to the Discord docs like MessageFlags.FLAGS?
that enum already exists in discord-api-types, imo it doesnt make sense to copy it, instead it could be added as a dependency (including other places in the lib)
a while ago iirc, you can use if(channel.isText()) ... however which works virtually the same
would you consider a pr whihc adds optional support for https://github.com/uNetworking/uWebSockets.js
I believe Vlad mentioned that it wouldn't be added until they follow the spec
or maybe that was a different one
Is that a client? It looks like a server and I failed to spot anything that looks like you can use it as a client (I didn't look very good tho)
uWs was removed because of it's lack of respecting the ws spec and many issues it brought up
Now, I know why they didn't respect the spec, thats how they're fast fast fast, but...
Personally, something reliable, even if slower is more welcome than something fast and unreliable
We won't go that route anymore
what makes uws so good?
Its faster. But as Vlad pointed out, its faster because it doesn't follow the websocket specifications properly.
wait was the channel partial never removed in the v8 pr?
so now bots cant get dms by default?
yeah i tested it and cant receive dms unless i enable partials: ['CHANNEL'], that should be fixed
cc @vernal atlas
personally i'd prefer it if it never dropped events due to uncached items
but it at least shouldnt do it in this situation
yea i guess the best route there is removing channels partial and having channels always be a possible partial
Are partials from the dapi per-event possible? If so, will this ever be implemented?
Discord api either gives the full object or partial. No events are ever dropped on their end
So no, there’s no per-event partials option
Damn, that would be a really nice feature if it were possible. Thank you!
Could open up a feature request (after making sure it doesn’t already exist ofc)
If I weren't already in bed, I would, but I highly doubt there isn't an issue already opened pertaining this feature.
will this and/or message type 20 be added in snek's interactions pr or should they be added in a separate pr(s)?
Why does ClientUser#setActivity has name as a separate param? Due to this, the ActivityOptions interface has the name property but the docs for it doesn't have it.
My guess would be that someone found .setActivity("name") to default to playing a more comfortable approach, and wanted to support that there
Typing wise that could be solved with omit though, afaik - question is if we want to
on message.mentions.channels the type is Collection<string, TextChannel> but it should be Collection<string, TextChannel | NewsChannel>, announcement rooms are mentionable
right, and NewsChannel extends TextChannel
yup, but text channel bind explicitly the channel.type value to text
right, also removes the possibility... to use news channel things on it
so we need to being able to check if the channel.type is news
actually, since channel mentions get parsed by the lib, it can be any channel type 👀
I'm talking about the type definitions
I know
The current one is
export class MessageMentions {
public readonly channels: Collection<Snowflake, TextChannel>;
}
TextChannel rely statically on channel.type value, which is intended, but due to that the type should be
export class MessageMentions {
public readonly channels: Collection<Snowflake, TextChannel | NewsChannel>;
}
oh, i see mention_channels is only included in cross posted messages at the moment... yikes
I could fix that with a channel.isText() check in the MessageMentions constructor, if we actually see it as a bug
otherwise the type would be GuildChannel
hm, good question, actually
after all the client sort of resolves voice channels, just not clickable
mention_channels will include mentioned text channel for lurkable guilds in cross posted messages
other question being: do we even cache/handle/provide these in any way?
I would like to mention that channel mentions for voice / category channels are indeed handled strangely by the client right now. (Behave like a channel you don't have access to) However, slash commands do let you select these channels, so it is possible that the client will do something different we these mentions in the future. Therefore I'd be in favor of keeping the API emitted mention_channels and changing the types to reflect it
the api provided ones are only present under very very specific conditions and i'm not too sure we do absolutely anything with that at the moment
we resolve mentions from cache right now for messagementions#channels
can also include dm channels, so Channel, really
ah, I have misread the docs. I do see that mention_channels is stored as messagementions#crosspostedChannels
oh, so we DO handle them, yays 
oh, this is interesting, so the private _channels Collection, which messagementions#channels is a getter for, is typed differently from messagementions#channels for some reason. Also, the jsdoc strings are all GuildChannel
export class MessageMentions {
...
private _channels: Collection<Snowflake, GuildChannel> | null;
...
public readonly channels: Collection<Snowflake, TextChannel>;
...
with its current behaviour? yes, def
the question becomes whether certain channels should be part of that Collection, which is arbitrary since the API doesn't give us anything
great question
no it's just that I did npm install discordjs/discord.js and it gave me v12.5.0 but the intents were bug
recent release is 12.5.1 but the package.json is still 12.5.0 on master
https://github.com/discordjs/discord.js/blob/ee5bc1a5c4e218ea1f16992694a2bff86c86d2d2/package.json#L3
probably not a bug, just that the way to set intents has changed (and it’s required now) in master
tbh the version number should be changed to v13.0.0-dev
🤔 looks like there are a bunch of unmerged approved prs? https://github.com/discordjs/discord.js/pulls?q=is%3Apr+is%3Aopen+review%3Aapproved
Yes... so? 🤔
@copper laurel on #4869 u marked this as resolved but looks like u forgot to remove it? https://advaith.is-in-hyper.space/732aaeb2ef.png
</github:805111231349653544> query: 4869
Which review was that? Linking to the comment would be way more helpful than a screenshot lmao
Might have been caught up with the others in that review
tbh im kinda confused why sometimes returning the raw message object was even discussed
instead of just creating a djs msg object
Originally part of the concept was for the manager not to cache things that werent previously cached
Moved away from that
well you dont need to cache the message to create a message object
@trim quartz will you add the new msg type (20, APPLICATION_COMMAND) and permission (1n << 31n, USE_APPLICATION_COMMANDS) in your interactions pr or should they be added in separate prs
I thought type 20 doesn't exist anymore
I don't know if anyone already saw this, but this dude copied you: https://www.npmjs.com/package/improved-discord.js
his link to the documentation goes to your website lol
And? The License allows it afaik, and it already happened like 30 times, forking and republishing should be fine under the Apache 2.0 License
https://tldrlegal.com/license/apache-license-2.0-(apache-2.0)
The Must sections do not seem fulfilled to me
true, but still, d.js has allowed this to happen and hasnt done anything about it since a decent amount of time so I dont see whats different with that fork
I don't want to waste time on these forks that aren't really getting in the way of anyone
he is in violation of the license yes, but his module seems fairly inactive and hard to mistake for the original discord.js at least
Except that the readme is 100% copied and links to us
i mean, the top of it is sort of clear that this isn't the original discord.js
i mean yes i have contacted npm/repos for less than this
but honestly i am tired of chasing up every fork
They're also trying to change the LICENSE, which is.. 
Hi, because <Message>#delete({ timeout: number }) will be removed and as is it a lot used, I'm proposing <Message>#deleteIn(timeout: number), what do you think ?
The whole point of removing that was so that it forces devs to think about how they are deleting messages after a time. e.g. checking if its already deleted etc...
Its also inconsistent with the rest of the lib
https://github.com/discordjs/discord-api-types/pull/72#discussion_r579488863
@tacit crypt just to make sure i'm doing this right, are you saying you want them to each be their own interface instead of unions like they are right now?
yeah and then make a union of all the interfaces
Its being removed because internal hidden management of the timeout has issues, not because we want to move it somewhere else
Exactly like how commandOptions are done
an interface defining the type
and an union of them

Oh okay
A weird thing is happening to me, When I start my bot.. It calls guildDelete event on 2 guilds that are already deleted (means bot is kicked)
And when I run same code with token of my test bot... It runs as expected.
someone else in #archive-updating-to-v13 also had same issue
we both are on master branch.. idk much about it but wanted to make sure you saw this
I was wondering if discord.js is going to support slash commands:
</github:805111231349653544> query: 5106
ty
dependent on discord finishing their breaking changes too
That announcement is only for a Use Slash Commands permission, Slash Commands themselves are still a beta as it says
Oh yea, mb
they said the API will be stable after the announced UI changes ship
Where exactly?
Where is the code that manages the queue and waits for rate limits? I just wanted to have a look but I can't see to find it. Thanks!
I see, I looked at it but wasnt too sure, thanks!
In src/rest/RequestHandler.js, why is there a +250? I looked at the issue stated in the comment but it still doesn't say why there is a +250. I have tried removing the +250, and it increases the speed that the bot can react at. Is there any reason that this is here?
Both yes and no
I think I understand now; the 250 should be the correct timeout for reactions
the react ratelimit is 1 every 250 ms, by removing that, you are likely to hit a ratelimit whenever you do many reactions at once
It's like a explicit timeout that is not based on the headers because the header parsing causes 0.25 to be parsed to 1
Is that correct?
That's a hard-coded rate limit, because is 1/0.25s and the rate limit headers used to only be in seconds, so we'd get a 0 I think, but yeah, basically because of header parsing issues
The reason reactions in particular are slowing is the ClientOption#restTimeOffset option, which defaults to 500
This option tells Discord.js how much extra it should wait when it hits a rate limit before continuing with the queue. This works pretty well for every endpoint where rate limits are 5s, 10s, 1m etc because 500ms is nothing.
Unfortunately for the Reaction endpoint, which immediately hits a rate-limit (because its 1-per) it turns a 250ms rate limit into a 750ms delay
I did set restTimeOffset to 0 for testing
If you do that, then you should definitely leave the +250 there
Wait Monbrey, are you saying the ratelimit header is in ms now?
Will the "quicker" reactions just be because of my high API ping or something?
No, they just explicitly stated that reactions = 250ms
rate limit headers used to only be in seconds
I'm talking about this
It is still in seconds even for reactions tho
That's why I was confused
Yeah "used to only be in seconds" suggests that its not in seconds anymore?
If I understand API v8 properly, then yes actually, it should be in ms.
I might do some testing with that tonight then actually, that special handling for the reactions endpoint should be removable now
Top: With +250
Bottom: +250 removed
And the pace of reactions with +250 removed is constant, so I don't see any rate limits being hit
are you on master?
I dont know exactly. It was seconds. Then it could be either and they added a precision header to tell you if it was ms or s
Now I think v8 is ms
Actually, with the +250 removed, you can see a small choke which is barely noticeable, so I guess its my ping then 🤷♂️
But still its a lot faster than with +250
Theoretically, the time it takes for 10 reactions is 2.5 seconds + your api latency + your event latency
isnt event latency like a few miliseconds?
If we're moving away from actually discussing library development, can we go #archive-offtopic or support
I do believe there is no reason to keep the line specifically for the reaction routes though, would you agree with that?
I think the headers is still in seconds
When I comment out the lines it takes 1 second for every reaction
if you are not on v8 (either by options or via using master) then its in seconds
The
X-RateLimit-Precisionheader is no longer respected.X-RateLimit-ResetandX-RateLimit-Reset-Afterare always returned at millisecond precision (e.g.123.456instead of124)
that's in the v8 changelog
I am on discord.js@12.5.1
I'm talking about in master, which has the v8 PR landed now
so that was more addressed at Monbrey
@ruby terrace yes
V8 reset-after is ms
Well
Its floating point seconds
seconds with ms precision
Is that not already changed in the v8 PR?
yeah, a little strange considering its present all the time, but 
I checked out master and It doesn't seem to be removed
But is that PR even merged
On master it is still this
oh
I checked out my master, not upstream
and yes, second to last merge
and that line is still present
Remove it and vlad or space or someone can yell at you if youre wrong
Ah hah, I've found why this won't work. Server date isn't in ms, and since offset calculations are done to account for...well...offset..., you'll never get ms precision for a ratelimit unfortunately.
For example one request I had had a reset token of 1614330706.302 and my system got 1614330705260 from Date.now() after this request
(for reference the server date was 1614330706000 which would mean I'm roughly 3/4 of a second behind the server, which doesn't matter necessarily. However, given that the reset-after is 0.250, the discrepancy between reset and server date being 302 ms tipped me off)
That's not something we can change, the server sends it like this
oh I misunderstood
Guess I'll scrap this idea then (until we're all on the same atomic clock or something
)
any reason we don't have support for
https://discord.com/developers/docs/resources/channel#group-dm-add-recipient
https://discord.com/developers/docs/resources/channel#group-dm-remove-recipient
(as far as i looked anyways)?
edit: new addition https://discord.com/developers/docs/resources/user#create-group-dm. Despite the description saying the group dm channels aren't visible to the discord client, advaith says that's outdated and has changed, making the group dm channels visible to the client.
Because the bots cant actually join group DMs iirc
The first two are really OAuth endpoints, since it requires an authorised scope to use
yes, but if we have methods for other oauth endpoints like add user to guild, why can't we have support for these?
The create group dms was intended for the GameBridge SDK, which is now deprecated. And also in the description, "DMs created with this endpoint will not be shown in the Discord client". Therefore, having group dm channel methods would be useless because bots can’t make use of them anyways
please see my edit
i can ask for a source, hold on
So it was a recent change?
that was like last year from the timestamp
not exactly recent if you ask me
and I assume it was actually changed long before that
But in true discord fashion still not documented as such
I'm encountering a weird behavior with permissions, i don't know if DJS is broken on this part or if it's the Discord API who act weirdly. Or maybe I have not understand everything. In any cases, here is my use case to reproduce it:
1. Revoke all permissions to the role bot from the server settings
2. Grant all permissions (green) to the bot role to a category
3. Create a room in this category with synced permissions
4. Try to clone it
Due to the category permissions and the fact that the category is the parent of the room, it should be able to create a new room with same permissions no? Currently it trigger a DiscordAPIError for missing permissions. But when i'm checking those permissions before doing anything, DiscordJS seem ok with those permissions 🤔
It needs Manage Server to create channels
no? you need manage channels to create channels
but to set a permission override you need to have the permission server-wide
and to set a Manage Roles/Permissions override you need admin
however iirc they said there was an exception for cloning 🤔
why does packages/voice exist in -next if there's also a voice repo
same question for packages/collections i guess too
because the voice repo didnt exist when next/voice was created 
collection one did tho
even its TS rewrite happened around half a year earlier than -next had first commit
we need manage channels to create a channel, but i think the issue comes from the fact that the bot is allowed to manage the channels from the category permissions, and perms room are sync with the category. Maybe discord consider it's a self assignment, idk. But anyway, if it's the case the library should not return true for the permission check in this case 🤔
It appears, even if i give the permission to the bot from the server settings, if his group is explicitly granted on the category and the room, then I trigger the missing permissions error, which is really really weird. I though there was some sort of hierarchical mechanism like that: Server settings > Category settings > Channel settings
Anyway, DJS don't catch it when i'm checking for permissions while the API reject the query, which is really annoying
There isn’t, only role permissions and channel overwrites matter
Pretty sure d.js doesn’t check perms in any case before performing an api call
The same thing actually happens in the client. You can see the clone / create channel button if you have been explicitly granted manage channel for a single channel / category. However, the API will error. I think this is quite a rare case however, and you can always check your guild permissions.
And this type of permission getter is something that is trying to be avoided IIRC
the bot is granted for the category, so it should be able to perform the clone, if there's a parent, then the parent perms should apply except if there's an explicit deny no? 🤔
categories are sorta strange, they're actually just channels, and they have no hierarchical inpuit
oh damned 😅
genius idea to put hierarchical rooms on the client but not applying it to the perms 😂
idk if this is the place to put it but thought i'd share a little helper code i wrote for making message replies, since i couldn't seem to find anything else online, thought i'd share my findings
Discord.Message.prototype.reply = function({ content, embed }, mention) {
let data = {
"content": content,
"embed": embed,
"tts": false,
"message_reference": {
"message_id": this.id
},
"allowed_mentions": (!mention ? {
"parse": [],
} : undefined)
};
let reply = new Discord.APIMessage(channel);
reply.data = data;
reply.options = {};
return this.channel.send(reply);
};
pretty sure there is a pr for that (and maybe already merged in master?)
for v13 yeah but if u don't wanna have to do any merge bullshit, i didn't want to run an unstable version so i just made the function that i needed
idk how v13 does it but i just tried reverse engineering yalls library to send an api message
You should use Structures.extend, not modify the prototype directly
Are there any plans on making .send() a tad more ts friendly? Currently, I am unable to modify the method directly and the types are atrociously difficult/confusing to any new typescript programmer. It is also not following the types mentioned in the documentation and it is resulting in a lovely handful of errors from ts.
The short answer is "yes but not right now"
Typings will be improved in the future!
next ™️
its worth noting that for the send methods the typings are a bit bugged, you can't do for instance
let x: MessageOptions | string = {};
if (something) x = "hi";
channel.send(x);```
something to do with the fact that there isn't an overload that just accepts both
i was gon do a PR on it but i don't have the patience to mess with those overloads atm
will message.reply() be changed to an inline reply in v13?
Yes, it's also available in master right now
Is there a particular reason for why discord-api-types may export never types? Seems odd since void seems to be more appropriate in those contexts
technically, both are valid types for it... The never type represents the type of values that never occur vs void is a little like the opposite of any: the absence of having any type at all
In the end, they should be achieving the same thing 👀
I don't think the typescript compiler treats them the same
it's really ruining my auto-generator 
how so? Can you give me an example of the issue? What's the output with undefined vs never? Which would be the expected output 👀
You can always DM if you don't wanna clog here
yea, im not entirely sure if my thing relates to the library itself since I only use the typings for deno :v)
but yeah I'll DM
what's the point of guildMember.permissions.has() if an array of permission resolvables can be used in hasPermission
#hasPermission is removed on master and will accordingly be removed with the release of v13
simply because (see link above) it's not much shorter than <GuildMember>.permissions.has which it calls anyways
It's "private" as in you shouldn't use it, doesn't mean you can't
If you're on TS and it bitches, either shard['sessionID'] or ts-ignore it
Oh wait really? lmao does js not enforce private properties?
Or is that just a comment and I'm dumb?
well, shouldn't should be enough of a: maybe what you are planning to do with it is not that good of an idea to apply in the first place
Yeah I can access it fine lmao I'm just dumb
Dumping shard session ids to redis to then resume them on another shard with an updated version of the bot?
0 downtime updating
Bad idea ^ ?
No, absolutely valid
Okay although maybe best to do with a custom djs fork?
As it currently stands, yes
Sounds good cheers 👍
though depending on if you use TS or not
you can modify those values anyway
there is no such thing as hard privates in djs
🤔 why is it private
Do a git blame
Yeah I see now. Been doing lots of straight java recently so I forgot that @private in the comment doesn't actually make it private just invisible in docs
re: https://github.com/discordjs/discord.js/issues/5277
@opaque vessel but didn't you yourself open the issue on DAPI docs? i'm confused 
and from what I understand this would go away if fixed on discords end?
also if you know how to fix it, why not PR it?
the discord bug is different
the discord bug is that if you edit the message without setting allowed_mentions, it resets allowed_mentions
the d.js bug is that if you only send allowedMentions it doesn't send anything
...yes, .send({ allowedMentions: { parse: [] } }) or w/e is never gonna work - or am i missing the issue
OH
editing
Why is Role.comparePositions available while Role.comparePositionTo is pretty much the same
is it gonna be removed on v13?
the latter calls the former (static) with this, don't see a reason to
but they do function the same why would there be 2 methods for it
what? the static method is called in the instance method - they're not the same, one depends on the other
oh
<Role1>.comparePositionTo(<Role2>) vs Role.comparePosition(<Role1>, <Role2>) (which is called in the former with this)
https://github.com/discordjs/discord.js/blob/stable/src/structures/Role.js#L154
I thought one of them should be pointless because they both return the same result but looking at the source code and what you said I got it rn
thanks souji!
one could argue that we can shove the static functionality into the instance and remove the static, but that's just removing a layer of abstraction vs. pruning duplicate functionality
so not a fan of that, personally
oh
Yes pretty pointless in that case.
Is it intended that when you have fetchAllMembers enabled, but don't have the privileged intent the library will just wait for two minutes until a timeout occurs to start the bot? Im not sure what discord returns however seems odd to fail due to timeout
Also the timeout "error" is logged over debug, rather than the error or warn events.. is that intended? Made debugging my bot more difficult as I was logging warn/errors but not debug
yes, fixed in master by removal of the option
So I looked over the VoiceState class and .streaming is not nullable? I would assume it would be considered nullable since the rest of the properties except for id and guild are nullable.
https://github.com/discordjs/discord.js/blob/master/src/structures/VoiceState.js#L64
per the api docs: https://discord.com/developers/docs/resources/voice#voice-state-object
self_stream? boolean whether this user is streaming using "Go Live"
i guess, yea
nada, Jake told us a few months ago that any optional boolean can be safely defaulted to false if missing
so it makes sense to guarantee it
most of these properties would be changed if that were the case
"these properties"?
oh, hm
i see what you mean
i think @unique axle tackled this a while back
Oh, is that yet another instance of https://github.com/discordjs/discord.js/pull/4706 (and linked PR's)
appears so
my memory usage is increasingly indefinitely, it's in around 2.2k servers and I have sharding enabled. it's using around 700mb of memory.
I have minimal intents, messages and guilds. and message sweep is quite strict
messageCacheMaxSize: 10,
messageCacheLifetime: 60,
messageSweepInterval: 10 * 60,
messageEditHistoryMaxSize: 0
just curious, how is discord.js-next doing?
typescript migration seems useful
and seems relatively simple, just adding types to existing javascript code
unless there are some non-obvious difficulties with migration?
You are misunderstanding what -next is. We're not simply adding types to existing code.
discord.js-next is going to be a full on rewrite of the library, from ground up.
types are already included with the project as it is now. (https://github.com/discordjs/discord.js/blob/master/typings/index.d.ts)
ah so like big restructuring of everything?
yes
any plans on supporting deno?
refer to
ty ty
Would there be any way to have like client.destroy return a promise containing a boolean with like if it successfully deleted the client or not
just bc like rn it doesnt return anything
so you cant really know when the client is destroyed
it's not asynchronous, it should happen more or less instantly
but why , what application does this have?
in case you want to like restart your bot
you don't wanna create a new client till the old one is made
client.destroy() isnt for restarting bots exactly, you should probably just use a process manager and restart it
oof
there's a possibility that there's leftovers which could cause unexpected behavior
destroyed clients should not be reused
I was a bit too late :snail:
loll, ty for the info tho!
Is there any point on keeping Guild.channels.cache if you have Client.channels.cache that has a property of guild for guild channels?
Well guild.channels is the actual manager with the create etc methods, so yes, it needs a cache
the cache could be based from client.channels.cache doesn't it?
But why
You want guild.channels to have to be written as a custom manager that doesn't have it's own cache, and a pseudo-cache getter for a filter on client.channels.cache? Why add that complication?
#archive-offtopic message about this, though you said its a reference, but reference to client.channels or other way around?
Neither. Collections with the same Channel objects in them
I don’t think you can have one-way object reference in js, it’s always mutual
so basically, channels in guild.channels.cache is the same reference on whats its counter part on client.channels.cache?
https://github.com/discordjs/discord.js/blob/f46940228e9f82db4af09ae2f2dad684db0d74ed/typings/index.d.ts#L991 is there any reason to not make the CollectorFilter type generic? so, in this case, you can go from
type CollectorFilter = (...args: any[]) => boolean | Promise<boolean>;
to
type CollectorFilter<T extends unknown[] = any[]> = (...args: T) => boolean | Promise<boolean>;
so that then you can add additional type data for filters like the following for the line I referenced in the link?
public awaitReactions(
filter: CollectorFilter<[MessageReaction, User]>,
options?: AwaitReactionsOptions,
): Promise<Collection<Snowflake, MessageReaction>>;
interface ClientOptions<T extends PartialTypes = PartialTypes> {
// ...
partials?: T[];
// ...
}
type ReactionType<T extends PartialTypes> = T extends 'REACTION' ? User | PartialUser : User;
interface ClientEvents<T extends PartialTypes = PartialTypes> {
// ...
messageReactionAdd: [message: MessageReaction, user: ReactionType<T>];
messageReactionRemove: [message: MessageReaction, user: ReactionType<T>];
// ...
}
class Client<T extends PartialTypes> extends BaseClient {
constructor(options: ClientOptions<T>);
// ...
public on<K extends keyof ClientEvents<T>>(event: K, listener: (...args: ClientEvents[K]) => void): this;
// ...
}
Same goes for here
Could someone shed some light on why replies are only being added in v13? It's been 4 months since the feature was introduced, shouldn't it be a priority to add new features as soon as possible?
we will not do another minor release on version 12
so we might as well introduce replies as a breaking change in the next major, 13
the usage as Message#reply is much more idiomatic than inventing another method name just for the sake of keeping it minor
Would it be such a breaking change to replace the current reply functionality with the new one that it requires a major release?
In my humble opinion I'd much rather have a new minor release with the new functionality than having to wait months on a major update, but thanks for your answer
anything that changes the publicly exposed API is a breaking change, no matter how small it is.
and changing the entire behaviour of a method is definitely a super breaking change
That's true
there is nothing about the method that stays the same but the name.
it takes different parameters
it does something else
there is no way replacing this could be framed as a minor release
I can see that, but I still feel like adding new features as soon as possible should be prioritized in some way, but I understand
I'll just use the fork for now
that is a priority, indeed, but not as much as to jeopardise semver over it, if we already have moved on with the development branch.
you can of course always install a certain commit and apply the necessary changes
in that case i'd heavily recommend pinning your dependencies to that specific commit, in order to not accidentally introduce more breaking changes when updating.
more on how that procedure works: https://docs.npmjs.com/cli/v7/configuring-npm/package-json
Thanks
I'm sorry if you guys get this asked multiple times, but I am curious and I want to try helping. I tried searching if someone asked about this in this channel before but apparently there wasn't (I could be blind though).
Has anyone got a rough idea about why discord.js is having trouble with piping Readable streams back in node v15? I know the fix is to downgrade back to node v14 but what change in v15 could've caused piping to not work, unless you do it twice.
Node.js v15 is not the stable version and has some unstable changes, so it might be having issues with the Readable Streams that are piped through discord.js's voice lib, however, the voice lib is getting a lot of changes apparently, no idea that would do anything in this case but as its not LTS, you gotta dig through Node.js's changelogs to find out what they changed between the two versions and see the difference
I dont think its worth figuring it out, use the workarounds and wait for discordjs/voice to be production ready
frankly there's not much to dig, there's very few changes that could've done this just on a quick scrim through the changelogs
[3f33d0bcda] - stream: fix pipe deadlock when starting with needDrain (Robert Nagy) #36563
being the main culprit (all though I'm not certain of the exact bug or if needDrain is used)
which is actually under the 15.5 changelogs 
so if this works on 15.4 for instance, it's probably that
With the research I did in the middle of the night. I haven't checked at which version it stops working. However I have found that this was changed between version 14.16 and the latest commit.
https://github.com/nodejs/node/blob/bd60e93357a118204ea238d94e7a9e4209d93062/lib/internal/streams/readable.js#L722L744
These lines of code in the pipe function. were changed to just pause() in the latest commit.
it stuck out since the comment said // If the user unpiped during `dest.write()`, it is possible // to get stuck in a permanently paused state if that write // also returned false.
is implementing this on DiscordAPIError feasible? https://discord.com/developers/docs/reference#error-messages
cc: @vernal atlas
yeah if im understanding right thats already implemented
the libs are broken atm, there are just random issues after the new stage channel stuff
e.g.
this is confirmed by people reporting similar in #archive-djs-v12-deprecated
and I can confirm not a single thing has changed on my bots in the past 2 weeks and this is all sudden so its def a lib or api issue with the new change
is this with one of the invite events?
they all look to be related to channel events such as channel create
also in line with the new change
can u list me all the events you listen to
nice one ty
- Does djs support slash commands?
- The new stage channels are not the same as vcs it seems so bots will say you arent in a vc how / when will there be a fix for that?
- not yet pr pending
- new channel type
Will there need to be a fix for that? Or is there a way to fix it currently
we will probably release 12.6 after all which introduces the new channel type and stage functionality
We didn't want to release anything else on v12, but things are breaking, so here we go:
• ⚠️ 12.5.2 emergency patch release to stop receiving INVITE_DELETE for stage channels from breaking the library
• 12.6.0 minor release for stage channels (might not happen because of new permission bit)
According to https://github.com/discordjs/discord.js-next/blob/master/.github/COMMIT_CONVENTION.md, (referenced in https://github.com/discordjs/discord.js/blob/master/.github/CONTRIBUTING.md ) types is a valid commit type
however commit-msg only lets me use one of [chore, build, ci, docs, feat, fix, perf, refactor, revert, style, test]
which type should I choose? the changes are only to the typings, nothing else
I would choose feat but I'm not sure whether that is reserved for actual features
sugden made a typings type commit 3 days ago but that doesnt work either
you can use feat for typings too, yes
thanks!
looks like in master PresenceData now needs activities instead of activity but docs still say activity
https://discord.js.org/#/docs/main/master/class/ClientUser?scrollTo=setPresence
did docs just not get updated?
ah so looks like it just sends the presence directly to Discord, and it changed in v8 but the typedef and interface weren't updated
why was the before option removed from ReactionUserManager#fetch ?
is it being deprecated by the API?
never worked, API docs don't get a response as to if it's a bug or just wrongly documented -> removed it
reasoning being that if it gets fixed and added back it's super easy to re-introduce in a semver minor
i see, thanks
any reason https://github.com/discordjs/discord.js/pull/5147 did not add ApplicationFlags to the Discord object? or was it just overlooked?
oh yeah, that was an oversight
Yes, see Github
last PR was in January
ran into a typings bug today
GuildMemberRoleManager extends BaseManager, which has the resolve and resolveID methods, even though they aren't implemented
I would do PR but i'm not sure how to
GuildMemberRoleManager shouldnt extend it
It doesn't directly but it extends OverridableManager which extends BaseManager
https://github.com/discordjs/discord.js/blob/6c6b1053b7a6778a5d0402941a13258ca13378f8/typings/index.d.ts#L1964
^
Interestingly GuildMemberRoleManger is the only class that extends OverridableManager
so either GuildMemberRoleManager should implement the rest of the methods of BaseManager, or not extend from it at all
either way OverridableManager seems rather useless and could probably be removed
keeping 7 as unknown is pretty 😬
maybe change to -1 or smth
although it probably wont have a real issue bc 7 was for lfg iirc (which afaik will not return/release), its pretty weird
the unknown type to existing in the first place seems to be an oversight from https://github.com/discordjs/discord.js/pull/3165 where the unknown channel approach was removed in favour of making channels of an unknown type not enter cache
Seems like this is an issue within D.JS,
where in this.connection can be null on ws open event(?)
https://github.com/discordjs/discord.js/blob/3af8179878c093985c8a94ee2fd7e99d45243bda/src/client/websocket/WebSocketShard.js#L268
Client event disconnect exists on the typings ClientEvents but its not documented in the docs 
The disconnect event is on v11, but it was replaced with shardDisconnect in v12. Strange it's not removed from the typing 
there is a very small time frame where that can happen: the shard getting disconnected/closed/destroyed before the open event is fired by ws
i believe this bug was fixed quite a while ago, strange
it rarely happens but if not dealt correctly, it will crash your bot
In my case it happened only this April 3rd
@tacit crypt ^^ seems https://github.com/discordjs/discord.js/issues/3641 has arised again 👀
latest master
cc @vernal atlas
was IntegrationApplication also not added to the Discord object?
the fetchInviteInfo method in client couldn't pass some trolling invites
For example, i'll provide 2 working invites for examples: test and 123
Example: https://discord.gg/123/test/
DJS fetchInvite method returns the result of the server with the code 123, but Discord site automatically redirect it to discord.com/invite/test/, which is the latter
(there are actually more cases when i tested the method, will add them here later)
i don't understand your request? both are vanity invite links that are given out to two different guilds, which we retrieve correctly from the API via the GET /invites/{invite.code} endpoint and provide the data for after fitting them into discord.js structures
I mean, the only problem is that discord.gg invite links only takes the last invite code after the last slash character (if there are no characters like #? beforehand)
Just try the example invite link with by both the djs method and pasting it in the website and you'll see the difference
i really don't know what you are referring to, both https://discord.com/invite/test as well as https://discord.com/invite/123 point to different guilds, even if i enter them into the browser directly - we retrieve those guilds accordingly from the API
123/test/ is parsed as 123 by discords redirect system
But discord.gg doesn't follow the rule above
https://discord.com/invite/123/test/
https://discord.com/invite/123
both lead to the same guild, which is also the guild we return 
discord.gg/123/test
I mean this one
both discord.com and discordapp.com work well with the method
ah, so what you are saying is that discord.com, discordapp.com vs. discord.gg resolve invites differently in complete edge cases, which we don't handle on the library level, see
as i see this this is an inconsistency in discord parsing invite links with excess differently in discord.gg and discord(app).com and i personally don't see reason to specifically add code to handle this edge case
I only recognized that when there are some trollers that posted that kind of invite to my server
Fyi, I coded a bot to detect invalid invites and delete them. And it failed in those trolling invites
The trollers then dm me and asked why their valid invites got deleted, which pulls me to a tough situation as I stated there "only post invites that are valid/linked to the discord invite page"
Does Discord.js support stage channel to be created
no, not yet
was thinking of suggesting a new property for all guild channels called locked that says whether a channel has the 🔒 icon in it or not (essentially sees if the everyone role has perm to view the channel and connect (for voice channels). Do you guys think this would be a good idea?
it's just a permissions getter for CONNECT (voice) and VIEW_CHANNEL (text) permissions after overwrites and depends on the viewing member
not a fan, don't see many use cases for it either
well you can say the same thing about manageable which is already a thing right
manageable at least factors in ownership apart from just role hierarchy
well ownership wouldn't matter in this case since the lock appears to everyone and doesn't depend on anyone's permission but the everyone role
it would be almost the same as this (with different permission flags) without the first line
An example of a use case for this would be if you wanna make a command that locks a voice channel (which is what im working on for my own project) which would make this process easier (checking if the channel is locked already or not)
well, it still depends on the viewer. if you don't have connect there is a full lock, otherwise there is a small lock next to the regular voice icon i guess
but i really don't see any use case for this - even less now that you detailed you mean the small lock, which is basically completely useless information
^ Just write yourself a util that does the permission check -- its literally just a permission check, doesn't make sense to have in the core lib imo
its useless to someone that has that permission but its not for a server owner for example if they wanna easily know what channels everyone can see. To me it makes sense to have this alongside the manageable property
discord has a built in functionality to do that now, so even as a bot feature that is completely unnecessary
but bots don't have that feature and if you wanna list all the channels that are visible to everyone through a bot it would be harder
You do have that feature, it's called checking permissions? Its very simple to do, and very simple to wrap in a utility function if you don't want to write the permissions check every time?
i understand that you found a use case (which you seem to feel rather strongly about) and want to reduce your code complexity
but if we start incorporating permission getters for every small things that may or may not have a use case in someones eyes our API is going to be very, very cluttered. most permission getters that are in the library at this point either have more complicated checks under the hood or at least a broad area of use cases, where they actually make peoples lives easier
channel.permissionsFor(channel.guild.roles.everyone).has("VIEW_CHANNEL")
i really don't see why this single line and single purpose check should get its own method/getter on a library level
I completely understand that doing this for every little thing is pointless, I just suggested this because it's a built-in feature from the user's perspective and it seems like everything that the user can see is also available to a bot through the library. But it's fine if you don't wanna implement this, it was just an idea :)
well, the information is available, if you need it but "is icon displayed in desktop chat app" is not really a good criterion to develop a library based on
yeah fair enough i guess
seems like theyre adding contentType to attachments, https://github.com/discord/discord-api-docs/pull/2762
done
I don't know if this is the right place, but I think Util.escapeMarkdown just made a mistake
That name is the same every time, fbz___
What's the input
Basically what you see except the name with the slash in it is fbz___.
want it copypasteable?
name: fbz___, displayName: fbz___, id: 29507072, creationDate: 2012-04-04T10:54:40.635Z (over ~9 years ago), type: , broadcasterType: , views: 869, description: :3
channel - name: fbz___, displayName: fbz___, id: 29507072, language: en, title: :), gameName: Path of Exile
turned into```
name: fbz___, displayName: fbz___, id: 29507072, creationDate: 2012-04-04T10:54:40.635Z (over ~9 years ago), type: , broadcasterType: , views: 869, description: :3
channel - name: fbz\_, displayName: fbz___, id: 29507072, language: en, title: :), gameName: Path of Exile
Hm
^ Reproduction fwiw: https://runkit.com/embed/sf8shw84csji, looks like escapeUnderline is somehow escaping \___ from escapeItalic to \\_\__
but only in 1 of the four times his name is there
it's interesting because it goes \___ and __\_ twice, then that becomes \_\_\_ 3 times and \\_\__ once. well I am sure my commentary isn't helpful at this point, suffice it to say I don't know how it decides what to escape
a single _ also is italics, so say you have
\_\_message\_\_ (which escapeUnderline is ran on) then run escapeItalic and you get \_\\_message\\_\_
i think thats whats happening right ?
perhaps the soloution is to escape everything else then .replace(/_/g, "\\_");
might also get similar behaviour with asterisks too but idk
I don't think it will mess up on such a common case
but clone and edit on runkit isn't working for some reason
It works fine with __message__
It works in an interesting way with ___message___, then italic really does take care of one and underline the other
Anyway. I kinda expected it to just escape everything that could possibly be markdown with zero analysis tbh
just a quick question about this is there any reason as to why VoiceChannel has 6 of these permission checks? https://discord.js.org/#/docs/main/stable/class/VoiceChannel
deletable, editable, manageable, joinable, speakable, viewable
some like joinable make sense but manageable, deletable and editable seem the same to me
yea they are a bit confusing, but ultimately, they check for different things:
super.deletable and this.manageable also perform different checks
they also all have utility for the bot itself to be able and do things
"is a channel accessible for everyone" is completely irrelevant for a bot to do stuff
Yeah I saw that but I didn't quite understand what those were doing, where can I find the code for that?
(updated the message to link to a more up-to-date version of that file specifically for the stage channel PR)
seems like the url of null is happening again more frequent this time
I should really just remove that...
bringing this up again since https://github.com/discord/discord-api-docs/issues/2702 was fixed: #archive-library-discussion message
I seem to have misread the docs for X-RateLimit-Reset-After.
On v8 it is in floating point seconds, to ms precision. The value in this is not how long the reset is, but how long until the current reset, meaning it is possible to handle ratelimits better.
Basically, I would like to add handling of the x-ratelimit-reset-after header so that, if present, RequestHandler#reset gets set to Date.now() + reset-after, without relying on calculating server offset and manually adding 250 ms for reactions. Falling back to the current handling if that header is not present (in case the referenced issue ever pops up again for example).
Can anyone see a reason not to do this?
recently people are getting errors connecting to discord.com, I am not sure if it's released yet but if not shouldn't it connect to discordapp.com
no? domain change happened several months ago
I feel so outdated
how should i add msg type 22
should i add 21 to the createEnum too? or just put null for it
since 21 is in the interactions pr
why isn't 'size' documentated as a property of collection
Its a property of Map, which Collection extends
so whys that stop it from being in the documentation
Because you can view the documentation for it on the MDN docs website
No point on having duplicate docs
then how come we do that for the get, set, clear, delete, and has methods
I believe because they are implemented differently (as in there is code that makes them different from Map's equivalent)
not for get, has, and clear. We literally just return the super method
set & delete are extended but provide the caching functionality that collections has
which is being removed IIRC
I am interested in all these functions that just call super
exactly my point
couldnt joinVoiceChannel in djs/voice just take a channel object?
so instead of js const connection = joinVoiceChannel({ channelId: channel.id, guildId: channel.guild.id, adapterCreator: channel.createVoiceAdapter() }); just js const connection = joinVoiceChannel(channel);
pretty sure that's the stated goal, yes
couldnt it work for either
ig 
aka you can use with a library or with pure raw data sprinkled from json files
I'm not sure so asking it here, is this endpoint covered in djs: https://discord.com/developers/docs/resources/guild#search-guild-members?
aight, thanks 👍
what do u guys think on interaction.webhook vs interaction.followup(s) ?
i feel like .webhook might be confusing since it isnt really a normal webhook
the library internally uses it for .editReply and .deleteReply but users wont need to use it for anything about the original reply
#archive-github-djs message @oak quail maybe callback would be better?
I agree webhook could be a bit connfusing, however, I can't think of a better name, and it is mostly a webhook
Hey! For v13, do you think it would be possible to keep track of extended classes throughout the library? By that I mean keeping the jsdoc/types. Quick example:
Structures.extend("TextChannel", (Channel) => {
return class CustomChannel extends Channel {
constructor(...) {
super(...);
}
};
});
Structures.extend("Message", (Message) => {
return class CustomMessage extends Message {
constructor(...) {
super(...);
}
someMethod: () => {
// Now
this.channel // jsdoc/hint shows that this.channel is a TextChannel
// Better I think
this.channel // jsdoc/hint shows that this.channel is a CustomChannel
}
};
});
Maybe what im asking for already exists, in that case please make me aware of how to achieve it :D Thanks!
Btw, i'm asking that because i'm trying to work in typescript so if I want to use a method from an extended class, I have to "force" types (ex: (this.channel as CustomChannel).customChannelMethod() // would not work if type is TextChannel
I dont see this happening in v13, it might be possible in the full TypeScript rewrite
Yeah, I don't think this is an important thing rn
JSdocs definitely dont do it, but you can write your own extended typings
declare module "discord.js" {
interface Message {
client: MyExtendedClient;
}
}``` etc
Okay, thx for answering!
Util.cleanContent can be modified to take a channel instead of a message right?
...for what purpose?
Or do you just mean in general because all it accesses is message.client and message.guild
well i want to do it so it can be used for interactions
was just making sure i wasnt missing anything
Just make sure you fix the message.channel.guild line lol
are the types intentionally not imported?
looks like eslint complains that its not being used, although it helps with intellisense 
The docsgen recognizes the typings as is since it's compiled into one file anyways
ik, but the intellisense helps for developing
I don't think the docsgen supportimport("...")
Wouldn't that create issues with cyclic dependency?
The no-unused-vars rule can easily be fixed with the jsdocs eslint plugin (jsdoc/no-undefined-types)
@clever crypt not sure I'm a fan of your delayFor test (here https://github.com/discordjs/discord.js/blob/eeafe72d3a0d526a06d3536e9a4a85c69bd785d9/test/Util.test.js#L231-L237)
I think this approach that isn't event loop bound at all and doesn't cause the tests to take an extra 100ms to exit is much more desirable:
test('Util#delayFor', async () => {
jest.useFakeTimers();
const cb = jest.fn();
const promise = halt(100).then(cb);
jest.runAllTimers();
await promise;
expect(cb).toHaveBeenCalled();
});```
or.. something along the lines of that nevertheless.
but it's kind of redundant to "test" the ms parameter at all when it's just thrown into setTimeout
there's fairly little to test with this method overall so I can't really think of an approach that doesn't look lame
slightly confused here because lint-staged runs eslint on js files and prettier on ts files (https://github.com/discordjs/discord.js/blob/master/package.json#L85-L88)
but the prettier script runs on both js and ts (https://github.com/discordjs/discord.js/blob/master/package.json#L25)
https://github.com/discordjs/discord.js/pull/5524#issuecomment-819227769 I'm thinking of making a PR which does exactly what monbrey is suggesting here but I'm not exactly sure which managers the use of LimitedCollection can benefit from
seems like I would need to dig deep into DJS to find out which cache the lib doesn't deeply depend on
i think the biggest hint would be managers that don't have everything cached from the start
how will main branch deployments on -next be handled?
come again?
They're asking for alpha builds
how will we do them for -next
build branch? npm publish?
not anytime soon
if so, who can publish or will it be automated for canary?
see: rest module once someone reviews it and it gets merged
will be figured out when its in an actual alpha state
i've been told the reason why rest hasn't been merged is because it hasn't been texted in prod but the only way you can at the moment is by vendoring
clone, build, npm link
that and reviews
what is left to be implemented for v13?
the main features (replies and interactions) seem to be implemented already
Interactions are not implemented
interactions haven't been merged (although they are not a major change so it can release without and be a .1.0 thing). There are several semver major things that are still left (check pins in #djs-help-v14 ) Some things that aren't noted there: #5490 - Welcome screens, #5298 + #5296 - Reply options, and some other internal things that generally clean up the library
ah i see, still workin on it
best of luck contributors, thank you for all your hard work
wonder what's the API status on screening
I pinged yuugu a while ago and he didn't respond
also it would be nice to get monbrey's manager method prs in
#4872 in discordjs/discord.js by monbrey opened 6 months ago (changes requested)
feat(GuildMemberManager): extend API coverage
📥 npm i monbrey/discord.js#gmm-api-coverage
#4869 in discordjs/discord.js by monbrey opened 6 months ago (review required)
feat(MessageManager): extend API coverage
📥 npm i monbrey/discord.js#message-manager-additions
Yeah it'd be nice to get those in before 13, but they are, suprisingly, semver minor
yeah
a lot are simply internal things, and waiting on conflicts resolved / reviews
speaking of which, for https://github.com/discordjs/discord.js/pull/5161 I never got a response on if I should change it to just not emit presence / GMU if the only thing changed is the user object (still emitting userUpdate, basically the oposite of the current PR). I am aware that the PR will not get merged as is, trying to find a good solution.
wait why would it not emit presence/gmu
because oldMember and newMember are identical in those cases
as they used a referenced user object
and there's no way to just freeze the user object because you'll get multiple GMU / PU per user change depending on how many servers they share, so it is only successfully freezed on the first update recieved, the rest already reference an updated user object
The tag property on User is returning null for a partial user? I understand it can be partial but discord docs never mark the username/discriminator property as nullable?
not sure if this is possible or its just "hard" to do, is it possible to manage the shards through PM2 .
Like if the library could implement it to auto shard and tell the PM2 to spawn N of processes
what benefits would what have?
apart from having to write completely new way of having shards communicate between each other, which is supplied by the fact that main process spawns child_processes (or worker threads) which in turn allows communication directly in the processes, without any external abstraction
In version 13, would you be able to give us more control over the caching? Some of the more popular bots that use discord.js use a crazy amount of memory, and most of the cache is useless because the bot doesn't use it. Even if it was just an object that said okay I want channels, roles, guilds etc etc
Then you could also ignore events where the bot doesn't want the cache for it
I believe you can achieve that already (and will be more selective naturally in v13) via intents. If you don't need a message cache, don't add the messages intent. Speaking of which, that is something that needs to be heavily considered for v13. While many people will use the built-in INTENTS.NON_PRIVILEGED (IIRC that's what it is), granted not what should be done and most likely unneeded, it is totally possible, and recommend, to only specify the intents that you think your bot needs, only to find out djs breaks because it expected cache to be present and updated
Intents are one method of controlling caching as ckohen pointed out - if you never receive the events, your bot doesn't cache them. v13 is unlikely to change the caching structures and methods themselves though - this is something we're likely to explore more in the TypeScript rewrite
Hmm okay thanks, I will look into intents and see if I can sort that out. Don't wanna have to buy a bigger server because my bot is using 200gb 
(it's not actually)
You can also manually clear caches as needed
discord.js is built to expect things like guild/channels/roles to be in cache though
The main things you can clear are users, members, maybe emojis, and presences. Those you can clear with little worry (except having to fetch members when needed)
Ah alright thanks
you have to modify the sharding manager, it is not possible without it, as Souji mentioned you would have small Benefit. But when you are so fricky on the ram usage, then there other ways to sink it...
Ghost Ping 
I think that caching is important, the biggest base of users here are js learners and this could be problematic and confusing for them. As you bot gets bigger you have to make your own library or modify it (you won't come around), to cache just things you want......
I mean, the caching can be enabled by default and more experienced developers can just disable the caches they dont need
but when the developers are so experienced, they can make their own one 
It will just bloat up the libary, you have to change every class, packethandlers.......thats so much work
discord.js does currently not support swappable cache implementations or optional caches
this is a design goal to apply when we get around to rewrite the library.
that being said, you can always clear caches you do not need on an interval, as has been said above. not receiving data in the first place can also reduce cache size.
if you want to further discuss this on a level that's got nothing to do with discord.js development please use #archive-offtopic
This statement is absolutely not true at all. A library that has no cache is for bigger bots, because then you control it yourself. A library that has no cache is way harder to use for beginners or tiny bots that most people built. Statistically speaking most bots aren’t built to be huge
lol, I builted in the not, I meant, I think...., otherwise my statement would not make sense
Yeah now that makes sense lol
a native implementation of AbortController has been released in node.js 16
should this kind of thing be delayed until a future version of djs, since node 16 is so new?
and I guess also because swapping it out doesn't achieve anything of much significance aside from removing a dependency
could polyfill it I guess
i.e check if it exists globally otherwise use the package
wait i thought it was released on node.js 15
so it was
I missed the
Some of the recently released features in Node.js 15, which will also be available in Node.js 16, include
question is still relevant though
Since master targets node 14 and I don't think there are any plans to make it target 15, this would be waiting until whatever comes next
Seems like API v9 has been released to the clients (canary only for now). Since v13 isn't finalized yet, any thoughts on jumping directly to api v9 (obviously once documentation is present)?
the issue is at this rate, by the time all changes have been done to use v9, discord will release v10 and discord.js v13 will never come out
and theres no eta ( afaik ) for v9
v9 has almost no breaking changes afaik, so switching over shouldn't take too long
v9 isn't likely to have THAT many changes
let's start worrying about API versions when they're actually documented, thanks 
I assume you mean officially documented, right? Because there was a commit yesterday for v9 https://github.com/ajpalkovic/discord-api-docs/commit/837332720fc4efc5686fa4deb96eea126fe3708d
Right, that's what I mean by "officially"
We can start discussing implementations of threads once the features API is solidified and a PR on the original source repository discord/discord-api-docs, not some fork (which is already deleted)
A merge will of course require the implementation to be tested and the docs PR to be merged
Node.js v16 is out also 👀
that's also not relevant, because by far not LTS
v16 will be LTS
yes, at some point that might factor into library development. at the moment LTS is still 14.16.1
Node v16 is scheduled to become LTS near the end of October 2021. D.js v13 should hopefully be released way before that happens
i wondered how exactly a discord library like this on fetches "incoming" messages (like in this case with client.on("message", msg=>{...}))
Why would you need to fetch a message?
does it, like, fetch every latest message of each channel of a guild and compare it with the previous fetch
No, it’s an event received via the ws
ah makes more sense
woah, sorry to spark such a controversy, thanks for the opinions (Souji, of course, was looking on a grand scale, although so far it seems like going to v9 might not involve a major change for the library somehow, all speculation for now though so I'll shut up)
@ruby terrace interaction routes dont use the bot token anyway
WebhookClient is the easiest way to implement it afaik
otherwise youd have to copy all the methods
That's an error in the latest PR's that add editMessage and deleteMessage, they should be passing auth: false to the request anyways
what's the point of resolve and resolveID if they depend on cache
resolveID does not depend on cache, whereas resolve does as it is attempting to give you the cached instance
Hey. I was wondering if there is an official port of discord.js for deno. I found discordeno but I'm not sure if that is the official one
no, there isn't any
will v13 support slash cmds / interactions in general
Yep, they already said that
but then we can just use manager.cache.get()
so resolve is useless
no it isnt
get must be passed an ID, resolve generically supports being passed any resolvable and returning the right thing
eg GuildMemberManager#resolve works with GuildMembers, Users, IDs
oh
Hi, I'm talking about djs-next, what is tsyringe ?
?npm tsyringe
@clever crypt can you elaborate on https://github.com/discordjs/discord.js/pull/5448#discussion_r619358828 or is that resolved?
@vivid field resolved
Hey, do you know when stage channels will be supported by discord.js ?
with the next major release (v13)
if you want to test it you can install the master (development) branch:
instructions and caveats: <#djs-help-v14 message>
Why aren't the Discord embed types not sub stringed? Like this would make much more sense to substing the embed types not just trow an error saying that there are too many characters.
Why should the library be responsible for something at the fault of the user?
Its your responsibility to make sure the input is correct.
Thank you!
And, do you know if the parameter dynamic of ImageURLOptions will turned to true by default in V13?
no
There was a pr, or at least a discussion, about having it be true by default but it couldn't be done in stable because it's a breaking change
Yeah I understand, thank you
what was the reason behind this change?
Encourage the user to handle errors properly, actually checking the message still exists before they delete it etc.
You can change it to client.setTimeout(message.delete, 10000) no ?
No
why couldn't you 🤔
Many reasons that are outside the scope of this channel
If i wanted to do this issue, what git commit message would I give it like feat or chore?
feat
so
threads
docs are available and looks like lib devs will have access to test them before full release (which will be in at least 2 months)
Already working on adding them, might make a draft PR if someone doesn't beat me to it. I'm thinking to add threads into the channel cache since they are truly channels at heart, then have a #threads on text/news channels that is a ThreadManager. That way they can be accessed globally and in the guilds cache but still have references in their actual parent channels
Also, definitely need to wait until after that disclaimer about potential breaking changes is removed
Yeah we get updates from Discord Developers too. They're API v9 though which although is supposed to have basically no breaking changes, isn't what v13 has been written to so far
Could be an easy switch, but I don't know if we'd want to wait another 2 months on deploying the other features
So far (of course subject to change but hopefully not), I think switching to api v9 would be a non-breaking, non-major change for the library, its already using the PATCH method for suppress-embeds which is the only actually breaking change for v9.
But yeah I agree the release of v13 should not be delayed for it no matter what
Does a pr take 3 approvals to merge?
there isn't any specific number for that
@slate nacelle https://github.com/discordjs/discord.js/pull/5566#issuecomment-830243300 here, did you mean that first we should split by the first char in the array, and while there are any splitMessages left that are longer than the max length, split them with each other char until we achieve a length less than the max length?
When will package.lock be updated to lockfile version 2?
probably not soon
since it's not really backwards compatible, and v16 isn't LTS yet
Hey! When a client creates a shard, it emits messages to the debug event listener. One of them is IDENTIFY followed by the id of the shard over the total number of shards. However, this display method is confusing.
For example, let's say a shardManager creates 3 shards. The last IDENTIFY message sent is [WS => Shard 2] [IDENTIFY] Shard 2/3 which could mean that the 3rd shard wasn't created yet.
I think it should be changed to [WS => Shard {ID}] [IDENTIFY] Shard #{ID} ({ID+1}/{total}) where ID is the id of the created shard and total the total amount of shards to be created.
That's not happening, as shard IDs are 0-based
Think of shards like an array, the ID being the index, the count being the length
But 0/3 being the first and 2/3 being the last is really confusing and doesn't make any sense even if it's 0-based.
Could we? Yea! Should we? ehh..
The docs also show it as 0-based, and it'd stay consistent with that and how the identify payload works. We could add a (normalized ${shardID + 1}/${shardCount})
??? How so?
const arr = [0, 1, 2];
arr.length; // 3
arr[0]; // 0
arr[2]; // 2
arr[3]; // undefined
The id is a 0-based cardinal number, you're right ;
in (position/total), position is an ordinal number tho, which means by definition that it has to be between the minimum value of total and total (included).The minimum value of total cannot be 0 so position must be included in [1 ; total]. Showing (value1/value2) implies that the two values are comparable and thus have the same meaning. An ordinal and a cardinal do not have the same meaning at all... Anyway, this debug line is just a detail.
Hey guys I am making my own client and am here for some guidance (don't worry it's totally unrelated and not a discord.js competitor)
So the thing is, I am confused what to do.
My initial plan was to connect to the gateway and cache the session id. Whenever the bot connects after that, use Gateway Resume instead of making a new session.
But would this be a good idea? What does discord.js do?
this channel is for the development of discord.js, not to help develop other libraries for the discord bot API
Well then is there any other channel to ask such a question? Or is it banned D:
Making your own client is already not really ToS conform, so it will be kinda hard finding a good place to ask such a question
Why is it not TOS compliant? I'm contributing to open source and helping people.
If you mean your own library instead, the discord API server is always a place to ask in #resources
Why aren't the Discord embed types not sub stringed? Like this would make much more sense to substing the embed types not just trow an error saying that there are too many characters.
It's not the library's responsibility to check your input. It also makes it harder to maintain, if discord ever changes their limits
It's better in that way to let the API throw the error like it does
to add to that there are a ton of different limits that need to be enforced. for example the "all characters in embed values can not exceed 6k"
in which of the up to 25 field bodies to you substring? why? do you just delete fields if you don't have characters left?
how do you handle the description? does it have priority over fields?
the title seems important, so maybe always use that... but what if field titles are already taking up too much space with the description, do you just show field titles? or field titles and values until that's depleted?
do you prioritise the footer over fields? or not?
etc.
Is it even possible to add possibility for bot to manage that settings?
I saw some discussion on discord support about that
https://support.discord.com/hc/en-us/community/posts/360043320632-Allow-bots-to-access-explicit-content-filter-endpoint
if its possible, function for that would be useful
No it isn't
what is that supposed to be
you can listen to guildMemberAdd and filter bots? I don't think a whole new event is entirely necessary
That would already be very achievable by listening to the guildMemberAdd event and checking to see whether the user is a bot
^
plus I'm sure there's a way to make your own event. Come to think of it, I should do that
But I mean that as someone will invite __ bot with this event __ something happens
And not that as the bot is already on serwer
Oh
That's what sweat
so you want to know who added the bot? I'm not sure the API handles that, correct me if I'm wrong
You need to fetch audit logs
yeah
this is 2 years ago, something may have changed
If that were the case then I'm pretty sure they would've said something by now
Sorry for the late response but on node v14 (npm v7) it automatically generates package-lock with lockfile version 2
but v14 is LTS
but it prompts you to update when you run npm commands
and v7 is not in beta, it's the latest release
it's what gets installed when you run npm i npm -g
Prompts you because node 14 comes with not the latest npm 6
And yes, correct, it's latest release, but it's different major, and as expected, has breaking changes
Which in this case rule out backwards compatibility
does package-lock change backwards compatibility all that much?
This change only adds things it doesn't remove anything
and I believe if you use an older npm version it converts to version 1
it did when I was using it
it automatically changed the file and warned about the wrong version
Yeah ok. Still doesn't change the fact that lock file in such case would be constantly swinging around.
Npm 7 does not come with latest LTS, and we don't require node 16
is node 16 even a thing?
OH I thought the "Current" version was v15, was not aware of the update 
Both 16 and 15 are current rn, look at linked time table
V16 doesn't really add features anyway
It does add features, though their usefulness is questionable
It’s a new LTS regardless. It’s not about features but the long-term support it has for us in case there is bugs or whatever
Since they will be fixed in an LTS compared to v15 for example
Region changer for VCs?
like
message.member.voice.setRegion("EU") ?
VoiceChannel#setRTCRegion already exists
oh
there are multiple instances across the library where optional parameters are marked like this which does not work properly in the docs website (the name of the variable should be wrapped in []). Should I make a PR to fix all of these or is this somehow intentional?
You're confusing it with optional param, the ? here shows that it can be null
No, it's using node-fetch.
ooohhh I did not know that indeed, thanks for the info and sorry for the confusion :)
New slash commands for bots! Performing actions with bots is easier than ever. Bot developers—when they’re ready, please don’t scare them—can have a list of commands available for their bots accessible by the forwardslash key (/). You won’t have to remember bot commands anymore and get laughed at when you get the command wrong :( !help…..!help….please
Any idea when and if this going to be in Discordjs?
#5448 in discordjs/discord.js by vaporox opened 1 month ago (changes requested)
feat: interactions
📥 npm i vaporox/discord.js#feat-interactions
When will djs update to v9 for threads?
Like how long after it comes out?
Hopefully it won't be like slash commands, it's been like 6 months since it released and the pr still isn't merged
as always, when it's done
The initial announcement of the developer beta wasn't even 6 months ago, let alone actual release (which has still had more changes since). It also went through a complete rewrite via a second new PR
you're welcome to contribute to the PR btw
Why can't @everyone mentions be disabled by default? It would make much more sense to make a option to enable it
this isn't channel for suggestions for discord
Ill make sure it wont be merged in the next 6 months then
Bringing the discussion here so it can get answered quicker than on GitHub.
As of now, <BitField>.has(undefined) returns true which may be problematic if you've made a typo in your code (e.g.: <Permissions>.has(<Permissions>.FLAGS.MANAGE_SERVER)).
<BitField>.constructor.resolve returns defaultBit if typeof bit === undefined.
Now, how should the library behave if undefined or [..., undefined, ...] are given to BitField#has. My first idea was to throw an error, like we did for earlier versions with string flags, but this message from Monbrey > #djs-help-v14 message kinda confused me.
- Should
<BitField>.constructor.resolvethrow an error whentypeof bit === undefined? - Should we silently ignore undefined bit(s) and do not count them ? (
<BitField>.has(undefined) === false)
Where can I suggest?
I'd personally be all for an error given that undefined is not BitFieldResolvable and the arg is required
Well that's my opinion too, updated my PR let's see what it'll give
Hi. I've noticed more than once that my server IP become temporarily banned from discord due to exceeding ratelimits, specifically due to multiple webhook clients (which are dynamically generated by user configured webhooks). I would assume this is because of a global limit of 50/sec? Does the library not handle this?
don't think that lib tracks that
it probably should given that I'm using it's WebhookClient class
Unfort. its hard to track but global rate limits are handled
Each WebhookClient uses its own #api internally, which has separate ratelimit handling
but global limits should be taken into account IIRC
which means you'll hit between 1 and N 429s for global
but N tends to be fairly small...
we ran into fairly large 'N' on our prod bot and and a while later https://github.com/discordjs/discord.js/pull/4711 was pushed and finally merged after being dusty for ages
you def shouldnt be running into this frankly
cc @tacit crypt
You got... 429d... on your bot token, by using a webhook client...?
they got the 10k ip ban
Thats on a bot token tho?
no, its ip
it's an IP ban, yes
only 6 shards
And you use the same webhook on all 6 shards?
well 4711 was only merged to master, so djs 12 won't have that fix yet
oh, right
ah so it's not in stable, that explains it
might have to merge that specific branch into a fork of V12 because it's very inconvenient
sorry I missed this. No, it's based on user specified settings, so it has to be a new webhook client in each event (for a logging module)


