#archive-library-discussion

25085 messages · Page 20 of 26

wild flax

Update jest

Jest has support for this

pine python

yeah i just found the release where they added support for it as you sent that, thanks for the help guys

outer raven
tacit crypt

The only difference will be that if your nickname is everyone, it will ping. Nothing else. Roles will use their names, users will use their usernames, members will use display names

outer raven

What?

Doesn’t clean content output the mentions with their ID?

tacit crypt

...no?

cleanContent getter calls Util.cleanContent

It has always called that method in fact

outer raven

Hmm ok

outer raven

Will there be no more 13.x versions?

solemn oyster
outer raven

When attachment options and modals come out?

solemn oyster

Not sure, we don't even have an internal ETA for it (while we do for v14 👀)

visual hornet

If v14 happens to work out before 13.5, those changes would all just get squeezed into 14.1, right?
Or would you want to wait to put them in with v14

tacit crypt

v14 won't happen that soon where you'd end up with the 13.5 turn into 14.1, so don't stress about that

outer raven

How soon do you expect it to be though? (If you wanna share that ofc)

visual hornet
tacit crypt
outer raven

Exactly 1 semver major release away 👌🏻

tacit crypt
worn bobcat

setAuthor string params are deprecated. Why not do the same on setFooter?

outer raven
visual hornet

setFooter doesn't have 2 optional parameters like setAuthor does
with the author, you could have a url without the icon, but to show either you'd just need text, so both of them are seperately optional
with the footer, you only have the optional icon, which is dependent on the text being there

opaque vessel
pulsar phoenix

They should add a timeout() function for Guild#Member

trim vigil

Why do you get a warning in console when not providing a token upon client.login()

It defaults to DISCORD_TOKEN so why does it error?

opaque vessel

I don't do that and don't get a warning, ever. You're doing something wrong

Ask in the support channels

outer raven
trim vigil

It is and it successfully logs in, it just throws a warning

outer raven

what warning?

@trim vigil

trim vigil

I don't think it works anymore because I just get an error now that says a token must be provided

outer raven
trim vigil

I had it setup properly

It got removed from the docs so it probably got removed

visual hornet

you have to have the env var set before instantiating the client, perhaps that couldve been it?

vernal rose
solemn oyster

Doesn't matter, those test files are quite useless and should be replaced with unit tests

vernal rose

Oh ic

outer raven

Is there a type guard that turns all interaction reply and editReply return types into Message classes but doesn't require them to be sent in a guild?

dawn merlin
outer raven
dawn merlin
outer raven
dawn merlin

@burnt cradle I just realized that typescript allows this combination for autocomplete getIntegerOption().setAutocomplete(true).setName('test').addChoices([]);

I don't know if there's a way around that

burnt cradle

Yeah I don't think this propagates the restrictions it previously had on it, so setName returns a full option to ts

But that's why runtime checks exist anyway so ¯_(ツ)_/¯

dawn merlin

I’m questioning the benefits of the static typing here then, if it can easily be worked around I don’t think it’s worth the complexity

CC @tacit crypt

tacit crypt

What

Do you have to explicitly set the return type to this?

dawn merlin
tacit crypt

Wack...

ruby terrace
dawn merlin

Yeah but it’s unintentional from our types. And it kinda invalidates the way we set types up in builders

loud blade

why was, setAuthor() was depracated, while addField() remained the same.
Shoudn't be addField take EmbedFieldData as well for consistency?

opaque vessel

The method isn't deprecated, just how you use it is

addField() doesn't have optional values

loud blade

what I mean is in the arguments obviously, sorry for the misleading info. But what I meant is the values

opaque vessel

Actually in the next major version, addField() will take an object as a sole parameter

loud blade

addField() has inline as optional.
and another thing is, why addFields accept a single EmbedFieldData option, if addField can obviously accept that, where in addFields should only accept an array for consistency.
I mean they did change the setAuthor in 13.5.0, so I actually hoped the addField was also changed so people would just do a single refactor on a single semver minor release.

oak quail

addfield only has one optional param so making it an object isn't needed

making it an object is useful when there are multiple optional params

loud blade

though since addFields accepts an EmbedFieldData, I think it also makes sense to add addField to accept an EmbedFieldData

and depreciate the old parameters options, so its either a single argument, or an object with multiple params to make message embed consistent.

solemn oyster

Yeah, we'll switch without deprecation I guess, it's unlikely we'll have a 13.5.1 (or a 13.6.0 for that matter), as we're now working on 14.0.0.

strange cedar

What does the roadmap look like for 14.0.0?

dawn merlin
oak quail

and i dont see any previous discussion of this, or an issue or pr

ruby terrace

switch to builders

dawn merlin

Objects are easier to add onto, without creating long parameter lists. They also have “built-in” labels for the arguments.

oak quail

an embed field is literally just name, value, and inline

making it an object is just code clutter

people keep saying "d.js is making useless changes to break code and make it less usable", and honestly this change would just prove them right

dawn merlin
oak quail

it may be inconsistent but its logical, and a better ux

outer raven

if you're only adding 1 field why would you need to construct its object? It's just nicer to type without it, also ^^

oak quail

is the plan to have no methods that take more than one argument

functions can have multiple params for a reason

dawn merlin

But if the only thing a function does is take input and shove it into an object and append, the object should be provided the user

oak quail

by that logic you would just make the user write out a whole discord message object and simply send it to discord

the point of d.js is to make it easier than that

dawn merlin

And if you want to do anything more than send text, you have to provide an object anyways

vernal rose
golden mortar
ruby terrace

that's why the change is happening. For addField, I don't necessarily disasgree with whats been said here, but that PR needs to be made to /builders in order to keep the current function signature

if maintainers agree with it, then said PR will merge, otherwise it'll be closed

solemn oyster
oak quail people keep saying "d.js is making useless changes to break code and make it les...

Hey, if we didn't do that, we wouldn't have a job to do.

Out of jokes, the addField change affects a huge deal to a lot of people, even me (who has been rejecting the change to objects for quite some time, this is going to take hours to fix in my bot T_T), but something undeniable is that making it take objects alongside the rest of methods promotes a level of consistency that allows users to intuitively use them correctly.

Having to remember which methods take multiple parameters, and which methods take an object is a bother and a mixed API, we're simply consolidating them into a single for everything, although in a quite unintended way.

wild flax

I also would like to go a bit further into this and ask the question how something taking multiple Params makes things “easier”

How is something taking multiple params compared to an object easier? By what definition?

What is “easy”?

How is it measured

oak quail

in this case i think the version which makes you type less is easier

since there isnt really other difference

also everyone is used to the current system already; I don't think making it more similar to the other methods really provides a benefit here

especially with modern editors which will tell you exactly what you need to put

vivid field

it would make the method totally unnecessary too because addFields already accepts a single object through rest parameters

oak quail
oak quail

(tbh it would probably be better to remove addFields, does anyone use it)

hasty bluff

I'm not sure if this is the right channel to ask.
guild#premiumProgressBarEnabled has the same value for both oldGuild and newGuild, why's that? shouldn't it return false in oldGuild and true in newGuild in case i enabled it?
(using latest djs version 13.5)

visual hornet
hasty bluff

it seems like a bug that's why i asked here

visual hornet

support channels would be more active for possible debugging to just kinda make sure it's actually a bug and not a mistake (not that that's bad, it happens, but having someone else check your work can help filter those out)

unique axle
hasty bluff

mhm alright, it was on my end sorry.

tacit crypt
oak quail in this case i think the version which makes you type less is easier

Typing less doesn't automatically make it better. That's a gripe I have with a lot of our methods that do this annoying "list of required parameters with an optional object at the end for all optional fields". What is each option?? Yes, if you use vsc or intellij suite you'll see what it is, but not everyone uses that, and yes you can check the docs but if I have to check the docs every time to remember the order.. I'll pass. With an object, you know at a glance what each field is, is it a name, a file, a value, you name it. It brings consistency with everything else

zenith oracle

In my opinion, yeah, it's surely more consistent having it as an object... But, it may be misleading. Both name and value are required, while inline is optional so having it as an object with these 3 properties may be difficult to understand what field should be filled and what field may be leaved blank, while with parameters you know you must put them.
Actually, not really a big problem if it's changed to an object however... it was already done with the send() method and I think it would also be better if Discord a day decides to add a new field to that object, just thinking about all the big projects that will require a big rewrite of all those addField()

tacit crypt

Technically, a good find and replace can automate most of the migration to an object based interface eyess

dawn merlin

I kinda agree with the notion that addFields() is a useless method. Its existence is only to be a shortcut to addField(). Something that can easily be used with .forEach

quiet viper
outer raven
tacit crypt Typing less doesn't automatically make it better. That's a gripe I have with a l...

If the problem is having to check the docs when writing these methods I think that using a single object for addField makes that even harder because, while you get suggestions when typing on modern IDEs (with the name and type of the parameter), the same doesn’t happen when that parameter is an object, you pretty much have to guess the names of the properties because not even vscode will give you intellisence unless you start typing one of the properties out. Also I’m pretty sure this has been mentioned here but if addField is going to take 1 object only then might as well remove it entirely because you’d be removing the only reason people have to use that over addFields

Does vscode work with capturing groups? I haven’t been able to do that

tacit crypt

I can experiment with that and see if I can come up with a regex

besides the point

opaque vessel
tacit crypt
outer raven
tacit crypt 1. It was an example 2. You do get suggestions in your IDE even for object ones....

Yeah I have use Ctrl + space but that doesn’t tell you which parameters are required even, which would make life harder for people on JS. Not to mention that they may not even get types depending on how they’re importing their embed builder
How do they cover different use cases? If you change the syntax for addField it will become the exact same as addFields or setFields for that matter

tacit crypt

They would notttt be the same as setFields.

outer raven

If you use it when adding the first field it would, and syntax-wise it would be the same too

dawn merlin
dawn merlin
inland gazelle

Hey all, ran into an issue last night with message embeds and displaying an image. If I use an image URL from my server, discord won't show the image. But if I use the image from the example at https://discordjs.guide/popular-topics/embeds.html#embed-preview, it does. I ran across a reddit or something that said discord only allows images from certain servers??? Embed aside, I tried posting the link itself from my server and the one used in the link above, and same thing, my link will not show an image but theirs does. If I send it in a direct message, it shows just fine. I know this is less a discord js issue, but wondering if any of you have run across this??

visual hornet

might be better to ask this in discord devs

inland gazelle
visual hornet

discord devs is a different server, the invite is listed in #useful-servers

also btw this isn't actually exactly a troubleshooting channel per se (check channel topic)

inland gazelle

Gotcha. Thanks.

waxen dove
wild flax

Yeah the example is just wrong

the return type is correct

waxen dove

alright thanks

could i open a pr for this

visual hornet

if there hasn't been one already, go ahead i guess

waxen dove

alright

charred acorn

would it make sense to use rust's discord module, compile it to web assembly and use it? will that performance increase be worth it?

wild flax

no

lilac tulip
drowsy barn

I wonder how do bots communicate with websites. Trying to make a captcha system that redirects to a website any idea how I should go about it?

wild flax

Websockets

drowsy barn

Pog damn I am an idiot

Redis pubsub I heard is decent too

wild flax

Redis is server side

Good luck with that on a website without leaking your credentials

drowsy barn

yeah but what about having it run serverside for the web app and having the bot as a different node app

using php or something im still tryna learn web dev

outer raven

Would the monorepo PR be a good chance to start using tabs all across discord.js? Most if not all of the other packages already use them so since the diff is big I think that would be a good opportunity right?

ruby terrace

that makes retargeting all those semver majors PRs that much harder, not opposed but those PRs should be merged first and then do that if we want to IMO (merging the other PRs first may be in the plan, don't know)

golden mortar

i really hope prs are merged before the monorepo one so i dont have to setup everything again 😄

outer raven
ruby terrace

it will cause merge conflicts yes, but without changing anything else in the files git recognizes the file structure is the only thing that changed and thus a rebase will successfully complete without any user intervention (unless you touch package.json or similar)

that's not a minor difference

solemn oyster
outer raven

oh alright then, I guess there will be a better time for that one

opaque vessel
remote wasp

can't remove it until discord does it first

real jetty

Is there really a need to have two types for the same thing here?

Well, channelTypes will be the same thing at runtime

tacit crypt
real jetty

Why not use a second type for raw api data (probably from -types) and then use a union?

tacit crypt

Thats what it is!

I don't exactly know why your editor shows both

real jetty

Hmm.. very strange

forest beacon

Hey guys, would you use Jest to unit test TypeScript modules ? I heard it does really bad with asynchronous tasks

outer raven
vernal rose
forest beacon

I’m wondering if it’s worth it to work around problems from Jasmine to unit test scenarios that should be easy to test…

(I mean working around could be easy but to me it sure means it is not as easier as to use the things like they were built for)

solemn oyster

We're already using Jest for -modules, but we're not using ts-jest, it's too slow and has many issues.

Also, that last bit is a bit off-topic and not related to this channel's topic.

drifting knot

some getters (ex. Role.members) are O(n) operations which is not documented at all. should this be changed? either lib-wide or for this specific instance

adding a note like "don't do role.members.has(userId), it's way slower than member.roles.has(roleId)" or even "this is a O(n) operation" can help users understand why their code may not be performing well at scale

solemn oyster

Do you think users know what Big-O notation is?

We could add it in the docs just like Redis does, but we'd need to decide on whether we want to do that, because it'll involve a lot of maths to even process them, specially for recursive things

drifting knot

i wouldn't recommend adding time/space complexity to the entire library as it's a very tedious process like you said

i think in this specific instance it'd be good to add a note about performance

dawn merlin

I would just say "runs in linear time complexity"

solemn oyster

Yeah, and what is "linear time complexity"? How do you explain that to a user?

drifting knot
drifting knot
solemn oyster

Yeah, I agree. Having the Big-O notation of getters and methods is hella helpful for me

I don't know if it's doable at all (cc: @wild flax), but maybe we could add an "Advanced" switch just like we do for privates, to show the time complexity alongside the docs, I think that would balance keeping things clean and simple for newbie users and verbose but resourceful for advanced users

drifting knot

probably worth making a GH issue/discussion as an RFC for this

i have a few ideas on how you could document this info but don't want to clutter the channel

wild flax

Feel free

drifting knot
pulsar ledge

Is there a particular reason we don't get a guildMemberUpdate event when a timeout expires?

opaque vessel

That's a question for Discord

pulsar ledge

Alright

quiet viper
ornate topaz

because it adds clutter that isn't useful for majority of users

fervent crescent

Hello, I want to use discord-js RPC to mute my self via a script. The example for rpc defines a clientId. What is a clientId and where do I get it?

outer raven
fervent crescent

I'm sorry. You are right this is the wrong channel. I thought rpc made to allow such functionality. Thank you very much.

oak quail

@outer raven @fervent crescent it is allowed

rpc isn't selfbotting

vernal rose

interaction.options.getMember("user", true) throws an error when the input is a user but not a member. But as there is no way to limit the input to member only (as per ik) then why getMember have the required parameter? Means what i mean is there shouldn't be any required param in getMember and it's output should be always GuildMemeber | APIInteractionDataResolvedGuildMember | null

visual hornet

if the user is in the guild the getMember's erroring behavior would function like getUser i guess?
if the option is optional and isn't set, required being true makes it error

vernal rose
visual hornet

You mean it'll return user instead?
...no, i said erroring behavior
option is required but the input was a user who isn't a member
and there's no member to return? so that makes sense
if you don't want it to error then you can just set required to false? (or omit it as that's the default)

vernal rose
visual hornet

...for there being no member

dawn merlin

@vernal rose I’m confused on what’s being asked the required parameter is only set to true if the option is required in your slash command

vernal rose
dawn merlin <@758880890159235083> I’m confused on what’s being asked the required parameter ...

My question is related to getMember. As discord don't provide a member type in slash command so users can enter any users id in USER type means a user who isn't present in that guild. So if the option is set to required then also we can't set getMemeber's 2nd param to required because it can still be empty irrespective of the user option is set to required.

I'm not able to explain it properly as English isn't my 1st language if u didn't got it then i can show a example.

so what i want is that there shouldn't be a required option in getMember method and it's output should be always GuildMemeber | APIInteractionDataResolvedGuildMember | null

dawn merlin

hence they're members

vernal rose

Id*

rustic boughBOT

Tag suggestion for @slender idol:
> text: single line blockquote
>>> text: quote until the end of the message

dawn merlin

hmmm

I honestlty didn't know entering the user's direct id worked even if they weren't in the server

vernal rose

Yeah u can try

dawn merlin

I just did

it works

vernal rose

Yeah so should I make a pr to remove required from getMember?

visual hornet

no? it still has the use for optional arguments
and still for this use here that you've pointed out

vernal rose

Other methods have use case but getMember don't have

visual hornet

it's for typechecking

visual hornet
vernal rose
dawn merlin

they're no longer a guild member, and as a result it's a null response

visual hornet

interaction.options.getMember("user", true) throws an error when the input is a user but not a member.
that seems like an expected behavior to me?

dawn merlin

Yeahhhh that’s fine

vernal rose
visual hornet

just check for the output of getMember, or catch the error if you have that required set

vernal rose
visual hornet

it... has the same use as it does in the other getX methods

vernal rose
dawn merlin
visual hornet
dawn merlin

yeah no, there isn't a problem, I just forgot it threw

vernal rose
dawn merlin

a try/catch should be used with true then

or switch to getUser()

copper laurel

This seems to have gone past lib discussion into general support on how to use these methods

vernal rose
dawn merlin a try/catch should be used with `true` then

Hm better use false to avoid a let and try/catch xD but I solved my issue so I thought it should be changed in lib but leave now

And for type check case u can just add a if statement to check if no member and Typescript will remove the null after that line

dawn merlin

I do agree that ultimately enforcing a try/catch, is not a great DX. I think a better solution for this would to have a type-guard ie Interaction.options.isMember('option-name'). This method would gaurantee that options.getMember('option-name') will always be a non-nullable GuildMember. I'll play around with this and see if anything comes to fruition.

Or just remove the required parameter 😉

Leaning towards the latter since (ignoring network errors) you can’t ever guarantee getMember is not-null compile-time. Setting required to true is just basically lying to you that it’s not null. It’s one thing to set required to true and have your option have required set to false. But you as a developer already know what options are required and which ones aren’t before runtime. getMember isn’t ever known to be present by a developer before runtime so it’s a different circumstance.

vernal rose
dawn merlin
vernal rose

are there any specific reason why every other method's required is set to false by default in CommandInteractionOptionResolver but for getSubCommand and getSubCommandGroup it's true?

outer raven
vernal rose
outer raven because why would you be trying to get a subcommand or a subcommand group in a c...

subcommand groups and sub commands can be used I mean like this

{
  options: [
    {
      type: "subcommandgroup"
    },
    {
      type: "subcommand"
     }
  ]
}

In this case when using 2nd one means sub command then there will be no subcommand group then it'll throw error but the subcommandGroup is present in that command. So it can also be default to false.

Idk if u understood what i mean because my English is so bad 😄

outer raven
vernal rose
outer raven

you can always make a PR but I doubt it would be accepted because iirc that was a conscious decision when the initial pr was made

honest barn

i noticed in some places that arrow functions that return an object usejs () => { return { foo: 'bar' } }when () => ({ foo: 'bar' }) could be used, which is easier to read, is this intended? i can probably make a pr changing it, but i wanted some feedback first

dawn merlin
alpine bough

is nor a typo? PeepoThink

should it be not?

wild flax

No

alpine bough

ok, thanks

real jetty

If builders is going to pre validate names for slashies could it be expanded to show the string in question and the specific error with it? Taking about these errors btw:
ZodError: [
{
"validation": "regex",
"code": "invalid_string",
"message": "Invalid",
"path": []
}

tacit crypt

We're planning on replacing zod so in the future errors will be much more useful

quiet viper
wild flax

Don't think so

you can keep track of it yourself

copper laurel

@dawn merlin we can discuss the middleware concept here rather than fill Github if you want

I very much do want to support it, so please consider it constructive criticism lol

dawn merlin

Yeah that’s fine

sonic frigate

What about "custom" events?
Like an event: guildFetch
Which will be triggered on every fetch of a guild
So you could extend the cache with data like settings from a database related to that guild.
or like memberFetch
So you could for example fetch custom data about that member such as subscriptions, economy / rank stuff

Just an idea, I guess at this moment you'd need to do it on apiResponse I guess and then check the requested path

visual hornet

i mean, you could just add those yourself to your own code

sonic frigate
visual hornet

well no, just whichever ones you need or want

sonic frigate
visual hornet

if you need guildFetch, then make that event, emit it after fetching guilds or add it to your version of djs within GuildManager#fetch or Guild#fetch

i don't see how an event for fetching guilds would relate to database fetching

sonic frigate

Add it to your version, is basically something you don't want to do as it get's lost every time you update your D.JS.

Manually after obtaining guild data would still not be satisfying as you'd still required to do multiple manual checks after that.

It's a feature I could see being useful to other people as well.


i don't see how an event for fetching guilds would relate to database fetching
It's an event... so you can smash your own sauce onto something that's being done, this was just an example.

In this case, it would be for fetching settings in a database.
Could be used to fetching data in a file.

Just data you might need more than once without the requirement to keep checking it.

Example: A bot log channel.
Fetching it once from the database right after the initial fetch that cached the guild wouldn't you require to check if the bot log channel id is in the cache on every single command you have.
If the guild is in the cache, the bot log channel exists as well.

On member fetch as example:
You could check if the member has a VIP membership active.
If not, take off the VIP role.
If they do, add or keep it.

On that you can also (re-) load your economy data.
On that you can also (re-) load the ranking data.

As this is always triggered when a guild or member is fetched, this data always exists and thus does not require an additional if (data !== undefined) -> obtain data

The event won't be triggered when the fetch data returned is from the cache.

visual hornet

that seems like something an extension would do, these aren't exactly gateway events from discord, no?
and also with those examples, you still need to add checks such as for the guild being unavailable, the bot losing perms, the channel being deleted, the member leaving, so this isn't going to be doing much anyways in those cases
said checks on "member fetch" seem to be better off based on fetching from the database than based on fetching from discord

sonic frigate
visual hornet that seems like something an extension would do, these aren't exactly gateway ev...

It's part of an automation.

These aren't gateway events no.
Doesn't mean it couldn't be a feature.

What does a guild unavailability or the bot losing perms have to do with your custom settings?
Pretty much nothing if you'd ask me.

Your last sentence is exactly what this event can be useful for.
The event is triggered AFTER it's fetched from discord to add your data to the cached version.

Thus adding your own sauce on it. hence that's what events are for.

visual hornet

Your last sentence is exactly what this event can be useful for.
so... if you need to remove vip from a member, you're just going to wait til that member gets randomly fetched?
again, you can just fetch from the database, check, then fetch the member yourself

that's what promises are for, not events

sonic frigate

So you insist on looping through 1000's of guilds per client possibly millions of members as well
Then run over each member on bot startup just to obtain the data.
Running a query the same amount of times as an event would be triggered. When this could be extended by triggering an event when the object you are working with is going to be necessary.

Again these are just examples this event would fit.

visual hornet

if you're referring to bulk fetch, then there's already an event for that, guildMembersChunk
those members aren't going to be randomly fetched reliably, you're still going to have to fetch them to do whatever you need to. for rankings or economy or whatever that you mentioned, those can all just be fetched on demand or cached

sonic frigate

Didn't know about guildMembersChunk
But it is exactly what I was talking about for on memberFetch.
This event is exactly what it could be useful for on guilds
However, guilds are already fetched on the beginning.
On a side note, guildMembersChunk would or wouldn't it be triggered when you fetch one member.

visual hornet

probably not, seeing as it's called Chunk and always gives a collection. but i don't know, i haven't used/tested it much.

as far as i can tell from discord docs, no

sonic frigate

Answer is no, and neither happens when the guild initially fetches the members (automatically after login)

visual hornet

because those a) aren't fetching b) aren't a request?

those are sent with guildCreate

sonic frigate

GuildCreate is triggered when a bot joins your guild....

visual hornet

https://discord.com/developers/docs/topics/gateway#guild-create

Guild Create
This event can be sent in three different scenarios:

  1. When a user is initially connecting, to lazily load and backfill information for all unavailable guilds sent in the Ready event. Guilds that are unavailable due to an outage will send a Guild Delete event.
  2. When a Guild becomes available again to the client.
  3. When the current user joins a new Guild.
sonic frigate
visual hornet

im referring to the gateway event, not the djs event.

sonic frigate

I'm talking about djs events not gateway events whatsoever.

copper laurel

Every discord.js event corresponds to a gateway event

What you're describing though is modifying the internal structures that get stored in discord.js caches - exactly one of the major issues that resulted in the removal of Structures.extend

visual hornet

guildCreate for an unavailable guild acts as a patch for the guild instead of emitting the client event, though.

sonic frigate
copper laurel What you're describing though is modifying the internal structures that get stor...

Doesn't need to modify the cache, it's what the user desires to do with it.
Simply said:
a guild is fetched from discord
Event: apiRequest is triggered
When the response is received: event apiResponse is triggered
feature request: event: guildFetchedis triggered

a member is fetched from members:
Event: apiRequest is triggered
When the response is received: event apiResponse is triggered
feature request: event: memberFetchedis triggered

event guildFetch or memberFetch to fetch from discord wasn't what I meant, it's an event being triggered after it has been fetched from discord.

copper laurel

Way too much feature bloat imo, as you said you're free to implement those custom behaviours in apiRequest and apiResponse

sonic frigate

Like the event ready is when the client becomes available

visual hornet

you can just use the promise resolution from actually fetching them though

copper laurel

Those methods were introduced to allow users to act when API requests have occurred

copper laurel

So whatever data you intend to expand isnt going to be returned yet

sonic frigate
copper laurel

Thats not what I said

Anyway, Im of the opinion that adding events for when every possible type of structure has been fetched is excessive feature bloat that offers very little to the actual execution of the fetches

sonic frigate
visual hornet

that's what you see, but if these do get implemented, someone's going to want them for other structures

copper laurel

Just because you only have those use cases doesn't mean others wont - if we're going to add a feature of this design, it would be done consistently

But, we probably wont

sonic frigate

Then that's fine as well. But anyways I'm out. Just a feature idea, turned down, cool. No need for me to spend more time on that then.

outer raven

@wild flax could you add if: github.repository_owner == 'discordjs' to the first line of each job in the documentation CI so that the workflow doesn't fail on forks?

real jetty

ayee monorepo setup, about time

👍

quiet viper
real jetty

type safe

🌈

ruby terrace

for /rest at least

outer raven
quiet viper
ruby terrace this is already almost done

As this includes a lot of breaking changes (like the @discordjs/sharder) will it be released in a new version like v15.x or even v14.x ?

Or is the plan: slowly replacing the parts with ts?
(sorry for the internal questions, will give me more planning safety...)

ruby terrace

/rest is planned for v14

golden mortar

so how would /rest work with undici

or is that just gonna be scrapped?

ruby terrace

the idea is to replace each module over time, and if its semver major then its semver major

I'm gonna port your pr to /rest, been waiting for the monorepo

golden mortar

nock doesnt work with undici, which means all tests need to be ported 😐

along with other issues such as using response.buffer, etc. (i did try to do the work)

ruby terrace

we're aware of that

golden mortar

thats great to hear

ruby terrace

my plan is to get /rest into djs, then implement undici in a semver:major bump of /rest

golden mortar

are u planning on waiting for nock support or were u planning on rewriting all of the tests using undici's mock client?

wild flax

Nock doesn’t work?

How come?

golden mortar

nock mocks the http(s) modules which undici doesnt use

wild flax

Which should work?

Since it also works in browsers

golden mortar

i messed with a few mocking libs that mocked sockets but didnt get very far lol

solemn oyster
ruby terrace
golden mortar
honest barn

since d.js is a monorepo now, do module related prs go there, or they still go to the individual repo?

opaque vessel

The other ones have been archived

honest barn

cool thanks

outer raven

Has anyone else gotten this error after the monorepo change when committing to djs? I recently reset my PC so I'm not sure if it's related to that or the monorepo change

also I already updated all deps

ruby terrace

change the line endings in yarn.lock

outer raven

lf?

ruby terrace

if you're on windows it has to be crlf

outer raven

oh alright

wild flax

but dont commit it

lol

just change it for now

ruby terrace

it won't commit IIRC

wild flax

it will eventually be fixed in turbo

ruby terrace

I changed mine and commited and git just ignored it

wild flax

you sure can make it commit, but git will prolly convert it to lf again

ruby terrace

yeah, so it noops in the diff

outer raven

yeah that fixed it, thanks

outer raven

was this change intentional?

the rule was completely removed and lower-case seems to be the default, which no longer allows us to put class names in the scope

wild flax

yeah

outer raven

oh okay

so should I put the class name in lower case?

wild flax

sure

outer raven

alright

wild flax

or rather

not put the class name

but a somewhat generic one

instead of "CommandInteraction" its ok to just put "interaction" or "interactions"

outer raven

oh alright

this PR is very specific so I'll go with the class name but I'll keep that in mind for the future

Pretty sure I've seen this error before but I'm not sure what caused it and I'm getting this on the latest main commit, any ideas on what could've caused it?

I would try to debug but we can't install packages from github with the monorepo anymore

tacit crypt

restart ts server

tacit crypt
solemn oyster
outer raven
opaque vessel

What about resetting to commit hashes? Like git reset --hard <commit>

outer raven

yeah that's what I was thinking

solemn oyster

I think you want git bisect here 02Think

opaque vessel

Ah yeah, even better

outer raven
outer raven

we should probs add type tests for these functions mmLol

real jetty

It seems we cannot access to CommandInteractionOptionResolver after PR #7197, since options field has been moved to ChatInputCommandInteraction class

dawn merlin

I’ll be home in like 5min

outer raven

oh btw that's an actual js error, not a TS error only

dawn merlin

uh oh

real jetty

😂

dawn merlin
outer raven

none, plain old CommandInteraction

dawn merlin

is this straight from the event listener?

outer raven

it's in a command file which is typed like that

comes from this function

dawn merlin

ok but like does your command file handle both chat input and context menus or just chat input?

outer raven

just chat input

dawn merlin

Then you have the wrong type, it should be ChatInputCommandInteraction

outer raven

ahhh

dawn merlin

BaseCommandInteraction -> CommandInteraction

outer raven

so should we never use CommandInteraction from not on?

dawn merlin

no you can use CommandInteraction, but it should only be used in cases where you expect a context menu or a chat input command

outer raven

well then we'd need to cast it to use the options class right

dawn merlin

or use a typeguard yes, it's the exact same like before expect it's not called BaseCommandInteraction

outer raven

got it, thanks

so the js error should be fixed by #7210

dawn merlin

@real jetty did you just open that PR?

icy bronze

did it cuz I had the same issue

outer raven

@wild flax sorry for the ping, since the last publish dev failed and most issues seem to be fixed now, could you re-run the script?

vernal rose

As the repo is now in ts so it'll use import/export. And vscode have a settings for import

organizeImport or smt like that which organizes all imports which isn't used in djs. So is it's worth making a pr to disable that setting in .vscode folder?

outer raven
vernal rose
outer raven

sounds like a you issue
the repo shouldn't need to disable a setting that comes disabled by default, and the eslint rule is much better

vernal rose
outer raven

the maintainers may think otherwise tho so ig wait for them, but it would surprise me

ruby terrace

its dtslint

vernal rose
ruby terrace

eslint doesn't work on d.ts files

vernal rose

oh ic

ruby terrace

its a non issue since typescript rewrite is happening sooner rather than later

dawn merlin
ruby terrace

some of it works, last time I tried it failed on the tests.d.ts

balmy slate

is there any example of a dynamic command parser for subcommands or subcommand groups?

vernal rose
dawn merlin
copper laurel

Yeah I dont really see the benefit of that

vernal rose
copper laurel

...okay?

vernal rose
copper laurel ...okay?

if i've understood correctly what he've said then he means if anyone who isn't a member of djs creates a pr then the current labelers won't work

nvm ig it's working in djs as it worked for Rodry's pr so leave it

ruby terrace

if you were to make a pr to your own fork it wouldn't work, that's fine

delicate sigil

why you guys gonna shut down v12?

@ruby terrace any idea?

ruby terrace

its already shut down, it will stop working soon anyways when discord stops supporting the gateay/api version it uses

delicate sigil

oh

copper laurel

wdym why

Becuase we made v13

outer raven

Dev releases are broken because the eslint hook is failing I think

vernal rose

why this is showing? It wasn't showing these errors last time

solemn oyster
vernal rose
solemn oyster

Go to the yarn.lock file and change LF to CRLF

vernal rose

Idk how to do that 👀

vernal rose
solemn oyster

Bottom right side in VSCode, where it says "LF"

vernal rose

oh okay ty

outer raven
vernal rose
outer raven

wait for #7215 to be merged

vernal rose

ok. my pr have conflict so i was fixing that and now meguFace

solemn oyster

Yeah, main's green

So that's a merge conflict on your side

Oh wait, it isn't

outer raven

hm?

vernal rose
unique axle

comaptibillity with twilight http proxy

outer raven

Can someone try re-running the publish dev script again? Last one failed because of the unused process so maybe it will work now

All dev versions on npm are deprecated now and the last one was published 10 days ago

wild flax

Still fails because of the unused directives apparently

but I can't reproduce running the same commands locally

outer raven

the unused directives can be removed tho right?

wild flax

I dunno

real jetty
outer raven
sullen idol

For the Permissions constructor, as a parameter, can you add like a permission object to return a bitfield? Example:

const { Permissions } = require('discord.js');
console.log(new Permissions({ SEND_MESSAGES: true, /*extra perms*/ }));
//object was created by hand, not of permission class or wtv
//throws invalid bitfield error
slate nacelle
sullen idol

Alr lemme see

woeful rain

I know a few people have farmed PR requests using bump licenses. I understand that it's been closed but in a few packages like voice it's been accepted. Now that the discord.js repo is like a monorepo, it says 2020 - 2021. Shouldn't this be changed to 2020 purely so that we don't have to make these pull requests every year afterwards?

All packages with "xxxx - xxxx": voice, collection
Without license: rest

dawn merlin

The year doesn’t need to be updated regardless

woeful rain
dawn merlin

I’m mean I’m sure rest needs a license, a ticket should probably be created for that I’m not sure about the ranges

sullen idol

GuildMemberRoleManager.add(), tho it says it accepts role objects it doesnt

opaque vessel

Make an issue with a reproducible code sample if you've found an issue

errant brook

just a note to the core contribs

it'd be nice if you guys could update the old readmes to point out that the code has been moved to discordjs/discord.js/packages/

wild flax

What old readmes

vernal rose
vernal rose

I was testing the latest issue of GuildMember never type and saw this.

If I do if inCachedGuild then return, then the interaction should become interaction<"raw"> but it's the default now. Is it's a bug? asking because i don't have much knowledge of these this is type

wild flax

if its not in a cached guild

it needs to be a raw interaction

lol

or rather one with a raw guild

vernal rose

after searching a bit i found that it's not possible if that inCachedGuild is true only then the type will narrow else it will be the same

drifting knot

should the main djs repo be using yarn 2+? i'd be happy to PR if yes

wild flax

Turbo doesn’t work with yarn2+

drifting knot

eh... it does in my experience

wild flax

It does not

drifting knot

have you run into issues with it?

i know their docs explicitly say it doesn't but like

wild flax

Jared himself said it doesn’t, and yeah we’ve run into cache hit misses constantly when running yarn 3

drifting knot

hm ok

dawn merlin

@golden mortar will you be opening another PR to /rest for undici?

golden mortar

the problem with /rest is that you'd have to rewrite every single test to use undici's mock client (which isn't api compatible with nock) and no other mock libraries work

and undici's mock client doesn't have as many features as nock

wild flax

Undici has a mock client?

And it could maybe be extended, we don’t use a whole lot of stuff I guess

golden mortar
wild flax

You can intercept

So i guess you can do anything you want then

Just more own code

golden mortar

yeah nock's api is way nicer with the chaining

and there are a lot of tests that need to be rewritten

drifting knot

hm, seems like yarn 1's lack of a "workspace:* dependency version feature is why lint needs a build first

solemn oyster

@outer raven hot take, you can make an utility method to abstract all those nullish and dates

outer raven

like a convertToDate method?

solemn oyster

Oh wait, it's just 2 usages, I thought it'd be more places

outer raven

nah I looked everywhere and its only those two

could come in handy in the future though ?

wild flax

Nah

No unnecessary abstraction

solemn oyster

Nah, we can look into that if we run into the case of needing more dates

outer raven

aight thumbs

outer raven

@wild flax instead of using an action to assign reviewers why don’t you just add a CODEOWNERS file

wild flax

I see no reason to

outer raven
wild flax

The people you choose as code owners must have write permissions for the repository.

outer raven

Don’t all maintainers do?

wild flax

Also code owners is a bit more than just "add this person to the review"

outer raven

The only other use is if you have branch protection rules which you don’t

Although it would automate more things too

And would make it more clear to the author of the PR what needs to happen in order for their PR to be merged

opaque vessel
drifting knot

ugh, was hoping this wouldn't happen on CI too

could you revert my PR?

opaque vessel

@wild flax ^ x:

drifting knot

for whatever reason, turbo only sometimes runs the build script before lint

wild flax

peepoLaughPoint

drifting knot

i spent a while resting ^build vs build in the dependsOn array locally

super inconsistent results

i assume it's a bug on their side

wild flax

There’s also a bug if you turn on parallelization

Where it fully ignores the dependsOn lol

drifting knot

lmfao

errant brook
wild flax
vernal rose
opaque vessel

Without explicitly denying rules, just remove the JSDoc

vernal rose

Means the param line or only this type?

opaque vessel

All of it

/**
 * Decrements max listeners by one for a given emitter, if they are not zero.
 * @param {EventEmitter | process} emitter
 * @private
 */
decrementMaxListeners(emitter) {
  const maxListeners = emitter.getMaxListeners();
  if (maxListeners !== 0) {
    emitter.setMaxListeners(maxListeners - 1);
  }
}

To

decrementMaxListeners(emitter) {
  const maxListeners = emitter.getMaxListeners();
  if (maxListeners !== 0) {
    emitter.setMaxListeners(maxListeners - 1);
  }
}

Then it won't show up in the documentation at all... since it's private I guess this is a viable solution without disabling valid JSDoc rule or unused imports rule

@solemn oyster what do you think^

Actually all he did was forget a description :thinking: seems fixed now

vernal rose
opaque vessel
vernal rose
opaque vessel

Other than what I just dumped as a review just now x:

vernal rose

We can no longer add a Pascel case subject. So should I create a pr to change these?

copper laurel

probably the contributing guidelines or something

dawn merlin

Oh yeah, I though this had to do with the enum PR lol

vernal rose
dawn merlin

Yeah you don’t need my permission

vernal rose
dawn merlin

Just open a PR and if there’s something wrong we’ll let you know

vernal rose

ty

warped crater

I found myself needing to spoiler an image I wanted to post via URL and it felt so unintuitive at first

I did know I could prefix the filename with SPOILER_ but then I was like "how do I actually pass the file now" until I noticed BufferResolvable does take URLs

regardless of how intuitive it is right now - feel like this is the sort of thing the library should offer 'abstraction' for real_eyes

opaque vessel
warped crater

I did notice the class but having to make an instance for a task this trivial feels off.

opaque vessel

It's also a trivial task to prefix SPOILER_, but adding a boolean option would result in duplicate code

fervent walrus

is v14 of the library going to have packages/sharder?

vernal rose
fervent walrus

noice

hot echo

Is Interaction.locale coming soon?

dawn merlin
hot echo

I'm not

Thanks though

outer raven

Installing the dev releases and updating breaking changes as they come is better than updating it all at once btw

idle glade
unique axle
errant brook

when im committing the formatting git hook errors out at this, i didn't touch this file so what should i do? skip the hooks and commit? or should i fix the issue if possible (this will be out of scope for my pr)

wild flax

That shouldn’t be an issue

Make sure to reinstall node modules

errant brook

oh ok, doing that

yeah that fixed it, thanks!

icy bronze

@tacit crypt did I do it wrong or uh?

i'm re-thinking of my pr

analog oyster

not much else you can do that wouldn't take too much effort / keep things readable

icy bronze

I mean

dawn merlin
icy bronze

ok

ty

tacit crypt
icy bronze

yeah that got me wrong lmao

analog oyster

typescript

icy bronze

i'm not event sure of the changes

I need to test more

I get ChatInput as this._hoistedOptions[0]?.type, or it's a subcommand

and the name fits my subcommand name

welp another PR

nvm I will add it to the one I made

icy bronze

Option "content" is of type: String; expected STRING. ixFine

outer raven

Why is the old PLAYING activity type called Game on discord-api-types?

analog oyster
dawn merlin

thats a good point

outer raven
outer raven
devout fjord

idk if it fits here, but can we talk about whose idea it was to depricate using strings for the footer, author (and as far as i can tell also for fields). Now we have to use objects, which isnt bad per se. but if you are like me and have a utility bot with 30+ commands, all of which have atleast 2 or 3 different embeds which it can send back it kinda will be a lot to change wont it?

golden mortar

the idea was to line up the api with /builders for an eventual transition, since it's only deprecated you can take ur time replacing strings

devout fjord

i mean ig

but having a blah blah blah is deprecated error spamming your console isnt the funnest thing in the world, tho my db also spams console so i guess i cant complain

golden mortar

the deprecation message should only show up the first time you use it which isnt really spam

devout fjord

well yes, but for testing i restart my bot a lot, meaning i see it many more times. which ig cant really be changed on their end

wild flax

man, that really sucks to hear

unique axle

deprecated error spamming your console
Deprecations are not errors on patch and minor versions

devout fjord

ye its not really an error, but still an annoying msg

anyways

guess ik what ill be doing this weekend

tbh the only reson i even updated was because interaction.editeReply() wasnt working anymore, which eventually was due to a different issue but still

also this situation could have been avoided if only i didnt just add stupid commands noone will ever use. e.g. /dogeify, /curseify, /uwuify (as for what those do, dont ask) and the 3 text to image commands, 1 is normal, 1 uses mc blocks and 1 uses an ai to try and make an image out of text. which could probably just be sub commands.

ornate topaz

i think you could do a single find and replace in vsc using regex.

devout fjord

hmmm, well yes but how would i be able to still keep the contents of the footer

and even if i do keep the content and like replace only the first part i still need to add an extra bracket at every command

dawn merlin

look I'll do it for you how does that sound?

unique axle

let's stick to developing discord.js in this channel, please, for regex and general chat we have #archive-offtopic

devout fjord
peak zinc

for other packages who were previously using some of the subpackages (i.e. collections only), what does this mean for them?

will those other packages still receive updates on npm? will there be any change to how dependent projects should organize their dependencies?

vivid field

there won't be a change regarding npm releases and such

peak zinc

or is it recommended for other people to just stop using collections lol

unique axle

the packages are still released to NPM as before, the only thing that changes is that issues and PRs will go to the main repository now

vivid field

it's easier to apply changes across multiple projects this way

ruby terrace

Nothing is changing in how you as a user consume the discord.js ecosystem, its just ^

peak zinc

ah, ok, thanks

my project uses d.js collections and i was worried this would break something in the future

ty!

oh, one more thing

why isn't discord-api-types package being moved to main repo as well?

ruby terrace

I think because its npm package isn't scoped to @discordjs and its designed to be independent of discord.js

peak zinc
unique axle

one might think that at first, but collection only exists because of discord.js needing a k/v structure for caches in the first place

whereas api types are more likely to be used by other libraries

ruby terrace

also another collection exists on npm so we need to scope it to publish smolCool

peak zinc

more likely than collections???

vivid field

in most cases a map is enough, whereas the discord api types are way more complex and feature-rich

ruby terrace

yeah, Collection is an extension of Map and...beat me to it

peak zinc

interesting

peak zinc

for d.js

collections only adds some utility methods to maps right?

vivid field

yeah

but they're pretty useful in this case

ruby terrace

Probably the most important thing is filter

vivid field

filter and find I'd say

ruby terrace

oh right, forgot about find

outer raven

Will the issues on the old archived repos ever be transferred to djs?

opaque vessel

Nah

If they're still around, they should be made anew

dawn merlin

I thought gh had a "transfer issue" button

solemn oyster
outer raven

It would be pretty easy considering they’re all on the same org

copper garden

Is the MessageEmbed.setFooter method with a single string supposed to be deprecated?

The docs seems to suggest that only the second parameter of setFooter is deprecated, nothing about the first parameter as string

visual hornet

i don't think so? same as the setAuthor allowing a single string?

outer raven

So ig yeah that is intentional

ornate topaz

what is

cause those 2 messages seem to contradict each other

visual hornet

"setAuthor won't allow a single string, so setFooter with a single string being deprecated is intentional"?
seems fine to me

vernal rose
ornate topaz

but the original question asked if it is meant to be deprecated at all since docs don't say that it is deprecated

visual hornet
vernal rose
copper garden

So the setAuthor deprecation implementation needs to be fixed too if the typings are correct

vernal rose
copper garden

Currently as implemented, setAuthor(string) does not trigger a deprecation message. But setAuthor(string, string) does

vernal rose

Oh ic lemme try

vernal rose
copper garden

A fix is necessary to provide accurate documentation

vernal rose

Author my bad lemme check tha

copper garden

According to the PR, it’s supposed to be conforming to what the builders package implemented, which means setAuthor is not supposed to take a string.

loud jayBOT
vernal rose
copper garden

That was my question

vernal rose

The code is correct and typings too. Both says that if u pass a string as the 1st parameter then it'll throw depreciation warning

But in docs it says only for 2nd parameter and not about 1st parameter

copper garden

The typings, docs, and implementation are inconsistent with each other when it comes to setFooter and setAuthor

vernal rose

Implementation and typings aren't inconsistent if I've checked correctly bcz both says if 1st parameter is string then it's deprecated

copper garden

The typings says that strings are completely deprecated.
The docs says that string parameters after the first one are deprecated.
The implementation is halfway: single string allowed for setAuthor, but no strings allowed for setFooter

vernal rose

In implementation single string is also deprecated. Yeah doc only says about 2nd param and not 1st that's what I said in above msg

zenith oracle

Not sure if this is known but on the latest 2 dev releases I get TypeError [COMMAND_INTERACTION_OPTION_NO_SUB_COMMAND]: No subcommand specified for interaction. even if there is a subcommand. Downgrading to 14.0.0-dev.1641945998.1479e40 worked and debugging the code with the latest version I can see that the option is present in the raw options data.

wild flax

Is known

Dev releases have no guarantee

zenith oracle

Ok 👍

woeful rain

locale is undefined in interactionCreate event (defined in WS INTERACTION_CREATE event)

  • I don't see the addition of the locale in the interactionCreate event, but the discord itself returns the locale.

14.0.0-dev.1642032388.2bb40fd

latest djs dev

opaque vessel

I cannot reproduce, you very much likely are not even running on that commit being as it's not autocompleting for you

woeful rain

its my problem

resolved, thanks

fervent walrus

Does it make any performance difference by importing/requiring setInterval from 'node:timers'?
I have seen discord.js importing setInterval and setTimeout from 'node:timers' module when its globally available.

opaque vessel

Not sure about performance but Node.js considers it to be a best practice to do so

fervent walrus

oh, I thought it was for documentation purposes

woeful rain
lethal storm

Hello library people. When might a version with the new interaction locale property hit stable?

real jetty

v14 most likely

golden mortar

on latest dev version, MessageButton.setStyle with a value from the ButtonStyle enum crashes, is this known?

import { MessageActionRow, MessageButton, ButtonStyle } from 'discord.js';

new MessageActionRow().addComponents(
    new MessageButton()
        .setCustomId('primary')
        .setLabel('test')
        .setStyle(ButtonStyle.Primary)
);
dawn merlin
golden mortar

thanks 👍

lethal storm
lethal storm

Speak of the devil

real jetty

what does discord.js use for keep connection alive and receiving data?

real jetty

so an interval with heartbeat?

how do I generate a session_id tho?

analog oyster

I just realised the return type of GuildBanManager.create() is a promise of GuildMember | User | Snowflake

but why

unique axle

it resolves the best it can
if the user was a member of the server (and cached), a GuildMember is returned
if the user was cached, a User is returned (was not a member of the server, "hackban")
if the user was not cached, the ID is all we can provide

analog oyster

i know what it is doing, i was asking why. why not return a single thing, or nothing at all since if you're using that method then you'll already have at least the user id

wild flax

I don’t see the problem

outer raven

There’s been a discussion here about making managers not return anything and that was one of the reasons why

I think it would be much better for it to not resolve anything and let the user decide what they want

wild flax

🤨

outer raven

I don’t remember where that is anymore but I think @copper laurel was in it

copper laurel

How do they have any choice if it doesn't return anything

I dont remember caring about this one, dumb hill to die on

I certainly don't think all managers should not return anything

radiant iron

Add timeout in fetchAuditLog, I cant fetch audit log for timeout

unique axle

Timeouts are of type 24 MEMBER_UPDATE

opaque vessel

@radiant iron ^

radiant iron

oh, thank you so much

azure hull

RESTPostAPIApplicationCommandsJSONBody is supported for ApplicationCommand#equals and ApplicationCommand#edit right? From the code it looks like it. But the typings don't allow it.
Bug or am I wrong?

I'm on d.js v13.5.0

hardy plume

i noticed the master branch moved to workspaces. is there any chance that interaction stuff will be abstracted into its own package so it could then be used with something like an http server?

wild flax

It’d have to be a new package

outer raven
outer raven

why does npm run build:deno create 132 new files on discord-api-types? I'm trying to commit something small and all of these files get added for some reason

dawn merlin

is the from the git hook or are you running this manually?

ornate topaz

because it builds for deno?

outer raven

Or is it fine to PR with that

fallow crater

Is there a reason why <Interaction>.locale is typed as string over something like InteractionLocale? Just curious, and asking if it'd be worth making a PR for it

outer raven

I believe that was suggested and someone was gonna do that

fallow crater

👍, I don't mind doing it if they aren't able to

wild flax

-types isn’t released yet with it iirc

So you couldn’t even do it if you wanted to

And 13.6.0 most likely won’t get it

fallow crater

ah, alright

outer raven
tacit crypt

Did you clean:node before?

@outer raven

outer raven

I did and then undid it

tacit crypt

You shouldn't have any built files

Before running build:deno

outer raven

oh right now it did work

weird, but I made the PR without that mess anyways so it's all good

analog oyster
wild flax I don’t see the problem

the problem is that the function has extra complexity for no reason, and the return type is more unpredictable

the more reasonable return type is guildmember|null since you wont be able to fetch the member afterwards because.. they were banned

like i said, if you're using that method then you'll already know, at least, the users id
so you can always get the user from the cache/fetch them yourself

making the function return guildmember|null or nothing at all would remove unnecessary complexity from the function

copper laurel

But a reliable return type would be Snowflake

Because we can always return that

outer raven

But that’s useless because you already have it

copper laurel

I know

But its no more useless than null

/ not returning anything

outer raven

But not returning anything makes way more sense

It sticks to the API behavior

vernal rose

when fetching a GuildTextBasedChannel's message it returns Collection of Message<boolean> instead of Message<true> is it's intentional?

warped crater

yeah this just returns Message without passing in a generic

this seems like its type parameter could be inferred unless there's something I'm missing

outer raven

yeah you could say that is always cached

since you literally just fetched it

warped crater

well, not always

you could literally pass cache: false

outer raven

that's not what this type parameter means

warped crater

oh yeah nvm I just saw the types

outer raven

the cached boolean is whether some properties are present or not

warped crater

yeah this seems like it could just be Message<true> then unless there's something I'm missing

outer raven

actually it's weird because that type parameter assumes things that aren't necessarily true

it seems like it's used for messages in guilds

analog oyster
warped crater

hm

analog oyster

the name "cached" for the generic type in message isn't very accurate

i suppose the MessageManager could also have a "cached" parameter so you can pass it down to the messages

warped crater

yeah I see now

outer raven

yeah so maybe that name should be adjusted

outer raven

Can we bring back #djs-at-dev for users of the dev versions? Or maybe once they're fixed but it would make sense now that we're going into v14

atomic locust
ButtonInteraction {
  type: 'MESSAGE_COMPONENT',
  id: '932222868455055380',
  applicationId: '919328973585002606',
  channelId: '931943047741210655',
  guildId: '925331433831170058',
  user: User {
    id: '853394858895343636',
    bot: false,
    system: false,
    flags: UserFlags { bitfield: 0 },
    username: 'Sopow',
    discriminator: '7130',
    avatar: 'a4b3672e77d23278ff7c931aad0ca838',
    banner: undefined,
    accentColor: undefined
  },
``` i logged interaction, but there is no channel
In the documentation, channel exist https://discord.js.org/#/docs/discord.js/stable/class/ButtonInteraction?scrollTo=channel

what is this bug ?

void rivet
atomic locust
visual hornet

it's not a property, it's not going to show up when you log the object

ornate topaz

not everything is going to be displayed when you're logging entire objects, javascript does have a way to set properties as non-enumerable, and discord.js utilses that.
if you want to see all properties, go to documention for respective class, or try logging the value directly, instead of object that contains it

rough roost
upper moss

Hi i think i found a bug in @discordjs/voice. Problem is: when i disconnect the voiceconnection and also stop the player i see 2 Sockets being not disposed when i look at the process._getActiveHandles() but if the player goes to idle because the resource finished rather then me using AudioPlayer.stop() it properly disposes that sockets is this my code problem or if anyone can replicate this should i make an issue on gh repo

visual hornet

if you can reproduce it on your own i think you could go ahead and make the issue to see if other people can reproduce it?

upper moss

i am not sure if it is because of my dependencies, node version etc etc because of nobody ever pointing at this problem in anywhere so i didnt wanted to open an issue first

zenith oracle

If you can reproduce the issue with a minimal reproducible example you can create an issue, then, if the problem is not in the package, the issue will be closed

upper moss

okay i am making an issue

zenith oracle

I see in the README, where are listed the optional packages, that erlpack is one of them, suggesting to install it using npm i discord/erlpack:

erlpack for significantly faster WebSocket data (de)serialisation (npm install discord/erlpack)
But I see that erlpack is also published on npm so it's possible to use npm i erlpack.
Is it suggested to install the package from GitHub for a specific reason?

wild flax

Yes the published one is not published by discord

zenith oracle

Oh, thank you very much

lofty birch

Is there any reason MessageComponentInteractions don't have a messageId? They have a channelId and guildId

opaque vessel

Discord sends a channel_id so we show a channel id. Discord sends a guild_id so we show a guild id. Discord does not send a message_id. Discord sends the entire message object. Just get the id from there

outer raven

Is there a typedef similar to GuildChannelResolvable but without ThreadChannel?

opaque vessel

Nu-uh

unique axle

⚠️ WHO PINGED ME?!?!?! pingBOYE
We have been experiencing a mention raid, our bot took care of it (#mod-log)
No, you don't need to complain about it
Yes, we will action shitposting in response to mention raids

golden mortar

for a real world example...

client.on('ready', () => console.log('ready'));
client.on('error', (e) => console.error(e.message));

client.on('messageCreate', async (m) => {
    // do some async task here that throws an error
    throw new Error('whoops');
});

this will no longer exit the program with an unhandledRejection

raven juniper
golden mortar

i've checked and the example works as expected

raven juniper

i thought this was support when i opened the server mmLol continue on

opaque vessel
golden mortar

yes but it has been there since around 2019 so i dont think it matters much

opaque vessel

If it doesn't matter much, then they should remove the warning :P

But they haven't, so I'm uncomfortable with it

golden mortar

they have for v18 i guess? same with Blob & Web streams too

opaque vessel

o,o

outer raven

v14 will probably release with node v18? idk

or probably similarly to v13, which released with v16 as a requirement while it was on current still but it hit lts later

lilac tulip
golden mortar

as long as you have an error listener

lilac tulip

so it‘s the same as if I listen to unhandledRejection shrug and handle rejections there

golden mortar

unhandledRejection event doesn't handle the errors, it just tells you there was an unhandled rejection

lilac tulip

wait roly

rlly*

I thought it also handled them

I‘m not home atm to test it

lilac tulip

so I just tested unhandledRejection and it indeed prevents the program from crashing

golden mortar

preventing the program from exiting and handling rejections are two very different things

const fd = fs.openSync('.'); // might throw error
// later on
fs.close(fd, ...);

although unhandledRejection prevents the program from crashing, you are still leaking file descriptors (for example)

lilac tulip

I dont really get the difference vkawaiihide

idk what file descriptors are but nvm this is not the right channel

maiden raptor

Wouldn't be good if it specified in the docs the permissions needed for both the bot and the user to run functions for example create a channel, timeout someone...

unique axle

we cannot feasibly document permissions, discord can change them at will without any prior notice

they are documented upstream on discord api docs, but it's not feasible to copy these via PRs every time they're changed either
most that i can personally see happening there is a link to the upstream docs as to which endpoint is used

ruby terrace
ruby terrace
lilac tulip

oh alright so the method he suggested would be cleanerAABongocatFat

outer raven

now idk how long v14 development is gonna last

ruby terrace

that's really far out

considering the amount of features Discord is gonna add to get over the line for message intent and we've said no more v13 releases? I think you get the picture

outer raven

yeah I see what you mean

so would the plan be to have v14 out by april?

solemn oyster

No, far earlier than that

dawn merlin

v14 should at least ship with modal support

copper laurel

Planning specific numbers on specific dates is troublesome when it comes to keeping up with Discord's release cycle

The date shouldnt matter. Just increment the version based on the changes we're making

analog oyster
solemn oyster

We also won't require Node.js v18 (geez, that's quite the version number) until it's near LTS or LTS, if it brings something useful

Second one is v15/TS

analog oyster

PES_SadGe

ruby terrace

yeah we should probably...migrate that to a v15 milestone now

solemn oyster

Yeah, whenever Crawl makes it

ruby terrace
dawn merlin
solemn oyster

We don't want the v14 update to be as breaking as v13 was, as simple as that

outer raven

sadge

solemn oyster

Nope, it's hell to do that change without TypeScript

And there's still stuff to discuss

outer raven

oh alright

ruby terrace

more...incremental, most of the breaking changes are removals of deprecated v13 things

solemn oyster

Because we want raw data storage to be beneficial, not a burden for those who are trying to scale their bots

Yup, we basically want to do major releases more frequently, as opposed to making large major releases every year or so

That way it's a lot easier to update between versions

outer raven
solemn oyster

lol no

I think we want to do 2-3 majors a year, depending on how much stuff we want to do during that year

outer raven

that's nice

solemn oyster

And ofc also depending on what Discord releases

analog oyster
outer raven

yeah lol

real jetty

rodry4contrib

copper laurel
copper laurel
ruby terrace
karmic leaf

I'm not sure where to post this, and it doesn't feel important enough to go make an issue on the github.

But I feel like it'd be worth while to put a comment in the https://github.com/discordjs/builders readme that says it has been moved into a monorepo of the main repository. Cause right now it looks like it was archived for no reason and archived generally means "not supported anymore"

I'd make a PR but it's archived so 🤷‍♂️

Something like this at the top of the file

## @discordjs/builders has been moved into the main Discord.JS GitHub repo. New link: https://github.com/discordjs/discord.js/tree/main/packages/builders

Especially because the guide still links to the builders repository.

outer raven

Yeah the other packages should say the same, not sure if one can commit to archived repos though

woeful rain

I recently came across that djs v14 uses discord-api-types which is cool. I was just a bit puzzled by the Subcommand thing, why is it Subcommand and not SubCommand when in UPPER_CASE it is SUB_COMMAND so in PascalCase it should be SubCommand

dim ridge

Will the event messageCreate disappear after April? Or still accessible?

woeful rain

but if you want to see content, you need have message intent

dim ridge

People are lazy.. Starting a / command takes them too long 😅

woeful rain
dawn merlin
woeful rain

Also, why did you choose PascalCase when discord uses UPPER_CASE in their documentation?

dim ridge
dawn merlin
peak zinc

why do GuildEmojiRoleManager and GuildMemberRoleManager extend DataManager, when most of the other managers extend CachedManager?

is this a mistake?

tacit crypt

It's intentional, since they don't store data but rather point to it

peak zinc

interesting

what exactly is the difference?

between datamanager/cachedmanager

don't they both have a cache

strange igloo

DataManager does indeed not have a cache, and the getter just throws an error if you try to access it
CachedManager does have one and its cache getter points to it

peak zinc

ahh ok ty

opaque vessel

Only guild commands can have permissions on them, so there's only one thing it can ever be

peak zinc

(source? where???)

opaque vessel

If you realise that then the distinction isn't needed

Not our problem? They should read up on the routes they're going to use lol

peak zinc

can someone explain to me where this d.ts file comes from

i thought github was the source already

does that show up after installing and building the package?

opaque vessel

When it's compiled d.ts are made

peak zinc

ahhh ok

dawn merlin

Depends it can be hand-written or generated

tacit crypt

Route names for the method are usually build from what the route says (guildMembers, guildBans, invite, channelMessages) etc. Annoying? Yes. Consistent? Also yes

peak zinc

but apparently they meant in the output

tacit crypt

ALTHOUGH to be fair, it should've been applicationGuildCommandPermissions

who did this

dawn merlin
peak zinc
const entry = this.holds ? new this.holds(this.client, data, ...extras) : data;

wondering if there is any situation where data would actually be returned hyperblobthink

outer raven

are components fixed in the latest dev release?

wild flax

Likely not

dawn merlin
outer raven

I'll try then

So components are but interaction.options.getSubcommand() isn't, I guess that will be fixed by the enums PR

ruby terrace
vernal rose
visual hornet

there's a typecheck right before it

copper garden

Could change it to use Number.isNaN, which does both

copper garden

Or actually no, we need it to return true if it’s not a number type

Number.isNaN only checks for NaN

visual hornet

you would still need the type check yeah, Number.isNaN is more specific to NaN
just seems unnecessary to me.

vernal rose
copper garden

I think some of them can take Infinity tho

visual hornet

it gives false for strings which can't replace the typecheck, so why bother

copper garden

It would also give false for NaN, which is correct

visual hornet

meant Number.isNaN

vernal rose
solemn oyster

The global isNaN does Number.isNaN(Number(v)), which parses values to a number

vernal rose

yeah got it

outer raven
slate nacelle

I submitted a PR to address that.

outer raven

Thank you!

outer raven

Can we get a manual run of publish dev pls prayge

outer raven

Thank you!

On the latest dev the component constructors are exported from builders but they don't exist there yet do they?

It seems like there hasn't been a builders release since that was added so that won't work

icy bronze

would you guys recommend using enum resolver or importing types or just putting the raw number in code