#archive-library-discussion
25085 messages · Page 11 of 26
How is that moving the burden of checking from the user, when it now makes it twice as annoying because it throws an error
It still serves to validate the user's command data against their runtime code
If anything, I think it should be a getter
If not a function
i don't see any advantage in that
it should be a property
and let users check themselves
there's no reason for it to be a glorified getter
But none of the other methods do that, for the sole reason of ensuring the user doesn't have mismatched command definitions and code
the other options are specifically of a type (roles, users, channels, etc)
subcommands and subcommand groups are strings and nothing more
All you do right now is throw an INCONSISTENT error when someone gets the subcommand / subcommand group
I think you guys make this out to be a way bigger deal than it is
lol
??
the whole point of us transforming the options is so the user doesnt need to check at all
so I agree with shino there
otherwise you can just use the get() method
I am strongly disagreeing with glorified getters for sub command (group) but 
which does none of this
Yeah I don't think its too big of a deal
I don't see how that's better than just having users check if interaction.options.subCommand === 'name'
Especially since I bet you there will be someone doing if/else chains of getSubCommand() instead of caching the variable
I don't think we ever tried to pre-optimize what users end up doing
So that is out of scope for this and rather belongs into the guide or a programming guide in general
Calling a function that returns the same value over and over, and how that isnt optimal, is not something we need to teach people.
Not sure if this is where I should be asking this but I can't seem to import SlashCommandBuilder, I have:
import { SlashCommandBuilder } from '@discordjs/builders';
Says Module '"@discordjs/builders"' has no exported member 'SlashCommandBuilder'. I have @discordjs/builders@0.2.0 installed
Its not yet published
Ill let you know when it is
Oh ok my bad, thank you
hm
for my stickers pr should i actually make it work for both stickers and sticker_items
so it works for old messages and new messages
stickers is technically deprecated but its the only way of seeing what stickers old msgs have
also, couldnt the Base class implement createdAt and createdTimestamp? since it says its for data models that have snowflakes (although looks like some non-snowflake objects incorrectly extend it)
yeah thats primarily the reason why it doesnt annoyingly enough
i had a look at it once but its fairly obnoxious to refactor
We could also update the docstring to reflect what it is.
not sure if worth
is it deprecated in v9 still?
Maybe Base can be refactored into Base and SnowflakeBase extends Base?
Why?
@wild flax @bitter peak why don't we make getSubCommandGroup do the exact same as getSubCommand? (aka throw if missing, return otherwise)?
I guess yeah that does make sense. What do you think, Crawl?
@wild flax
sure
next time make sure to ping me directly instead of waiting :P
changed :)
yeah, the client renders from both
man fuck discord
aj did say no more breaking changes for v9 right
i think someone said theyre removing guild.region in v9 but that doesnt sound right
the client still uses it tho 
there doesn't seem to be any documentation about how context works in broadcastEval, I've spent the past hour searching and the only thing I've found is where the context should be placed, but not how to access it
passing a second argument seems to be the solution to this, but why is it not documented?
here are a few oddities with GuildInviteManager
-
#cacheis typed asCollection<Snowflake, Invite>, while it is actuallyCollection<string, Invite> -
it has
#resolveId(should perhaps be calledresolveCode?), and it just returns back whatever you pass at it as long as you pass a string- e.g. if you pass
discord.gg/djs, it returnsdiscord.gg/djs, if you passdjs, it returnsdjs
- e.g. if you pass
-
#resolveshould support invite urls as suggested by InviteResolvable, but it doesn't. it only supports invite codes
Why do I need the MANAGE_ROLES permission to edit the permissionOverwrites of a channel when I can create a channel with initial permissionOverwrites without it?
- A Snowflake is (correction: like) a string, so that's not totally inaccurate.
- resolveId is inherited from DataManager. I suspect it's meant to be overloaded in situations that warrant it, otherwise it's just a base method that's inherited. And the behavior you describe looks to be intentional.
- 👀
- Not really. A snowflake is a stringified bigint
noted, the second part of the point still stands
#6084 in discordjs/discord.js by Bluenix2 opened <t:1625850843:R> (review required)
refactor(InteractionCollector): only keep Ids of objects
📥 npm i Bluenix2/discord.js#patch-2
isnt this pr a major semver as it renames some of the properties
yes, but technically interactions haven't been released yet so shouldn't it be semver: N/A instead
it's still semver major i think 
its labeled as semver minor tho
so is there a decision?
can you find out if they'll run a migration on those messages?
they probably won't but I can ask
They should
So please do ask 🙏
I would guess they won't, based on the fact that old crossposts no longer return guild_id which is supposed to be guaranteed
current CommandInteractionOptionResolver implementation leaves subcommand options as a Collection and a tiny bit fuzzy to access them. Shouldn't they be adapted similarly?
What do you mean?
getSubCommand() is just a getter for the name, which is resolved at construction time
I've got an idea:
What if you could insert a filter function in the cachefactory to tell it that it should only cache what matches the filter
So (c) => c.isText() to only cache text based channels
In the file MessagePayload method makeContent makes the content an empty line only if the content was STRONGLY null. I assume you need to check for undefined as well.
Line: 110
https://www.github.com/discordjs/discord.js/tree/master/src%2Fstructures%2FMessagePayload.js
Definitely not - you want to be able to edit things that arent content without changing content
message.edit({ embeds: [embed] }) for example - you dont want this to change the content (which is undefined)
null is the correct way to specify something as intentionally having no value, hence editing out the content. Undefined is only the lack of its presence in the object
well right now you can only access subcommand options as <interaction>.options.get(subcommandName).options if im not mistaken, and you get Collection<Snowflake, CommandInteractionOptionData[]> instead of another CommandInteractionOptionResolver. Maybe an interaction.options.getSubCommandOptions() is too much, but different types between first and second options layer is weird
That's intended.
CommandInteractionOptionResolver#get() is intended to return unparsed option data. It's up to you to parse the subcommand options if you do it that way. The preferred way to use it is like this:
declare const interaction: CommandInteraction;
const subcommand = interaction.options.getSubCommand();
switch (subcommand) {
case 'foo': {// /command foo
await interaction.reply('foo!');
break;
}
case 'bar': {// /command bar <baz:string>
const baz = interaction.options.getString('baz', true);
await interaction.reply(`baz: ${baz.toUpperCase()}`);
break;
}
default: throw new Error(`Unknown subcommand: ${subcommand}`);
}
CommandInteractionOptionResolver#getSubCommand() returns the subcommand name as a string
Looks like you forgot to update https://github.com/discordjs/discord.js/blob/master/typings/index.d.ts#L3027 though because all the collection stuff was refactored back to arrays
This is totally up to you to do, since you can provide any cache class you like (as long as it implements the map-like interface) you can extend Collection and have it filter on add
⤴️ this. first option layer is an OptionResolver, but second (subcommand options) are still a collection. They should match
No, it should actually be CommandInteractionOption[]
Since the purpose of get() is to return "raw" data
I'll open a PR to fix that this evening
\👍
So in case of me somehow managing to do it, could i do a PR?
No I mean, it doesnt need a PR
Uh
Oh hmmmm
Can I?
I thought the cache classes are just object names
const FilteredCollection extends Collection {
set(key, value) {
if(filter) {
super.set(key, value);
} else {
// idk, something
}
}
}
const client = new Client({
makeCache: (manager) => {
if (manager.name === 'ManagerToFilter') return new FilteredCollection(filter);
}
});```
Thats a really rough example of what you could do
Hmmm
I thought about something like this
[...].makeCache({
MessagesManager: {limit: 200, (f) => !f.author.bot},
EmojiManager: {limit: 1000, (f) => f.animated}
})```
Idk the exact names
Someone with perms should probably review this issue, the comments are crazy https://github.com/discordjs/discord.js/issues/6136
wtf
Nobody online can right now
I don't know where to ask this but the property fetchReply for reply options isn't in the documentation. Is this normal?
https://discord.js.org/#/docs/main/master/class/CommandInteraction?scrollTo=reply
Wdym?
In reply options you have a property named fetchReply to fetch the reply immediately :
// First way
const reply = interaction.reply({ content: "test", fetchReply: true })
// Second way
interaction.reply({ content: "test" })
const reply = await interaction.fetchReply()
Ah yeah, you're right, this option doesn't seem to be in the docs
regarding #6143, I'm not too sure what a good solution there would be; interaction.options.options definitely doesn't sound too great. While their issue could be solved with a loop/helper function in their code, it seems like a use-case that would be useful to support. Maybe CommandInteraction#optionsArray: CommandInteractionOption[]?
Another thing that can be cool is to add the same thing for ClientApplication that for Client, something like :
type If<T extends boolean, A, B = null> = T extends true ? A : T extends false ? B : A | B;
export class ClientApplication<Fetched extends boolean = boolean> extends Application {
...
public owner: If<Fetched, User | Team>;
public isFetched(): this is ClientApplication<true>
...
}
@wild flax @tacit crypt thoughts on the issue above ^?
#6143 in discordjs/discord.js by Jiralite opened <t:1626688842:R>
Have stored values available for access for CommandInteractionOptionResolver
Would it be possible to have getSubCommandGroup() return null/undefined instead of throwing an error when the command issued doesn't have a sub command group? When checking if a received command interaction has one I would do:
if(<CommandInteractionOptionResolver>.getSubCommandGroup()) {
(...)
}
instead of something like:
let subCommandGroup: string;
try {
subCommandGroup = <CommandInteractionOptionResolver>.getSubCommandGroup();
}
catch {}
if(subCommandGroup) {
(...)
}
I'm using this to run certain code for specific sub command groups
That isn’t really the intended use case for it
Also there’s always the generic get method that doesn’t throw
I think the option resolver should have a public collection property, so that users can still use their own ways to handle options, like the issue mentioned above. What if I want to filter or map the options? I actually can't. It's like a collection with a really advanced get methods...
This went over me, thank you
which issue, sorry I'm like blind
#6143 in discordjs/discord.js by Jiralite opened <t:1626688842:R>
Have stored values available for access for CommandInteractionOptionResolver
@tacit crypt
Could just turn _options into a Collection like before
wait, right, options.options
uhhhh
.raw?
Might I just suggest .data or .raw?
.data as in, the data supplied to us
Or .raw if you really wanna go that route!
I was thinking like interaction.optionsArray
It's not really raw tho
It's already processed by us
eh, true
Or instead name it like a property we could name it like a function / getter :
interaction.options.toCollection -> return _options into a Collection like before
interaction.options.toArray -> return _options into an Array like now
We will avoid interaction.options._options and give the possibility to DJs user to use what they want
I agree, it would be really useful
I like the idea of toArray() since we could return a copy of the array
I also wanna suggest a rename of the methods? Right now, they are .get(), .getBoolean(), .getChannel() etc. but imo this feels kinda weird since discord.js relies a lot on Collections and using .get() returns undefined but .get() here returns null. I know they're not the same but it's still... weird to me.
What about renaming the methods to.resolve(), .resolveBoolean(), .resolveChannel() etc.? The managers across discord.js use .resolve() and also return null which is what the current methods do on CommandInteractionOptionResolver. Also there's "resolver" in the name so it kinda matches up.
Thoughts?
Not a friend
It’s not a collection
it's the Collections that are odd ones here and return undefined
and it's like that because Collections extend Maps by adding Array methods, and both Maps and Arrays return undefined. We just mimic those in Collections
Right ok theres one issue @bitter peak
👀
Def need a way to access all the options before they get transformed or anything
I used to do something along the lines of const args = [...interaction.options.values()];
which is obviously not possible right now
I can do _options for now I guess
But since its private, it will obv throw in TS
okay, which do you prefer:
interaction.options.toArray(): CommandInteractionOption[]interaction.optionsArray: ReadonlyArray<CommandInteractionOption>
or?
just make options public
probably
but that looks bad
interaction.options.options

call it data then
and we are good
interaction.options['_options'] won't throw
yeah but you know what im trying to say lol
ye ye
theres just no real way yet
id be fine with interaction.options.data
alright I'll add that as a ReadonlyArray
since data will probably be our key moving forward for raw data on structures
In DataManager class we have this :
export abstract class DataManager<K, Holds, R> extends BaseManager {
public constructor(client: Client, holds: Constructable<Holds>);
public readonly holds: Constructable<Holds>;
public readonly cache: Collection<K, Holds>;
public resolve(resolvable: Holds): Holds;
public resolve(resolvable: R): Holds | null;
public resolveId(resolvable: Holds): K;
public resolveId(resolvable: R): K | null;
public valueOf(): Collection<K, Holds>;
}
But when you pass a snowflake to resolveId (for example with ChannelManager), TS consider that you are on this function: public resolveId(resolvable: R): K | null; instead of public resolveId(resolvable: Holds): K;... so TS consider that the result can be null. So I wonder if it would be possible to change the typing to include the snowflake type in the first function like this : public resolveId(resolvable: Holds | K): K; so resolveId(<Snowflake>) return Snowflake and not Snowflake | null
It should be changed tots public resolveId(resolvable: K | Holds): K; public resolveId(resolvable: R): K | null;
Although we'll have to check for the extended managers, specifically emoji ones
Yes, that's how I saw it. But I don't have any vision on the internal code (didn't take the time to look at it) so I propose it like that to know if it's possible 🙂
@tacit crypt they said to use (data.sticker_items ?? data.stickers)
CC @wild flax
also 
for real?
wait
but it isnt backwards compatible is it?
it is
so you dont even need to change anything but do that?
sticker_items has partial sticker objects
yeah
then sure
@oak quail did you add the new error codes?
doing rn
👍
and i'll do the docs link thing
@oak quail youll need to like rebase or something
the lock file is out of sync
actually hold on
just merge https://github.com/discordjs/discord.js/pull/6147 and i'll merge it in
yeah
i dont have the new npm ver
I should have thought first
done
🎉
really close to release now
Although we'll have to check for the extended managers, specifically emoji ones
I just check all managers and I didn't see any problem with this modification. I'll look into making a pull request with the change (I've never made one) if no one sees any problems that this could cause 🙂 If someone wants to do the PR for me, don't be shy 👍
why are deferred, ephemeral, replied, and webhook on CommandInteraction and MessageComponentInteraction instead of on Interaction 🤔
Future proofing, there might be a type of interaction that doesn't use those response types
#6152 in discordjs/discord.js by Apokalypt opened <t:1626773214:R> (review required)
types(DataManager): add 'K' to type parameter of 'resolveId'
📥 npm i Apokalypt/discord.js-1#master
I hope I didn't make a mistake and did it right XD
#archive-voice from v0.5.1 to 0.5.4 newState.channelId changed to newState.channelID (Capital D) which is the opposite of what happened to discord V13. Is this right?
@fringe temple
can you show me where this is?
In JoinConfig, everything is cased as Id
In Sticker.js we have :
async fetchUser() {
if (this.partial) await this.fetch();
if (!this.guildID) throw new Error('NOT_GUILD_STICKER');
const data = await this.client.api.guilds(this.guildId).stickers(this.id).get();
this._patch(data);
return this.user;
}
!this.guildID will always be true because the variable has got renamed to guildId no ?
I just left my computer. But I believe if you do client.on(“voiceStateUpdate… and console.log(newState.channelID) you’ll see
That's unrelated to the new voice library, @tacit crypt ^
ah
Ye, issa bug
I can make a PR in few minutes to patch this little bug if you want
Sure
#155 in discordjs/voice by SuperchupuDev opened <t:1626783015:R> (review required)
fix(Examples): change guildID to guildId
📥 npm i SuperchupuDev/voice#main
my first pr here, tell me if i have to change anything
So djs issue? Or no issue at all?
Maybe we should take advantage of this PR to change the other xID to xId (e.g. interface ConnectionOptions) in the voice lib ??
just found it, it's just one file so i can change that quickly
one sec
nvm its better to just make a new pr
i have the code ready, do i make pr
@honest barn if there are other places in the voice repo to make this change, feel free to do it in the same PR 🙂
i will review it later today
when you posted about it, was it referring to the code in the examples?
i searched for id on the repo to see any mentions of ID
the only one was in Networking.js other than in the examples
and this has the changes of Networking.js
#156 in discordjs/voice by SuperchupuDev opened <t:1626786134:R> (review required)
refactor(ConnectionOptions): change xID to xId
📥 npm i SuperchupuDev/voice#refactor-connectionoptions
Will ReadonlyArray<T> work in a JSDoc comment?
diff --git a/src/structures/CommandInteractionOptionResolver.js b/src/structures/CommandInteractionOptionResolver.js
index ca0b1587..7d93b6cd 100644
--- a/src/structures/CommandInteractionOptionResolver.js
+++ b/src/structures/CommandInteractionOptionResolver.js
@@ -45,6 +45,15 @@ class CommandInteractionOptionResolver {
}
}
+ /**
+ * The array of `CommandInteractionOptions` managed by this resolver.
+ * @type {ReadonlyArray<CommandInteractionOption>}
+ * @readonly
+ */
+ get data() {
+ return this._options;
+ }
+
/**
* Gets an option by its name.
* @param {string} name The name of the option.
And, should this be return this._options.slice()? Or assigned in the constructor?
Why readonlyarray?
You already have the readonly tag
No. I did npm update and ran my bot. Then I saw it didn’t work and found out newState.channelId had changed to .xID
Don't use npm update for discord.js@dev, npm seems to go crazy when getting into parsing dev version (even tho this was supposed to be fixed??)
Use npm r discord.js then npm i discord.js@dev
But right now the property is channelId
https://github.com/discordjs/discord.js/blob/master/src/structures/VoiceState.js#L69
on my last pr in voice this workflow failed, do i need to change anything?
You can look at what went wrong with the Details
src/VoiceConnection.ts:337:5 - error TS2345: Argument of type '{ endpoint: string; serverID: `${bigint}`; token: string; sessionID: string; userID: `${bigint}`; }' is not assignable to parameter of type 'ConnectionOptions'.
Object literal may only specify known properties, but 'serverID' does not exist in type 'ConnectionOptions'. Did you mean to write 'serverId'?
337 serverID: server.guild_id,
oh im on mobile i didnt see it
ill fix it later fixed
yep, that fixed the issue. I also wasn't recieving messages, weird
ReadonlyArray doesn't have .push(), .pop(), etc.
@wild flax these two messages ^
What if we clone the array instead?
Like return [...this._options]
gave error on a different file, gonna fix
fixed
epic
👍
This would be the same as this._options.slice()
Yeah
The typing for the function Interaction.inGuild() ins't perfect because it doesn't change the typing for the channel...
Instead of :
public inGuild(): this is this & { guildId: Snowflake; member: GuildMember | APIInteractionGuildMember };
We should have :
public inGuild(): this is this & { guildId: Snowflake; member: GuildMember | APIInteractionGuildMember; channel: TextChannel | NewsChannel | ThreadChannel | null };
Are you agree ? (it will remove DMChannel and PartialDMChannel on possible types for channel)
should the set functions from Embed (builders) allow to pass undefined?
that's what isText is for. you also missed VoiceChannel on inGuild. could alway do both if (channel.inGuild() && channel.isText())
Sorry, I was not precise enough in my message :/ I'm talking about Interaction.inGuild() so VoiceChannel aren't possible
imo, we can have a clear<Variable> function..
sounds like more bloat
and just allowing set* to accept undefined would work fine
and of course all the field values are already public so a user could just do embed.description = '' so if anything, it makes sense to allow undefined or do nothing at all
undefined is ew. Maybe null
Maybe we need a ?undefined tag at this point tbh
no people just need to learn js
null should be used for the intentional clearing of a value
We've had this discussion several times over the past few days lol
Does anyone object to this change or see a possible error?
I don't know about providing the complete raw data @copper laurel @bitter peak
where else do we do this
Well we dont, but whats the point of this otherwise
Also its hilariously painful to work with
We were providing "all" the data in the Collection too
It had just been parsed into a different format
What is the point of what?
Okay let me rephrase - what exactly are we intending to provide in interaction.options.data
If its not the raw data, then what it is?
whatever _options is now
and whatever it was before where you just called options.values()
its perfectly parsed data, thats not entirely raw, but very easy to work with
and gives you all the freedom you want
if you want raw data, use the raw event
Right, I didnt see that we were still transforming the options, but still
Before the resolver PR, it was a Collection<string, CommandInteractionOption> of all parsed options, with subcommand data un-hoisted.
Now, in the current master, _options is CommandInteractionOption[], still parsed, no longer a Collection, and with the subcommand data hoisted up, since those have moved
So ignore the fact that I said raw - should it be with or without the sub-command hoisting is the question
maybe I just accounted for that when parsing it myself, but I noticed no difference in the data given
so I'm not sure where hoisting or not hoisting is a problem here
You can always check the type
The type is the same either way
Oh right, looks like my parsing just ignores it, since its hoisted now
You can also still get the subcommand using try/catch, if nothing else
Should it be
data = [{
type: "SUB_COMMAND",
name: "sub1",
options: [{
type: "STRING",
name: "string",
value: "foo"
}]
}]
OR
data = [{
type: "STRING",
name: "string",
value: "foo"
}]```
And make people use getSubCommand() to check subcommands
Well I don't see a problem with that, it makes it so you don't have to write recursion
That seems like a win to me
The latter?
I vote for the latter
k
Thats probably fine then
I have no sympathy for people who cry about an error being thrown when they do something erroneous
aaaactually
it did break my parser
I just didn't seem to notice
What part broke?
Yeah thats what I'm about to find out
Ah yep
its the subcommand part
yeet it
the easiest way would be going back to the nested approach
I already closed the discussion, we're sticking with the PR as is, right?
Kinda getting both signals here
Considering my whole parser exploded from the hoisting
making it impossible to detect if its a subcommand/subcommandgroup without using the resolver
its a bit of a problem
presume you have something like
restrict
-> mute
-> embed
interaction.commandName will be restrict
but you will never find out which subcommand it is
with using interaction.options.data
Well, we kinda figured above that you can just use try { commandName += ${i.options.getSubCommand()}; } catch {} or something a bit more elegant
oops formatting
using .options.data should allow you to completely opt out using the resolver methods
So in that case you agree with the former of the two suggestions monbrey posted?
Yes, basically reverting to the format it had before it was removed/modified from being a collection
Alright sounds good
Also, it should be an array yeah?
Not a collection
So basically the format it had when it was a collection before the resolver format, but as an array, correct
that should alleviate all our problems then
Alright, I'll change that this evening
I'll make .data a getter maybe
are we really scared people will modify it?
I don't think we should
imo options.getMentionable is pretty weird, since it has so many return types
meanwhile there are 2 methods just for user types
Yeah thats what I meant, I didnt realise we were still transforming options when I said "raw"
I see two approaches for that - getUserFromMentionable and member,role etc or supporting MENTIONABLE in all of getUser, getMember.....
are we still waiting for threads to be finalized before releasing v13? it seems that they aren't gonna be fully coming out anytime soon from dapi
the last thing we want is to release another major version because discord decided on changes to their threads api
why are getSubCommand and getSubCommandGroup functions 🤔
they just return a property, cant the property just be exposed
We’ve been over this so many times now
Is the 13.0.0-dev version collection dependency going to be updated?
would it be possible to get a build branch on builders similar to some sapphire repos?
It's probably possible to setup an @dev / @next like d.js/-types
@wild flax What if I made getSubCommand() and getSubCommandGroup() have (required=true) so people can do whatever they want if they opt-out
I think that keeps the best of both worlds
I explained why thats a problem
Theres situations you don't want to/can't use it
where you wanna work off the parsed data
It would be in addition to having the .data property tho
all youd need to do is de-hoist the sub commands and we should be good
Right but I'm asking if I can do both
I dont wanna bring in anther change thats unrelated to this pr
alright
if you feel its a good change, maybe make a second pr
👍
PR rebased and updated hoisting
idk if its a discord thing or discord.js thing
but
maybe add a button style called like
WARNING or somethin
and its yellow
Discord
So no
We can only give you the styles they provide
ah
i figured
im prob one of the very few thats asked that
Ah
Ok
Hi, I notice discord.js doesn't allow us to edit messages with empty strings. Why is that? Bots can edit messages with an empty string if there is an embed
because you should be editing content to null, no?
No, otherwise if (typeof data !== 'string') throw new error(errorMessage); would yell at you
works fine for me
I've tried it a dozen times on latest master and I get greeted with errors all the time (:
Simply removing the check discord.js has on Util.js on line 407 makes the edit
But that's not the fix either T_T
To be fair, I'm not on the latest commit, I'm still pre Id change, but I don't think the content has been changed since then
Okay so I learnt that you have to pass null instead of an empty string so it'll edit, and that'll make allowEmpty true, happy days
Should it not be "string or null" or something here then
it ideally should accept an empty string too
it used to work but broke a while ago
discord accepts empty strings tho
Yeah it looks like discord.js' utility method for verifying a string will yell at you for supplying an empty string, and it is used for checking the content when editing a message and sending a message. Looking closely, it seems that if we pass null to editing content, discord.js makes the content an empty string and skips validation of if it's empty. So that's why shrugs
We're sending across empty strings, just it's transformed from null to one
That’d break our strictness and proper errors, so that won’t happen
How come it has to be an array? Imo, going into the .data as an array differs from original behaviour, and doing .data.options which returns the same typedef but as a Collection seems a lil' weird to me
There’s no reason for it not to be an array
And data.options doesn’t return a collection
Huh, it says it does
I haven't tried it yet, was just reading the new documentation on it (': Will test it out to see
Ah yeah it returns an array but docs say a Collection, odd. In that case I'm fine with it I guess, but I guess docs should be updated. Typings seem to be done already
#6169 in discordjs/discord.js by Jiralite opened <t:1626952120:R> (review required)
docs(CommandInteraction): Correct type definition of CommandInteractionOption
📥 npm i Jiralite/discord.js#patch-1
@tacit crypt the overloads are reachable — I specifically wrote a test case for them in index.ts
huh?
Just saw, 👍
Can the defer method return a Message? Because on the docs options don't include fetchReply but typings do...
Looks like it can : https://github.com/discordjs/discord.js/blob/master/src/structures/interfaces/InteractionResponses.js#L54
JSDoc hasn't been updated
Mmh, but it's only a defer... if I use fetchReply, what Message will be returned?
thats because uh
sometimes you need to do:
await interaction.defer();
const message = await interaction.fetchReply();
with the option you can do:
const message = await interaction.defer({ fetchReply: true });
Getting this from a defer with fetchReply - so it appears to be working
its basically opt-in auto-fetch
Ok, so it's only an error in the docs
Thanks!
what is license of discord.js?
Apache 2.0
sorry for the naive question but... what is an info block? 
It's something our docs support, iirc its just <info>OwO</info>
so just
- * Note that this defaults to true, unlike the other `getX()` methods.
+ * <info>Note that this defaults to true, unlike the other `getX()` methods.</info>
```?
Or would that go in the method description not the param
That looks right but i don't know if we DO need to document that... @wild flax thoughts?
Ye
I wouldn’t
Whatever really
ok that's even easier
resolved
btw are there plans to go through and close all the old now-invalid issues?
Which?
Lol
https://github.com/discordjs/discord.js/issues/3890 - says it should be fixed with API v8
https://github.com/discordjs/discord.js/issues/3576 - probably a wont-fix (or tracked in discord.js-next?)
https://github.com/discordjs/discord.js/issues/4963 - doesn't look like it will be implemented; should be reclosed?
First one is def not fixed
https://github.com/discordjs/discord.js/issues/5337 - isn't this solved by the CHANNELS partial?
Maybe, we got no feedback
I’ll prolly close some of them for sure
But it’s not too needed rn
We aren’t in a position of 2 months ago or so with 90 open issues lol
fair enough
In what cases would ChannelManager#fetch return null instead of a Channel?
https://github.com/discordjs/discord.js/blob/master/src/managers/ChannelManager.js#L95
Also it makes the example a little bit confusing as it doesn't check if channel is not null to log its name
Right okay, got the answer looks like it returns null when discord.js doesn't has a structure associated to the channel type
@cerulean swan
here's why it may return null
See ChannelManager#_add behavior when Channel.create returns undefined
will
msg.channel.send("hi")be deprecated soon?(talking about on how u send messages)
not afaik
why would it
does message.channel.post sound better?
I guess since message.channel.send is so embedded now, it wouldn't make sense for a change
post 
No, it does not sound better
(node:13788) DeprecationWarning: The message event is deprecated. Use messageCreate instead
(Use `node --trace-deprecation ...` to show where the warning was created)
how does it detect where I used the message or interaction events instead of the messageCreate or interactionCreate events?
If you don't understand the magic behind, EventEmitter#emit returns true if there were listeners attached to the event, false otherwise
assumed so, ty for confirming
hello, so guild.owner is nullable and have to fetch it manually right ?
why dont djs automaticly fetch the ownerId and return fetched owner object to guild.owner ?
the library should not be making api calls for the user like that. you should be the one initiating it
why not ?
is it cause it takes 2 api request and could be a spam ?
Because you probably don't need to know who is the guild owner
Would be useless to fetch this data if you don't care
This has been addressed by replacing that getter with Guild#fetchOwner, which will fetch them from Discord if necessary.
aaa okay
The ClientUser class is missing the readonly presence getter, which is documented and it relies on Client#presence
fairly certain it inherited that form User, from where it was removed in https://github.com/discordjs/discord.js/pull/6055
Right
It should be readded in the ClientUser class now, so?
why?
Because it exists actually? 😂
I mean, it's in the docs (https://discord.js.org/#/docs/main/master/class/ClientUser?scrollTo=presence) but not in the typings
I'd say it should be removed if anything
Not sure what its supposed to be doing
Yeah, it's actually just a shortcut to the Client#presence property
yeah, imo that getter on ClientUser should go away
because Client#presence is quite something different than the guild propagated GuildMember#presence
also... isn't that a ClientPresence vs. a Presence anyways?
right, but doesn't really matter, because that extends Presence... weird spaghetti there
Wait, why is Client#presence private? 
because you should be using guild.me.presence
But you can also have a bot that isn't in any guilds, in that case you can't access it from guild.me
Internal sharding allows a client to yield multiple shards with different presences
so everytime the client starts, the lib caches a amount of users, do u guys fetch a random amount of users to do that or wut because i have a array of user ids and i want to fetch each user but that'll get me rate limited if i use a loop
structures are cached whenever we receive them via websocket payloads. users are included in a bunch of payloads that might cause a user to be cached
hm so is there anyway to fetch a array of user ids without getting rate limited
why dont you guys defaultly set button style to PRIMARY if there is no Button.setStyle setted ?
why would we
i think its better that way
wait..
if it defaultly setted to primary
someone would think style cant be changed
nvm then
hello i found a bug with TextChannel#bulkDelete but it is very unconsistant and i replicated it once(50 tries in same code and only 1 times) https://sentry.io/share/issue/f588648f85a54b439a6cbfb7dfcbeb72/#exception i can give you breadcumbs of sentry(all http requests node procces has made) if you want too i didnt want to make an github issue because as its so unconsistant it can be a code issue as well
That doesnt really tell us anything
Also this seems a rather odd... usage:
await message.util.send("abi ğ", true);
await message.channel.bulkDelete(4, true);
await message.channel.bulkDelete(1, true);
what do you expect here to happen? lol
I mean there’s a literal option called “setStyle” so
I’m kinda leaning towards the idea of setting that by default but idk
because i wanted to simulate my purge command(https://gist.github.com/ShockTr/2ede2d2c422739362a13939fceb9d600) it allows for message deletion upto 500 so it loops also it adds 1 more count to their requested amount for deleting the command message and i always get this error when deleting the last message. i know this is a bad practice but users will spam the command if i dont loop it
@haughty flame @sharp wigeon its not the job of discord.js to decide what the "default" style of a button should be. The API doesn't have a default, neither do we
it should be alright
Not sure if this is where I should be asking this but, if I understood correctly and <Collection>.get() returns a reference to the object in the <Collection>, and every operation I do with that object applies to it in the <Collection> aswell, how can I create a "copy" of a <Collection>'s object, to which I can perform operations without affecting the original object in it?
Collection.clone() ? iirc, but I am probably wrong
well, if the question is how to make a copy of a single entry element, yes, that's wrong
yep
copying structures isn't really a topic for a library development channel
whether or not an entry is stored as value or reference depends on if it's primitive or not, non-primitive values would need to be deep-cloned if you want to not modify the stored structure (sometimes via Object#assign, sometimes preferably by using the structure's constructor, largely depends on the structure)
Okay thank you and sorry for asking it in the wrong channel
No, it shouldn't. Libraries should not be opinionated and make these decisions on behalf of developers. We correctly reflect Discord's behaviour, thats all.
It was a joke 😦 but yeah I understand
Then I'm going to warn you again to keep this channel on topic. Right there in the topic, "serious discussions"
si senor
@oak quail I disagree with you on the options
Making a new property object with arbitrary values on it got resolved “targets” with no resolver is way worse
Context menus are just slash commands with no args
They still give you resolved values though
If they add more options in the future, that'll probably be a major semver anyways, so I don't think we need to account for that rn
It also splits up parsing logic lol
It wont be major with the current implementation though in theory
Cant access that link, so no idea what youre saying
same
Yeah I don’t see how that’s relevant
What does that have to do with options?
crol can you repost
Why does it matter?
No I can’t
well they said that they might put those in the options field
I don’t know what the availability of this info is, so I can’t
so wouldnt that conflict with the fake options
No why?
You’d just write logic to support that additionally
Since that feature won’t only be on context menus
Thatd be kinda silly
Aren't underscores invalid in option names? If so, I see no reason why not to use a fake option with an underscore
The naming restrictions might get lifted anyway
Also options with an underscore don’t make too much sense
wdym?
i just dont like the idea of making fake options
discord gives it as a separate property
wouldnt this basically be like storing channel metadata in fake messages
maybe interaction.options.getTarget()?
To match the rest of that class
Target what
hm
User and Member is still separate
so getTargetMember/User/Message?
Terrible
Just terrible
Also it’s our job the make this bad interface discord gives us in a good one
that would be much better than getMessage('message')/getUser('user') and getMember('user') imo
And if that means “fake” options, I’ll take it
How so
Are context menus kinda like buttons but for use on members and users rather than messages?
Bruh, it’s a context menu
What’s there to explain
You right click
Yeah but there are many types of context menus
Ones on messages, guilds, members on member bar, on user profile, channels, categories
Yes there’s currently ones for users and messages
Yeah that’s what I meant
Will this be handled by a ContextMenuInteraction class or reuse the command one?
If there are no arguments like how buttons work, why not treat them like buttons?
in the pr, its just in CommandInteraction
Instead of additional fake options
so like interaction.message?
Maybe if we had it as a separate class this would be easier. We could have interaction.targetType = member | user | message etc. and interaction.target
No
That’s awful still
It’s not member OR user
It’s member & user OR user
Yeah that makes sense
That’s just type fuckery then
PR is a draft and there are changes I havent pushed yet
But you could do member.user
Thats literally why drafts arent ready for review
Its going to be subclassed
Yeah
No stop that’s not even how the resolver currently works
Also theres no member if its from a DM
Oh ok true
Everyone making opinions based on code that is going to change anyway
Forgot for a sec that GuildMember was its own thing
I think we have a pretty good idea how to move forward with it ourselves
I'm just struggling to think of ways to implement this, I only skimmed the code in the PR
And it will 100% involve the resolver
We aren’t going to not use it
oh yeah sorry that PR for the resolver was so messy
The resolver is fine tbh
Yeah all good it looks like you have a clear idea anyways from what you were discussing. I’m just confused what the fake options thing was about in the discussion though
the resolver is good except for the MENTIONABLE handling imo
What's the issue with mentionable?
- getUser: User
- getMember: GuildMember
- getMentionable: User | GuildMember | Role
Isn't that literally what the docs say tho
mentionable gets resolved into one of those anyway
They don’t put it under resolved.mentionable
Lol
I think the argument is that getUser() should work on mentionable too
On a role?
Wat
- getMentionable: User | GuildMember | Role
I think the argument is that
getUser()should work on mentionable too
for USER args its like "use the method for the object you want" and for MENTIONABLE args its like "fuck what you want, i'll just give you something"
I mean I guess I get it. You can’t know what it is, so you need manual checks anyway
Not sure what’s there to improve
well no, not for role
getRole() should exist for that
or something
If you call getUser you are kinda fucked
But how do you know what they put?
You don’t 
check which resolved object its in?
you dont, but you never had an issue with resolvers returning null/throwing before now
Advaith
How do you as the dev know
You give them a choice
You have no idea without checking yourself
You can’t just call getUser and know they supplied a user lol
They might as well supplied a role
The way it is rn is 100% typesafe, any change would also need to be as such
The only real usecase I can think of for MENTIONABLE is something like permission overwrites, which means it doesn't matter which of the two it is
Otherwise the dev should have asked for a User anyway
X
Souji has some weird commands that use mentionable
And based on the type do different things
getUser(name, required = false) {
const option = this._getTypedOption(name, ['USER', 'MENTIONABLE'], ['user'], required);
return option?.user ?? null;
}
``` I think this is the suggestion right?
Didn't that array get converted to a string
We can allow that, but I don’t think it’s the best approach honestly
does souji use getMentionable?
This isnt the real code, its a mockup of the suggestion
It feels like this will backfire on a lot of people
Which is why its an array
That would also be confusing to document IMO
so how exactly would you use getMentionable
instanceof checks?
most likely
just using get() and then checking the presence of .role or .user would probably be cleaner tbh
I don't think you can check for key presence in typescript
what
why wouldnt you be able to
oh nvm
I remember it erroring with something like Property "username" cannot be used on type User | Role, Property "username" does not exist on type Role for example
but I guess it doesn't
Thats different, where one type definitely cant have the property, while on a resolved option both are just nullable
shouldn't this pr be in the done section?
Moved, thank you
this one is in the in progress category too but it should be moved to review in progress
That's automatic
i see
if interaction.options.getMember(...) can be a APIInteractionDataResolvedGuildMember how are you meant to get its ID, since there is no id property on that type 🤔
probably by grabbing the user
or does that not have an id on it either
probably not, lemme check
ah well the user does return a full user object
so that would have an id
should the internals assign the ID to raw member data though? for convienence
no
lol
🤷♂️
Would it make sense to have a MessageEmbed.setFields() method? I saw someone talking abt this in a support channel earlier today and it would be relatively easy to make and really helpful as well
Could also add a shortcut for setting 1 field called .setField that would work like addField but would replace all existing fields
MessageEmbed#spliceFields should already cover this, no?
well yes and no, that applies to when you wanna remove a specific field or replace it (although you can extend this to all fields). These methods would completely overwrite and seem easier to use
splice is just a more powerful version of that
yeah but there's a set method for every embed property, why not fields too?
setDescription, etc is because there's only one of those per embed, not so for fields
Yeah but I feel like if you wanted to overwrite all your fields this would be an easier way
ill make the PR and leave it up for the reviewers to decide
okay then ¯_(ツ)_/¯
I thought about it too, like a resetFields or something, but like you can use Embed.fields = [] or assign it your array of fields?
embed.spliceFields(0, embed.fields.length, newFields)
Yeah, would be best to maintain the reference to the array with .splice
wdym the reference to the array?
Array#splice just removes elements from the array, but it's still the same object. Reassigning it with = [] would overwrite the object with a new one.
but there's no difference if you wanna overwrite all fields right?
const fields = embed.fields;
embed.removeAllFields(); // this.fields = [];
fields.push({ /* ... */ }); // fields is now not the same variable
embed.fields.length = 0 done
why would we need an api for that
souji what
why would you overwrite the length property of an array
lmao
Because thats how you remove all elements from an array
MessageEmbed.prototype.resetFields = function() {
this.fields.length = 0;
return this;
}
Here, make some discord.js-utils package

awful awful language
discord-api-types 0.18.1 has no deprecation message, is this intentional?
Im not sure what you mean exactly
Where/why are you suggesting it needs one
Just bother vlad about it
is this intentional?
could use interaction.channelId but its annoying that you can't just do interaction.channel
Seems intentional to me, even if Channel was made stricter you still wont be able to pass PartialDMChannel to that method
That's cause I fucked up some deprecations when I was trying to deprecate alphas and my shell said "lol no". I'll fix today
lmao aight
btw it should probably be bumped on discordjs/builders since that's where i got that warning from
Pretty sure I bumped it already, just that @wild flax didn't publish yet
Has been fixed
yeah I see, just hasn't had a release in almost a month, ty!
I was referring to the deprecation messages
ah ye i see that too, noice
I was looking at Message.embeds in master and I saw that it was an array but in almost any other array-like property it is used as a collection -- is this intentionally an array or just not decided?
Intentional, since there is nothing to key them by.
mock unitintegration testing
I don't know if it's could be useful but maybe we can Improve typing by adding something like that :
type If<T extends boolean, A, B = null> = T extends true ? A : T extends false ? B : A | B;
export abstract class Application<Fetched extends boolean = boolean> extends Base {
public constructor(client: Client, data: unknown);
public readonly createdAt: Date;
public readonly createdTimestamp: number;
public description: If<Fetched, string>;
public icon: string | null;
public id: Snowflake;
public name: If<Fetched, string>;
public coverURL(options?: StaticImageURLOptions): string | null;
public fetchAssets(): Promise<ApplicationAsset[]>;
public iconURL(options?: StaticImageURLOptions): string | null;
public toJSON(): unknown;
public toString(): string | null;
}
export class ClientApplication<Fetched extends boolean = boolean> extends Application<Fetched> {
public botPublic: If<Fetched, boolean>;
public botRequireCodeGrant: If<Fetched, boolean>;
public commands: ApplicationCommandManager;
public cover: string | null;
public flags: Readonly<ApplicationFlags>;
public owner: If<Fetched, User | Team>;
public readonly partial: boolean;
public rpcOrigins: string[];
public fetch(): Promise<ClientApplication<true>>;
}```
Didn't we already have this discussion a few times lol
For Client
But not for application
Ha maybe but I don't remember the answer XD
https://github.com/discordjs/discord.js/blob/master/typings/enums.d.ts ts imports these and compiles thinking they are actually exported, should this be changed to only export them as a type?
because they are only ever used as a type
Both of these have the warn tag but only the first one displays as a warning, does anyone know why? Link: https://discord.js.org/#/docs/main/master/typedef/ThreadAutoArchiveDuration
Yeah, its an error on the site side, I mentioned it a bit ago. It doesn't like the two warn tags in the same description
could it be because they're inline with the duration or is it unrelated?
should we make ApplicationCommand#description nullable now, so there isnt a breaking change later?
oh nvm, i forgot they'll change it
so is v13 gonna release requiring the CHANNEL partial for receiving DMs or is that gonna be changed?
I raised the same, but there isn't exactly a nice way to not require it without introducing the possibility that message.channel is a partial on every message
is that so bad
The change would be something similar to how interactions handles it with interaction#channelId and get channel() I guess, however right now without the CHANNEL partial its just null
We could do that, and if the partial isnt enabled, the channel is null on message
Or drop it entirely, and just include that as a type I guess?
according to guide, partial structures are to be assumed not working, so technically message.channel.send couldn't be used without fetching
Probably would work though since it has the id
I know there has been discussion before about removing dumb helpers, and frankly resolveId feels like a very very dumb helper? https://github.com/discordjs/discord.js/blob/9cd5e7ed6104e40c038d17456abd0cc4a3778b9e/src/managers/DataManager.js#L50-L54
resolve isn't much better either, but does interface with the cache at least
It's not a helper at all, both are used quite a lot internally
The reason I bring it up is because it came up in a convo I was having with someone where they were expecting it to be able to resolve way more in terms of types
Could argue for making them private _resolveId
Not sure what they thought it would do though
That'd make sense to me if they're needed internally
They were expecting it to be able to resolve strings to snowflakes, but the typings don't allow that
In most managers, its literally either is a no-op on the snowflake you pass, or returns the snowflake for an object
I mean, I don't think it's documented to suggest it does that anywhere
Because it doesn't accept strings
Its not, for sure, but when you see resolve one might expect it to able to resolve more types
Cause as an end user, it feels very pointless as a function in its current state
I mean sure, but if it feels pointless don't use it?
I don't think we really ever encourage it's used in guides or anything
Oh yeah for sure, just somewhat feels like a trap to have it there given how little it does
Making it private feels sensible to me
agree, #resolve is rather useful as .cache.get(..) alternative, but resolveId was even confusing when i first looked into it because it just forwards strings and such
private seems quite fitting for those, tho if not documented that might actually be private enough as well
Hi hi! Quick question, I notice the documentation uses "subcommand" and "sub-command" in places and to save my sanity, I wish to make these consistent (the same) so... should we be saying "subcommand" or "sub-command"? It should also match the guide's preferred style, but I don't know if there is one yet (or a preview of one)
subcommand and subcommand-group as per dapi docs
https://discord.com/developers/docs/interactions/slash-commands#subcommands-and-subcommand-groups
Nice nice, thank you! As a sidenote, now I'm gonna be haunted by this 1 small result (':
time to PR to dapi i guess 
Just to clear it up, it should be "subcommand group" and not "subcommand-group" right? The only instances of "subcommand-group" I can find is when they use it for an example for command names which must match the regular expression^[\w-]{1,32}$
https://discord.com/developers/docs/interactions/slash-commands#nested-subcommands-and-groups
oh, right, yes
@wild flax @opaque vessel related to your PR, I don't know how to feel about the rename of SubCommand to Subcommand
Its 1 word
No it ain't
sub isnt a word though
Well, I also don't like seeing "sub-command" and "subcommand" being used in several places in the documentation :thinking:
subcommand is a single word
Yes, it is one word.
sub command 
We have to pick one, so uhm... which one do you all want to agree upon then?
Oh good more breaking changes in -types
fuck
that said - this does make more sense to me so im for it nonetheless

Jiralite, for free PR, discord-api-types, SubCommand -> Subcommand
Tho..
Discord types it as SUB_COMMAND
So
not sure how thats ever been a concern?
other than properties that reflect raw data of course
Don't care much about types, they can stay if need be, but the word itself
Its a concern because usually converting from snake case to camel or even PascalCase, every immediate letter after a _ gets uppercased
So for stuff like Routes.registerSubcommands we should change it
And yeah, I would just go with Enum.Subcommand
But that's inconsistent with discord
The enum doesn't even represent discords data
Its literally just enum convention for enums
^
Talking about their docs/clients, where they use upper_snake_case, we use PascalCase in -types so... I'd rather stay consistent with that there
In docs sure
It's the same when using Permissions.UseSlashCommands not representing USE_APPLICATION_COMMANDS
lol
That's cause someone ignored that review in the pr
Yeah but I'm just saying
its just a name
It doesn't have to be a 1:1 mapping, esp not when its about proper english
At least for the documentation, since Discord documents it publicly as one word, we should use one word there
For the internal methods, I don't think that really matters
For methods that are not private... guess that's the tricky one T_T
I'd just go with Subcommand and call it a day
It's not gonna break anyones neck, nor confuse anyone
isnt #6192 need to be a semver major as it changes parameters of the constructor or i am mistaken
Any reason why a ThreadChannel doesn't have a fetchOwner method?
Is there data that comes from the API that points to the owner?
yeah there's ownerId
can be missing tho somehow
i don't think it should be marked as nullable
its nullable
Super sorry, but I'm not really familiar with that repository, so if you don't mind doing it or someone else doing, that'd be wonderful!
interactions are annoying in that (partial channels)
but you shouldn't mark a property as nullable if it's only missing in partial channels
Yeah you should
Its alright haha, thankfully TS would make it easier (clone, npm i, find all references of subcommand (in all files outside of the deno folder), f2, new name, vsc does the rest), but we can do it later. Can you at least make an issue so we don't forget? 🥺
why tho? Something being partial means that all of it's properties can be missing (talking about the docs btw, not types)
Because not everyone uses typescript
Lol
You get a struct as a partial, its not marked nullable on the docs, you assume its not
Now your application explodes
Will try (:
fair
but going back to the main topic, should i add a fetchOwner method to threadchannel?
you're trying to fetch the member object for the owner right, cause you can't fetch the thread member
well I didn't know that but in that case yeah the member object
Since we can't fetch members, should a getter be added for the owner thread member object that gets it from cache?
#6207 in discordjs/discord.js by ImRodry opened <t:1627509823:R> (review required)
feat(ThreadChannel): add owner and fetchOwner()
📥 npm i ImRodry/discord.js#thread-fetchowner
did it anyway
We generally don't have an owner prop anymore
not even on guilds
bump, is this a good idea or no?
I know but that's because you can fetch the guildmember object of an owner. I decided to add it here because you can't do the same for thread members
Seems kinda useless though
You would STILL need to do
let owner = thread.owner;
if (!owner) owner = await thread.fetchOwner();
lol
Might as well fetch in the first place
Fetch doesn't fetch anyway if its in your cache
that's not really good practice to have two different types in a single variable
How?
It does by default now? fetch force is default true now?
No
well ts thinks that djs exports the enums
but it doesn't
Only on structures
not on the manager fetch method
ah right
so it would make sense to export them only as types
I mean if you can fix it, without breaking everything
i ask because im unsure why that wasnt done in the first place
And them still being exported to be used as a type
We broke typings a lot trying to "fix" them
and it was never worth in the end
ah
@outer raven I get your point about different types, but having both an owner and fetchOwner() property that return different things isn't any better. If owner is null, you'd fetch expecting to get that type... and then not get it
Well I don't know any scenario where the owner wouldn't be cached and Discord doesn't allow us to fetch a single thread member so what other option do we have?
RoleManager#fetch for example can't fetch a single role either, it fetches them all then gets the one you asked for
I thought of that but didn't know you'd want that to be done. I'll update the PR with that and remove the owner getter
I don't like that because it requires members intent to fetch a single member, which isn't something people are used to
we can add that as a warning
We don't really have any warnings based on intents
Thatd be very out of place
I mean we could go with the nullable cache getter too and not fetch
I just think having both, with those naming conventions, returning different types is yuck
yeah but then its dumb too
the owner may be null and then you have to manually go with members.fetch() lol
and considering we alr removed the owner prop on guild to avoid the annoyingness of that
wed just back at square 0
any reason for this?
Dunno, I don't think its too feasible currently
Lot of work, especially with v13 on the horizon too
Prolly needs to be another component on the docs website too
So we can do <Intent></Intent>
so its displayed nicely
could add that later but for now a warn tag works doesn't it?
So you can update the whole codebase?
Lol
wdym
Well its either all or nothing imo
Adding it now in one place is not the way to go
i guess you could open an exception since this is a privileged intent
or just no warning at all
i got the code working, just can't test it cuz i dont have threads
Stemming of that exported enums discussion, Im looking at the fact that although we do document the exported typedefs in the Constants file, we don't actually document Constants itself, which means nothing in the docs suggests that people can do things like Constants.MessageButtonStyles.PRIMARY for example
Which is the alternative JS way, since the enums arent exported
I mean users could always do with (Constants) { /s
So I figured I'd document the Constants object, but then I run into a different issue - differentiating between the enum-like typedefs, and the ones which are just string arrays, eg Constants.MessageTypes which isnt one
Maybe an Enums object?
Enums.MessageButtonStyles.PRIMARY
Yeah, or I just dont document the ones that arent used in an enum-like fashion?
#6208 in discordjs/discord.js by monbrey opened <t:1627513177:R> (review required)
docs(Constants): document the Constants object for enum-like usage
📥 npm i monbrey/discord.js#constants-typedef
the soloution for the enums could simply just be export const enum ...
https://www.typescriptlang.org/play?#code/KYOwrgtgBAglDeUCGAaKAjNBjKBfAsAFBYD2IAzgC5QCWUAvLAHRIDcRRpF1okUAQgmRpMUHAWJkqUAFYMBLdoSJA this is how it behaves when compiled
cant do that
we tried
whats the issue with it ?
i tested compiling i didn't find any errors
oh
hm this one is very puzzling
Which is why I've now does the PR to document the Constants object, since thats the JS way of handling this
Why does the <ThreadChannel>.delete() method accept a reason?
Because the channel delete endpoint supports it?
Does it? I don't even see a log when I do that
the only thread delete logs I have are only from when I delete it
is there a reason we dont put descriptions in typedefs?
Presumably because most don't need any
Would be nice to have since vsc can pull them in
Typdefs != types
Mm.. looks like we can fetch guild previews even if the bot isn't in the said guild
Wouldn't that be convenient to have something like GuildManager#fetchPreview (or Client#fetchGuildPreview, no idea)? As of right now we can only fetch it through an existing guild instance
And if so, would the logic code behind go to
and Guild#fetchPreview would just call that new method, or should both keep their separate code logic (even tho there would be no difference?)
I'm gonna get glasses soon (:
Does anyone know what WelcomeGuild https://discord.js.org/#/docs/main/master/class/WelcomeChannel?scrollTo=guild is supposed to be here? I also cannot find any typings for it so I'm very unsure...
lol what
@unique axle ^
nvm
I just found that out :D Managed to get it like that as so, will try to correct it :eyes:
#6222 in discordjs/discord.js by Jiralite opened <t:1627557349:R> (review required)
docs(WelcomeChannel): Correct guild return type
📥 npm i Jiralite/discord.js#patch-1
Shouldn't the <Message>.startThread method accept an object like <ThreadManager>.create does? This could create some issues if more parameters are added in the future
Are we getting a v12.5.4 to allow bots to read messages from threads?
currently they wont see messages and therefore commands and text moderation are no longer working inside of threads
Basically, people saying n word in threads to bypass chat filtering
not possible really
events for threads are only sent on API v9
Damn
v12 still uses v8, and it's not really possible to move v8 to v9 in a patch or a minor
Yeah that's understandable
v7*
eh, doesn't change the answer
and v7 is v6 anyway :)
Yes, both are deprecated versions
While v8 is current and v9 is latest
And what v9 adds ?
Threads
bump
why not make a thread
was waiting for the person who replies to do that
then you do it so it exists already instead of it not existing until someone decides to answer you
fine
Possibly change Message.startThread to accept an object instead of 3 parameters
@vernal atlas removing the assignment to this.target will break it more
no?
i meant not assigning the promise itself to this.target
Yeah, that
since the build method awaits all entry.target
and now you have a dangling promise thats never properly awaited
oh mb
will fix
Thats why I asked you if this still works 
test it
works
Since https://github.com/discordjs/discord.js/pull/6186 got some backlash, would it be preferred if the function uses spliceFields internally instead of reassigning the fields array?
yeah probably
aight, will do that
i still don't see much if any utility in that method existing at all
spliceFields isn't intuitive for most users and most would prefer to just replace all fields when they need to, instead of doing what we're doing internally
then you can still do embed.fields = or set the length to 0 to clear it and re-populate it
if you wanna go that way then why do all of the MessageEmbed methods exist?
obviously not saying they should be removed, they're just utilities that makes everyone's lives easier when building embeds and this is just another one
i don't get why setFields would be useful
just make a new embed
if im being honest i dont see the use case for it either
what if you wanna keep every other property in the embed and just change the fields?
thats a good point
useful in a pagination system, where every property stays the same and the fields change depending on the page
with this you can keep the same embed variable and just run a function that applies your fields, which is what I've done
then you can still do
embed.fields =or set the length to 0 to clear it and re-populate it
if you wanna go that way then why do all of the MessageEmbed methods exist?
hmm makes sense
yeah youre right
https://support-dev.discord.com/hc/en-us/articles/4404772028055 Discord is becoming lame on purpose?...
No, its a good change.
Also not library related
Shouldn't DataManager#cache be readonly on the docs?
nevermind my question i just posted, i was being dumb
What makes setFields() different from spliceFields(), other than removing the index and deleteCount?
that's exactly what it does. Splicefields is used when you want to remove some fields. This method is a shortcut if you want to replace all of them
and spliceFields is not intuitive and new users are usually afraid to use this from what ive noticed
I disagree that it's not intuitive. It's pretty much exactly a basic Array method from core JavaScript
New users need to learn
that's true, but having to use splice when you want to overwrite doesn't seem intuitive at all and people won't look at that immediately
they also don't do that for arrays, but i don't remember any Array.setValues, maybe apart from fill
I've been trying to use makeCache option to reduce guild member cache. But it seems I can't set a lower value. As soon as you hit the limit, it removes the first cached member even if the member is the client. At that point most commands breaks. (e.g. can't check if the client has X perms).
Why does interaction.reply() not return with the reply Message?
because discord doesnt give us the message data back
I don't think that's a good idea. This option was given to reduce cache cacheWithLimits({ GuildMemberManager: 10 }) but you can't set any lower value at all.
Just because you can doesn't mean you always should
it makes sense to be able to limit it without it removing the client user
Whats this arbitrary 10 value here
No offense to whoever wrote that feature, but is it really a good idea to let people play with everything's cache limit? Looks like people are trying to reduce it at most without really thinking to how useful (and important) caching is, thinking also they can save a gigabyte of RAM having only 10 members cached at most? 
Or at least, put a big warning in the guide against how delicate this feature is, and that only "advanced" developers should be playing with it
people have developed tons of third party packages just for the sake of cache manipulation so we're just giving them what they want in the main lib
shouldn't be playing with fire if you don't know it burns
That's just an example to explain my words.
and that's exactly what I was trying to say.
Does someone know why the buttoncolours are named so unsual?
wdym so unusual
That's how Discord calls them, not a decided by discord.js
Think they mean primary, danger etc instead of blue grey or red
yarn outdated flags dev tag as outdated
shouldn't it be interaction.author.id instead of interaction.user.id ?
like msg.author.id
I was also wondering that, but I'm not very familiar with the naming thoughts in the API. For now I just use this message.author?.tag || message.user.tag
Makes sense for me cus it’s the user who runs the interaction
Idk
discord.js follows Discord terminology
They talk about a message author
and an interaction user
Can I get a response on #870267529321410560 please
I think it's important to do that before v13 arrives, if we do
just make a PR then
alright, sure
@spiral fulcrumthis will fix your issue hopefully: https://github.com/discordjs/discord.js/pull/6242/files#diff-d165f056c558947125ae776c833631ced37a87837b0ce367a255df13c1c10431R15-R22
It will, thanks.
should i update the example in the readme to a slash command?
probably copy the example from the website* yeah
nevermind it's the same lol
i would have sweared to have seen an interaction example
yes, the one from the website used interactions
it was just removed completely
prob because people thought it'd work out of box without any slash command creation? 
Yeah
And it’s too long otherwise lol
So i at least removed It from the front page for now
#6250 in discordjs/discord.js by SuperchupuDev opened <t:1627720282:R> (review required)
docs: change example in readme to slash command
📥 npm i SuperchupuDev/discord.js#readme-change
do i update the example in the website too
no that's actually intended to have reverted to message example
this example should then include the deploy code, but that would be too long
because that won't work out of box for a freshly created application
however client.on("message" should be turned into client.on("messageCreate" (on the website at least, readme looks fine)
in the guide the creating your bot section doesnt have deploy code either nvm it doesnt have the code but it has a warning that links you to that
also, message based commands won't work after april 2022 without enabling the priviliged intent, so it wouldn't work for a freshly created application
imo the example usage needs to handle creating a command too
otherwise its worthless
but then it would be using a text based command again for deploying
no, why?
at least in the guide it does that by making a !deploy command
I highly doubt that
and making it create one on ready would be potentially bad for ratelimits if the bot is restarted a lot
that's nitpicking but message.content can be null
Can it?
Anyway, scroll down on the guide
if that question was for me, yes if you just send a file it will be null
hmm, i see it's a separate script for deploying
Hey @solemn oyster can you undo that commit on my PR? I don’t think that should be changed
Talk about timing
The change was requested for 4 hours and you reply 2 minutes after I make the change
I literally just woke up
It does fail the CI too though
Gonna revert with force-push
