#archive-library-discussion

25217 messages · Page 12 of 26

strange igloo
#

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 this 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 (:

opaque vessel
oak quail
#

lol what

#

@unique axle ^

opaque vessel
#

I just found that out :D Managed to get it like that as so, will try to correct it :eyes:

loud jayBOT
outer raven
#

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

raven cloak
#

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

ornate topaz
#

not possible really

#

events for threads are only sent on API v9

raven cloak
#

Damn

ornate topaz
#

v12 still uses v8, and it's not really possible to move v8 to v9 in a patch or a minor

raven cloak
#

Yeah that's understandable

ornate topaz
#

eh, doesn't change the answer

#

and v7 is v6 anyway :)

solemn oyster
#

Yes, both are deprecated versions

#

While v8 is current and v9 is latest

empty viper
#

And what v9 adds ?

wild flax
#

Threads

raven juniper
outer raven
#

was waiting for the person who replies to do that

ornate topaz
#

then you do it so it exists already instead of it not existing until someone decides to answer you

outer raven
#

fine

#

Possibly change Message.startThread to accept an object instead of 3 parameters

tacit crypt
#

@vernal atlas removing the assignment to this.target will break it more

vernal atlas
#

no?

#

i meant not assigning the promise itself to this.target

tacit crypt
#

Yeah, that

#

since the build method awaits all entry.target

#

and now you have a dangling promise thats never properly awaited

vernal atlas
#

oh mb

#

will fix

tacit crypt
#

Thats why I asked you if this still works meguFace

#

test it

vernal atlas
#

works

outer raven
vernal atlas
#

yeah probably

outer raven
#

aight, will do that

unique axle
#

i still don't see much if any utility in that method existing at all

outer raven
unique axle
#

then you can still do embed.fields = or set the length to 0 to clear it and re-populate it

outer raven
#

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

honest barn
#

i don't get why setFields would be useful

#

just make a new embed

vernal atlas
#

if im being honest i dont see the use case for it either

outer raven
honest barn
#

thats a good point

outer raven
honest barn
#

then you can still do embed.fields = or set the length to 0 to clear it and re-populate it

outer raven
#

if you wanna go that way then why do all of the MessageEmbed methods exist?

honest barn
#

hmm makes sense

#

yeah youre right

real jetty
wild flax
#

No, its a good change.

tacit crypt
#

Also not library related

outer raven
#

Shouldn't DataManager#cache be readonly on the docs?

pulsar dirge
#

nevermind my question i just posted, i was being dumb

sage frigate
outer raven
#

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

copper laurel
#

I disagree that it's not intuitive. It's pretty much exactly a basic Array method from core JavaScript

#

New users need to learn

outer raven
ornate topaz
#

they also don't do that for arrays, but i don't remember any Array.setValues, maybe apart from fill

spiral fulcrum
#

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).

dawn basalt
#

Why does interaction.reply() not return with the reply Message?

copper laurel
#

because discord doesnt give us the message data back

spiral fulcrum
#

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.

copper laurel
#

Just because you can doesn't mean you always should

oak quail
#

it makes sense to be able to limit it without it removing the client user

wild flax
strange igloo
#

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? Thonk

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

outer night
#

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 shrug shouldn't be playing with fire if you don't know it burns

spiral fulcrum
spiral fulcrum
slender kettle
#

Does someone know why the buttoncolours are named so unsual?

solemn oyster
#

wdym so unusual

strange igloo
#

That's how Discord calls them, not a decided by discord.js

Think they mean primary, danger etc instead of blue grey or red

bitter peak
#

yarn outdated flags dev tag as outdated

winged dust
#

shouldn't it be interaction.author.id instead of interaction.user.id ?
like msg.author.id

lethal storm
#

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

thin obsidian
#

Idk

strange igloo
outer raven
#

I think it's important to do that before v13 arrives, if we do

wild flax
#

just make a PR then

outer raven
#

alright, sure

spiral fulcrum
#

It will, thanks.

honest barn
#

should i update the example in the readme to a slash command?

strange igloo
#

probably copy the example from the website* yeah

nevermind it's the same lol
i would have sweared to have seen an interaction example

vivid field
#

yes, the one from the website used interactions

#

it was just removed completely

strange igloo
#

prob because people thought it'd work out of box without any slash command creation? thonk

wild flax
#

Yeah

#

And it’s too long otherwise lol

#

So i at least removed It from the front page for now

loud jayBOT
honest barn
#

do i update the example in the website too

strange igloo
#

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)

honest barn
#

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

wild flax
#

imo the example usage needs to handle creating a command too

#

otherwise its worthless

honest barn
#

but then it would be using a text based command again for deploying

wild flax
#

no, why?

honest barn
#

at least in the guide it does that by making a !deploy command

wild flax
#

I highly doubt that

honest barn
#

and making it create one on ready would be potentially bad for ratelimits if the bot is restarted a lot

strange igloo
#

that's nitpicking but message.content can be null

wild flax
#

Can it?

#

Anyway, scroll down on the guide

strange igloo
#

if that question was for me, yes if you just send a file it will be null

honest barn
#

hmm, i see it's a separate script for deploying

outer raven
#

Hey @solemn oyster can you undo that commit on my PR? I don’t think that should be changed

solemn oyster
#

Talk about timing

#

The change was requested for 4 hours and you reply 2 minutes after I make the change

outer raven
#

I literally just woke up

wild flax
#

It does fail the CI too though

solemn oyster
#

Gonna revert with force-push

outer raven
#

Yeah it doesn’t make much sense

solemn oyster
#

There, reverted

outer raven
#

Thanks!

solemn oyster
strange igloo
outer raven
#

yeah that could probably simplify the code a lot and reduce memory usage

tawny warren
#

Additionally, all messages sent by bots now support up to 10 embeds. As a result the embed option is completely removed, replaced with an embeds array which must be in the options object.

why? having a single option was very comfortable, having an array only bloats my code, perhaps accepting the embed option and turning it into an array would work better

outer raven
#

if you can send more than 1 embed why would discord.js support sending only 1 embed, it's just a useless shortcut and you don't need to change much

bitter peak
wild flax
#

You are being very minimal about it

#

Maybe rethink the usage of the word “bloat”

tawny warren
#

i made a lot of the conversion by hand, it's kinda tedious when you call the send method a lot and never intend to send more than one embed

wild flax
#

Have you thought about making your own send function then?

#

send(message, your, own, arguments)

#

And inside you can wire it up as you like

#

So whenever something breaks, you can change it in 1 place

tawny warren
#

yep, most of my commands do like return embed

#

but in some cases i send non command messages and that's where it gets longer - i still preferred having the singular options

wild flax
#

It’s not coming back

#

That’s for sure

tawny warren
#

why? that's what i want to know. i have no problem editing my code but my original question was left unanswered

wild flax
#

It was never intended to stay once discord switched to allowing multiples

#

We mirror the api for args we take closely

#

Also it could lead to problematic code like:
embed: embed1, embeds: [embed2]

tawny warren
#

that makes sense then

wild flax
#

Yeah, I mean it’s valid that you ask but

#

We aren’t doing this for fun lol

outer raven
#

I feel like most people that have membership screening now only consider someone a member of their server once they complete the required steps so wouldn't it make sense to have a property in guild called estimatedMemberCount (name suggestions are welcome) that holds the amount of users that are not pending based on the cache? Basically something like this

get estimatedMemberCount {
  this.members.cache.filter(m => !m.pending).size
}
wild flax
#

Misleading because this requires an intent and caching might be restricted or sweeped

#

Thus -> pointless

#

Just do it yourself

outer raven
#

I figured but the name does include estimated, we could add a note in the docs saying what they need to do in order for that to be fully accurate

wild flax
#

Meh

outer raven
#

probably not worth it since it's so simple but I feel like it would at least encourage people to check for pending more often

wild flax
#

Encourage why?

outer raven
#

cuz if they check the docs and see that there is a property that makes counting non pending members easier they might look further into what makes a member pending and change their code accordingly, just a guess tho

wild flax
#

That… is our concern why?

outer raven
#

not saying it is, just a small QOL thats all but not the end of the world if it doesnt exist either

solemn oyster
#

We don't need to bloat the library with a lot of getters, tho

#

Specially if they're very unreliable

outer raven
#

understood

#

Well one more thing: it is possible to make autoArchiveDuration an optional parameter when creating a thread?
We could use the channel's defaultArchiveDuration and throw an error if that's not present (since users need to set it in order for it to appear)

fallen arrow
neat bolt
#

fiexd

fallen arrow
#

xD

empty viper
#

x)

honest barn
#

@wild flax someone requested these changes on my readme pr for deployment support, thoughts?

console.log(`Logged in as ${client.user.tag}!`);
if (await client.application.commands.fetch().then(commands => commands.size) === 0) { await client.application.commands.set([ { name: "ping", description: "Replies with Pong!" } ]) }
wild flax
#

no

#

you should incorporate the portion of the guide

#

"advanced deployment"

#

in a separate codeblock above or smth

#

explaining that you need to register a command first

#

and then run the bot

honest barn
#

hmm

#

do i keep the deployment example as a guild command like in the guide

wild flax
#

i mean sure

#

otherwise it takes 1h to deploy

#

lol

honest barn
#

yeah

#

do i keep const commands = client.commands.map(({ execute, ...data }) => data);

#

that would only work with a command handler ig

wild flax
#

yeah no hardcode it to a ping command or smth

honest barn
#

sure

#

doing this on mobile is hard so expect me to commit the changes tommorow

honest barn
#

is this fine? (i know the formatting is fucked up i'll fix it later)

const { REST } = require('@discordjs/rest');
const { Routes } = require('discord-api-types/v9');
const { token } = require('./config.json');


const command = {
name: 'ping',
description: 'Ping the bot'
} 

const rest = new REST({ version: '9' }).setToken(token);
try {
console.log('Started refreshing application (/) commands');
await rest.put( Routes.applicationGuildCommands(CLIENT_ID, GUILD_ID), { body: command }, ); console.log('Sucessfully reloaded application (/) commands.'); } catch (error) { console.error(error); }```
tired valve
#

fairly certain the body needs to be an array

honest barn
#

yeah, i'm on mobile so i can't really test it right now, thanks for telling me

wild flax
#

just do it tmr

#

lol

tired valve
#

The description should probably also match up with the guide

honest barn
#

yeah

#

do we really need the console logs

#

its just a example usage after all

upper moss
wild flax
#

seems like a bad excuse to give people some bad code

real jetty
#

Why are features removed from the lib that are already there? Like Collection.array being removed in favor for.. [...collection.values()]? I guess my question is why remove something that works for no (apparent) reason? Because imo collection.array() looks cleaner then that

oak quail
#

because its pretty pointless

real jetty
oak quail
copper laurel
#

The .array() method only existed to provide access to a internally cached array for some methods. With those methods refactored to no longer rely on cache, .array() was no longer doing anything that didn't already exists in base JavaScript

oak quail
#

is Client#_finalize() supposed to be marked as private?

void rivet
#

For inviteCreate

     const client = this.client;
    const channel = client.channels.cache.get(data.channel_id);
    const guild = client.guilds.cache.get(data.guild_id);
    if (!channel) return false;

    const inviteData = Object.assign(data, { channel, guild });
    const invite = guild.invites.add(inviteData);
``` and for inviteDelete
```js
    const client = this.client;
    const channel = client.channels.cache.get(data.channel_id);
    const guild = client.guilds.cache.get(data.guild_id);
    if (!channel) return false;

    const inviteData = Object.assign(data, { channel, guild });
    const invite = new Invite(client, inviteData);
    guild.invites.cache.delete(invite.code);

it checks for the channel but not the guild, so if I only disable the GuildManager cache, the guild should return undefined
and since there's no check, for both this and inviteDelete, it'll cause an error
is this expected?

oak quail
honest barn
#

@wild flax i've been testing the deploy code and i ran into two issues

#

one is that i cant use await because it's not an async function

#

which is easy to fix

#

but then there's this one while importing the api types

#

nvm i fixed it by updating to latest

#

for some reason it installed 0.18 before

#

the problem now is that removing await makes it log this even if the promise fails

#

do i add a .then or something

stray delta
#

well you see removing await would make it synchronous so that's intended

honest barn
#

the thing is that the code is supposed to be async because it uses await

#

but since it's not an async function it throws an error

stray delta
#

pretty sure lts node enables TLA

honest barn
#

im on node 16.5 rn

honest barn
#

okay so i ended up not removing the await and commiting the changes, will remove it if needed

solemn oyster
outer raven
wild flax
#

wdym why

fallen arrow
#

#6114 ChannelUpdate.js
im assuming this was an accident?

#

newChannel is not going anywhere now

slate nacelle
#

Looks like an accident, yes.

wild flax
#

Happy little accidents

fallen arrow
#

pr'd

slender kettle
#

What do you think about renaming/adding the events to edit, reply, delete and similiar of CommandInteraction similiar to Message or Message similiar to CommandInteraction?

honest barn
#

pretty sure it's like this to match discord's api

wild flax
#

I don't even understand the question

slender kettle
#

Like you do <Message>.edit() and <CommandInteraction>.editReply()

wild flax
#

Yeah what about it

slender kettle
#

Couldn't they be matched? .-.

wild flax
#

No

#

You aren't editing an interaction

#

you edit a reply

slender kettle
#

but there's <Message>.reply() and <CommandInteraction>.reply() too

#

So there would be a edited a reply too or not?

#

(in master branch)

wispy mason
#

?? interaction.editReply edits an existing reply to the interaction, but message.edit edits the message

#

they're completely different

vivid field
#

I just noticed, shouldn't .defer() actually be .deferReply()?

#

For the reason stated above and to be more consistent with update -> deferUpdate

honest barn
#

hmm

opaque vessel
#

Also I noticed the immediately invoked function expression on the README.md is missing a semicolon, looks like a styling need since semicolons are used everywhere else in the code snippet + the guide has it

long arch
outer raven
quiet viper
#

Hmm, I wouldnt like to deferButton, deferSelect, deferCommand

#

Thats to much cosmetic changes

opaque vessel
#

Disagree with that, all those would just internally call the same thing and we'd need to add more if more types come. Should just have a deferral for each interaction type

#

Changing .defer() to deferReply() though I think is a good idea (and this can be used currently on all received interactions)

quiet viper
#

This bloats up the libraray, when the Functions Code is the same, then its senseless

#

Since it does the same thing

vivid field
#

It's not about adding a new function for every interaction type

#

It's about showing more clearly which function replies with which interaction response type

#

And the name defer is too ambiguous for that

quiet viper
#

Agree on this point

outer raven
#

I agree. On MessageComponentInteractions, calling .defer() would seem like it would call deferUpdate at first glance but that's not what it does, so removing a generic defer is definitely a good idea imo

#

Also @copper laurel why did you add setTopic back to StageChannel? I thought the discussion was heading in the direction of removing it

copper laurel
#

Because that discussion happened after I had already done it

outer raven
#

ah alright mb

copper laurel
#

I'll wait for a maintainer to decide, or get some indication from API devs

outer raven
#

while you're here, why don't createInvite and fetchInvites go back to GuildChannel?

copper laurel
#

Because you cant create invites to every type of guild channel....

outer raven
#

can't you?

ruby terrace
#

categories, threads

copper laurel
#

you cant

#

Thonk do we still support StoreChannels? You can invite to those cant you

ruby terrace
#

you can

copper laurel
#

stupid store channels

outer raven
#

ahh mb, I forgot about those

#

wait but

#

store channels extend guild channel

copper laurel
#

yes

outer raven
#

might wanna add that then

quiet viper
#

What are even store channels?

copper laurel
outer raven
#

ah aight

outer raven
quiet viper
#

Ah, I remember, interesting

copper laurel
#

I think thats it now, pending official call on StageChannel#setTopic

wild flax
#

Id leave it

#

Like, leave it in

copper laurel
#

If its your own message you can actually edit the embeds out entirely if you wanted to, embeds: []

empty viper
#

Is discord-next gonna be v14 ?

unique axle
#

no, there is no version associated to typescript modules

fallen arrow
#

GuildInviteManager should have a configurable cache, since it extends CachedManager and DataManager, no?
typescript is saying it doesnt exist in CacheWithLimitsOptions

#

seems to be missing from the Caches type

ruby terrace
#

Feel free to PR it in

fallen arrow
#

will do 👍

outer raven
#

The Discord API docs document the member field in slash command options as a guild member object, so can I change APIInteractionDataResolvedGuildMember in the docs to APIGuildMember?

#

just saying this because it currently doesn't lead to anything

#

wait nvm there's a different PR covering this

#

@opaque vessel btw those links were correct, but they changed after i added them

#

as for APIApplicationCommandOptionResolved, that is also the correct link (you can see this from the old one)

outer raven
#

@vernal atlas why do you prefer parent over parentId?

vernal atlas
#

i reacted because i think it might confuse the issue author 😄

outer raven
#

oh

vernal atlas
#

its also slightly off-topic for that issue no?

wild flax
#

Why shouldn’t it accept both?

#

Adding roles to a member does it too

vernal atlas
#

both aThonking

outer raven
#

ill just fix it on setParent and pr tho, parent does make sense

vernal atlas
wild flax
#

Wdym where

#

I can choose to either provide a role or a roleId

#

Or is that not the issue

vernal atlas
#

oh no thats not the issue

#

its the name of the property on the options

#

parent over parentId

outer raven
#

ye i didn't think it could be a channel resolvable

#

never used that so it didn't cross my mind

wild flax
#

Oh

loud jayBOT
outer raven
#

btw

wild flax
#

Yeah parent makes more sense then

#

parent can imply both a struct or id

#

But parentId heavily implies an id only

#

All gucci

outer raven
outer raven
#

Was thinking of making a PR that would use a es2021 feature, is that ok for v13?

honest barn
#

if it works in node 14 sure i guess

ruby terrace
#

I've already updated the eslint config to target es2021

outer raven
#

Ah alright
I had some issues with es2021 stuff when using node 14 so I upgraded to node 16, that’s why I was asking

ruby terrace
#

logical assignment stuff is 15+ so no

outer raven
#

Oh wait really?

#

Well then we can’t use everything from es2021

ruby terrace
#

other than finalizers and weakref we're still on es2020 yeah

outer raven
#

PepeHands there goes my idea then
I’ll still PR tho and we can change to the es2021 way later

#

Was gonna use ??=

#

Should I add a TODO comment or is that too annoying since it appears on every pr going forward

honest barn
#

??= is epic but it was introduced in node 16

outer raven
#

15*

honest barn
#

wait really

#

i remember trying it out in node 15 and failing

honest barn
#

i see

#

still

#

it wont work in node 14

#

sad

outer raven
#

Yeah

ruby terrace
#

No, there will be a PR to do that in a bunch of places for v14 I'm sure

outer raven
#

just saying it may be hard to find but ill leave a regular comment then

wild flax
#

we want to mostly move away from mutations anyway

#

so local assignments will be mostly useless

honest barn
#

wdym with mutations

outer raven
#

I ended up not needing any of that but it may come in handy in the future

empty viper
#

When Node v16 will be LTS, is djs will move to it ?

outer raven
strange moat
#

probably the next major release of discord.js it will

outer raven
#

yeah ^^

copper laurel
#

We'll move to it if/when we want to use features introduced by it

#

There's not much reason to arbitrarily bump up Node versions if theres no benefit

honest barn
#

i think the new operators like ??= are a huge benefit

copper laurel
#

I mean, maybe

#

But thats just refactoring stuff that already works without the operator, its not important

honest barn
#

yeah its a low priority

solemn oyster
#

In some classes we do something like```js
if (data.foo) {
this.foo = data.foo;
} else if (this.foo === null) {
this.foo = false;
}

iirc, `User#bot` is one of those cases
#

That could be refactored tojs } else { this.foo ??= false; }

copper laurel
#

I know we could use it of course

#

But theres no immediately urge to

solemn oyster
#

The recent change to support custom user agent parameters could also use it

empty viper
copper laurel
#

why

outer raven
covert flint
#

it is

real jetty
#

Any reason why repliedUser is not on ReplyMessageOptions and is instead super'd from BaseMessageOptions allowedMentions? Can you reply to a user without message#reply?

ornate topaz
#

doesn't current setup of it being placed in MessageMentionOptions allow it to have different default value passed via ClientOptions?

real jetty
copper laurel
empty viper
copper laurel
#

Because like I said

#

Why do we need it

vagrant holly
outer raven
#

Apparently the Collection link was removed from the docs, which file should it go in?

#

gonna PR and throw it in the Client file cuz i don't see a better place for it atm

outer raven
#

Is there any reason why ClientUser#setActivity still accepts 2 parameters instead of just 1 object?

#

Since v13 already changed that for sending messages, I think it would make sense to do so here too

quiet viper
#

There should be a function for hydrating objects from broadcastEval or anywhere else to a guild object, so you can access the methods and getters

quiet viper
# solemn oyster So... using v8's serder?

what are you meaning lol?
lemme elaborate:

const guildobject = {id: guildid, name: guildname...}
const guild = client.guilds.hydrate(guildobject)
guild.leave()
///Functions, which can now be accessed
```Turn a plain object in a Discordjs Structure
solemn oyster
#

v8's serder is able to serialize and deserialize complex types

strange igloo
#

Would guildobject be a Guild#toJSON or a raw Discord guild object

solemn oyster
#

Curious, we can't use it for v12's collections

solemn oyster
glass cypress
#

when is v13 gonna drop

unique axle
#

when ever crawl feels like it + 1 day every time someone asks, +1 week whenever someone asks in devcorner channels

long arch
#

Should defer be changed to deferReply? I remember a conversation about that here the other day but a maintainer didn’t give an answer for it so I’m not sure if it’s a yes or a no

Conversation started from here #archive-library-discussion message

copper laurel
#

We kinda dont care

long arch
#

So like you guys wouldn’t mind if a PR is made for it to be changed to deferReply?

#

Cause like I don’t want to open a PR for it and then have it be rejected or whatever

copper laurel
#

I mean people will probably debate it, but you're welcome to make the PR

outer raven
#

Why is the Emoji CDN endpoint the only one that defaults to png instead of webp?

#

the docs don't document that

real jetty
#

I still don't get how the djs manages the requests Hmm Especially the APIRouter file

wild flax
#

A big mystery

rough glacier
#

currently <Message>.content is marked as nullable in the docs but it returns '' when no content is specified. Should it return null or be marked as a string ?

outer raven
#

Yeah the API sends '' too, should probably be updated

slate nacelle
#

That's for partial messages.

obtuse hazel
#

Then every property should be considered as nullable, excepted the id, in each structure which might be partial, which is not the case

slate nacelle
#

The docs seem to take those into account, except for cleanContent.

outer raven
#

@solemn oyster since you already approved https://github.com/discordjs/discord.js/pull/6278 lemme ask you this
We noticed on the upstream PR that Discord actually defaults the autoArchiveDuration to 24h and not the channel's setting. Should we try to set it to the channel's defaultAutoArchiveDuration when it exists?

solemn oyster
#

That's why we don't land stuff before they land in dapi-docs

outer raven
#

yeah ik

#

the fix is really easy, should I push?

solemn oyster
#

@wild flax @tacit crypt @slate nacelle wdyt?

tacit crypt
#

02shrug whatever crawl says

solemn oyster
#

I personally think we should not define the default, but let Discord default it

#

To not deviate from the behaviour from Discord

outer raven
#

but then if discord defaults to 24h it might be counter-intuitive if people are expecting to see the setting they chose

rough glacier
#

would a "MAX" option in autoArchiveDuration based on guilds boost count be too much of a runtime check?

winged dust
#

when replying to an intent with nothing (interaction.reply()), a better error would be nice. This one isn't very descriptive: UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'fetchReply' of undefined

#

I spent a lot of time with this stupid mistake in my code 😅

ruby terrace
#

options is documented as required

strange igloo
#

If you really want a strict language that tells you when you're not using methods correctly, you should probably switch to TypeScript Thonk (or at least get its server running on your code)

winged dust
#

yes yes, I know, I'm just saying that in case someone doesn't give any arguments by accident, a better error would be nice

strange igloo
#

While that could be possible, validating any possible input would take a large part of the code and create useless checks at runtime

winged dust
strange igloo
#

OP's idea is equivalent to a warn, you say it's wrong but don't halt it (so basically you'd still get the thrown error later in the code)
The second one would probably be the "best" one (but with throw new Error instead, and no console.error at all) - but as I said the code related to input validation would likely take like a third of the whole code, then
The last one that wraps everything into a try/catch is terrible

copper laurel
clever summit
#

@copper laurel seems like https://github.com/discordjs/discord.js/pull/6262 broke guild text channels. From my testing _patch gets never called because immediatePatch is set to false throughout the constructor chain. calling this._patch(data) at the end of the BaseGuildTextChannel seems to work, though idk if that breaks something different

copper laurel
#

Yeah okay these never patch

#

I think I would need to add a constructor back to TextChannel which just calls super with false and then patch

#

And then patching starts its own super chain?

#

(and NewsChannel probably)

ruby terrace
#

it should _patch at the end of the BaseGuildTextChannel constructor

copper laurel
#

I guess it could there too

ruby terrace
#

at least until there's a constructor in its subclasses

copper laurel
#

Should I just put constructors back there I mean

ruby terrace
#

What would possibly go in them

copper laurel
#

this._patch(data) 😄

ruby terrace
#

lol, up to you where you put it

copper laurel
#

Nobody uses text channels anyway

copper laurel
#

@outer raven | number is a valid type for those - when you create a guild you can also create roles, set overwrites etc all at creating

#

You reference the roles by a referential index

copper laurel
#

Yep

#

Say you create a guild, and you also tell it to create 5 channels, you can reference those 5 channels by number for overwrites, and roles etc

outer raven
#

ahhh I see

#

alright my bad, will revert

copper laurel
#

All good, its a specific niche case that rarely gets used

#

But I imagine before Guild Templates were a thing template bots probably used this sort of stuff often

outer raven
#

I don't see why a bot would own a guild tho but yeah if it's there we gotta document it lol

unique axle
#

that is largely irrelevant, it's supported api spec
(also me, hi, i use that)

outer raven
#

lol aight

strange igloo
vernal atlas
#

probably not a bad idea

tender field
wild flax
#

used to be the fastest

tender field
#

hmm weird i'm pretty sure it's the slowest

#

at least in all my cross-platform workflows, it's always the slowest

wild flax
#

it might be by now

supple current
#

what r the possible text of <MessageAttachment>.contentType

oak quail
#

it's returned by the API, djs just passes it through

supple current
#

oh ok thx ill look into it

outer raven
hasty kindle
#

Is there any chance of an embedded audio file, similar to videos, images, YouTube, etc.?

slate nacelle
#

I don't think implementing that is within our power.

thorny tree
#

why 😭

slate nacelle
#

Because it just was an alias to the resolve method of the member manager.
No idea why that isn't used in the second line there.

thorny tree
#

yes but it was really useful and very short way to test if the bot has certain permission

slate nacelle
#

Guild#me is still there, isn't it?

thorny tree
#

oh thanks 😄

outer raven
#

@tacit crypt btw

tacit crypt
#

Huh? They changed the name? Is that en-us?

tacit crypt
#

@outer raven

rough glacier
#

@tacit crypt should i use a temp value and assign something like maxArchiveDuration ?? data.autoArchiveDuration since they all get reassigned?

tacit crypt
#

perhaps? could do it like the file above the one i reviewed

outer raven
#

they changed this months ago tho

#

same on en-uk btw

rough glacier
round thorn
#

Is there a reason why URL isn’t capitalized when used on its own but is capitalized with other words hmm

Example:
MessageAttachment.url
MessageAttachment.proxyURL

I can make a PR to fix this inconsistency unless it’s like that for a specific reason

outer raven
#

because why would you have .URL

tiny swan
#

Maybe .proxyUrl

round thorn
#

^

#

Idm which but it should be the same tbh

clever crypt
#

what djs currently uses is correct and follows camelCase standards

#

if the name of a function/property is an acronym, it should be lowercase (MyClass.url, MyClass.http). the rules are different for constants

#

but it also depends on the length of the acronym. so like openURL looks descent and openHTTPConnection looks odd

#

v13 changed Guild.ownerID to ownerId and interaction.channelID to channelId because:

This is a more-correct casing for the camelCase used by discord.js as Id is an abbreviation of Identifier, not an acronym.

URL is an acronym

round thorn
#

I don't think the library reflects this atm

solemn oyster
#

@clever crypt we'll eventually replace them to Url

outer raven
#

wait you will?

#

why tho

copper laurel
#

Because of all the reasons already listed above

uneven rain
#

so if a user was uncached when the bot was started, and they sent a message thus triggering the message event, would that cache them?

copper laurel
#

yeah

real jetty
#

You would need to have the intent(s) to trigger the event though, I think

stray delta
#

..yes?

honest barn
#

wait why is the minimum node version 16.6 now

#

are any of its features used in the code

solemn oyster
#

Not at the moment, but we will

#

Normally, we'd make the minimum 16.0.0, but 16.6.0 is a security release, so anything lower than that is discouraged.

#

16.6.0 brings Array#at in comparison to 16.0.0, which brings logical assignment operators (||=, &&=, ??=)

analog plover
#

Since to Node.js added an AbortController (quite a long time ago), why not use it in the library instead of the abort-controller module?

solemn oyster
#

OH YEAH

#

@wild flax can we have this change before release?

stray delta
real jetty
#

I was wondering why I was able to install a module nodejs already has(abort controller), now realized its not the same...

ruby terrace
real jetty
stray delta
#

the latter

outer raven
#

Why is node v16 gonna be required? Afaik there's nothing that uses node 16 in djs right?

hallow ocean
#

according to Monbrey:
But we're setting it to 16 so we can use its features later

outer raven
#

nah you can install it but you get a warning

#

I really don't think you should be recommending a version of node that is not LTS

#

I mean sure it will be in 2 months but it isn't yet

copper laurel
#

Yeah but we also dont care

#

We dont want to have to release v14 in two months in order to use new Node features

#

When we can just make this version a v16 version

outer raven
#

why would you release v14 just to use the new node features

#

like someone said the other day they're nice to have but you don't need them that urgently

copper laurel
#

But we can also set v16 now

#

And not need a semver major if we want anything

#

I don't see why it's an issue

outer raven
#

v14 would've been a semver major anyway and when that comes out node 16 will be LTS

#

I think it would've been better to wait tbh

wild flax
#

We agreed internally having a 2 month transition period where it is still "current" before it transitions into "LTS" is ok 👍

outer raven
#

aight

void rivet
#

(repost)
For inviteCreate

     const client = this.client;
    const channel = client.channels.cache.get(data.channel_id);
    const guild = client.guilds.cache.get(data.guild_id);
    if (!channel) return false;

    const inviteData = Object.assign(data, { channel, guild });
    const invite = guild.invites.add(inviteData);
``` and for inviteDelete
```js
    const client = this.client;
    const channel = client.channels.cache.get(data.channel_id);
    const guild = client.guilds.cache.get(data.guild_id);
    if (!channel) return false;

    const inviteData = Object.assign(data, { channel, guild });
    const invite = new Invite(client, inviteData);
    guild.invites.cache.delete(invite.code);

it checks for the channel but not the guild, so if I only disable the GuildManager cache, the guild should return undefined
and since there's no check, for both this and inviteDelete, it'll cause an error
is this expected?

copper laurel
#

You REALLY should not disable the guild manager cache, and we added warnings and removed it from types so you dont

#

Like if there's any cache you shouldn't disable it's that one

void rivet
#

Wasn't aware of that
came across this issue because a user disabled every cache they could

#

so I take it this falls in the functionality break category and there's no need to add any further checks?

raven cloak
#

Thanks to all the contributors who helped ❤️

vagrant holly
#

Can a PR be made to remove the message event now that v13 is out? mmm

opaque vessel
#

I wonder if there's a chance now to rename the master branch to main? Not sure if that would mess anything existing up

digital hawk
#

see so my thing is. I'm okay with it being node 16 but it's just that many use v14 lts because it's lts

digital hawk
#

yes v16 goes into lts in like 2 months

copper laurel
#

So if you want it to keep work if we do a minor release like v13.1, use node 16

copper laurel
void rivet
#

okay thanks 👍🏻

vivid field
digital hawk
#

from what I've seen, v13 doesn't even work on node 14

#

cuz abort controller yeah

vagrant holly
copper laurel
vivid field
#

oh true, it's --experimental-abortcontroller

copper laurel
#

Anyway, only talk here if discussing lib development please

vagrant holly
wild flax
#

Why not?

vagrant holly
#

Wasn't sure if y'all had a planned deprecation period

tacit crypt
#

its not like v14 is coming out tomorrow

round thorn
#

damn there goes that hope 😔

quiet viper
#

Will the existing PR's merged in v13?

#

and how will it be with new Features?

solemn oyster
#

New features will land as semver minor (13.1.0)

quiet viper
#

👍

tacit crypt
#

Unless they're breaking in which case why v14

drifting knot
#

should structures with a .toArray() method also have a Symbol.iterator that calls it

drifting knot
#

huh i guess bitfield is the only thing with a toarray method and it already has an iterator

#

nvm

wild flax
#

@oak quail can u rebase your PR (banners)

warped crater
vagrant holly
#

Will open another to keep things clean

warped crater
wild flax
#

less conflicts too potentially

#

lol

vagrant holly
#

Slightly meta, is there a reason Gh sponsors points to Amish, and not y'all who actually maintain the lib daily?

wild flax
#

because we get robbed

vagrant holly
wild flax
#

I have no idea honestly

#

github also only allows 4 people

#

which kinda sucks

vagrant holly
#

4 works

wild flax
#

we have like 5 though lol

vagrant holly
#

who am i missing

wild flax
#

hydra, me, space, vlad, kyra

vagrant holly
#

space doesnt have gh sponsors

unique axle
#

no love for the support crew

wild flax
#

guild subs soon

#

well just charge people here

#

lol

vagrant holly
#

What's hydra's username

wild flax
#

hydrabolt

#

amishshah

vagrant holly
#

oh same person

#

yeah so 4 works cause space doesnt have sponsors

wild flax
#

should add my ko-fi link in there too

vagrant holly
#

smh

wild flax
#

man I wish they would accept OF

#

oh they do with custom!!

vagrant holly
#

You can do custom links

#

Yeah

wild flax
vagrant holly
#

Gonna get some spicy pics of djs source on OF, soon™️

wild flax
#

naked inner workings of our code

cobalt comet
#

Can I hold d.js' hand?

icy bronze
#

yo, I don't know where to ask because #djs-help-v14 is flooded by v13 update but i'm having an issue when I require Message structure in the Webhook structure (forked repo to edit myself some stuff), it seems to invalidate the holds and cause it to be an empty object (very weird), is there any reason behind that?

unique axle
#

we do not provide support for forks to persist old features
potatodetective oh, this is not about Structures, i see

icy bronze
#

not exactly old feature

#

just a quick edit on the webhook structure where I build Message instead of returning APIMessage

#

but when I require it on top of the file, I don't get why but it invalidate my Message hold in MessageManager

#

I never used Structures to extend ehe

#

i'll provide more context if you don't mind

#

Webhook file, simply require Message

#

what I edited, build Message instead of returning APIMessage

#

the issue I get

#

and I have verified, when I bring back the file to the lib state, I don't have any holds issue

#

I also tried console loggin Message in different files.
Webhook file returns the class
MessageManager file returns an empty object

#

so node warnings are giving me more context
Warning: Accessing non-existent property 'Symbol(nodejs.util.inspect.custom)' of module exports inside circular dependency

copper laurel
#

Circular dependency is why

tacit crypt
#

Move the import to the bottom of the file or in the function

icy bronze
#

yeah got it but how could I do in my use case 🤔

#

alright I was trying in the function, still not done yet but i'll update

icy bronze
#

welp, here is my workaround, seems to be working

#

ty for helping everyone

#

by the way, it may be confusing the reason of doing that but its because I use the lib without the gateway for my interaction project (that runs with webhooks) and it lacks of support for uses like that.
so I am doing workarounds that aren't much reliable but works

#

building the Message here allows me to create interaction collector for example without having the channel in the cache

#

pretty useful when you don't want to fetch the channel each time

bitter peak
#

As the announcement says, it will be patched soon

loud jayBOT
real jetty
#

Why was Guild#owner removed?

rustic boughBOT
strange igloo
#

Because the member object associated to the guild owner was not guaranteed to be cached - as a replacement, that method ensures you will get its member no matter what

stray delta
#

sounds like the opposite reasoning why fetchApplication was removed lol

strange igloo
#

The application is unique, only used for the client, so I guess it can behave differently

tacit crypt
#

which never changes

slate nacelle
#

It effectively just moved to Application#fetch, as you couldn't use it before logging in anyway.

fallow crater
#

Will any of the packages in discordjs/discord.js-modules be implemented into discord.js? Or should these modules only be used for interacting with the Discord API without a bot?

tender field
#

This is a rewrite of discord.js, so the main package will work the same as the current one, and i don’t think they’ll be implemented in the current djs because their goals is to replace the current one entirely, not implement them in the current one

copper laurel
#

Not entirely true - there's no reason parts of it like rest or ws couldnt be introduced piece-by-piece into discord.js eventually

tender field
#

Yes of course they could, but i mean they are mainly being built for /core right? Not to replace current djs pieces (event though if they are ready before /core, yes you don’t have any reason to not implement them)

copper laurel
#

It makes more sense to implement the modules if we want to continue enhancing them, otherwise you end up in the situation we're in now - djs v13 got enhancements that modules doesnt have, because its twice as much work

#

Better to enhance in one place

tender field
#

Yeah right

real jetty
#

why are ya still recommending erlpack to be installed? it doesn't work with node 16 at all

#

theres a pr for it, but due to the lack of activity in the erlpack repo i doubt its getting merged

solemn oyster
obtuse fox
#

is detect invisible user possible?

wild flax
#

no

solemn oyster
#

It's invisible for a reason

honest barn
real jetty
#

Why doesnt GuildMemberRoleManager have a method fetch()?

#

What if I wanted to contact API directly to check if a user has a specific role Hmm

unique axle
#

there is no guild member roles endpoint, is there

real jetty
#

Oh

real jetty
unique axle
#

the member data includes a list of role id's. we resolve them based on the roles we get from the initial guild payloads + update events

real jetty
#

hm ok

unique axle
#

you can fetch all guild roles, but not the ones of a specific member, including the actual role information
the association member -> role always works via the id in the member and the data in the role payload

real jetty
#

Ok

bitter peak
#

btw @wild flax the version number pr should be good now

terse magnet
#

Why APIMessage has been deleted? To prevent developers from using additional libraries?

slate nacelle
#

It has been renamed to MessagePayload.

terse magnet
#

Thanks

icy bronze
#

Hey, trying to import discord.js using ESM gives me this.
I have fixed it replacing by "import": "./src/index.js" but it shouldn't be the way

wild flax
#

I am using ESM, so that can't be

#

Its probably because you run from github

#

The esm only gets generated on publish

icy bronze
#

I don't run from github thats weird

clever crypt
#

@tacit crypt @solemn oyster should i refactor all the iconURLs in the Emebd or to iconUrl?

tacit crypt
#

no.

solemn oyster
#

no

tacit crypt
#

URL stays as URL

clever crypt
tacit crypt
#

kyra is fake news-ing

clever crypt
#

calling the cancel culture police

clever crypt
#

okay

clever crypt
#

builders discussion

loud blade
#

Is there any update about the issue where if you use zlib-sync, you would have increasing gc pauses over the time you use it?

real jetty
#

Can't Typing#inGuild() made into a property instead?

#

using a getter

solemn oyster
#

Nope

#

We can't make TS casts with getters, it needs to be a method

oak quail
#

how will d.js handle resolved interaction string mentions 🤔

#

might be useful to just expose resolved

fallow crater
#

maybe they can also be implemented into the CommandInteractionOptionResolver

tacit crypt
#

We actually talked about this (me and @ruby terrace) when we were in VC in Ian's server.. but uh i don't think we got to an "answer".. probably gonna have a Mentions of sort..who knows

#

It's definitely to be done

wild flax
#

Probably like on messages

#

A .mentions or smth

#

It’s dumb

#

It should never have been done this way

tacit crypt
#

🤣

#

True

quiet viper
#

but, when you use the CHANNEL or ROLE Type, you will get the object in the option?

haughty flame
#

why wouldn't there Permission on ApplicationCommandData
so we can just do

      Name: name,
      Description: description,
      Options: options
      Permission: Permission
#

so we wouldnt have to fetch the commands and adding command.permissions.add({ permissions }); manually

unique axle
#

you can't supply permissions during creation

#

those are two separate api calls and shouldn't be mushed together in the library

haughty flame
#

should i ask for this call on discord api server ?

#

or there must be seperate api calls for a reason ?

unique axle
#

technically yes, but they already said they're going to revamp the permission approach, so i doubt that'll do anything

haughty flame
#

Cool, i guess not gonna add a moderation command for now,
my SlashHandler will look like a mess if i do that manually

oak quail
haughty flame
#

what if they add a permission like MANAGE_GUILD only to use the command ?

unique axle
#

@real jetty permissions are still per guild. you patch permissions in the guild scope, not on global, even for global command permissions

#

@haughty flame "what if"'s don't really use much here, you can suggest approaches in discord developers or on their github, we can just implement what's there

brisk remnant
#

Are the TypeScript definitions automatically generated?
I've tried all day to see if I can bundle them up (for the monaco editor) but I haven't suceeded.

covert flint
#

no, they're manual

frank turret
#

tho if you still want me to use Number.isNaN that’s fine, I’m sure regular isNaN is broken in more ways than I accounted for

icy bronze
#

Hey @ruby terrace @solemn oyster @tacit crypt
I am contacting you because since v13, I am having a big issue with memory usage. My bot was already using v13 before the release but using an old commit before some breaking changes.
I have updated it to v13 the same day of the release and since that, my memory never stop climbing, I tried configuring cache but it doesn't get any better.
I'll send some graphs for you

Here is past month, we can see the ram climbing normally (5-6 days to reach the limit but never uses swap or at least doesn't make other process crash)
At the end you can see past 3 days where the ram usage just climbing way faster and never stops, it causes some process to crash like database)

#

Also more closer look to past 2 days usage

#

I have tried multiple cache configurations, here is my current one

tacit crypt
#

Btw, its defaultMakeCacheSettings

#

Thats an offtopic

#

and you have another typo at the Permission one

icy bronze
#

crawl sent me there

#

will fix the typo

tacit crypt
#

its not defaultmake

#

its defaultMake

#

as for ram usage.. do you have any heapdumps you can inspect (do NOT send them, as they can contain your bot token/auth details)?

icy bronze
#

I have tried to heapdump on a shard but it literally killed it lol

tacit crypt
#

right..that

#

What are your intents?

icy bronze
#

13999

#

sorry I don't have a list

#

mmh weird when I select all my intents I don't get the same number

#

it may have changed with new intents

#

but basically this

tacit crypt
#

I see you're not sweeping members, is that intentional?

icy bronze
#

I wasn't before v13 too

#

but I could, I have no reason not to

#

my current config is just some testing I made fast this morning because I didn't have much time

#

but it can be improved I guess

tacit crypt
#

and you don't happen to have v12 graphs, right?

icy bronze
#

v12 you mean?

tacit crypt
#

Yes, my kb skipped a v

icy bronze
#

(after thinking about it I should have created a thread sorry)

#

I switched to v13 the day it was a thing

#

as I said I was on a previous commit before some breaking changes (like send(string, options) one)

#

but I always been on master branch

tacit crypt
#

Then a graph from then

burnt thunder
#

Is there a way you can check if a user has Discord Nitro?

tacit crypt
tacit crypt
icy bronze
#

I have a shard that itself use 8GB of ram, Im making a heapdump and will investiguate

#

the dump only ends being a 600mb file HmmHmm

tacit crypt
icy bronze
#

alright did it with node one

#

still 600mb but eh, ig its normal

vagrant holly
#

fwiw im running pretty much the same intents as you and seeing ~250mb ram per shard @ 1k guilds/shard

#

the only major intent i see you have that i dont is voice states

icy bronze
#

I don't have music just a radio thing

#

and ye im seing ~1500mb per shard

#

and some are going wild I don't know why

vagrant holly
#

I would start tracking the size of different collections to understand what's growing

icy bronze
#

with the dump I noticed one of command taking a lot, i'll find a fix

#

other than that 😐

#

I don't see anything revelant

#

like, TextChannels has 13% retained size

#

perm overwrite manager too

#

does setting a sweepInterval without a sweepFilter works?

vagrant holly
#

No, how on earth will it know what timestamp to use to sweep by?

icy bronze
#

well how do I sweep users or guild members then mmmh

vagrant holly
#

Up to you

quiet viper
icy bronze
vagrant holly
#

My recommendation is very much to start tracking the collection size for assorted collections as well as overall mem usage, so you have a better picture of what's causing issues

#

It made the source of my mem issues w/ the v13 update very obvious

icy bronze
#

damn why I never thought about that before

#

thanks for the tip i'll monitor cache sizes

spice sierra
#

Hello sorry for bothering, you still have the opcode 5 I know it has been removed now but what was it used for when it was available ? (I'm being a bit curious I asked in the developer server but didn't get a reliable answer apparently it's for users)

icy bronze
#

@vagrant holly guild channels are automatically in channels cache too right ?

ruby terrace
# icy bronze I have removed thread caching and it didn't get any better

You didn't remove thread caching, that typo in ..defaultMakeCache made it not sweep archived threads from the guild and client caches, and yes, threads are in the client and guild caches too, so you'll have to write a custom Collection to enforce no thread caching (you'll get a process warning for doing so btw)

icy bronze
icy bronze
wild flax
#

That is really fully making sure nothing gets cached lol

vagrant holly
#

nod Using a LimitedCollection with a limit of 0 is just inefficient, 'cause it does a lot of ops to just go "welp shit im full"

icy bronze
#

ty lmao

vagrant holly
#

I should also note that lastMessageTimestamp is not a standard prop of User/GuildMember, I inject it in a listener

icy bronze
ruby terrace
vagrant holly
#

Oh neato, will switch back to it then

ruby terrace
icy bronze
#

my larger cache is

#

permissionsoverwrite

#

thanks

#

120 fucking millions

#

bye

vagrant holly
#

that seems

#

risky

icy bronze
#

skillz

outer night
#

can you guys take this into a thread?

icy bronze
#

nah jk but shouldn't I set a maxsize or sum

vagrant holly
#

Koyamies caching hell

real jetty
#

I had a question regarding copyright for async queue, I'm talking about the v12 file instead of the sapphire/async queue package. I want to add the async queue file to one of my projects, I included the copyright comments that say its the property fo Kyranet and Discord.js

Is there anything else I need to do regarding copyright stuff?

tacit crypt
#

Why.. aren't you using the module from npm?

#

But usually if you just copied the d.js file it should be fine, iirc it had a license headee

real jetty
tacit crypt
#

You know that adding extra dependencies isn't a bad thing right?

#

Nonetheless, if you don't want to install the dep, make sure your local file has the license header

real jetty
tacit crypt
#

Yes

real jetty
# tacit crypt Yes

Also what about the APIRouter, RequestHandler part? Do I need to add djs license header for that too? And sorry this will be the last question I promise

tacit crypt
#

Yes, yes you do. I don't exactly know which part of it is needed, but you would need to provide the license header. Or use @discordjs/rest

solemn oyster
#

Having certain deps within your project, instead of having them as regular dependencies can harm the maintainability of your project. For starters, do you even know how async-queue's code works? Or djs/rest?

We're also adding more and more dependencies (carefully) to discord.js and related projects to improve the maintenance, like we installed ow for /builders

real jetty
solemn oyster
#

We plan on switching to djs/rest to some point, so yeah

real jetty
#

oh ok, thanks a lot, I'll check it out

copper laurel
#

If you copy the code, you lose any link to the original developers maintenance and updates

#

It just becomes the orphaned code that you're less able to maintain yourself

cosmic pagoda
#

When having custom cache manager and maxSize equal to 0 keepOverLimit function is ignored and it never adds anything into the cache. But if maxSize is > 0 then the keepOverLimit works just fine. I tested it with BaseGuildEmojiManager and ReactionManager

ReactionManager: {
        maxSize: 0,
        keepOverLimit: (reaction, key, collection) => reaction.emoji.id === config.IDs.upvote || reaction.emoji.id === config.IDs.downvote //even if this method returns true, cache is always empty
    },```
Feel free to open issue on github with this (if its not intended behaviour) as I can't open issues
fallen arrow
#

keepOverLimit doesnt actually go over limit, it prevents removal when adding new items. for example if your limit is 5, and you want to add something new, the oldest item by order of insertion will be removed to make space for the new one. keepOverLimit will prevent specific items from being removed, so the next in line is removed instead, but the limit never goes over 5

cosmic pagoda
#

then it doesnt work because when I was testing it with maxSize just 1 and keepOverLimit which would permit 2 more items in the cache the total cache size was 3 and not 1 as it would have worked like you just explained

fallen arrow
#

then i misinterpreted the code

cosmic pagoda
#

so 1st item was some random collected emote and the other 2 kept over limit were the one I permitted in this cache upvote and downvote emote (total 3)

cosmic pagoda
fallen arrow
#

but yes, like you said, maxSize =0 does a hard return in the function, so it never checks for any of that

cosmic pagoda
#

so when having maxSize it should check the keepoverlimit func

cosmic pagoda
#

but can you link me where the keepoverlimit is called? i cant find it anywhere

fallen arrow
#

util/LimitedCollection.js

cosmic pagoda
#

ah I was in different commit

#

got it

#

in my eyes it should take in account for the keepoverlimit before returning maxSize: 0 so the keepoverlimit can be used to cache only very specific objects

#

not like the 1 unrelated is gonna make a difference but still

oak quail
#

yeah it should, if it doesn't then I consider that a bug

vagrant holly
#

This is gonna make the convo yesterday about limitedcollection maxsize = 0 being efficient redudant/incorrect

#

cause suddenly ops are gonna be performed before it goes "welp shit im full"

wild flax
#

Yeah you have to set it to 1 if you want to use keepOverLimit

vernal atlas
#

freshly installed dev 13.1.0-dev.t1628337792.68c0591

#

hm interesting vscode seems to just have just been having trouble, very strange lol, fixed when i ctrl clicked

bitter peak
solemn oyster
#

It reads from package.json

wild flax
#

Dunno, doesn't look like it

#

oh it did

#

but its not setting it as latest @dev for some reason

#

oh no

#

its all good

#

you are just on an outdated release @vernal atlas

vernal atlas
#

oh interesting

stray delta
#

when #6172 gets merged will we need to specify the type for slash commands? I know it's an option but more or less asking about djs's side

minor ether
#

Anyone else thing the Boolean option should be Yes No instead of True False? Seems a bit more use friendly and makes more sense in most scenarios

#

Or is this a discord api thing

cloud kraken
#

We don't control that lol, just use choices

copper laurel
copper laurel
oak quail
copper laurel
#

Unless the API starts requiring it wouldnt that just be incorrect though

short crescent
#

Add discord context menu api

copper laurel
real jetty
#

is user.bannerURL gonna be available in 13.1.0?

stray delta
#

that pr isn't going to be merged until the pr for the api documentation is merged

icy bronze
#

it was afaik

stray delta
#

no

honest barn
#

yeah its not merged yet

icy bronze
#

ic

pale seal
#

Partial Messages for typescript

vagrant holly
#

Thoughts on throwing an error in LimitedCollection if a sweepInterval is provided w/o a sweepFilter -- seems to be something that's caught multiple people out, and seems like a sensible option error to throw?

ruby terrace
#

hmm, I'm not exactly opposed to that, but there was a reason I didn't do that, I just can't remember it

oak quail
#

isnt there a default sweepFilter that checks createdTimestamp?

ruby terrace
#

there is not, there was when it was SweptCollection, but since the merge there isn't

oak quail
#

oh

oak quail
neat bolt
#

0 is meant as a noop cache

#

the difference between 0 and 1 isnt a big deal

wild flax
stray delta
#

should context menus have builders? the guide uses them, so it would be more consistent
any ideas? souji said maybe deprecate slash command builders because the name is too specific. should I pr?

wild flax
#

It should already be possible

#

the only thing that needs changing is allowing no description be set

#

and the naming needs changing

#

since it allows uppercase and spaces

oak quail
#

does changing BaseGuildEmojiManager's caching do anything if client.emojis isnt accessed? since it's just created in the getter

#

also shouldnt GuildEmojiManager be in the Caches interface?

ruby terrace
#

BaseGuildEmojiManager is a DataManager, it doesn’t have a cache (technically). probably got them backwards

wild flax
#

@vernal atlas what? cc review

vernal atlas
#

well assuming this.guild?. is handling the rare case the guild isn't present, it should be checked before adding to the collection, if not then it should just be removed and assumed present

wild flax
#

Idgi

vernal atlas
#

what does that mean

wild flax
#

We still add to the collection though

#

Just the raw

#

You say it seems silly to add undefined, but we never do

vernal atlas
#

OHH

wild flax
#

We either resolve, or add raw

vernal atlas
#

i misread where the ?? member was

#

yeah no im just blind

wild flax
#

lol

vernal atlas
#

facepalm moment

opaque vessel
#

~~Hi hi guys, does anyone know why the typings for a WidgetMember allow for undefined, but the JSDocs says they're nullable? Is this some sort of oversight? >:

For example: If a widget member is not in voice, deaf will be undefined. The typings match up with this, but the documentation says ?boolean, but I was checking against null and was being mislead here. How come we don't default these properties to null and instead allow them to be undefined?

I would look into the pull request for more information, but I get an internal server error from viewing it >:~~

void rivet
proper token
#

Hello - I notice the lib doesn't require a style for a MessageButton, and defaults it to null, but the API docs say that style is a required parameter... Is this mismatch intentional? I don't have any code running on d.js 13 yet, but it seems like this would be an API error waiting to happen.
References:
https://discord.com/developers/docs/interactions/message-components#button-object
https://discord.js.org/#/docs/main/stable/class/MessageButton?scrollTo=style
https://github.com/discordjs/discord.js/blob/stable/src/structures/MessageButton.js#L49

vivid field
#

You can still set it after constructing using setStyle()

proper token
#

I'm aware; just concerned that the d.js lib treats it as optional when the API docs say it's required.

#

Especially since the lib doesn't supply it a default value under the hood

unique axle
#

it's the same level of optional as embeds need to have a description or field, but the constructor still doesn't require any input at all
that's how these structures have generally worked, you make an instance and then set the specific attributes

#

do not see any reason for concern here

copper laurel
#

It's optional because as a structure, you might not have set a style on it yet. Once you do, it will be defined. If you don't, you get an API error

tired kindle
#

Context: <#archive-djs-help-v13 message>
Isn't it a better idea for the library users to define the behavior themselves rather falling back to another behavior?

copper laurel
#

define the behaviour how exactly? I'm not entirely sure what you mean by that

#

Like a client option?

#

throwIfNoGuild (bad name but)

tired kindle
#

I'm not longer familiar with Djs or Discord API anymore but I would find very hard to diagnose such issue. I would be unsure whether I'm receiving a D.js object or the raw data from the API. It's bit ambiguous and hard to test of the same function does return different structures when you call the same function with the same arguments but the library initialization parameters differs

#

Something like a... "inconsistency?"

copper laurel
#

I sort of agree, but theres a very specific reasons for that inconsistency, which is required to support the way slash commands work

#

If you have a bot user in the guild, and you provide the GUILDS intent which is essentially required to use discord.js as a bot user, it will always be a Message

#

If you dont have a bot user in the guild, its just the applications.commands scope, you get raw API objects

#

The unexpected inconsistency really only comes up when people havent fully understood intents and left out GUILDS

tired valve
#

You can do an instanceof check if you are unsure what you're receiving

copper laurel
#

You can also construct an InteractionCollector with raw objects, you just cant use Message instance methods

tired kindle
#

I see, thus I believe it might not be a bad idea to have specific methods for each behavior rather sharing them as it would be able to report (elevate error) if there's no bot user

#

Making the reporting more clear

wild flax
#

There is no methods on raw objects

tired kindle
#

That's the issue

wild flax
#

Yes, so check what you get

tired kindle
#

How would you ensure it's a D.js object (with methods and so) or raw data from the API? It would look very ugly

copper laurel
#

instanceof

vivid field
#

I thought of just constructing a new Message() regardless when I first implemented interactions, but the channel and guild were in the way

#

but now that they're getters I think it should be fine

copper laurel
#

Possibly

#

Would be good to isolate raw out to client.ws events

wild flax
#

is breaking though

tired kindle
#

v14?

vivid field
#

right

#

I'll keep that noted though

ruby terrace
#

yeah, personal goal for v14 is to completely separate out stuff like that, making djs far less cache dependent

vivid field
#

yeah I think

#

so instead of ?? data it would become ?? new Message(data)

copper laurel
#

So why do DM messages still need the partial to emit

#

Surely we can remove that now?

vivid field
#

wait actually no

ruby terrace
#

cause messages are created on the manager for the channel, we could totally remove that though and just emit with a message object lacking channel

copper laurel
#

i mean yeah, but we could emit one that wasnt if channel wasnt found

#

Exactly like webhook currently does?

vivid field
#

Message#channel is a getter now but it's not marked as nullable

copper laurel
#

Why tf not

ruby terrace
#

wtf

vivid field
#

so that would be breaking too

copper laurel
#

Arent getters kinda implied always nullable gdi

vivid field
#

¯_(ツ)_/¯

wild flax
#

Its because our whole lib currently doesnt really work without GUILDS

copper laurel
#

I thought it was going to be nullable because people can fuck up the cache, or is that why we also did the whole "stop breaking unsupported cache modifications"

wild flax
#

so theres no reason to mark it as nullable

copper laurel
#

Okay fair enough

ruby terrace
#

and messing with channel caches isn't supported atm

vivid field
#

welp in that case this is a dream for v14 then

tawdry egret
#

any idea why default emojis will not show up on selects-menu on mobile, but will show fine on desktop?

#

very likely, it's the same bot code behind both interfaces. just a minor nuisance for me that some people will have emotes and some won't

copper laurel
#

Yeah definitely not library related, just a rendering issue

wheat basin
#

were there any thoughts about passing custom class type as a replacement to Structures ? ex. ```js
class ExtendedMesage extends Message {
constructor(client, data) {
super(client, data);
...
}
get property() { ... }
}
const client = new Client({
structures: { Message: ExtendedMessage }
});
client.on('messageCreate', x => { /* x instanceof ExtendedMessage */ });

typescript support might be literally impossible but i kinda fw the idea
copper laurel
#

Thats just the same thing with the same problems

unique axle
# copper laurel Why tf not

because that would've been a fucking disaster
we depend on it so much that that'd have made half the library in its current state nullable

#

we talked about that in #archive-internal-lib-discussions and while i'm still not really a fan of it, crawl has rightly so decided to consider a non-nullable getter here

copper laurel
#

Yeah I forgot the original issue it was resolving was just the change in type of channel

wheat basin
#

i see alright

icy bronze
#

but its tricky, some functions or properties may not work, its for my use only.

#

but doing that allows me to have a djs client that doesn't connect to the gateway but receive interactions via webhooks and build them like djs do. then I can use them to defer, reply etc! its just that I have no guilds, no channels in cache

#

so it was rendering an APIMessage (that could be a Message)

#

so I made a workaround for that

opaque vessel
wild flax
#

When it’s not a community I guess?