#archive-library-discussion
25085 messages · Page 15 of 26
ah alright, should probably link to that then right?
I suppose there's no harm :shrugs:
we can't choose UNKNOWN for channelTypes can we 🤔
no, the library uses it when a new channel type is introduced and it doesn't have support for it, iirc.
I believe that's a rather new addition (uh, relatively speaking. probs about ~12.x) when people realized that "oh shit, stage (or was it the game thingy channels?) channels cause big bad crash"
UNKNOWN was here before stage channels but yeah, ill make a PR to remove that type
Are DM channels in there? O_o
unknown should be any new channel type that may be introduced but isn't yet supported, it should be the default, if the payload type does not match any known type. unsure why you'd want to remove that
I'm getting this strange error where TypeScript won't compile when I'm using a channel type within a subcommand?
<Client>.application!.commands.create({
name: "test",
description: "test",
options: [
{
type: Constants.ApplicationCommandOptionTypes.SUB_COMMAND,
name: "test",
description: "test",
options: [
{
type: Constants.ApplicationCommandOptionTypes.CHANNEL, // Error here
name: "channel",
description: "A channel.",
required: true
}
]
}
],
defaultPermission: false
});
Type 'ApplicationCommandOptionTypes.CHANNEL' is not assignable to type 'CommandOptionChoiceResolvableType | CommandOptionNonChoiceResolvableType'.
node_modules/discord.js/typings/index.d.ts:3123:3
3123 type: CommandOptionNonChoiceResolvableType;
~~~~
The expected type comes from property 'type' which is declared here on type 'ApplicationCommandNonOptionsData | ApplicationCommandChoicesData'
Seems like a bug, this isn't malformed slash command data: https://github.com/discordjs/discord.js/issues/6702
Passing that as an option is passing a type 0 (?) to the API which doesn’t exist and will error out
Good point, will add
I few weeks ago we talked about an ExcludeEnum type but I forgot to do that, we really need that type cuz these excludes are getting big
actually @opaque vessel I have a question
the DM and GROUP_DM types are accepted by the API and throw no errors, however they result in an unusable option since there are no channels to pick from, should they still be excluded?
UNKNOWN does actually send an error so that one should definitely be removed, not sure about those two tho
Ehhhhhhhhhhhh I dunno, the user is most definitely making a mistaking by allowing those types since they're not usable in the first place
Strictly speaking, if the API accepts it, I guess it should also be included...
Might have to defer to others on that :eyes:
should I ping anyone in specific or..?
Shrug
Hopefully a knight in shining armour will appear and impart their wisdom upon us

we usually do
If you used it in a DM, does the DM type work?
nope, no channel shows up
Weird. Well, removing those from the typings is an opinionated decision from the lib, which we don't do very much since discord could change that at any time
yeah but I don't see why discord would allow you to set dm channel types, that seems more like an api bug to me
you can't see a dm channel on the client so you cant have it in the dropdown
and neither can you have group dm cuz bots cant join those
I don’t know if the maintainers have any sorting settings on the pr list but the oldest pr (guild member avatars) is no longer a draft so it can finally be reviewed xd
I have it open already.

On a different topic, I'd like to discuss something
Since the properties accentColor and banner on a User need to be force fetched to appear, could we remove the else in this condition (and in banner too) so that these properties are not set so as to not lead the person into thinking the user doesn't have an accentColor/banner?
Basically the null from "we didn't get this property" isn't the same as the null from "this user doesn't have this property set" so I think they should be different in some way, and not setting the property would be the way to go imo, but since the library usually doesn't do this I'd like to get feedback first
This also applies for User#bannerURL as that should probably return undefined (or maybe even throw an error ?) when the property is missing, and null when no banner is set
Probably something about "changing the shape of objects is bad" applies here, but I'm not too versed with this problematic.
Maybe we could go with undefined for "this property is unknown until fetched" cases. (No idea if this is a good idea though)
I wouldn't say an explicit undefined though, just removing that else since that should only really apply when we dont get that data aka when getting it from a member
actually maybe on the user update event but still, it wouldn't change anything I don't think
I see what you mean by "changing the shape of objects is bad" but isn't having a property set to undefined worse? I'm not sure which one you prefer here but I'd personally go with not setting
How would not changing the shape be worse if that's the goal?
because it would mean explicitly setting a property to undefined I guess
just my opinion though, I'd go with whatever you and the other maintainers prefer
like changing it to this.accentColor ??= undefined doesn't seem like something discord.js would do
Yeah, we generally go for null.
yeah exactly
so which alternative should we go for
is this behavior intentional? shouldn't it be TextChannel?
Fine for me
That's odd, here's my entire snippet:
const channel = interaction.options.getChannel("channel", true);
if (channel.type !== "GUILD_TEXT") return interaction.reply({content: "You need to use a Text Channel!", ephemeral: true});
Not sure this belongs here, but I'm was pretty sure those strings didnt typeguard unless someone has changed that
Can reproduce in the interactionCreate event. Bit weird
That only works if you have a union (like TextChannel | DMChannel) because there every channel type is present once, if you have GuildChannel instead there's no guarantee that maybe multiple extended classes have that type
Not really a fan of that naming convention, it feels very backwards to read. Plus, although yes they're all channels what they really represent are Guild configuration settings, not the management of channels
Well how about keeping the property with the id of those channels in the guild object and the getter with the channel object in the manager?
....why
That makes even less sense imo
And still ignores the first part of what I said, it's a backwards naming convention
There's no reason at all for those getters to exist on the manager because they are not managing any data
Happy for people to disagree but I'm really not seeing any reason for this one
i think it's kinda inconsistent with the everyone and premiumSubscriptorRole properties being on the RoleManager, but tbf they aren't settings
that kinda is the "backwards naming" that you mentioned though, and i think premiumSubscriptorRole having the Role at the end is kinda redundant? but that's kinda another topic
Hmm, yeah that's a fair comparison
Yeah I agree the role at the end is a bit redundant so either we change that for v14 or, if we were to move those getters to the managers, we’d keep the names they already have.
The reason why I suggested moving only the getters is because the setting (only the id) belongs to the guild and can be set on the guild itself whereas the full channel is taken from cache which is managed by the manager, just like the premiumSubscriberRole and everyone. Of course those two are different as they cannot be changed but I still think the same logic should apply
@solemn oyster you approved the PR, any comments on this?
hey can i request some feedback for my PR please? the reason it's draft is because i'm awaiting feedback from the core team for the last touches
#6647 in discordjs/discord.js by noftaly created <t:1631726793:R> (review required)
types: improve audit logs' typings
📥 npm i noftaly/discord.js#feat/audit-logs-typings
the best way to get feedback is to not have it as draft
draft prs usually get ignored as long as they're drafts
yeah i figured as much, i'll mark it as ready for review then
short question, for further changes to my PR do you prefer single commits or amend+forcepush?
Single commits so that we can actually see what changed, unless it’s a rebase or fixing an issue that was accidentally committed
kk thank you
but duplicating the commit message?
/ the commit message subject
doesn't have to, the commits will get squashed before merging
perfect, thanks
You should give it a unique message
It doesn’t really matter honestly
Since we do squash in this repo
But somewhat descriptive would be nice
docs
docs(Message): corrected description of property for example
fix is code fixes for bugs
Its not a new library feature
And docs is not a scope
fix is bug fixes (to code), feat is new library features, docs for anything documentation related
shouldnt there be docs for Guild.createWebhook() ?
I don't think there is a relevant endpoint for that.
yeah there just isn't, webhooks are channel-specific
Anyone know when uses here turns out to be null? https://discord.js.org/#/docs/main/main/typedef/Vanity
> Guild with vanity URL, uses is a number (0 included)
> Guild with vanity URL but not set, uses is 0
> Guild without vanity URL, uses is 0
Can't seem to find out when this is null, I fear behaviour may have changed when this was done or I'm missing something?
might be there for sanity? since Guild#vanityURLUses gives null if it hasn't been fetched
Yeah that’s it ^^
If a property can be null when partial it’s marked as nullable on the docs
Guild#vanityURLUses does not return Vanity, it returns a number
Yeah but its null before you run Guild#fetchVanity right
Yes
I don't see how it would be null because of that. We could just remove that property as it's never there initially and is not updated when the vanity URL is even used
Talking about the type definition though, rather than that property
yeah i agree, both vanityURLCode and vanityURLUses could just be a single property, as the fetchVanityData we already have
Right now just focused on when the uses property is null, don't think it ever can be, is bugging me in the typings lol
but it can I don't understand the issue
you don't get that info on startup, so you have to manually fetch it
before fetching its null
I don't see anything wrong with that?
I'm not talking about the property at all
Pretend it doesn't exist
oh wait
The vanity-url endpoint is documented (by discord.js) that the uses can be null, but it doesn't look like it can be null
well I don't have guilds with the feature enabled so I can't test, but if you do and what you're saying is true then you can probably change
I do and yeah the results were as posted initially
I do too, and the results were as you posted initially. doesn't seem like it can be null
seems like the uses property isn't even documented at all on Discord's side so it makes it hard to check
https://discord.com/developers/docs/resources/invite#invite-metadata-object-invite-metadata-structure it's documented here as non-nullable
oooh right I forgot the invite object has that weird documentation style
I'd say you can go ahead and make the pr then @opaque vessel
If we change a method to throw an error where it wouldn't before, is this considered semver major?
yes
Is it possible to send a warning without throwing an error?
Technically yes probably, but thats generally goes against library practices. What is this for?
Or at least, there isnt much precedent for it other than deprecation warnings
A few days ago I brought up the fact that the accentColor and banner properties in the User object were misleading since they need to be force-fetched to appear and currently they are set to null before being fetched, however they can actually be null after being fetched
My idea was to make them undefined before fetching them and to make User#bannerURL throw an error saying the banner hasn’t been fetched when trying to run it
dont we typically use null for unknown properties
Is that PR even merged yet. I dont see those properties on the docs
(although a distinction would be useful here)
It is on main
Yes but we need a way to tell them apart here
Its not breaking if it hasnt been released to stable
So not semver major
Oh amazing
was merged over a month ago

Yeah I've been out of the loop with development for a while outside of discussion in this channel
is a release waiting on something btw
feels weird that its been sitting in main for so long
Icons prob?
They’re out now
No idea
I dont think its anything specific, most likely just maintainer fatigue after releasing v13 and getting bug fixes into 13.1
Im not even a maintainer and I know I switched off a bit once it was out
Yeah I noticed crawl hasn’t been nearly as active recently
And it was much more fun to contribute prior to the v13 release xd
Either way I’ll make the PR about accentColor and banner tomorrow
Just not sure yet if I should explicitly set them to undefined or if I should just not set them at all, guess I’ll pick one and see what the feedback is
I lean towards explicit undefined
Alright, thanks
Theres never a case where its not a property of a user object, just cases where we dont have the value yet
Thats my rationale anyway
Yeah true, space also seemed to agree from the discussion here the other day
If you were to do that, I'd go with explicitly because of exact-optional-property-types in TypeScript.
Anyways, is it really okay to set them to undefined? If I were making use of these, I would always force-fetch them, as if the user changes these, the client does not update the properties (payload is not sent to us) so the instance you fetch them, they become potentially outdated
thats also a good point
Maybe we should be abandoning the concept of them as properties entirely and go with a User#fetchBannerData() route?
Imo, I think that'd be wise. The same goes for others like Guild#vanityURLUses for example, where the property is only set after fetching the vanity and never updated when someone uses the vanity invite (another case of being potentially an out-of-date number right after being fetched). Should just be left as methods
Yeah, if we cant reliably maintain the validity of cache I don't see why we'd cache it at all
well anything in cache can be outdated
In a general sense sure, but the event driven nature of discord.js keeps the cache up to date
I don’t think so because unlike vanity data, there is no specific route for the banner info and it would be hard to have the bannerURL method if we don’t cache the banner. I think that if we set them to undefined at first and users realize that it must be fetched to be present they will try to keep it up to date, or will at least be okay with the fact that it may be outdated at any point and they’ll have to fetch again. Also wouldn’t the userUpdate event fire when these props change?
Not based on the discussion here, if I'm reading it right
The gateway event documentation isn’t very explicit but I guess it would ?
I’ll try to do some more debugging later today but the properties don’t seem to be updating on their own :/
Gateway user update isn't useful at all
you need a privileged intent to get real user updates
also, I think the fact that changing color doesn't fire an update could be considered a bug, though super minor (clients probably don't display correct color background in the vc window after a change)
That’s only from the guild member update event, but the user update event should fire when a user prop changes so I guess that could be a bug
no, the gateway user update event does not fire for anything but the currently logged in user
discord.js hijacks the GMU / PU events to get user updates
Oohhh I see
still think we should not do that 
same souji, same 
Yep,same
Pretty sure I've been saying that for a while now
Why do we even need the accentcolor property?, 99% of the users will not use it and adding it in the cache, is one property more.... . The fetchBannerUrl() is a better Option.
it's sent, it exists, API coverage is reason enough
You dont get to declare what 99% of users will or wont do
Besides, banners are nitro restricted. Everyone else will have a color, so your "99%" statement isn't even close to correct
What's stopping us from changing how we modify the user update event for version 14? I also don't think we should do that
Nothing ig, just someone making a PR
But I wouldn’t invest much in v14 atm since those prs aren’t being merged rn
also, I think the fact that changing color doesn't fire an update could be considered a bug
In the event it isn't a bug, I thought of removing those properties and replacing them with a.fetchBanner()method which returns an object of the removed properties via force-fetching the user. You could passImageURLOptionsto change how the URL is received. This might be weird but I also think it's weird why we store such properties when they're potentially outdated the moment we use it
Waiting for Discord to give us a proper user update
I really don’t agree with this because you would be fetching the user not the banner. There’s nothing wrong with storing them, as long as you tell people it won’t update automatically
the Guild#owner property was removed in favour of Guild#fetchOwner() too ¯_(ツ)_/¯
because that was a getter that relied on cache and become less reliable with intents
People really hated it when I tried to do it
@solemn oyster this isn't really semver major https://github.com/discordjs/discord.js/pull/6721
It is
banner and accentColor haven't been released on stable, so if that is merged before the next release it can still be on v13
It is
You don't know how many people, me included, does === null or !== null
By adding undefined as a possible value, you're breaking a lot of code
well on the dev release, not stable
dev releases are unstable and can change at any time, thats the whole point
yes, and how exactly does that matter for the semver tag?
that's for releases, in general
because if the feature hasn't been released to stable, it can take breaking changes and still be on the next minor release
if something breaks the API compared to current stable that is a semver major, by definition
Wouldn't be the first change they'll hate
That is not how semver works Rodry. If the change is labeled as semver major it means the next release will be a major one - 14 in this case
yeah I know and that's what I'm saying doesn't make sense
why does this have to wait until v14 to be changed if it has never been released to the general "public"?
If those properties existed before its definitely major
If they were added in your PR it's minor
If those properties existed before its definitely major
If they were added in your PR it's minor
It's simple as that
I think we all get what you meant now, hold on
What he's trying to say is that the features he is making changes to only exist in the main branch. It is not shipped to stable
that's the thing, they don't exist on stable and neither were they added in my PR
holding on 
Yeah the light bulbs just lit up in our brain waves, please hold on for landing
lmao
That seems like exactly what we're doing here too though. A getter/function, which relies on cache, and is less reliable based on intents (GUILD_MEMBERS would be required if it includes the data at all)
but no intents help you get this info, all you need is a force-fetch
and I think it becomes a bit harder than the fetchOwner method, since you have hexAccentColor and bannerURL
Which is what fetchOwner does
Which is what fetchOwner does
but that has its own endpoint
there is no endpoint for fetching the banner
and why are my messages not sending
but that has its own endpoint
there is no endpoint for fetching the banner
wow
Discord API issues
Discord API issues
Discord API issues
yep
To clarify this:
As how I work mostly (all the time actually) with semver, I don't treat it as a "semver compard to current release" when I apply those labels. I use those labels more as a "compared to the current source code", regardless of release.
So yes, it is a breaking change, compared to the current code, but also a semver minor in the actual changelog of a release (but thats not how we use the labels, we don't use labels to indicate what a PR means to a release, we use milestones and projects for that).
The Guild#owner getter relied on cache to find the guild owner and worked somewhat fine since all users had all intents in v12 (mostly), but became unreliable so it was replaced by fetchOwner that has its own endpoint and the method returns exactly what you get from Discord (while creating a GuildMember class obviously, I hope you get the point)
if we were to implement a fetchBanner method, not only would that be a fake shortcut for fetch() but it would also require the addition of a new class - UserBannerData (or something similar) to hold 2 properties, a getter and a method, which doesn't make sense imho
I think we should be good by just doing this initial approach for when the properties haven't been fetched at all, then store them and warn users that the properties will not be updated automatically, which I have done in my PR
This is how I see it, but please let me know if you think any of these points don't make sense
That method doesn't have its own endpoint, it just fetches the owner's id in the guild
It's a shortcut for guild.members.fetch(guild.ownerId)
However we spin this it seems a little weird I guess lol
My main concern is just caching properties that won't get updated, warnings or otherwise
I'd be open to keeping it as it is with a warning stating it won't be updated tbh
but it fetches a member and that has its endpoint, this doesn't
damn i just cant seem to send any messages
damn i just cant seem to send any messages
has anyone filed a bug report/asked/gotten to know if that not updating is an API bug?
if it's not i'm definitely with monbrey, we shouldn't cache things that can become invalid immediately afterwards, but we don't get update events for
but do you think a class just for those properties makes sense?
has anyone filed a bug report/asked/gotten to know if that not updating is an API bug?
I don't believe so, no. I also think it may be a bug tbh
unless you were to pass the banner url options in the fetch method and then it would give you the url with those options in just an object, which just seems increasingly stupid
and no i dont think anyone has made a bug report
do you even know if those properties not being sent with the guild member data and others is intentional?
do you even know if those properties not being sent with the guild member data and others is intentional?
unless.. the client doesn't really update banners, it keeps them as-is and fetches them whenever you open a profile, iirc
do you even know if those properties not being sent with the guild member data and others is intentional?
unless.. the client doesn't really update banners, it keeps them as-is and fetches them whenever you open a profile, iirc
discord please
unless.. the client doesn't really update banners, it keeps them as-is and fetches them whenever you open a profile, iirc
discord please
well yeah seems logical, but how would that translate to bots?
I opened an issue, let me know if there's anything to add to it https://github.com/discord/discord-api-docs/issues/3898
Checked the site and couldn't find any mention of this yet — have I missed any further discussion of it? Was anything decided upon?
@tacit crypt https://github.com/discordjs/discord.js/pull/6710#issuecomment-929528909
you approved the pull request after the fact, so i dont know if i should do it or not?
If its the linting imo I'd say do it but I'd wait for @wild flax too
it is the linting
@remote wasp was testing the role icons PR and I noticed that trying to set a role's icon to another role's icon URL without any options (webp format) gets rid of the transparency of the icon. What do you think of defaulting the role icon endpoint format to png instead of webp?
I would personally like for all endpoints to default to png but that would be something for later
makeImageURL defaults it to webp and every other CDN method did too before your PR. If it was a random choice then yeah sure, but if there was a reason why only webp was chosen as default then you might want to ask others too
When is the new api change going to be added?
my pr only removed redundant defaults, but we could theoretically change the default for the role icon endpoint
As for a reason to use webp, I've never seen any on the discord docs and I can't come up with any myself but I think crawl once said it was better, but I don't know in what world since it's quite an annoying format to work with
Discord tends to use .webp & they're also generally smaller in size for same/better quality... off the top of my head that'd probably be a contributing reason why it's used as the default
Oops sry
Where does discord use webp? Also if that’s a format that doesn’t even support transparency, even if it has smaller file sizes why would that matter when all you’re doing is generating a url?
All avatars are in a .webp format, a quick Google reveals that it does support transparency, and people may be downloading them
yeah they can download the image but that doesn't concern the library at all
if the discord client doesn't even show previews of webp images i dont see why it would be a default
how can i make the esm portion of the lib manually (ie. a pr)?
there seems to be an error in the latest dev version (13.2.0-dev.1633089797.fe95005) - passing message options w/ an empty string content and an embed gives you an error saying the content can't be empty, but this is valid because the message has an embed
just to confirm, empty content but with an embed, which is valid but obviously the validation checks give a false negative
Set the content to null instead
ah i see
would it make sense to accept an empty string too though, if there is other content on the message (last time i checked discord did accept this, don't see why that would've changed)
I see what ur saying, but that would require a breaking change for an edge case that most ppl won’t run into
I think we intentionally are treating an empty string as error since this happens a lot on accident.
it's been erroring like that since at least 13.0.0-dev.b15d825bb3acdf432b94d8413a7a964ccc8734bc, though it didn't complain this way on v12
v13 added the stricter string checks bc ppl were passing in objects into methods that only accepted string
you'd get an api error instead when just passing an empty string as the content, so it's not much better
why would it be breaking though?
iirc if you pass null, d.js changes it to an empty string before sending
Nope, it passes null
Because iirc the api doesn’t accept empty strings at all
the api supports both but doesnt document nullability
Pretty sure that is not related to sending messages because I just called MessagePayload.create myself and it passes null in the content
that is called by MessagePayload.resolveData which is called by TextBasedChannel.send
also i tested with the raw api and both work
Ah I was one step behind then
Well I guess the empty string check could be removed then and let users get Discord’s error instead? Or maybe it would only be allowed when there is an embed
I think embeds are the only other thing that counts as content right
Oh yeah
That check would be more robust then, but it’s easily doable
And would not be a breaking change
In fact it would probably be minor
npx gen-esm-wrapper ./src/index.js ./src/index.mjs
thanks, exactly what i needed
https://github.com/discordjs/Commando i think there should be a deprecation message or something similar in this repo telling users to not use it
@ruby terrace "In order to type the response, I had to add @types/node-fetch (since we don't target DOM), which does not have a version matching the version in the library since v3 has built in types." wdym? The last published version of @types/node-fetch supports v2.5 of node-fetch
and the lib has 2.6.1 installed. The types for Response should not have changed, but its a semver minor bump, so some types are wrong
I find it weird that the maintainers of @types/node-fetch didn't bump it tho
perhaps they did and forgot to bump the version?
https://canary.discord.com/developers/docs/interactions/slash-commands#receiving-an-interaction
Regarding <Interaction>.member.permissions — do you think this information should be added to Interaction itself, or should an InteractionGuildMember extend GuildMember? Was gonna get started on it.
you can't have an InteractionGuildMember because not all interaction.member's extend GuildMember, some are just the raw data from the API
that's what I've been doing until something was decided upon:
this.memberPermissions = data.member?.permissions ? new Permissions( data.member.permissions ) : null;
yeah this sounds like the way to go
What's the use case for that?
Discord provides the member's exact permissions, all roles included, of the member which the interaction was created
DJS currently ignores this
You can locally calculate them just fine through the permissions getter, can't you?
Plus they update unlike the number you get through the payload.
No. Now, with DJS' caching, if you don't have a channel cached, you have to fetch the channel. If the bot doesn't have VIEW_CHANNEL for that channel, you get an error
The reason we ignore it is because we already have the ability to easily calculate it if its cached
If you don't have the channel cached you might have other issues with djs 
Just saying
The only issue I've run into so far is trying to fetch channels that the bot doesn't have VIEW_CHANNEL for. You can still respond to interactions in these channels, but you can't fetch permissions of members/roles for them
You surely can do that.
You get all channels of all guilds your bot is in, no matter the permissions.
Right, and if you don't cache them, you have to later fetch them. Manually fetching a channel which you don't have VIEW_CHANNEL for is a missing access error
yeah and the api docs don't specify any limitations in regards to permissions
sure? This isn't documented anywhere
Yessir
So we need to implement the permissions that Discord sends us with the interaction
Otherwise, if we don't cache channels, we need to fetch the channel (which could result in an error), manually calculate the member's permissions based on their roles, fetch the default/global permissions for each role they have, etc... When Discord just... Sent it to us
nope that is incorrect, just tested
you can fetch any channel as long as you're in its guild
it also seems weird to me that you have the guild cached, but not its channels
I just tried it, and got Missing access
you're doing something wrong then
/guilds/:guild_id/channels includes it, it's also part of the guild create payload.
Not sure what the point in discarding channels is however.
@dim steppe see
bot.on( 'interactionCreate', async interaction => {
await interaction.guild.channels.fetch( interaction.channelId )
} );
DiscordAPIError: Missing Access
at RequestHandler.execute (C:\Users\Stev\projects\rocket-planet\node_modules\discord.js\src\rest\RequestHandler.js:298:13)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async RequestHandler.push (C:\Users\Stev\projects\rocket-planet\node_modules\discord.js\src\rest\RequestHandler.js:50:14)
at async ChannelManager.fetch (C:\Users\Stev\projects\rocket-planet\node_modules\discord.js\src\managers\ChannelManager.js:114:18)
at async Command.handler (file:///C:/Users/Stev/projects/rocket-planet/commands/reputation/mjs/handler.mjs:30:9)
at async Command.handleCommand (file:///C:/Users/Stev/projects/rocket-planet/structures/command.mjs:395:30)
at async Promise.all (index 11)
at async Client.handler (file:///C:/Users/Stev/projects/rocket-planet/events/command-interaction/command-interaction-handler.mjs:47:9) {
method: 'get',
path: '/channels/658894775814062096',
code: 50001,
httpStatus: 403,
requestData: { json: undefined, files: [] }
}
🤨
The only permissions it doesn't have for that channel is VIEW_CHANNEL.
As soon as I give it that permissions, it works
you probably have the channel cached so it doesn't call the api
but as I said, if you have the guild you should have its channels too
I run a couple bot that are in 35K servers, 80K servers, etc. Not cacheing channels was the biggest way to save RAM
aight yeah you're right, mb
So far I've been able to account for that by manually fetching the channels. The only issue I have now, because of the error cause by the VIEW_CHANNEL permission, is determining permissions in channels that the bot cannot fetch, but interactions can still be used in
Still, it seems silly to not implement information that Discord sends, and instead jumping through hoops to attempt to manually fetch and calculate the very same information
It's not an issue for small bots. It's an issue for large bots that can't afford to cache literally everything
It's not silly at all if you think about how we don't even support overriding the channel manager lol
But I guess we can do it, space just asked for a use case and a reproducible example how it errors
Not that its dumb, sooo
It just needs to nicely work with the current permissions and not be confusing
I find it even more silly that you can't fetch channels without view channel. 😕
Because best case scenario, you wouldn't want to use interaction.member.perms if you can calculate them differently
Except in your use case I guess
I think a memberPermissions property in the interaction object works just fine, seeing as you cannot overwrite member.permissions
is that present on all interaction types or just some? The api documents it as optional with no extra context so idrk
well
dms
Yeah, global interactions used in DM don't have it.
I wonder if the permissions issue was somehow Discord's way of attempting to address the problem of "hidden" channel names and topics being technically visible to anyone using a self bot or BD or something.
Probably just inconsistency.
The client still has all of them.
Is it me or this didn't happen
#archive-github-djs message
it didn't but not only can member.permissions never be 0 but if it could that wouldn't be a problem because it's a string
Ah yes, okay
and it can't be 0 because the member needs permission to send messages and use application commands to send the actual interaction
I just noticed we can't use ThreadChannel#setLocked on a thread that is archived, could this be documented with an info on the edit and setLocked methods?
archived threads are completely immutable other than unarchiving, which is pretty well documented IMO
Is it? Where’s that?
I’m saying there should be sth about it on the djs docs
On another note though, it seems like setting locked to true on a thread doesn't do anything if archived is false, both of them have to be true for the thread to be locked
Am I doing something wrong or is this an actual bug?
That seems to be somehow intended behavior.
well then the setLocked method should be changed right?
because currently it only edits locked, not archived
It's not called setLockedAndArchived though.
but setLocked is supposed to, well, lock the thread
and currently it doesn't
It does, it not doing anything until the thread is archived is on Discord however.
that's very counter-intuitive
Concur
would it make sense to create a method like this then?
so that the actual behavior on the client can be reproduced
No, at this point you should use the edit method.
well the setLocked method just seems useless in that case then
I'd say very niche, not useless however, since it's doing what Discord intended for some reason I don't know.
They even added that to the client by now.
ah I see
well but the setLocked description says this, and the latter part is not true I believe
How is it not?
because after doing thread.setLocked() everyone can still chat in it, and to me that sentence gives off the impression that the thread would be actually locked so that people couldn't talk in it
Yeah, I agree that locked is a misnomer here, but unfortunately that ship sailed long ago and there isn't anything we can do about that.
well yeah changing the method now would probably be somewhat breaking so I guess we'd have to wait but it would be nice to change this method to lock and archive the thread
I'd be in favor to explicitly document this "quirk" and suggest to use edit instead when one wants to archive and lock.
that could be done now then
Wait so if a thread is archived and not locked do I need 2 api calls to make it archived and locked?
I don't know, but could be necessary due to how Discord handles threads.
seems like it is since you get an error when trying to do anything on an archived thread
well that's extra annoying, but thanks
Is it just me or does editing threads not support a reason?
the parameter is there on djs but it doesn't show up on the audit log
Loads of methods do that, it's a client bug no one cares about
Ah I thought it wouldn't be present on the audit log entry but it is so nvm I guess
I thought this was the same scenario as the message.delete method
I'm gonna post here cause I can't really verify if this is a definite library bug, but I've been noticing that fetching certain invites are throwing errors from InviteStageInstance, which I believe is because in my case, my bot is fetching an invite for a guild it's not in, which has a public stage instance, then the library is trying to set the members cache for that stage instance but it's using this.guild.members where this.guild is a getter from guild cache, so guild ends up being null
Maybe someone else would be able to verify this?
Public stages are going to removed anyway, right?
well yeah but that doesn't really matter
without code samples and error stack traces we can't really do much with this info
I can give you an error stack but that's all I really have
I suggest submitting a bug report on github, surely you have the code you're running
I do yes, but it's not really "stock" code
The descriptions seems clear to me. Now the question is: How to address this?
I had thought for a simple fix, wrapping some of the code in an if (this.guild) check might have worked, but I wasn't sure if there could be better solutions
well you have the guild in the data from the invite fetch, so it shouldn't be too hard
although you don't have all the members in the guild but you get the members in the stage instance
Yeah, another option may be to send the guild directly to the stageinstance class instead of just the ID
yeah
this.members should default to null, and if a guild is detected, it should become a Collection
members is only on the "actual" guild class, not on invite guild.
yeah but you have the members inside the stage instance object
and those seem to be full guild member objects
That's the problem.
only issue is that the roles are ids and we dont get any other info abt them
Easiest way would be to just have rawMembers or something, but that's probably not optimal.
And make guild an InviteGuild (assuming the props are the same) - might be breaking 
btw this warning is a bit dangerous isn't it? I feel like it's way too alarming for no real reason since the user should be able to tell when each one of the properties will be present in their case
guild is InviteGuild or Guild though
It's documented as Guild or null.
on what class?
The one reported, InviteStageInstance.
ahh
I was looking at Invite (which has a bug on the guild property that causes it to never be a Guild, will try to fix that)
But yeah it seems like the only solution here would be breaking, which makes it useless since public stage instances won't be a thing when v14 starts to be developed
A non-breaking fix would be to have new props for both things, not really nice, but would work.
it would take longer for that pr to be merged than it will for stage discovery to be removed soooo
about this, do yall agree or is this warning still needed?
I dont see whats wrong with having that warning?
like I said, it's scaring users for no real reason. Basically what that warning was meant to mean is that those are the only properties that will be present on the invite object no matter the type of invite, but it gives off the impression that, for example, when fetching a guild channel invite, the guild object won't be guaranteed to be present
I dont get that impression
I'm saying this because I actually saw that when I first started and that was the idea it gave me, but now that I understand the discord API a bit better I know that's not the case
It just says they can be missing
in a way that makes it seem like it's an unreliable behavior
because in a message, the member object can be missing too and that doesn't have a warning, because users can deduce that
I think the point of this warning is not to focus on things that are clearly contextual like a guild or member, and more relating to properties like uses
when can uses be missing?
the api docs don't document that as nullable nor optional
discovery is being removed, afaik public stages are staying
public stages are very useful beyond discovery
How so?
they show in invites and on profiles
On profiles? 🤔
I have this on my fork so I assume the upstream repo has this too. When will this be addressed?
Did you check what it actually is?
That can show up in some obscure dependency of a dependency of a dependency and its fixed whenever that dependency fixes it
yeah they are dependencies of dependencies but you should be able to fix them without the main dep fixing it on their side
only 1 of the 4 alerts doesnt have a fix available, all the other ones do
I dont see that on my fork
is it up to date?
you can even see this on npm with npm audit
and they offer you the fixes, however one of them is downgrading dtslint to v3, not sure if that would break anything
Yeah I just updated it
Thats kinda my point though - we wait for dtslint to release a v4 version with it fixed
dtslint is deprecated tho, it won't be updated
Probably should replace it then
it should be on eslint now, lemme look into it
dtslint relies on @definitelytypes/utils which relies on tar which is where one issue lies, and npm-registry-client which relies on ssri which is another
tar and ssri are the actual flawed packages
there is an open PR on the definitelytyped utils repo to bump tar, but ssri comes from another dep of theirs
is this a library bug? i used message.guild.stickers.fetch()
at Sticker._patch (/usr/src/moonlightbot/node_modules/discord.js/src/structures/Sticker.js:81:50)
at GuildStickerManager._add (/usr/src/moonlightbot/node_modules/discord.js/src/managers/CachedManager.js:48:26)
at GuildStickerManager._add (/usr/src/moonlightbot/node_modules/discord.js/src/managers/GuildStickerManager.js:31:18)
at /usr/src/moonlightbot/node_modules/discord.js/src/managers/GuildStickerManager.js:161:65
at Array.map (<anonymous>)
at GuildStickerManager.fetch (/usr/src/moonlightbot/node_modules/discord.js/src/managers/GuildStickerManager.js:161:32)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async Command.exports.run (/usr/src/moonlightbot/src/commands/Owner/eval.js:10:16)
at async module.exports (/usr/src/moonlightbot/src/events/command.js:127:20)```
Yes, has been fixed in main with #6421.
If we get some more approvals on stuff I guess we can release 13.2
Nothing stopping us really
Role icons should be on 13.2 imo
space saw this message
Hey I'm pretty sure this is false as I just tested and the event didn't fire, can someone else confirm?
Doesn't the member has to be cached?
And it was in my tests
userUpdate fired, not guildMemberUpdate
by looking at the code it does indeed look like guildMemberUpdate should be firing, but idk why it isn't
From glancing at the code, it looks like it happens when the user is first recognised and in a guild
that seems like a bit of a stretch, since nicknames aren't really part of the user's info
Look at line 10-15 in the source code for that event
but those lines don't have a return, so if those get executed, the others should do too
I guess the description isn't entirely inaccurate then
what I think is that there's a bug here
Yeah, the bug is discord.js emitting user updates manually >_< lol
yeah that's quite stupid xD but nothing we can change now
it its documented saying the event can fire on username updates, then it should be firing with username updates
Ok so I found out why guildMemberUpdate isn't firing on user changes, it's because we check if !member.equals(old), which returns false since the member didn't update, only the user did. My question is, do we wanna remove the line saying the event fires on user updates or do we wanna fix the event so that it fires on user updates?
@tacit crypt I see you online so could you give me your opinion on this pls ^^
I have no idea to be honest
tbh since discord emits guild member update events for user changes I think we should also do the same
Not exactly trivial to do properly.
it should be easy
Surprise me
give me a min
@slate nacelle
old is a GuildMemberObject
Aren't those user objects reference equal even?
So you're firing user updates in there now?
That's how we currently do it.
Sorry, this should be the actual fix
tested and it fires the event
This should only fire for the first guild member update, you should receive one for every shared guild however.
Couldn't a fix also be to simply emit the guild member update in the user update actions as well
discord emits the guild member update event on user update, so there's no point in doing that
I found some flaws with that fix so lemme do more tests to make sure it works
Ok so after a lot of head scratching I just keep finding more bugs and I need feedback on these
So the check in https://github.com/discordjs/discord.js/blob/a8c21cd754d634b4d40047f85264528681a61b41/src/client/actions/GuildMemberUpdate.js#L13 is broken and will always return false because the equals function now compares banner and accentColor, which are not present in a user object received from a member object. Should we make a private method to compare the user to the api user? This isn't really a major issue though because in the userupdate action it compares 2 user objects, so that will work as expected
The User#equals method does not compare user flags, causing the event to not be emitted when it should
Due to the first point, we cannot use that same check to emit guildMemberUpdate because we cannot have a user object to compare the cached one with, unless we call the User constructor which I'm not sure we should do ?
So overall the action is sort of working as expected with a lot of things that don't work in the process, which makes it impossible to make guildMemberUpdate fire when the user updates, like Discord intends us to do
@opaque vessel @slate nacelle btw ^^
Gonna give my final 2 cents on the matter
Discord sends presence updates where there should be user updates and doesn’t send user updates without the presences intent
Even with that disabled it’s impossible to send a guild member update event with the old data. The only way to do that is to not send a user update event. Either one of them will not have the updated data due to how we store them. I did find an issue in the user equals function though so I’ll submit the PR to fix that and another one to undocument that sentence saying guild member update can fire with username changes
And also due to that I think we should keep the manual userUpdate event emits because otherwise the event will never be emitted except for client user updates which also happens to be a manual call
If anyone wants to attempt a fix for this however be my guest, but I just spent an entire evening banging my head against the wall with this and it didn’t go well
Or we could, you know, drop the equality checks since if we get a GUILD_MEMBER_UPDATE event, something updated.
Just my 2 
But you don’t know if the user updated or if the member updated, and I don’t think we can stop emitting userUpdate events in a semver minor or patch
Does it matter?
It doesn't
Wait so what exactly are you suggesting
Our fake events for things that don't come from the ws are just a maintenance headache imo
.
The issue is that you have to patch the existing user and if you do, you’d end up emitting an event with nothing changed
Because the current workflow is
Member update received
User equals check
User gets patched and userUpdate event is sent
Guild member equals check
Guild member update event
If we remove the checks, the guild member update event will fire without any changes since the oldMember.user will already be patched
I think that’s the reason why those checks are in place
Doesn't a clone clone the user too
It does yeah but that only applies for the user update action
It works correctly on userUpdate, but when you get the old member from cache, it’s user object is already patched because the user update action modified it
And yes this is very painful to work with and would be much simpler if we just didn’t emit fake events, but we can’t do that now 
Sorry to interupt you guys, but I have a question regarding the user.flags. So currently the userUpdate event wont work with flags is what you say? I wanted to know because I am facing issues there.
it will if you have either one of the privilledged intents
otherwise only for the client user
I have the Members intent enabled only. And I am listening for the userUpdate event. When it triggers it only has values undefined or 0 but otherwise it does not trigger.
can you show me the updated data?
You mean my code?
I only logged a few, like trying to change my Hypesquad house but it didnt emit
the data you receive
if (oldUser.flags?.bitfield !== newUser.flags?.bitfield && newUser.flags?.bitfield > 0) {
console.info(`Flags of ${newUser.tag.red} changed: ${oldUser.flags?.bitfield} => ${newUser.flags?.bitfield}`);
await User.updateOne({ id: oldUser.id }, { $set: { flags: newUser.flags?.bitfield ?? 0 } });
}
This is what I am trying to do. Update database entry when the bitfield changes. I know its not the best code. When the event emits oldUser.flags.bitfield equals undefined and newUser.flags.bitfield equals 0. Otherwise it does not emit
I also logged data before the if statement same result
that's odd, I could not reproduce this in the 3 hours of testing I did on these actions, it always worked perfectly
friends, this isn't really a support channel
you have to fetch user flags, and if the old ones weren't cached you won't be able to obtain them after they changed
isn't uncached stuff supposed to be null though
and it is
you really don't have to fetch flags tho 
oh i brainfarted, excuse me
I am sorry for asking here, but no one could help me in the help channel. So I need to fetch the users/members on ready event to have the flags cached?
I don't think you do, they get sent with the member object
But shouldnt the new flags still be greater than 0?
do they actually ship them with every user payload now? that was def. not the case before
seems like they do but yeah I also noticed the fetchFlags method earlier
for some reason there's also flags and public_flags
Huh
flags are nullable, they are not sent with every payload, you may need to fetch them, depending on how the user payload arrived
https://discord.com/developers/docs/resources/user#user-object
yeah but when will they not be sent?
do you know how many things come with users we cache?
So the event does not emit when there are no old flags cached because of the discord.js equals checks?
if our equal check doesn't account for null, possibly so
user updates are a bit of a headache anyways atm, because they don't really exist in this capacity, we forge them from the inner user payload on receiving GUILD_MEMBER_UPDATE event payloads
and iirc the current implementation just only emits the first and drops all others (in case your bot shares more than one guild with the user)
the equals check didn't check for flags 
#6750 in discordjs/discord.js by ImRodry opened <t:1633292836:R> (review required)
fix(User): compare flags in #equals
📥 npm i ImRodry/discord.js#fix-user-equals
I just want to fix my problem 😫
see if the linked PR does
But I will need to wait for the next version to release or use dev build
nah, install it
you have the command there
I am currently not home but I will try
But why not just drop the equals check from discord.js side?
Doesnt it make no sense if the event emits then it is a new user object?
like we were discussing, the user update event emits with other events
So I'm gonna remove that phrase from the guildMemberUpdate docs. Should I add an info tag saying this will change in v14 or do we not do that here?
I'd rather not make predictions for semver versions
I plan on opening the PR once development on v14 starts but in that case, should I only delete the phrase and not replace it with anything else?
Development on v14 starts whenever people start opening semver major / breaking PRs
there already are semver major PRs tho
Then they are for v14
Or might be anyway
well yeah I know but I'd rather wait for those to start getting merge than clogging up the PR list
Theres some technicalities in there
guess ill just delete it then
Yeah but theres no guarantee we go this way is what im saying
ah yeah
so putting it on the docs now might convey a wrong image
sure thing then 
Is it worth updating...
https://github.com/discordjs/discord.js/blob/stable/src/util/Constants.js#L38
...to add the new image sizes?
From what I see, DJS just calculates them...
const AllowedImageSizes = Array.from({ length: 9 }, (e, i) => 2 ** (i + 4));
...but those aren't all of the valid sizes.
according to this those are all the valid sizes https://discord.com/developers/docs/reference#image-formatting-image-base-url
Image size can be any power of two between 16 and 4096.
The introduction of banners, I believe, added new sizes. The one that comes to my head currently is 300. The sizes can also be used with avatars etc
https://cdn.discordapp.com/avatars/228937760390643713/353889e1eb10ab1e61d7274028a69500.webp?size=300
IIRC, default banners are 300px
do you know the full list of valid image sizes that aren't documented?
perhaps the image size validation should just be removed
Not off hand — I had the ones I had found when I was at work earlier. Only one I remember off the top of my head was 300
Oh and 600
It's not pretty, but could just:
const AllowedImageSizes = [...Array.from({ length: 9 }, (e, i) => 2 ** (i + 4)), 300, 600].sort((a, b) => a - b);
Would they not be two totally separate sets of image sizes
For banners and avatars, you mean? The new sizes work for all images, not just banners
Fair enough
I think if you have the message partial enabled then djs should send the messageUpdate event even if the old message isn't cached, instead of just ignoring the newmessage entirely
Sometimes you don't need the old message at all, like for link scanners or swear detection.
That's the idea behind partials.
Isn't that exactly what it does? I'm not sure what's been suggested / addressed here
Could you change the dev build interval to be in the middle of the day or something? The majority of the time the release at midnight is the same as the release at midday because everyone is asleep during the night and barely any prs ever get merged then
So I found a place that tslint is fighting with prettier, TSlint wants this:
export class ...
extends ...
implements ... {
But prettier wants this:
export class ...
extends ...
implements ...
{
it seems that setting one-line to false in the tslint.json fixed the issue
Which one do we want tho
I’d say the first
I don't think prettier should be running in the .d.ts files
I don't think we should be using tslint
well...yeah, eslint needs to support .d.ts files for that though 
does it not?
I always run it before pushing, it just takes long af because the file is huge lol
but I've never gotten eslint errors on the typings
my vscode runs prettier formats on save
that's because eslint is scoped to the js files only
by using eslint src
it doesn't tho 💀
vsc can, its a setting
? I set it to do that?
but I remember when you made the messageReactionRemoveAll PR every PR created after that changed the formatting on that event xd
that might be because prettier isn't supposed to be run on the typings files? idk
what else would we run then? It has to follow some formatting rules
It looks like it does run prettier in ts files on commits so idk why that in PR caused issues
Its meant to do nothing if there are no changes, why is it releasing
it does because the dev release has the timestamp at which it was released and we don't run any checks to compare the commit hash
which we probably should, but I personally don't know how
oh i thought we did
make a pr pls
I mean it doesnt seem that important, whats your concern with it releasing?
Well it's basically just that multiple releases are published on the same commit and often only the midnight release has changed because from midnight to midday UTC there usually aren't any merges
my initial suggestion was to just change the schedule
You know timezones are a thing right?
What you describe as midnight only works for the UK
Will yall ever add a onclick function to interactions?
well it doesn't because its 1am and 1pm but im talking UTC here but what im saying is still true
Yeah I don't think thats necessary sorry
its "nightly" for a reason
Not even a check to compare commit hashes?
what will that change?
clicking on a reaction emits "interactionCreate", check for the interaction to be a button with .isButton() and validate it's the right button by it's .customId.
if you want a higher level approach to temporary buttons for confirmations and similar, look into component collectors https://discordjs.guide/interactions/buttons.html#component-collectors
clicking on a button emits "interactionCreate"
yes i know that, its just a very big use of space and switch statements and so on. The onclick function would allow clean easy to read code and support usability, but you gota use what you get
if you want to target a single specific button, like a onClick, a component collector is what you want
prevent multiple releases from being published on the same commit, essentially not spamming your npm versions if you care about those
not extremely important, but would be nice thats all
dont really care about npm versions honestly
aight
I noticed the change log that gets generated references pull requests as issues o,o
For example
prs are issues
theres no difference
Welp, alright then (:
has v13.2.0 been pushed to npm?
not yet right?
since ephemeral messages can now be fetched, does that mean we can create component collectors on em?
nevermind, tested them and it works
yeah it has been
oh okay tysm
@wild flax github had an outage on actions when you released 13.2, could you try to re-run the docs publish action?
this is still not fixed 
hey do you guys think it might be a good idea to export the type of type as a type?
export interface ActivityOptions {
name?: string;
url?: string;
type?: ExcludeEnum<typeof ActivityTypes, 'CUSTOM'>;
shardId?: number | readonly number[];
}
cause as of the latest d.js update I can't use as ActivityType anymore when setting type to an environment variable and I instead have to add the whole ExcludeEnum to my code since that is not exported either
why don't you use ActivityTypes? iirc I removed the ActivityType shortcut because it wasn't used anymore
wait no I didn't, it's still there
yea but it isn't assignable to the ExcludeEnum thing
can you show the error?
neither is ActivityTypes
when using as ActivityType
show the code please
presence: {
activities: [
{
name: process.env.CLIENT_ACTIVITY_NAME,
type: process.env.CLIENT_ACTIVITY_TYPE as ActivityType
}
]
}
hmmm that's a very niche case
what happens if you remove the "as"?
wait you can just use Exclude<ActivityType, 'CUSTOM'> iirc
oh that worked, swear i tried that but apparently not. thanks
uhm bump please this is quite important
this is also erroring out
someone re-run the actions
Im sure he will once he sees it
Probably asleep or busy
does @discordjs/rest module supposed to be used outside of node too?
It's related to this PR: https://github.com/discordjs/discord.js-modules/pull/55. The issue mentioned in the PR is still there and you still have to opt in for dom types in tsconfig, else it won't compile. I imported the URLSearchParams type from node's built-inurl module, which let's you compile without adding dom types. So, what was the reason that they went with that solution and not this?
cc @strong hull
was going over a guide page for my beloved souji and have found out that those (https://github.com/discordjs/discord.js/blob/26340acad946989e9a8825966b76c506d82fc641/src/structures/MessageMentions.js#L217-L233) don't have capture groups for the IDs
what is the stance on this? would there be an issue with having that added?
Uhm... I'll have to look into that. I could've sworn I tested it back then but I'm starting to doubt now.
oops, turns out your fix was released in the @canary tag. I installed that tag and it does fix the issue. Still, why didn't you went for the node type here
They do have capture groups though
eeerm, my bad
*named capture groups
Is there a reason to make it a named capture group over a non-named one?
yeah I didn't realize it was grouped in the first place, cus I was looking for named groups 
but yeah, it could be beneficial
bit redundant but could be
.groups.id is much nicer to access
That I don't know. I just added on what was already there.
CC @wild flax
(Why does rest use DOM libs instead of Node libs)
You’d have to ask the person who implemented it
Git blame it maybe?
I didn't add the ///types directive
No, I did. Thats not the question however. The question is why you made the lib depend on URLSearchParams from DOM insteading of importing it from url (aka node:url)
Because the latter needs an import when its otherwise global anddddd the only reason the node typings don't make it global is bc of the clash
Well there ya go @wild flax @remote wasp
I see. How about using the global URLSearchParams when using it as a value and importing the type when we just need to use it as a type? This way we won't have to do anything related to dom
You.. won't have it in your globals if you don't use the dom typings pretty sure
And TypeScript will yell
that's correct yeah (had this issue with Response typings in the main lib)
got it 👍
<ClientPresence>.userId is always going to be null
https://github.com/discordjs/discord.js/blob/d32956c6b70a3a03c431d5f761c058072999289a/src/structures/ClientPresence.js#L13
However, <Presence>.userId is both documented and typed as a non-nullable Snowflake
https://github.com/discordjs/discord.js/blob/d32956c6b70a3a03c431d5f761c058072999289a/typings/index.d.ts#L1636
Right now, by the time the ClientPresence class is instantiated client.user is not available so there's no easy way to get the client id
Hey, i want to ask about Error [USER_BANNER_NOT_FETCHED]: You must fetch this user's banner before trying to generate its URL!. I always get this error when json stringify User and fetching User, I not using method <User>.bannerURL(), but why i get that error message?
my bot always getting crashed because that error
There’s no User#toJSON so what exactly are you doing?
yes i know, i can use JSON.parse and JSON.stringify method
Ah wait I know the fix
Don’t have the time to open the PR rn but I will later if no one else does before me
Also the toJSON method exists, it’s just not documented so there’s probably a reason for that
i'll test it later
Me and a friend of mine managed to get the guildMemberUpdate event to fire on userUpdate's like the Discord gateway does. My question is: should we also fire presenceUpdate when we receive it from the API as a userUpdate or should we leave that for guildMemberUpdate only?
presences don't really exists on users
Yeah ik despite Discord sending the user with the presence update payload, but we won't fire it then, thanks 
yeah I never really checked how it works when you are only friends and don't share a server
im sure theres something happening for this
but it doesnt really concern bots
yeah I can't check that either but it shouldn't matter and it's way out of the scope of this PR we're making anyway
oh btw @wild flax I noticed you didn't really review the vscode extensions PR, do you not agree with it or did you just not see it?
if an object has a #toJSON() method, JSON#stringify calls that method instead of using the JSON default serialization.
yeye I know, I was literally about to create that PR
im out of the loop here, but why does #bannerURL need to throw in the first place?
starting to question that too now 
my idea behind it was to force users to fetch the banner before trying to generate it
but in theory you could throw undefined, but that could be badly interpreted
but doesn't undefined imply it just isn't part of the object at all. And then null just means it could be part of the object but it isnt
if it isn't part of the payload, just returning undefined seems fine, no?
👍
I'd like to hear from the maintainers now, because while you are right, the error forces users to fetch the banner and actually tells them whats wrong
also unrelated but this doesn't follow commitlint so it won't show up on the changelog, maybe someone should force push to fix
What do you want to hear, good luck it being a semver:major now
Not like we can change it
it's not tho
removing an error is patch, adding it is major
Removing throwing is very much a major
You aren't fixing a bug, you change behaviour
how is it? I've had prs that removed errors on semver minor
or patch even, can't remember
Feel free to dig them up
So I can actually see the context
#6631 in discordjs/discord.js by ImRodry merged <t:1632397615:R>
refactor(VoiceState): use manager edit method to remove error
it was patch actually
Thats quite different
Look at what the PR does lol
You made something generally work in all reliable cases
Whereas before it wasn't
well yeah and here we're making the bannerURL method work in all cases, but output something different in the cases where it throws atm
so going from error thrown to no error + undefined return doesn't seem like a major to me
the throwing if not fetched behaviour is documented. it would be semver: major.
You're expected to receive an error when the user isn't force fetched. Removing this error to return a different thing is a major, isn't it?
Eh I guess so
Both alternatives work
And we should’ve had this discussion before the PR was merged anyway
If anyone wants they can fix it when v14 development starts I guess
Can't anyone submit PR's for semver major now?
Well you can
But I am saving those for when we’re merging semver major prs so as to not clog up the pr list
you arent really clogging anything up
Just a personal preference tho, you can do whatever you want
we use the new projects boards https://github.com/orgs/discordjs/projects/2
so we have a nicer view of things
Ohhh I thought you went through the list
Aight thats good to know
hell naw
But still, we have TODO comments for some stuff so I’ll wait
also one last question on the bannerURL method, is there a specific reason it isn't a getter?
It's a method as other methods like avatarURL, iconURL etc...
Also it takes an options parameter so it couldn't be a getter
Only place where that is a getter is on emoji and I plan on making a pr to turn that into a method because it doesn’t make sense to be a getter
It should always be customizable
im literally blind
What do you guys think of a possible CommandInteraction#toString method that would return the command that was run in a way that can be copied and executed again? It would basically be /commandName {subcommand group} {subcommand} {option1:value} ...
Sounds good to me
What would be the use case for that?
You can already do that inside the client.
Not that it works 90 % of the time, but. (parsing the copied command, not copying it)
Logging commands. I do it
I see.
Do we know if bots can have avatars per guild?
They can't.
👍
question for user/channel/role options though, how should we display these? Discord accepts the ID on all and this would be the easiest to implement but it also supports @Username#discrim for users for example
for roles that is just @RoleName tho so maybe we shouldn't go that way as that's quite unreliable
if the point is to just make it executable the ID works fine
You only get the id though, so, there's only one option to use. This also gets opinionated so I wouldn't recommend adding it really
the other toString methods are all for utility purposes and if the point is to make the command re-executable (if that's a word lol) easily then I don't see why not
but ye I'd def like some more input
Does pasting in slash commands even work?
But I'd still go with ID, it would be the only reliable way to actually ensure you're getting the right values that were used the first time
Is it even possible to replicate the command in order though? Is the raw data reliable for that?
I believe you get options in the way they were sent
I can test if you want tho
there was a user in tph that had a problem relating to this, when role mentions were pasted in, they were @name instead of <@&id>
so it works to some extent but not fully, it seems
the helper in that case is present in this server, it was chooks
Which is why I'd probably go with ID
Though the new editor is coming soon too, might be worth waiting? idk
editor?
ayo what
Pretty sure this was public knowledge from their stage about it
https://auralytical.notion.site/Editor-Upgrades-dee51c93462c44b8a0a53fed3d94c4cd
They released this at the same time as the autocomplete docs and permissions overhaul info
But since its client side rather than dev focused maybe it got less discussion here
oh I did see that but that's only a visual change for the client and allows us to have multiline strings, which should still be supported by this method and we can always update it if not
I mean its not just a visual change
Its an semver major upgrade of the editor in the client
Slate, the library that powers the editor, has undergone a massive rewrite since we originally built this component.
that rewrite was internal, the editor update shouldn't remove any features, and should just add those boxes and multiline strings from what I understood
...of course it wont remove features
But theres a very good chance it will change how it behaves if you were to paste in a slash command input
still the data passed to the API won't change for sure, and that's what we're using here
it's only a client-side update
I don't see how that update could break this function tbh
Working as intended btw, will PR
That's still not what I meant, at no point did I suggest the API data would change
But the whole use-case for this feature, if I'm not mistaken, was to output a string that could be used to copy and paste into the editor to re-use the command, right?
And the editor input is going to change
Hmm so you think the option:value format will change?
It might still work perfectly fine afterwards, but its just something to keep in mind
Or could at least
Could, yeah. I wouldn't say I think or know it will
Alright then
I have the branch published and will make the PR once that update is out
Since I think one of the issues they did want to address was how you tab through options and stuff
Yeah I think all options are these by default, not sure how optional options work tho, they didn’t really show those
You could probably PR it now if it works now
If it doesnt work with the new editor we can probably patch it? idk
What if its not patchable? Not likely but its possible
Did they give us any ETA for that update btw?
nah

I’m just worried this isn’t feasible in the new editor but that chance is so small that we might as well just go with it
Anyway quick question: if a property is set to undefined on an object and we change it to not be present in the cases where it is undefined is that breaking?
Uhh, probably
Since you're changing what Object.keys/entries would return

Aight
Currently, it works in the new editor. Only problem is it doesn't let you select which bot, but that's not a djs problem
Yeah ai actually stumbled across that issue on mobile but we can’t really worry about that
Are there any plans om removing client.api access?
Client#api is an internally used private and unsupported method and is not subject to semver, so it might change at any point without notice
but there arent any plans to lock it down like classes
There isnt really a way to "lock down" a specific propertyu
We could try JS's new private fields but im not sure what compatibility on those is like
good
bc i use it a tone
once those are reliable, definitely going to do that
Awesome guess ill have to switch bc my whole bot is relying on those
If you're relying on client.api you should really be using a package like @discordjs/rest
if your whole bot relies on raw API access i'm not too sure why you even use discord.js to begin with?
For the websocket and the classes
and the client.api
Oh what lemme see
is there also a thing like for the classes
..yeah.... discord.js
use it properly
I use it properly
Clearly not or none of this would be an issue
Not really a library discussion anymore
Okay then, just sad that everything more advanced people use is getting locked away
if you were to elaborate on your use case we could maybe understand what you are doing and suggest changes/adapt to make that possible
but since all we get is
Okay then, just sad that everything more advanced people use is getting locked away
over and over (even after explicitly asking for those use cases, yesterday) we really can't do anything productive with this feedback
Okay sorry i didnt mean to do that, lemme explain
Its not "more advanced" though, if you want to make raw API calls you can just use node-fetch
Using discord.js's internal methods does not make you more advanced
So I've made my bot with djs in v12 and back then interactions weren't a thing so I made my own classes and stuff using client.api and to use some useful djs stuff. I used e.g. the message class and invoked a message with the message data given with e.g. message context interaction or the message collector from textchannel class by invoking it with the interaction channel
I use it so frequently that I would need to change 50 of the bot to bot use the classes and I use client.api even more
I was talking about classes
But now they are classes and you dont need hacky workarounds
Changing to those would be even more work than removing the djs class usages
Which is unsupported and always was
So saying we “take away” things us untrue
It could just break
Or it might not
But that’s your own fault at this point for “I’m too lazy”
Why was it documented then
What was?
client.api has never been documented
The classes? Because of extended structures when we had them
Not to create them yourself
I again was talking about classes
Fine about client.api since discorjs/rest exists
You got your answer
Yup
@tacit crypt in https://github.com/discordjs/discord.js/pull/6790 I changed both ApplicationCommandOption and ApplicationCommandOptionData but I'm not so sure about the first one since all options have all properties (yes, even channelTypes) and some just have them set to undefined. Should I update the Option interfaces to include this or do we just pretend like they aren't there?
You only changed SubCommand(Group) options
I don't understand your question
well yeah but I changed both the Option and OptionData interfaces
i just said it that way because the actual names are too long lol
I still stand by my I don't understand your question. You fixed the issue in this PR. If there's other issues, make another PR?
in that PR I removed the required property completely from sub command and sub command group options, but this property is actually present, it's just set to undefined on these types of options
If it's set to undefined it won't even be sent to Discord
So...like...??
no like
there's 2 different interfaces, one for data we send to discord and the other one for options we receive
and I'm talking about the options we receive
We wouldn't receive required??
but we create it that's the thing
that's why it gets set to undefined
hope that makes sense
That's an oversight on our part, tho it doesn't affect it dramatically because JSON.stringify skips undefined props
But yes, you can submit a PR to fix that I suppose
to fix types by adding undefined or to remove those undefined props?
because that would be a semver major right
the second option
If it's strictly internal code that doesn't interact directly with the users, fairly certain it's not major but citation is needed
and it wouldn't be major anyways because its a bug that they're present but undefined
so
Like
yeah I feel like it wouldn't be since the public methods always return values and not the full option (except for get)
maybe that exception is what makes this semver major
.
alright then, will do that
thanks!
also gonna address your review in the toString pr in a bit
is there any difference/preference in using Boolean() over !! ?
Other than one being more verbose (which wins me) and the other being syntax sugar, I don't think so. Just be consistent with the rest of the codebase
yeah seems like !! isn't used anywhere so I'll go with the Boolean constructor
actually, ckohen suggested using only Boolean in the filter but I think this would be more verbose, or does it not make a difference?
vs
makes no difference here
Alright, will just use Boolean then
if it's just filtering for truthiness then couldn't you just do prop => prop
or is that bad to ts/eslint or against some standard or smth
well Boolean does exactly that so ¯_(ツ)_/¯
it is for readability isn't it
I think so too but crawl said it makes no difference
btw about this: if an option can have a property but it's set to undefined should we include it or not?
say for example a STRING option with no choices, should it have choices: undefined or should it not be present at all
Ideally, the former, but even if it's the latter, it still won't be "present" once we send it down the pipe
aight I'll just default it to an empty array then, since the types and docs never included undefined
actually, can I?
yeah seems like that's fine by the API
No?
Leaving aside the fact I mixed my former and latter this time, if a user doesn't specify choices it shouldn't be sent period
Hell, YOU asked if it should be undefined or not present and now you forcefully make it present??
My original objective was to remove the property in cases where it absolutely cannot be present (e.g required in sub commands) but keep it everywhere else. On situations when these are not set they could be defaulted to sth depending on the property
if the property is not required, it shouldn't be present PERIOD unless the user set it
Alright then
Thats how builders and most of our patch methods do it too
Send just thats needed
But here I’m talking about the received options in ApplicationCommand#options
Well both that and the options sent to the API in this case but I guess it still applies, just making sure we’re on the same page here
Ok, maybe you need to explain a tad better because I don't understand what the issue is still
Code samples would be 🙏
This is still the best example I can provide
My goal is to remove properties from options that cannot have them (e.g required in subcommands) but keep them if the type of option allows them
If the prop is allowed and not set by the user then it could either default to an empty array or not be present in the object at all, which is what I’m asking you
For context I’m editing the ApplicationCommand#transformOption method, which changes the ApplicationCommand#options property and the options sent to discord
I've already said, if it's not set by the user it shouldn't be present
(I mixed up my former and latter but thats a different issue)
Alright, will go with that then
Thanks 
Does APIApplicationCommandOption from discord-api-types not support channel_types?
it does, it just hasn't had a new version release since the PR was merged
ah it should probably be released then, was gonna use that in a PR
it's only a return type for a private function though, nothing urgent
One day I will make a workflow that does a full release every friday
That day is not today

do you make commits every week though?
Does it matter? Thats not even part of the idea 
oh idk then, was just thinking it could make duplicate releases that way
Why wouldn't it be an array 🤔
There are a lot of type checks though and when the error isn’t explicit (same when not passing an array to embeds or components in MessageOptions) it should probably throw a custom one
There’s some errors that are fine as it is but when the error references a function in the lib people tend to think its a bug and not an issue in their code
Problem is finding all these instances but I think at least the most common ones would be good enough
is there any reason why the Channel#delete method doesn't support a reason when the GuildChannel and ThreadChannel methods do?
because DMChannel doesn't support a reason, does it ?
the endpoint is the same
so it theoretically does
Why should you provide a reason for DM channels though? There isn't an audit log lol
just to generalize the method so it doesn't need to be duped, but I'll probably do something else about this
Can someone switch https://github.com/discordjs/discord.js/pull/6802's branch to main?
Should be done.
It seems there's also a repeated instance of this in the ChannelData type definition >:
isn't there like a massive json or something that's for generating the docs
couldn't we run smth like /(\w+) \1/ on that
The error will still be in the source code. I don't think that's appropriate to do
well yeah but we could find where it's from from that, no?
Oh you mean for finding duplicate words
Sure, I guess, you can try do that
yeah, just needs a human filter
ill try that later ig
The double for is actually grammatically correct there but if you make it a single for it's still correct just a slightly different meaning
"The properties to check `required` for."?
That has a different meaning
How about "The properties for `required` to check for."
got 4 matches, both on stable and main
WebSocketShard#setHelloTimeout(private method) parameter desctime
"If set to -1, it will clear the hello timeout timeout"
https://github.com/discordjs/discord.js/blob/stable/src/client/websocket/WebSocketShard.js#L498- seems correct (the one jiralite just mentioned)
ReactionCollector#create(event) desc
"...as opposed toCollector#collectwhich which will be emitted..."
https://github.com/discordjs/discord.js/blob/stable/src/structures/ReactionCollector.js#L72- "the the" that jiralite initially mentioned
"hello timeout timeout" is correct?
That is my question, yes.
idk i was debating if it was, but it doesn't seem like it to me
i don't think adding another "timeout" there really helps
in the code for that method it just says "HELLO timeout" as well
I think it's more "correct" to have them both, but having just one works as well.
Or, actually...
I don't think we should have double words, correct or not. It's just... ambiguous and seems like a mistake at a first glance. Sentences like that should be rewritten
To me it only adds confusion.
But yes, that was changed an hour ago.
other methods like the setHeartbeatTimer below it doesn't say "heartbeat timer interval" either, just "heartbeat timer" in the desc and "heartbeat interval"/heartbeatInterval in the code
here we can't really rewrite it, since "timeout" isn't a part of grammar so we can't really rearrange it, "heartbeat timeout timeout" would have to stay a single blob i think
But it's not a timeout for the timeout.
It doesn't clear the timeout's timeout. It just clears the timeout.
Literally below that is a debug message "Clearing the HELLO timeout.", it's not correct and is already inconsistent
The extra one should be removed
well that's 2 we can agree on, and i think we can agree that the 3rd one here is incorrect?
so just the ambiguous "for for" that jiralite found
I believe I already included all of those
nice
Pretty sure that's just flat out wrong, it only checks if it's required. The last 'for' should be 'if'
constructive criticism usually does not involve insults
however, please note that we abide to semantic versioning, the API will stay consistently usable within patch and minor versions.
semver major (11.x -> 12.0, 12.x -> 13.0), however can include breaking changes
you can generally not rely on functionality to stay the same when doing a major update, in no library
if we were to stick to always make our versions backwards compatible we'd throw any chance for innovation and fixing up design mistakes or change the direction the library takes
if you want a consistent API stick to version 12, however, please note that new features will not be ported back to old versions and that discord will eventually (no known date) shut off the version of API version 12 uses
that is precisely why they are introduced in semver major version changes, because they are not minor changes and break the public facing API
now, as to why these changes have been made:
v11 -> v12: optional parameters have been moved into objects for consistency
v12 -> v13: we removed an inconsistency, no other delete method ever had a built in timer + this one was broken beyond repair, with more and more introduced checks against edge cases of when a message may have been deleted already
i can assure you, most of the things we do has a solid reason, albeit it being an inconvenience at time. to remedy that we're trying to list all changes in updating guides https://discordjs.guide/additional-info/changes-in-v13.html, so people can easily find the new usage based on their current code. if you have a suggestion as to what we could add or improve there, feel free to open an issue or PR on the guide repository https://github.com/discordjs/guide
I think a good thing to think about is that I would assume none of it is done out of fun, cuz like I don't think any of the devs find entertainment by breaking other peoples code, changing discord API version can break certain stuff which may require for stuff to be changed, it may also be to code new code more efficiently.
I get it, it's really annoying to update a large portion of your code just because of breaking changes, but that's kinda to be expected when upgrading a major version, this is something your gonna find happen more times with both this library and others, but fortunately developers leaves this big changes for major versions so we can prepare more for these changes.
I dunno, we usually give people months and months to update
If over a year isn't enough, then I don't know what to tell you
Why in each new version do you make drastic changes to the package and these changes are just a change in functionality and perform the same function as the first version? Why don't you just stick to each version and add features and if there is a modification to the Api from Discord, just implement the modifications and not modify the way the function is created, I know everyone agrees with me on this point
@wild flax@unique axle
theres usually good reason to most of the changes to djs, like consistency and whatnot
drastic changes
because that’s how semver works?
if it wasn’t drastic, it would be on a minor version
My friend, the drastic changes are long after the package is released and after 5 years he makes a drastic change if he wants, and he is not obligated to make a drastic change every year.
well could you give an example of a "drastic change" because changes that arent backwards compatible go into major versions (https://semver.org/)
nor are the contributors required to not make changes
updates to the library are to utilize new feature of js or node, to comply with the discord api, to create consistency between other parts of the library
we’re on major version 13, semver says that this means there are breaking changes, if we didn’t have drastic changes we’d be on 1.45.7 or something
Software versions
I know it well, I use Google Translate, so it replaces some words
This is the explanation of the program version if you do not understand it well
@clever spoke
Major version numbers change whenever there is some significant change being introduced. For example, a large or potentially backward-incompatible change to a software package.
Minor version numbers change when a new, minor feature is introduced or when a set of smaller features is rolled out.
Patch numbers change when a new build of the software is released to customers. This is normally for small bug-fixes or the like.