#archive-library-discussion
25085 messages · Page 16 of 26
we all know that, why do you think we referenced it?
semver major introduces breaking changes, that’s what it means to be semver major
My friend can make changes and add features, but I noticed in some versions that he changes the name of some of the functions. Why?
for consistency, managers were introduced in v12 to manage data structures more easily
The package has reached version 13 and has not reached consistency yet?
well, yes, if you read the update guide, permissionOverwrites were just moved to the manager
stuff is constantly changing, and we have to change to fit those
stuff can be overlooked and noticed and suggested, to try to keep improving the library further
and improving it majorly can’t come without a major change
I know my friend, but he doesn't have to make a big change every year
and they aren’t required to, but they do it to improve the library
are you referring to using or developing the lib?
if you're complaining about major versions having major changes
new major versions are the place to implement the major changes, which is what you mentioned here
Thats why those breaking changes are being deployed in major versions.
1.- No one is forced to update in the same minute as the version is deployed
2.- Djs gives plenty of time for you to update your code
I honestly dont get the issue, thats how semver works
There are very huge packages. Have you seen it every year that changes the name of the function in each version and changes the internal method of the function and the way it is used?
…because that’s what semver major is for? if you don’t want to have to update your code then don’t update to a major version
it also happens that we find an idea to have a more organized lib design only after a few major versions, like e.g. managers broke a lot of stuff but after implementing them the methods that belong together are actually grouped together
and these breaking changes all get collected first so that there's not a new major version with every change, e.g. v13 would've come later too if it wasn't for discord bumping their api version
I know what you mean, but what I mean, why does it get me to the point of not updating to the latest version, why doesn't it add features that I can use without modifying the 400 lines in one file, think what I mean my friend and you'll support me
Because that is what updating is.
You cannot expect everything to be static.
Things change, and you sometimes need to change what's already there for new changes.
if it adds features then why would you expect them to be usable without changing anything?
when you update to a major version, you're making a bargain, you accept new features or better practices in exchange for changed features or removed methods
Who told you that this is the update Do all the packages in the world make drastic changes and expect the user to change their idea in terms of specific points in one day and modify all projects to use a new feature?
Other packages get new major versions too, yeah
Yes.
As I said earlier no one expects you to update your code in 1 day
That is exactly what other packages do as well.
but here it needs to happen more frequently because discord.js depends on another api
You don't understand what I mean, why does it make a major release every year, why doesn't it just add features and fix bugs?
if you want an example for major drastic changes to other modules, just look at node-fetch, they dropped support for an entire module system with v3
Why don't you take a look at Mysql
😂😍
because we want to move forward with our library, not just stay in one place and fix bugs as they approach
we make major updates that fix major parts or add major things that will fix things in advance, like interaction support coming because the GUILD_MESSAGES intent is going to be restricted
they have 2 major versions because they don't have a lot of things to change
look at all the new things discord has brought or changed, we have to change to adapt to the conditions we work in
Ok I don't want to fix bugs but I want to make changes that are useless and he knows that major version of
node-fetch is 3 every year do they make a major change?"
This can stop
You aren't providing any constructive criticism, nor are you accepting the answers given
This channel is not for you to rant and whine about small inconveniences in rewriting code
Yes, its been discussed. Read the rest of what I said
I read it. I said my point, and this would improve the library if the developers of the library understood what I meant and what I said was constructive criticism not sarcastic
Maybe you mistake some of the breaking changes that happen during development with released versions?
If not, I can just repeat what crawl and I said here (reply and down)
We hear this all the time, you aren't saying anything new, nor are you accepting any of the responses as to why it was necessary for us to make major version increases
I appreciate your efforts, you and the work team, and I hope that the main release will be in two years from now, and that the changes are not in the way of writing the function or changes in the names, but that there are radical changes that deserve this. Thank you.❤️
v11 was release 5 years ago. v12 was 2 years ago. 13.0 was two months ago.
Quite large windows and well within the range you seem to be requesting from us
I appreciate your effort and the efforts of the staff and have a nice day and that you understand what I mean
The next major version (v14) will very likely re-structure some of the API in a breaking way to address problems we have found during development in the current version (be that actual bugs, unsupported use cases or "just" design decisions). That is, after all, what major versions are for.
The difference to other services (like the quoted node-fetch above) is, that this wraps another API we depend on (the Discord bot API). Meaning, while you can still use very old versions of node-fetch, you will eventually have to update discord.js, as Discord stops supporting older versions of their API. Discord also introduces new features only in new API versions, which forces the user to apply major version jumps and all the changes that come with it
Thank you for your simple explanation. Good day🤍👌
What a joke
hey, with Discord JS, it was always hard to write test with its internal structure and the need for the client. But now with all classes having private constructors, ist much harder. Whats the point of making this even more harder?
why exactly do you need the private constructors? They were never meant to be used anyway
the constructors for most structures were never meant to be used, you should be getting most stuff from cache or from fetching or from other structures
not for prod code sure but creating mocks for jest test. like here
https://github.com/Yes-Theory-Fam/yesbot-ts/blob/master/__tests__/mocks/message.ts
Why would you need to test a package that isn't yours?
we dont want to
we want to test our code
can't you just use the actual djs structures then
well then test your code, not discord.js's?
If you really need to create classes, you can use Reflect.construct but you're really really on your own (and it does not fall under this channel)
just a question, I was looking around and in the APIRouter.js file in rest folder and it has target in the parameters of the function but doesn't use it. Is this intentional or?
also in the deleted property in the Message class just defaults to false without any checks. Is this also intentional?
Yes this is intended for internal library calls from client.api
On the message delete event, this is set to true
If you were to remove the target parameter there, clients would never connect to the gateway :P
if a message is deleted before the client was ready, it will be false?
If a message is deleted then the client fetches it... well that won't happen, it can't fetch a deleted message. Also it's not a case whether or not you're using the event, the library handles the incoming event
well yeah because many people think that it will automatically tell if the message is deleted, and people get confused, I think a note should inform them that messages deleted before client will return false, even if it's deleted
that makes no sense
you won't even get a message if the client isn't connected
oh yea mb, i just realised that
on component collectors can we assume that the component interactions we get back are from a bot that's within a guild?
What about DM channels?
I guess since those methods can only be used from discord.js's structures, you can at least assume that it's not from a guild that the bot is not in (and cached in DM channels)
hi everyone 🙂 is it possible to mute my music bot for all users in a channel except one ? example --> I want to listen music, but the others users don't necessarily want to hear. can i make my bot play music only for me ?
#archive-offtopic this isn't a support channel
A fetchRules function to fetch the guild’s rules ? (Suggestion)
you mean the welcome screen? That exists
if you mean the rules channel, that exists as well
No, the rules that the member has to accept so as to access to the server
yeah the welcome screen, it exists
Documentation suggestion for @split elm:
Guild#fetchWelcomeScreen()
Fetches the welcome screen for this guild.
No, welcome screen = the screen that appears when you join a server
That's membership gating. There isn't anything for it other than a few properties and flags
There is no method to fetch that information from a guild
Rules = the menu that you have to accept if you want to write
Okay so I suggest this function ^^
Because I saw that we can look if the rules are activated, but we can’t look at these rules
That's correct. Discord removed that functionality: https://github.com/discord/discord-api-docs/pull/2547
Long story short, the current API design isn't great
So until they re-add it, nothing we can do
Too bad…
Thx 🙏 !
Why do some some properties in discord.js-modules use the javascript private properties (prefixed with #), while others are just marked as private in TypeScript? Imo it would make more sense to be consistent and use the hash prefix everywhere since the privacy of those fields is also actually enforced by Javascript itself
private in TS is both similar but different than #, one is not objectively worse or better than the other in any arbitrary scenario. This comment from one of the maintainers sums it up pretty well: https://github.com/microsoft/TypeScript/issues/31670#issuecomment-497370201
yeah theres benefits and disadvantages to both, it just feels kind of odd to me that the accessors arent consistent across the project
I think I remember seeing some discussion about narrowing the type of the value of a collection with the filter or find methods, did that ever go through or is that possible to do?
I'm asking this because I'm trying to find a channel in the channels cache and I'm sure it's a category channel, so I wanna narrow it's type down and there's no method for that. Could we created methods for checking each type of channel like we did for interactions?
or just the type property?
checking for the type property in a filter or find doesn't narrow the type down
I guess, but using the methods like the Interaction ones is more useful to me at least
How so
well it's easier to just return if the method returns false than it is to import the class and do an instanceof check
oh you mean as typeguards
yes
these
I'm not sure it's normal that Guild.available is sometimes undefined, it leads to an incorrect amount of unavailable guilds (i'll switch from !guild.available to guild.available === false to make sure I have to correct amount but just reporting)
#6769 in discordjs/discord.js by cycloptux opened <t:1633470939:R> (approved)
fix(Guild): guild.available is never set on new joins
📥 npm i cycloptux/discord.js#fix-guild-available-not-set
ohh thank you
Ok so make your own
If importing another one is such a big problem
Why can’t we implement them in the library?
Because it’s not the same as the one you linked above
How is it not?
The others aren’t just instanceof checks lol
Different channel types have different methods and properties, I don’t see how that’s any different from interactions
Yeah I know?
Yeah
There you go
So again, why can’t we implement them into the library
As I explained in the PR these type guards are better than instanceof guards because they make all applicable properties on the object the cached type. Instanceof doesn’t do that
The interaction checks just check for the type
I’m really not talking about those
If you don’t want to make your own
Make a pr
You’ll get your feedback on there if it’s something people want or not
That’s what I was asking, I thought you were against me even making a pr lol
I’m never. Just know that it could be denied that’s all
Yeah I’m fine with that
on second thought, I'd rather do that in a semver major because the current isVoice and isText check for text and voice based channels, and not the text and voice types, so that'd be confusing
unless it was split up and the other methods were added now and those renamed later
its semver-major later too
you can break either way
whether you do it now, or later
isText vs isTextBased would probably confuse some people but i could see that being useful.
could probably make it isStrictText, jest does that for some things
and then in semver major break it
but then, we might as well do isTextBased and isText
and just have an info block
ye that was my idea but that'd be semver major
I could do isStrictText for TextChannel checks tho
and if we were to add that we wouldn't need to break it later on
but then again it's a bit inconsistent and it feels weird to have isStage and isVoice which do different things (for example)
so to avoid confusion I think it's best to do this all in one go in a semver major change
Is this an error?
I copied this from another bot I had made which was running 13.1. 13.2 seems to have introduced this in the TypeScript typings.
What is ActivityType?
From discord-api-types I believe.
you need to cast the type because we changed it to not accept CUSTOM
so it can't be any string
I'm not using CUSTOM. In the screenshot, I am using Game.
yeah but you still have to cast the type because it's a property in an object and not a string
why don't you just write "PLAYING"? (I think that's what you want)
You can see that it worked in 13.1
yes I know
I'm telling you you need to explicitly say what the type of ActivityType.Game is
It's an enum? I am not sure what to say
I am not sure if I can actually cast it to a string.
So basically, we just do not accept from discord-api-types anymore? I found out that there is Constants.ActivityTypes.GAME
yeah that's probably better. It may be a bug though, since it should know the type of that enum
not sure if it's fixable though due to how enums work in ts
maybe @dawn merlin knows?
That does seem a little odd, I'd agree that as a developer even though that field excludes a particular property of the enum, you'd think TypeScript would still let you use the other properties from the base enum
it should, but TS is weird with number enums
so it doesn't know that ActivityType.Game is 0 but if you type 0 in it works
I have a similar issue with my option types, leading me to casting them.
type: ApplicationCommandOptionType.Subcommand as number
Isnt this exactly why we provide Constants?
Those are the real values and TS enums kinda dont exist in JS code
yeah how are those imported? 🤔
uhh, import { Constants } from "discord.js"?
The reason that this doesn't work is that TS doesn't let you use 'alternative' enums in place of the enum the that is expected. Basically just because one enum has the same values, doesn't imply it's strictly equivalent to another enum.
no I mean the enums
Mine?
like how do they translate to js
Looks like this in my dist.
Just the number (and a comment)
the fix for this is to have the object accept both the API enum or the djs enum
I don't really see a point in that tbh
i mean at that point might as well use the djs stuff
I mean I would
like if it's djs, use djs types
because if we were to do that for the entire lib it would be quite a lot of work for something that can be easily be fixed by using the djs package lol
yeah saw it in my code too. It's weird that it knows how to compile but still errors
I'm confused, doesn't this just need to be Constants.ApplicationCommandOptionType.Subcommand?
Using discord.js' enums works as normal.
well there's your solution
It's not a problem for me. Just thought it'd add to the convo.
wait can enums be used during runtime now? I remember a PR was merged to do that
yeah
They said you only need Constants now if you wanna do indexed enum access but accessing an enum directly now works (in runtime) without Constants
The values selected, if the component which was interacted with was a select menu
Isn't the last bit kinda redundant, since it's in theSelectMenuInteractionclass?
Also, I've been wondering why DJS calls _patch() at the end of some constructors - why does it do this, as opposed to assigning the values in the constructor?
_patch() is also called for updates to the structure
From events etc
When we dont want to construct new ones
Oh, so anything that could update, gets placed in the patch
yeah, which is why it also does checks on the existence of properties
Hi @vagrant holly! For your event removals, I think the typings need to be updated (old event names still in there)? :P
Did I not remove them? 
Oh huh I did not
All fixed 
@dawn merlin I think we overlooked the return type of interaction.options.getMember in https://github.com/discordjs/discord.js/pull/6668 because if inCachedGuild() returns true then getMember will always return GuildMember or null, right?
Oh for DM's?
nah, regular guilds
but if your bot is in the guild then the member options will be GuildMember objects and never API objects
yeah assuming, the guild member in that option is cached, it should be GuildMember | null, I'm kinda busy rn, but if I don't get to it today you can submit a PR
ill look into it and if it doesn't look too complicated I'll submit a PR
yeah I'm not quite sure how to do that so I think I'll leave that for someone else
You'd have to extend all the generic cached typings right down into the resolver
Can anyone still reproduce https://github.com/discordjs/discord.js/issues/6126? Strict mode needs to be disabled. It looks like pull request #6644 made this behaviour working delightfully again for me
I thought the issue in that ticket was that the person didn’t have strict mode enabled
Yep. With strict mode disabled, the else block from .inGuild() return the interaction as never. It doesn't do that for me anymore
Ah ok
So it seems this issue is now solved :P
Genuinely curious why that PR resolved it
I'm encountering a typing issue moving from v12 to v13, when I need to setup the default activity type using env var, I'm making a validator which reflect the type in use which is ExcludeEnum<typeof ActivityTypes, 'CUSTOM'>, but ExcludeEnum type is not exported then I had to duplicate it from my side. Can you consider exporting custom types too ?
ExcludeEnum is already exported, it's just not in a released version
so the next release will fix it 🥳
Ideally, yes (:
Pull request that made this happen: https://github.com/discordjs/discord.js/pull/6808
there's a fix aboutn const enums too ?
i don't understand why all enums are declared as const, but it's not really useful
currently due to export const enum ActivityTypes... we cannot use those enum to validate values and compare them against data from any type using Object.values like Object.values(ActivityTypes).includes(input). Maybe this choice is motivated, but currently I don't get the point
Use the constants export instead
But typescript enums are not javascript enums, so you can’t really use them in code like that
They’re exported as consts so that they can be replaced by their values in compiled code
Can you show a screenshot of the code that’s giving you this error? There’s an alternative to the ExcludeEnum type
when exporting a const enum TS don't generate the lookup table, so we cannot iterate on the values, I found the PR with the changes, but frankly I don't understand which errors are solved 😅
I'll check for the constants export
bot.user?.setActivity(env.BOT_DEFAULT_ACTIVITY_NAME, {type: env.BOT_DEFAULT_ACTIVITY_TYPE})
options are
export interface ActivityOptions {
name?: string;
url?: string;
type?: ExcludeEnum<typeof ActivityTypes, 'CUSTOM'>;
shardId?: number | readonly number[];
}
You can do as ActivityOptions[“type”] after the type and that fixes it
You aren’t supposed to use TS enums, you can use js enums exported from Constants
I see
then now it's fixed, i'll just wait for the next release to remove my ExcludeEnum copy
I wonder what would happen if the user enabled —preserveConstEnums?
I'd prefer avoid using flags, they can update/remove them easily 😅
Just like random strings then
Except that flags usually get updated to the new value, while a raw string doesn’t
So if anything using flags is a good thing
And that one surely won’t disappear anytime soon
It’s an integral compiler feature lol
^
Also tsconfig.json
anyway i'm using constants which are made for it
is that normal to not being able to compare Message.channel.type to Constants.ChannelTypes ?
the first contains the API keywords as value, the second is numeric, why DJS don't use the same values everywhere?
the ChannelTypes object is more of an ENUM (so we can go from number -> string and string -> number)
I don't see a mention about moving Guild.region info in the migrating doc, currently the value is not defined and I don't find it back 🤔
iirc regions are on voice channels now
maybe should i go to #archive-updating-to-v13 😅
oh ok, so each channel can have it's own region? that's pretty cool
anyway, v13 is awesome, seeing true typing is a real pleasure, I'm in love, tyvm for your awesome work ❤️
@wild flax you commented on https://github.com/discordjs/discord.js/pull/6278 saying you weren't sure about it. The upstream PR is now merged and they said that default_auto_archive_duration is only intented to be used by clients and not the API so do you agree with defaulting autoArchiveDuration to that or should it be closed?
why does d.js use const enum over enum?
afaik const enum only exists now for legacy support.
Scroll up just a bit, we talked about that earlier today
The thing is you can use enum as constants and manipulate them just like an object does, which const enum cannot.
tldr; const enums allow users to use djs enums during runtime, without stuff crashing
crashing?
yeah because you can't import regular enums without you getting an import exception during runtime
I could've sworn TypeScript enum can be used to manipulate as an object, unless I'm missing something?
I'm talking in terms of djs, keep in mind djs isn't transpiled from ts to js, it just offers typings, if you have a 100% ts project then it'll work like a charm
oh wait, so the typings do not overlap for d.js' js constants?
Which is why djs exports Constants which has all those enums. You’re not supposed to be using the enums from ts
The enums in the typings represent those constants but you should use the constants and not the enums
damn, that kinda sucks
that's why i see so many people confused about it.
yeah basically without const enums we were mapping enums to values that didn't actually exist, hence the changes
aha
Why lmao
that makes a lot more sense why
I mean unless you want reverse mapping you don't actually have to use Constants
Then my only question is why doesn't the typings just map over the Constants that are actually being exported to avoid confusion?
The enums are literally put in a separate file to avoid that confusion
They’re not meant to be imported
You should just be using Constants, it’s the exact same
bc there's no way to tell TS that it corresponds to another arbitrary enum that happens to be an object in JS
Then why does the enums exist if there not meant to be imported? Are they just private typings?
they're meant to be used in the type declarations
Let me take a look at src code rq
I really don’t understand why there’s so much confusion on this topic
If you don't use the already declared enum types, then your method parameter types (in the typings) would have to be number or string
thats relatively loose typing compared to using enums
In typings/index.d.ts couldn't you just use a namespace? e.g.```ts
export namespace Constants {
// objects
export interface Package {
name: string;
version: string;
description: string;
// ...
}
// enums
export enum ActivityTypes {
PLAYING = 0,
STREAMING = 1,
LISTENING = 2,
WATCHING = 3,
CUSTOM = 4,
COMPETING = 5
}
}```
honestly the might work, but as I said earlier most people are just going to not use Constants bc they don't need reverse mapping. But if that code above actually works during runtime I'd say that's a definite improvement.
I'd have to do some testing for sure, but I think that could definitely clean up that section of typings.
also small nit: namespaces are deprecated in favor of modules now
Yeah, but this is just typings, if it were a full TypeScript project I would totally go with that approach. This approach shouldn't make a difference afaik.
im pretty sure ts/eslint won't let you, but you can try
dang, well then I'll probably just leave it then, because tbh whoever wrote that section like that probably tried a namespace approach. I'd rather not go against elint rules.
why not just use module instead?
Could give me an example of what that looks like?
it's pretty much just like namespaces but you replace 'namespace' with 'module'
oh, hmm
I'll do some testing later then. If it works, I'll probably make a PR for that improvement.
tested this out bc I was curious, can confirm that it does work, and properly finds the enum values during runtime 🎊
that's awesome!
are you ok with me making the pr or do you want to?
nah, you came up with it you can make the PR
awesome, ty!
i'll make it tonight then.
For reference this is what the syntax should look like:
export declare module Constants {
enum ChannelTypes {
GUILD_TEXT = 0,
DM = 1,
GUILD_VOICE = 2,
...
}
...
}
ah, ok then, no need to export inside, that's nice.
@dawn merlin my only question about #6840 is how can you be sure that user is never null on partial guild members, specially on the guild member remove event?
in the ticket, @opaque vessel stated the ID is always present on all three of the events, so wouldn't it have to be non-null?
I'm not going to make the PR for that because most of the Constants contain property value types that are named the same as their key so I can't really do anything to avoid it except to put the type in their manually. It adds too many lines. The only way it would work properly is if we did more files so I could rename types exported from the file when importing them, but I'm not sure if that's something we'd want to do as there is a minimal amount of declaration files.
The daunting issue is that the .id seems to be typed as always there, but .user is possibly null. I have no idea why these typings are conflicting - that's why I made the issue. It's weirdness
oh so you were referring to the static types not the runtime types?
in that case my PR should probably be inversed
I'm also unsure when the .user is possibly null. No idea when that may be
so basically, it can be null, so therefore id should also be?
Maybe? Maybe not. I don't know
for what it's worth its documented to give a user object back
All I know is that the typings are wrong. The id cannot be always there yet the user be possibly null
Yeah I think the bug here is that id should be nullable
But more testing should be done on this cuz from what I understood, Jiralite’s issue was only covering types and not actual return values
yeah I misread it, I had assumed that was runtime types
But this is rather... weird? How the heck can we we receive a payload of a user/guild member without their id
I mean I am reading the docs wrong, it gives a user back on the events? It's referencing the full user schema as well: https://discord.com/developers/docs/topics/gateway#guild-member-remove-guild-member-remove-event-fields
Looks like it wasn't always null. It happened in a recent addition?
https://github.com/discordjs/discord.js/pull/6066/files#diff-4f45caa500ef03d94d3c2bfa556caa1642df95d4e2b980d76b876a8fd2e8c522L3831
Hmm ok, I'm going to assume that, that diff is a regression
I guess so
@oak quail I thought bots didn’t get command C/U/D events?
they dont anymore, correct
this updates cache when u use the c/u/d methods on command manager
Ahh ok
in #6838, why not override channel to be GuildTextBasedChannels too?
@tacit crypt what is the policy on empty interfaces that may or may not have properties added later in the typings. Should they just be type aliases or remain as empty interfaces?

I'd say keep them as interfaces
Ok
Good point
Could we maybe have an object in every message that includes all the text in between formatting tags (so all the italic text, all the bold text, all the spoilers, etc)? I just wouldn’t be sure what to call this but it would work similarly to mentions
why? that seems like a lot of additional memory, unless you want to make them getters which just throw a regex against the content and even then i can only think of edge use cases
well I have a very specific edge case so I'll explain that
there's a bug in discord that allows you to hide text in a message (mentions included) by spamming a lot of empty spoilers and then writing after them. I don't know what the exact amount is but I'd like to delete these messages automatically and that would help, but it's obviously possible without that
If it were to be a getter, do you suggest one getter for each type of formatting or one getter that returns an object with all?
i think that that's a good use case, but something very easily solved on your end and does not need a library solution
couldn't you just use (or make i guess) an external library to parse the Message#content
well yeah what I can do is simply check if the message has an empty spoiler and delete it, but I thought this feature could possibly help others
it's a super specific and super narrow use case to support in the base library
wouldn't require an external library, a simple solution to my problem specifically could just be a simple .includes() function, this is just an idea I had from that case
fair, thanks for the feedback 
sorry should have been more specific, i meant the original question (of parsing the entire content for markdown)
ah I see
well still, that could just be done with a series of regexes
Could something like this be useful?
I don’t think djs does command handling
Is there a reason that toJSON on structures don't return the discord api types, but instead return the djs object with camelcased keys?
The toJSON() methods existing on the structures only return a JSON-serializable (JSON spec complaint) object of the original object so it can be consistent and spec complaint, for example it converts bigint literals to strings as the JSON spec does not have a way to serialize them, and to not get users confused when they store the object as a JSON, so the properties and method names would be consistent, but only for now; the return values of the methods might be changed later
this doesn't explain why, but it suggests changing the methods to return the discord api types objects
https://github.com/discordjs/discord.js/issues/6567
It's a proposal for v14 at this point
idk if it's just me, but I can get @Typescript/eslint to successfully parse and report linting errors on .d.ts files 👀
Yeah those errors do exist and there’s actually a tslint ignore comment on the typings file, but did you change anything?
i dont see one
It is there tho
what line?
also, tslint and eslint are different so that would be a // eslint-ignore line
tslint ignore on line 1036 in master
Is there anything in discord-api-types that holds all the rtcRegion ids?
Yeah I set up/installed the typescript eslint plugin
I was under the assumption that eslint didn’t parse declaration files, that’s why tslint was still used
we use dtslint tho and yeah I thought so too, but if you managed to get it working with dtslint uninstalled that would be amazing because microsoft themselves say thats not meant to be used
dtslint uses tslint, which has been deprecated for a while. so yeah, switching to eslint would be great
Good luck replicating the dtslint rules
No, mainly because it's not documented on Discord's side
Well its an endpoint and it rarely changes, so maybe it could be added? I was gonna add this to djs anyway in a pr, but could use dapi if it had those
One thing I’m not sure about is if we should put deprecated regions in there because my guild still has it’s region set to central-europe but this doesn’t appear in the endpoint
If theres no publicly known list, we don't put it
it is publicly known if it's in the endpoint
and it's reliable enough that we can put it in the docs and types and update it when/if it does update
Not really
That list could be dynamically updated
if there's people noticing new flags before they're even released im sure someone would notice those too
that's not exactly what "dynamic" meant here
If its not on the docs, I don't see why it would be documented
What is that argument here?
Flags and new errors get documented
that while they're not documented, someone would notice they changed and could update them
and kyra seemed to like the idea too
And why would you randomly or consistently, 1x a week, call an endpoint and check?
lol
We implement the API based on the docs not the information returned from the api via endpoints
why not? I mean saying that we can pass any string to that is not exactly true so having some sort of suggestion would be nice
can you document content of last message in a channel?
Because if something is not documented, its not meant to be
At the very least you should think about documenting it at Discord's API documentation before here
Guess I’ll try that then
Anyone know the answer to this? 😅
is there any circumstances where the message is sent in a guild but the guild happens to not be cached?
Not if you don't mess with the client cache
which is unsupported
Ok ty
I believe if you don’t have the message intent, you don’t receive message events at all
if you don't have GUILDS you won't recieve messages from that guild either
even with GUILD_MESSAGES
so the only thing should be messing with cache
Does anyone know why we export the api types as RawX?
Wouldn’t the name from dapi types be just fine
It might be because Dapi types aren’t a dep on djs, and the only way to expose them would be to reexport them? But I’m not sure
Yup
Most of the api types need to be unions because they come from as many as 6 different places in the API, so for conformity
But there are a LOT of Raw types that are literally just an API type renamed, I’m talking about those
It is a dep tho
- I don't think its "a lot" by any sense
- As I already said, consistency
- Ease of maintaining it, it's a lot easier to add to / adjust a union in one place than all over the place.
- As far as I'm aware, vsc doesn't even ever surface the "raw" types, instead displaying the underlying type / union
I get that unions need to be there but I don’t get why some types are literally just renamed. And yes I’m not using these on my project, just talking about development really because I’ve used the raw API types before and had no idea these existed like this 🤔
Its not all raw API types, its specifically the types that are used as data when constructing a structure
@ruby terrace just a question: is there really no other way to do this?
like having 2 properties documented that do the same
if anything that should be mentioned on builders jsdocs right?
also you missed the types on your PR
Typings are not yet updated due to a potential issue with choices and min / max that I will be noting upstream
ah aight
I could do an info block at the top:
In addition to the listed properties, when used as a parameter, API style
snake_caseproperties can be used for compatibility with generators like@discordjs/builders. Note that providing a value for thecamelCasecounterpart for anysnake_caseproperty will discard the providedsnake_caseproperty.
yes please 
I debated that originally, decided to do it that way
(comment that on the pr, I'm interested in opinions)
Aight, will do
https://github.com/discordjs/discord.js/blob/579569ae18d5a2dbcb39ad5e5adfe486315467ea/src/managers/RoleManager.js#L140
What's the meaning of restricting this to the current guild this is being called in?
*Technically it resolves ReactionEmoji and GuildEmoji no matter where it came from before it attempts to look into the cache, so the warning block here isn't accurate.
Anyway, it will work without being restricted to the guild as the URL is uploaded, so there's no need for restrictions here, so...
I suggested using client emojis but they said the cache is too big and would be a useless performance hit for bots in lots of guilds
and also the client only shows you emojis from that guild when applying a role icon
I assume it wouldn't be accepted now if it wasn't accepted when I suggested that on the main PR
lemme find the discussion
none of the maintainers replied tho so idk
Okay, well, the warning is a lil' inaccurate - only the id needs to belong to the guild, other resolvables don't need to be
EmojiResolvable does need to belong to the guild, that is correct
Not sure what u wanna change here
The description says the "same guild"
Which is correct
I said this already :P but no, because resolver methods return if it meets an instance, which means you can pass in an emoji from another guild
what are you looking to change I still don't get it
the warning is completely accurate in my eyes
only the id needs to belong to the guild, other resolvables don't need to be
This. Not every type that is part ofEmojiResolvableneeds to belong to the guild, only string
ah I see what you mean
eh I guess it could be changed but doesn't make that big of a difference
A provided
Snowflakemust belong to the same guild as the role.
This is a better description of how it's handled internally
Could we start adding deprecation messages to the types?
They exist for the deprecated client events already
eg. https://github.com/discordjs/discord.js/blob/579569ae18d5a2dbcb39ad5e5adfe486315467ea/typings/index.d.ts#L3511-L3512 https://github.com/discordjs/discord.js/blob/579569ae18d5a2dbcb39ad5e5adfe486315467ea/typings/index.d.ts#L3545-L3546 https://github.com/discordjs/discord.js/blob/579569ae18d5a2dbcb39ad5e5adfe486315467ea/typings/index.d.ts#L3565-L3568
Canvas is not compatible with v13?
If is, please see #djs-help-v14 if you have specific questions about the lib. You can also search in the channels, someone just asked about canvas on node 16
well yeah only those ones do (and I'm not sure if they display correctly), but wouldn't it be better for all deprecation tags to have messages associated with them?
Sure, if there's an associated jsdoc deprecation notice that has a message, I guess it makes sense to also have it in the typings deprecation flag
ideally we'd have all jsdoc comments in the typings file so they show up in the editor. but that's way too much work
get an IDE that actually reads the source and so knows about the jsdoc comments, as well as the typings
The one I just did has one too. Managed to make it a cute lil' link
the link doesnt work tho does it
It does, doesn't it for you?
oh my god it works
i had no idea
ok will pr to add it to all the other deprecation tags
only one I will not add is MessageEmbed#type since idrk what to say and the docs don't have a description for that either
wait most deprecation tags have descriptions and there's only 8 
well nvm i guess
Wait should we be deprecating types that we remove in favor of other types?
Bc I have not been doing that 😅
what exactly do you mean
he's deprecating that because it will be removed in a semver major update
breaking type changes usually aren't classed as semver major, only if the actual code changes in a breaking way
Yeah ik, but I didn’t know if we needed to offer deprecation notices for breaking type changes, while they’re not semver major, they can still break ts projects
they can break but in a way that should've already been broken before
imo if its an easy fix you shouldn't mind if, otherwise maybe consider a deprecation warning
@dawn merlin if you’re gonna open a new pr to move the types you can probably just repurpose that one right?
Just gotta undo the changes in the non ts files
no I'm gonna do it in 6867
it's small enough to tack on
Wait which one is that
#6867 in discordjs/discord.js by suneettipirneni opened <t:1634750646:R> (review required)
typings: cache types cleanup
📥 npm i suneettipirneni/discord.js#typings/cache-type-cleanup
Ah gotcha
Could we get some type narrowing for interaction#member so we don't have to do this?
yup it already exists, interaction.inCachedGuild()
also ironic you and daro have very similar pfp's
oh lol, whoops
Is DJS 13 compatible with ES2020 ? I need BigInt support for my bot but when I'm setting up the project I'm always encountering this issue from DJS files:
ERROR : C:\Wumpus\discordjs-bot\node_modules\discord.js\typings\tests.ts:1
import {
^^^^^^
SyntaxError: Cannot use import statement outside a module
When I'm creating a whole new project without deps it works well, once DJS is added to the project this error appears. IDK if opening an issue for it is relevant, 'cause I don't know if it's really related to DJS source code, or Jest which currently seem encountering some issues with Node 16 🤔
Yes, it is fully compatible with ES2020.
Djs is es2020 compatible if you want assistance please use a help channel
@dawn merlin in fact I'm mainly asking about a potential issue related to a dep you're using for your tests, to see if it can be relevant to point it out in a new issue or not
I am using ES2021 with discord.js v13.
But I am not using ts-node.
We aren’t using any deps for our ts tests other than well, typescript
ok, so moving to node16 lead my setup to this error, pretty weird, then i'll continue to dig into
@tacit crypt do you wanna steal #205 in dapi-types from me, I feel like it would be faster, because I don’t know where some of the types would go
Whats #205 again?
Autocomplete types
Ig anyone familiar with the types can take it over
I mean the PR looks fine, you just have to fix your compile errors
and the inconsistency between AutoComplete and Autocomplete
Hey, plz add a function to "reset" a select menu (that is to say, the select menu returns to the form it had before selection)
instead of having to edit the message to reset the select menu
That seems like a feature request for Discord, not djs
iirc if you don't touch a message's components when editing a message it won't change the select menu if thats what u mean
no, I'm just asking for a function that would actually remove the selection from the menu
that's just resetting the default property on the option
that is to say ?
Editing the message is the correct way to do it though. Are you proposing a method like Message#resetComponents() that would just do a no-change edit for you?
Most of the time you want it to be part of an interaction response though
Exactly ! It’s for a « role menu » for example
So it would really be more of a SelectMenuInteraction#reset() method, which would behave like an update with no changes
Yes 👍
can bots send and receive messages between eachother in DMs?
no
saved me a lot of effort thank you lol
What’s the purpose of having bots dm each other lol
lmao it’s a very interesting reason
there’s a website that has stats for this game called DayZ, and there’s a discord bot connected to it and a command will display your stats, i wanted to have my bot send the command and display the response on a webpage
the dude that runs the site doesn’t wanna take the time to add a “daily stats” function so i’m doing it myself lmao 😭
he put a lot of work into it tho i’m not complaining. just a qol i want
We do not filter any members out.
You might not have had all those members cached at point in time of kicking.
member.roles.add(["901232121149018112"]) // This is an invalid role id
On v12 this code gives an TypeError [INVALID_TYPE]: Supplied roles is not an Array or Collection of Roles or Snowflakes. error
however on v13 it doesnt throw any errors ?
On version 12, an actual role is attempted to be resolved. On version 13, the id is only extracted. So, this is expected behaviour. It's a bit strange you would pass an invalid id in the first instance
its an invalid id because the role was deleted
I'd expect this to error on Discord's end however.
Are you guys aware of any bugs with creating channels with positions? I'm currently trying to create multiple category channels and sometimes the rawPosition and position properties are different and, on Discord's side, there are 2 or more categories with the same position until one of them is manually moved through the client
I only remember Discord ignoring the position if it's 0.
weird because that's not the case, I have two rawPosition 4 and no rawPosition 5 then a category at rawPosition 6 sometimes
and this is weird because on the client they don't even show up in those positions (the duplicated ones)
rawPositions can be duplicated, since category channels even more
but should they be duplicated among categories? I know they are different from categories to regular channels and voice channels but im exclusively working with raw positions here
If Discord wants it to be that way, then sure I guess.
If they are equal, compare the ids instead.
So do I have to make subsequent calls to update the positions after I create the channels? That sounds like a Discord bug imo
One, since you can bulk-update positions, can't you? Might be a bug though, since the client doesn't allow you to create a channel on a specific position it might have gone unnoticed.
Positions as a whole are a headache
you can through the API but there is no method to do that on the manager 🤔
there is channel.setPosition tho
It's one the guild still.
https://discord.js.org/#/docs/main/stable/class/Guild?scrollTo=setChannelPositions
oooohhh I thought it would make sense for that to be on the manager
will have a look, thanks
I too think so, probably an oversight, since those are very niche methods.
For it to be in guild#channels#setPositions would be better, in my opinion.
could be something for v14, not worth the effort atm to duplicate the method
you wouldn't duplicate, move the core logic in the manager and keep/deprecate the guild method with making it call the manager one
That is a status. These things:
(except the "custom status", that's also an activity)
You are looking for this: https://discord.js.org/#/docs/main/stable/typedef/ActivityType
will do then
Since Discord sends the timestamp of when a rate limit will expire in the x-ratelimit-reset header, could we use that to provide a date object in the RateLimitData object received in the event?
hey it seems like there's a problem with creating stickers.
it looks like it defaults to treating it as a jpg file, which makes discord throw an Invalid Asset error.
shouldn't passing stream or buffer data without the file name for context be disallowed to avoid this issue?
#19 in discordjs/docgen by xHyroM opened <t:1634930049:R> (review required)
fix(Tsukabi): remove
📥 npm i xHyroM/docgen#master
Why though lol
why is readfileSync being promisified if readFile exists 
Gonna work on making docgen accept TS types at some point, I think typescript-eslint/estree-parser would come in handy here
What would be really awesome would be to move all jsdocs to the typings and have docgen read that instead so that we can get jsdoc comments in the IDE
I think the ts rewrite will be a better time for that
hey, not discord.js but, does anyone know a npm package that can fetch a whole channel and send it as an html transcript? all of the packages i found are able to fetch 100 messages only, but i know this is possible cuz ive seen it done on ticketing bots.
what you see on ticketing bots is either some sort of data storage in a database or keeping all messages in cache, discord does not allow you to fetch that many messages
oh, the ticket tool bot has transcripts that contain all of the messages in a channel tho
This channel is for developing discord.js, not asking about downloading a channel
yeah you should've stopped at the "not discord.js"
oh, ooh my bad, sorry thought it was for external discord.js libraries 😭
Slash commands add limit must be increase
nothing is a "must", and since we are not discord, this is not in our control.
If you were at the DDevs Q&A you’d know that they are looking into ways to improve this and possibly increasing the limit, but this is definitely not a topic for this channel nor this server
Thank you for responding. I apologize for misusing the channel.
Is there a possibility for the library to support SlashCommandBuilder objects for command creation (guild and global)?
Currently, it is not possible to create a slash command with the builders (discordjs library) because of the incompatibility of the types.
This was fixed in 13.2 I believe
I didn't see it in the patch note, I have to check it then
Hummmm, this is not fixed...
"discord.js": "^13.2.0",
"@discordjs/builders": "^0.7.0"
can you provide the error message it's giving you?
Maybe we should move in #archive-builders if this is a development problem on my side :/
Don’t you just need a non-null assertion?
Go ahead and create an issue ticket for this, and I'll take a look later
it's saying that ApplicationCommandType.Chat input isn't assignable to ApplicationCommandType.Chat | undefined, it looks like an enum mismatch maybe?
You're just encountering a version mismatch between -types in d.js and /builders
Ho yes, discordjs use 0.23.1 and builders use 0.24.0. But the result is that the two modules are incompatible and it's a pity especially since they are made by the same organization 😂 I will create an issue in few minutes
Solution: bump on djs
idk why no one bumped it yet
usually crawl does on release but if someone prs they can have that on the dev versions
If you’re comfortable you can just make a PR, just gotta edit the package.json version and ur set 😄
and lock file
Tru run npm i before pushing 😅
speaking of lock file, why doesnt that have the "name" property on the first object? I always get that when running npm i for some reason
a recent pr added that I think
yeah, #6809
oh really
ah i see it now
didn't even notice that but finally lol
(you're supposed to run npm ci anyway)
when there's no node_modules yeah I do that, otherwise npm i which is the recommended
Using the built-in module would just be importing readFile
Commits are done in bulk so I don’t think so but it should definitely be improved on because commits were happening much more often when this was first added
Stuff might be a lot different with readFile tho since you gotta pass a callback to that
done
can't you just use fs/promises
that already has a promisified version
so require('fs/promises') ?
i guess?
i haven't been following what you're trying to do
How long is the ETA for Autocomplete to land in D.js?
Wdym? d.js already has typings
Autocomplete, in the sense of what was said/shown in #announcements
That's waiting on https://github.com/discord/discord-api-docs/pull/3849

https://discord.js.org/#/docs/main/stable/class/GuildMember?scrollTo=send the example shows how to send a message to a channel, not a member
The documentation is the same for all the send methods related to a TextBasedChannel
It's actually just one. The one from GuildMember inherits the documentation from TextBasedChannel#send
It's just a short-hand for sending to their DM-channel. It still sends a message to a channel, but I can see it being somewhat weird.
Same thing applies to guild#setRolePositions
@vernal adder did you see #6875?
#6875 in discordjs/discord.js by ImRodry opened <t:1635031757:R> (approved)
refactor: move Guild setPositions methods to managers
📥 npm i ImRodry/discord.js#refactor-managers-setpositions
Not yet, will look soon
Looks good! 👍
Noice
Hey @wild flax https://github.com/discordjs/collection/pull/46 has been lying there for quite some time and it didn't get any attention from maintainers so could you take a look at it please? Sorry for the ping 
Thats actually just an error in tsubaki
I flipped the important parts:
"exports": {
"import": "./dist/index.js",
"require": "./dist/index.mjs"
},
👴
Yes, but then I actually said why is Tsukabi there, so I made a fork, and I made a PR.
Because the docgen runs at node 8+
and it was written when it was running like... 6+?
and tsubaki automatically falls back to using promisify anyway if you are on 8+
Oh and the other reason this happens is because the CI uses npm i and not npm ci
so it automatically installs higher patch versions lol
its fixed though
no need for me to re-release the docgen this way
I think I found a bug with the library. When the client is first added to a server after being logged in, Guild#available is undefined, when it should instead be true. This behaviour did not exist in v12.x
It's also documented to be a boolean, not boolean|undefined
Fixed in 13.3
https://github.com/discordjs/discord.js/pull/6769
not yet released though
Ah
This caused me several hours of pain, wish I knew that 
can we make a PR about a new discord feature if the dapi docs pr isn't up yet?
there's a thing that started rolling out but no one bothered to PR and i dont really like doing PRs to the docs but I'd be comfortable with the djs pr
well yeah i know that
setPremiumProgressBarEnabled is a really mouthful name for a method
It's also a big property, so I don't see an issue with it
doesn't a boolean indicate a state already?
setPremiumProgressBar should be ok here for the method no?
Removing the enabled can mean many things - set it to a number, to a goal, to something
I agree that we should stick for properties with the API naming
but since we wrap things, I don't see why we would need to keep the explicit naming for methods
Well yes, but for that documentation exists too
I mean this to me sounds like we can change the progress bar to something custom, not toggle its enabled state
hmm
true but ideally you should know from the method name what you expect to change
I guess its whatever
But for v14 id def like to get rid of some of that ugly naming we have for those things
And change it to..what
just remove utility functions like these no, someone will kill me for daring to bring that idea up
not in this specific case, but we could also go with togglePremiumProgressBar()
if you supply a bool, its getting sent, if not, it flips the current state
Hmm..we could, sure
im ok with leaving it like this for now
but we have a lot of those ops, where we could name them toggle and flip states
Definitely something for v14, although i know people will rage due to it 🙄
I wanna build a good wrapper though and not be a people pleaser :P
I want a mix of both 
Although if it was after me I wouldn't even add these shortcuts because it's just extra code that adds little benefit other than a shortcut
I think its important and makes code more idiomatic
instead of always calling edit() with a different partial object
GuildEditBuilder
I suppose that's true, anywho
Thing is you’d have to keep set methods for things that don’t take booleans so wouldn’t that look inconsistent then?
not really no
those helpers aren't really meant to represent the edit values 1:1
but rather have them being used as a more idiomatic way
So what else would you name them?
.
Well, it was useful back then, but now it's useless to support such old versions of nodejs, after all even djs switched from v12 support to v16.
Now Tsukabi is completely useless in docgen, because docgen requires a minimum version of nodejs 8.
but I'm talking about methods that don't take boolean values, those would still have to be setX right?
Can’t you use the js “set” modifier for those?
You can’t have a property and a method with the same name, even if it’s a set
Because then it would be
this.nsfwLevel
set nsfwLevel
For example
well if we're talking in the context of v14, which may or may not have es2022 support, this is possible with private fields:
class A {
#prop;
set prop(value) {
this.#prop = value;
}
get prop() {
return this.#prop;
}
}
why would we make everything getters? And still, can we have a get and a set with the same name?
yes you can have getters and setters of the same name
This is how the design works, if you want "truly" private props, you can't expose them publicly, they have to be behind a getter. Any other solution still allows anyone to “arbitrarily” edit the value, even though they shouldn't
hmmm would have to be discussed then, I'd rather see a PR with that later on so that I can judge better
and of course, would also like to see what the maintainers say
Sounds unnecessary to make every private prop a getter/setter.
Don't see the point of that.
Not every value needs to be private. Ones that can be edited without side effects, don’t need to be. However I was pointing out if we want truly private storage get/set is the only way to go about doing that, otherwise you can’t access it. Otherwise you just have props on an object that can be edited without using the proper setters. I’m just throwing in my 2 cents, we’ve been doing pseudo-private props so it’s up to the maintainers if they want to continue that or use another method of private storage.
IMO it's the end-user's fault if they mess with private properties. If they're marked as private you should not mess with them. If you do, that's your fault.
Problem with true privates is that they're incredibly inefficient, both CPU and memory wise
Since it relies on WeakMap
that is a good point
Was looking at the code of GuildMember#manageable and this seems wrong: if the logged in user is the user in question and is the owner, why should this be false?
I don't think it made much sense to declare the owner being above the owner, looking at the description of the getter.
from what I can see the third if should be moved to the top right?
No, that'd make GuildMember#kickable return true for the owner if the bot is the owner. You still can't kick yourself however.
(Same for GuildMember#bannable)
maybe the issue is those getters depending on this one then, because as-is, this will return false when checking for the bot's guild member in a guild they own
This behavior sounds about right, when looking at the description.
technically yes but the point of using this "for moderative actions" is to know if you can run certain methods on the member in cause, which you can if the member is the clientuser's member object
What else is there, aside from the two above, which would break here?
wdym?
The certain methods you mentioned.
oh no they wouldn't break, I'm just saying that if you have, for example, a function that relies on member.manageable to be ran and the value turns out to be inaccurate it won't complete
It's accurate however.
say for example member.setNickname
A bot cannot act on its own users - it can't kick itself, it can't ban itself, it can only add roles to itself that are lower than its highest role
and the setNickname has a different endpoint for the bot user vs normal members
technically space we were tied
Setting your own nickname is, in the api, something else than setting another member's nickname.
too slow again
well but the method is the same on djs isn't it
well yeah it is
talking about the method, not the endpoint
Makes a difference how
setNickname calls edit
edit calls the function Drango just linked
yeah exactly
Pretty much everything calls edit 
but say you have a generic function to edit any member's nickname, and that relies on member.manageable (so you don't have to catch every time), that will not run when the member in question is the client user, but it should
But it would make every other check inaccurate or outright wrong
And even then, manageable doesn't even get into the permissions side of things
oh yeah I know I'd also have to check for MANAGE_NICKNAMES here, but both checks would need to be ran
is there a better way to do what I'm doing without using manageable?
Except its not MANAGE_NICKNAMES for own member
yeah ik
Then what are you trying to get at??
Manageable is strictly role hierarchy wise
I mean we can guesstimate that if user.id === client.user.id, its manageable, but it's not 100% accurate
hmm I guess this breaks more than what it fixes so it's better to leave it as-is ig
will do my own checks for the client user
I mean.. cogwheels are spinning... wouldn't moving the client.user.id === guild.ownerId above then checking the user.id === client.user.id and returning true... that sounds like it'd make sense but either way we're still not 100% accurate
You might have a point, hold on I need to check things now
It wouldn't, since first check is if user.id == guild.ownerId, which will make manageable return false
Neverminddd this 
wait i didn't see this, so what's the veredict?
It's correct the way it is rn
aight 
Could anyone tell me why the MessageComponentCollectorOptions type in index.d.ts omits the message option from InteractionCollectorOptions? Passing a message option to createMessageComponentCollector is extremely useful, I have been doing so for a while as I find it far more elegant that using the filter option to filter interactions that came from a specific message.
It is possible in JavaScript so I am confused as to why it is being omitted from the type for typescript.
These are the relevant lines from index.d.ts:
uhhh, createMessageComponentCollector is a method you call on a Message instance (or TextChannel). It binds to the Message/Channel you're calling it on, not the one you pass in
If you want to construct a generic MessageComponentCollector you should be able to with those options though, so it does seem odd that it would exclude them.
@dawn merlin is this one of your typings?
doesn't seem to be his, at least not after the rewrite
Oh I see why
Yeah, MessageComponentCollector isnt a class. Either you're constructing a generic InteractionCollector in which case those options exist and are entirely valid in InteractionCollectorOptions, or you're using <Message|TextChannel>#createMessageComponentCollector in which case it binds to the instance on which it's called, not the passed options
I don’t know if passing a message option in js is actually doing anything. iirc There’s no equivalent js typedef so it uses the base interactioncollector. For reasons monbrey stated the type was made stricter for typescript
GuildStickerManager#create should throw a error saying You didn't provide any tags or something like that when you didn't provide any tags
It is definitely doing something, I tried removing it and I got different results, it tried to collect interactions from buttons on other messages and threw an error. However, the solution you guys have brought to my attention is just to call createMessageComponentCollector on the message instead of calling it on message.channel and passing in a message parameter.
what exactly is your mission here?
Thank you
Seems some files import @discordjs/collection without respect to the import/order rule from ESLint, which isn't being picked up from npm test. Example of this is at src/structures/interfaces/Collector.js on line 4:
what does it say currently?
nope, thats an issue in your IDE, it is correct
it throws a error
which error lol
saying cant read property name of undefined
ah
then yeah sure
will look into doing that
to elaborate on this: VSCode and more specifically eslint comes with a bundled node version that is set to node 14 by default and thus your IDE sees a "node:X" import as a regular package and not a built-in module. If you update the node path to use your node installation this will be fixed. Also you wouldn't even be able to commit that because eslint --fix reverts the change
@wild flax I saw that you bumped collection to use node 16, but why not 16.6? The PR that adds #at needs 16.6 to apply the suggestion given by vlad
Well if doesn’t allow you to use it on a channel that’s also a type bug
Because that’s just formality. 16 installs 16.6
Like lol
Nothings released yet
but you specified 16.0.0 and not >=16
Again that doesn’t matter
You needed the CI bump
aight if you say so
ill rebase the PR now
I'm experiencing an issue ~~caused by https://github.com/discordjs/discord.js/pull/6084~~. This pull request allowed APIMessage to be passed to the interaction collector so it could be used via webhooks.
When you create an interaction collector on a message that's within a thread and delete the parent channel, the collector still has bound events (it continues collecting), but the thread no longer exists. If you do not pass a time, this is indefinite.
The interaction collector only caches the ids and allows raw messages to be put in. Since an APIMessage can be passed, I don't see a way to link it to the thread's parent channel. Before this pull request, this is easily doable.
Anyone got an idea of how to detect that if a channel is deleted to stop the interaction collector on the message within a thread? Right now, it's the same issue as https://github.com/discordjs/discord.js/issues/6895 and can cause possible event leaks
well APIMessage still has a channel_id so couldn't you check for that?
I don't think so. That would be the thread's id, and this implementation allows bots that aren't in the guild to use this collector so it wouldn't be in their cache
ah good point
not sure then, that might be hard
Actually it's just outright unfixable because both the message and channel parameters are optional lol. Looking further, it seems it's not caused by https://github.com/discordjs/discord.js/pull/6084.
A fix can be made for the reaction collector and the message collector, but I don't think the interaction collector can be fixed
Maybe @ruby terrace knows?
I don't do collectors, sorry
who does? I forgot
I don’t think that’s too high priority
Maybe just open an issue so it’s on the radar, detailing that
Alrighty (:
We could think about an info block
Detailing that long running collectors with that type of structure is a bad idea because of the implications it brings
And that one should set a timer
Ya, that sounds ideal for now
Does this seem alright?
no need for the ! but sure
[...] or manual cancellation
what about the idle option?
That works too, so I've amended it to this:
Interaction collectors that do not specify
timeoridlemay be prone to always running. Ensure your interaction collectors end via either of these options or manual cancellation.
hey @dawn merlin , iirc you wrote most of the <"cached"> stuff right?
Yeah
Could you take a look after the most recent commit
into the test.ts file with all the assertions
im not sure if typescript in my editor is tripping
or if the types or tests don't properly grip
gives me like
Argument of type 'MessageComponentInteraction<CacheType> | MessageComponentInteraction<"cached"> | SelectMenuInteraction<"cached"> | ButtonInteraction<...>' is not assignable to parameter of type 'ButtonInteraction<"cached">'.
Type 'MessageComponentInteraction<CacheType>' is not assignable to type 'ButtonInteraction<"cached">'.
Types of property 'componentType' are incompatible.
Type '"BUTTON" | "SELECT_MENU"' is not assignable to type '"BUTTON"'.
Type '"SELECT_MENU"' is not assignable to type '"BUTTON"'.ts(2345)
since I extended and made the rules more strict in the tsconfig.json
in help of maybe catching some issues
if its some hackery we do, we can just // @ts-ignore them with a comment too I guess
thats really strange, I just tsc'd and it compiles fine on my end, what version does tsc --version say?
We don’t use tsc on the test file
Only on the index one to see if it even compiles
So only the editor shows those errors
Or you tsc the test file specifically
My editor uses ts 4.5 though
The repo uses 4.4
Yeah I ran tsc manually on the test file, and my editor doesn't show any errors, I'm on 4.4 so maybe try switching to 4.4?
huh ok you are right
4.5 seems to introduce some big breaking changes 
lets hope its not gonna end up that way
actually maybe not
after switching back to 4.5 they are gone
oh well

#justTSthings
I just switched 4.5 and I'm getting the same errors, I have a feeling this has something to do with it
I feel like we did rename it though 🤔
what's strange is it's not on just the cache types, it's affecting a bunch of other types as well
going to chalk this up to beta bugs: https://github.com/microsoft/TypeScript/issues/46506
@wild flax sorry for another ping but was rebasing a pr and noticed you removed .vscode from gitignore. Is this intentional?
its pr #6666 btw, in which i modified it to exclude every file from .vscode except for the extensions.json file
is this going to be addded?
thats the context menu?
Yes
oh
i see
Do we support an endpoint for fetching the invite background?
aka the splash url
no, and theres no specific endpoint for fetching it
Ah, right
It’s odd that the name doesn’t include invite
¯_(ツ)_/¯
It's called splash on Discord's documentation too
the guild feature for it is called INVITE_SPLASH, but the property itself doesnt mention invite at all
Best leave it, and you can document that it's the invite splash if you really want to
it has been like that for years, don't think it matters that much
Would be nice
Then we're all good!
It’d be nice to have a shortcut for getting the client’s role on RoleManager
maybe call it clientRole?
I don’t think perm shortcuts are really being considered anymore in the main djs lib, but I might be wrong
yeah we dont like it as much
try to keep it low on those
not even a huge friend of like the whole TS checks
but they are absolutely necessary sadly
I see, fair enough
The type guards?
yeee
I wish we didn't have to do them 
Yeah this is what happens when instanceof can’t be used with interfaces or types
that already exists as guild.me?.roles.botRole and guild.roles.botRoleFor(client.user)
Could you guys enable reviews on the #858855149643497493 webhook? It currently only posts comments not approvals/changes requested/comments
Should guild#vanityURLCode and guild#vanityURLUses be moved or otherwise have a presence in guild#invites?
Maybe as a guild#invites#vanityInvite?
invites#vanityCode?
wait, hasn't this been discussed before lol
I don't know
Didn't check
how do i shard my bot?
I don't see why we'd move it off of the guild object
not sure if this is a good example but probably for the same reason why there's member.roles.color instead of member.colorRole
That's our property/getter tho
While vanity data is on the guild object itself
Idk
Then something like that might be an option
Just found it odd that there is no "easy" way to get the vanity invite url
Because its discord.gg/guild.vanityURLCode
Yes, but we have role#toString()
even thought it's just <@&id>
I think there should be a getter for the invite, but 🤷♂️
An InviteGuild doesn't have an GuildInviteManager, so the property is exposed on the class itself. Only proper Guilds do. If we were to move it to the manager, the same problem will exist on other classes unless you're wanting to make an invite manager on the InviteGuild & AnonymousGuild, right?
If a getter were to be added it wouldn't affect InviteGuild and AnonymousGuild
But I see the point, yes
#42 in discordjs/builders by Khasms created <t:1632414577:R>
feat(SlashCommandBuilder): add autocomplete
📥 npm i Khasms/builders#feat/autocomplete
Why was this closed?
Because the author said they couldn’t figure out the types, and said it would be better if someone else tried to implement it
What's the most common reason for prs to be ignored? There are quite a few atm and some are quite interesting
but prs are being reviewed daily and then there's some that are 20 days old that haven't gotten an update since
most likely because they are very low in the priority list
we usually don't look at PRs if they arent on a milestone thats soon to be released
Well they were on the 13.3 milestone
Talking about https://github.com/discordjs/discord.js/pull/6782 btw
You moved this to 13.4 just now, I was just wondering why
Because in the timeframe we wanted to release 13.3 there was no resolution
And this PR comes with a huge perf hit
I understand, but the initial concerns were replied to and then nothing else was said, I believe a solution could’ve been worked out or a decision could’ve been made (since the only alternative to that PR without the performance hit would be semver major)
IMO it was pretty clear that the perf hit is pretty much a no-go
so yeah
Hihi, I'm unsure if https://github.com/discordjs/discord.js/issues/6905 actually has a pull request per its tags :thinking:
does not, is mislabeled
Thank you for correcting it (':
Well then if no one can come up with an alternative it should be closed? Tbh I’d rather if it wasn’t but if it’s the only option then it’s better than leaving it hanging
the perf and memory hit is not acceptable honestly
for such a niche fix
like
the fix would be for <20% of people probably
but affect 100% of people
Thing is the current behavior is not following discord’s behavior, and it has been said in this channel that it is not ideal
So instead of removing userupdate events completely (or almost completely) it would be better to have them both work
I understand that the performance hit is not acceptable, but if feedback was given maybe other solutions could be found
I honestly think over overestimate the ability for us to give feedback
certain things cant be magically fixed with some sort of solution honestly
Yeah I know you don’t have the answers for everything, but I thought someone might do
Either way saying nothing at all doesn’t seem right, specially for a “first” time contributor
If theres nothing to say, im unsure what to elaborate on
Close maybe? Idk I think it can’t stay open forever right
But if its closed it should be explained to the author maybe
Apparently the collection repo says the latest release was 0.2.4 even though there's a 0.3.2 tag, could someone update this? (maybe even release a new version for the new method)
Any reason why the return type of MessageEmbed#toJSON is set to unknown? Pretty sure this could be safely set to APIEmbed right?
I think it's because nearly all others type toJSON() the same. It should be fine
other toJSON methods don't have interfaces but this one does, so it should be used imo
unknown types are annoying to work with
and the docs even document it that way
It might have been set before dapi-types were integrated into djs
I don't think so, it was just done to all because the other toJSON methods can't have the API types
so we'd have to be making tons of interfaces
unless there is a way to make an interface out of a class in TS
Interfaces can extend declared classes
we'd still have to declare them all though, I'm talking about like a type or something that turns a class into an interface
wrong
iirc
because it has our camelCased properties in footer/author
it doesn't, I tested
didn't test with all fields, but the ones I did did have snake_case
will test with all actually
From an embed you made or you got from the api?
from an embed in a message that I called toJSON on
Ah
We made toJSON act like the old _apITransform
apparently yeah
then yes that type could be corrected
oh wait there is an issue
some props are snake cased some are camelCased

toJSON returns api data
nope, not for image for example
then that should be fixed
wait
it doesn't even matter
proxyURL cannot be set by the end user
and the API ignores it
so is it fine to keep it like this?
I mean others like author have their icon_url typed in snake_case so guess thats fine
I think you can safely type it as APIEmbed, tho it will mean that proxy_url won't be set
if it doesn't get set by us nor the API I guess it's fine right
the API sets it derp, but it ignores it if we provide it
which is what I said
aight then that's fine as it is
@tacit crypt is this what you're suggesting in the builders PR?
public setAutocomplete(autocomplete: false): Omit<this, 'setAutocomplete'>;
public setAutocomplete(autocomplete: boolean): Omit<this, 'addChoice' | 'addChoices' | 'setAutocomplete'>
.....no
Stop Omitting anything if autocomplete is false
and definitely don't omit setAutocomplete for a general boolean set
So have the overload return this? and remove the setAutocomplete omission from the general boolean method?
The overload should return the original class
without omissions
ohh ok, now I see my misunderstanding, this is mutated whenever an Omit is returned, it's not static
hmm, the only workaround I can think of for this would be to do something similar to SharedSlashCommandOptions<ShouldOmitSubcommandFunctions = true>, and add a SharedSlashCommandOptions<ShouldOmitSubcommandFunctions = true, ShouldOmitChoiceFunctions = false>
that won't help at all
the omit is done already
Just return the original class
or just don't omit it if this makes it so complex
but how do you return the original class without a polymorphic this? If you change an overload to return the original class without using this it's an error:
do you mean return this & { addChoices(), addChoice() }
you shouldn't add it there..
In the setAutocomplete base class
this & Pick<CommandOptionBaseWithAutoCompleteOrWhateverItIsCalled, 'addChoice' | 'addChoices'>
Ok, so this?
public setAutocomplete(autocomplete: false): this & Pick<ApplicationCommandOptionWithChoicesBase, 'addChoice' | 'addChoices'>;
public setAutocomplete(autocomplete: boolean): Omit<this, 'addChoice' | 'addChoices'> { ... }
yes
Probably, test it
make sure everything builds and works
got it to work with conditional types:
public setAutocomplete<A extends boolean>(
autocomplete: A,
): If<
A,
Omit<this, 'addChoice' | 'addChoices'>,
this & Pick<ApplicationCommandOptionWithChoicesBase<T>, 'addChoice' | 'addChoices'>
>;
public setAutocomplete(autocomplete: boolean): Omit<this, 'addChoice' | 'addChoices'> { ... }
That's..why
That's overkill
Makes the second overload useless
Because if you use just the top overload, you have to cast the return to any ie return this as any
this is a TS type limitation, ref: https://github.com/microsoft/TypeScript/issues/33912
This doesn't work because I get this error:
The call would have succeeded against this implementation, but implementation signatures of overloads are not externally visible.
Even though everything is exported
couldnt I just do ```ts
public setAutocomplete<T extends boolean>(
autocomplete: T,
): T extends true ? Omit<this, 'addChoice' | 'addChoices'> : this { ... }
You can but the issue is that you have to cast the return type as any
Return this as any
its not making me
I can use it fine without casting
hmm you're right, I could've sworn it didn't let me before
can anyone test running npx tsc typings/tests.ts --noEmit
not sure if its TS thats being unreasonable here (again)
uh....this seems weird
I'm erroring out, but the strange thing is that #6913 doesn't?
different file
Does the tsconfig somehow not include tests.ts?
oh I see
yeah I found it by accident
uh, why is skipLibCheck enabled again?
I wanna say that there is a misconfiguration somewhere, because the typings work when djs is used in another project, and within tests.ts my intellisense is accurate
it was never disabled
🤔
yeah but I dunno if I wanna trust the editor over the cli
The editor doesn't show errors because those files aren't being included properly it seems
also eslint errors
have to add them to an eslintignore file too
ts will still error over eslint, but yeah, we'd need the typescript parser for eslint to not error
skipLibCheck is false by default and wasn't in the tsconfig until 2 days ago
ok I included the typings dir and the editor now shows the corresponding errors, these are legitimate errors
although this was previously enabled
I see it in the git blame for 2 years :thinking:
it keeps changing
for context why that's a problem: #archive-offtopic message
That reaction from space feels appropriate
feel free to disable it again