#archive-library-discussion

1 messages · Page 14 of 1

copper laurel
#

Good for them. Different libraries for different purposes then I guess. discord.js is a very well documented, easy to start with bot library that is the most popular for a reason

faint current
#

I already said that D.js is good when you learn or don't know what to do but at scale, for more experienced things people switches to Eris or other its forks

#

Cause many people also works every day on forks

copper laurel
#

This is still not on topic of this channel

Serious discussions about developing discord.js

solemn oyster
#

Ok, and how do we improve that?

#

Lay out a plan

wild flax
copper laurel
#

I'm waiting to see any serious suggestions, other than modularisation which we've indicated is happening

wild flax
#

And we reached that, hence our popularity.

#

The problem with "big" bots, is sadly also 90% of the time on the developer

#

Bot devs aren't the smartest or greatest, neither do they develop bots with "scale" in mind, they just write a bunch of code and suddenly need to support 400k server usage

outer raven
#

should I PR and add that as private?

wild flax
#

Neither do they update d.js very often, so in the end they use their own fork with their own modifications

icy bronze
#

is there any plan on adding InteractionOptionResolver to sub command options?

copper laurel
icy bronze
#

oh?

#

so I use it like I would with top level options?

copper laurel
#

There can only ever be one subcommand or subcommand group selected at a time, so the getThing methods are for that subcommand

#

And getSubcommand() tells you which one

icy bronze
#

damn yeah thats obvious

#

alright thx for answering

copper laurel
outer raven
#

yeah I'm adding that and I'll leave set as public, will see what the reviews say

loud jayBOT
#

pr_open #6450 in discordjs/discord.js by ImRodry opened <t:1629066437:R> (review required)
types(ClientPresence): add type declarations and docs
📥 npm i ImRodry/discord.js#types-clientpresence

strange igloo
#

Next thing is memory management. I have no idea who had idea of storing everything in Collections. They are cool to use - true, but they leave huge memory footprint at scale.

I would like to know what would be a better alternative tbh Thonk yes hash maps internally takes more RAM compared to what it actually stores, but they are also super efficient to work with.

Using plain arrays would be suicide for bigger bots, as looking for a specific item would require a function to be ran up to n times (assuming Array#find is used - but n iterations with a for-loop leads to the same problem). I don't know exactly what would be the performance drop but there would surely be one, Map wasn't invented without any reason behind.

sent back with Souji's permission

ornate topaz
#

i don't think it was necessarily asked "why store everything in collections" but more of a "why store everything in collections".
in which case i'd assume "<some other library> that doesn't cache anything at all is automatically better, because hugest of bots, duh"

vagrant holly
#

How 'bout we don't make up random facts to push your personal agenda, just saying

#

Signed, a dev that works on Rythm

ornate topaz
#

(that might take a while, given that they were muted for 3 days)

vagrant holly
dawn basalt
#

Is there a plan on replacing TSLint with ESLint?

#

TSLint has been deprecated for a while now.

solemn oyster
#

Yes, whenever we rewrite d.js to TS

fallow crater
#

iirc there is/was an issue open about that

loud jayBOT
tired valve
#

you need the channel partial for that to work.

outer raven
ruby terrace
#

I saw (heh, edit pings don't ping), I'll get it in for the next minor

real jetty
#

How long does djs cache messages for?

oak quail
#

by default it caches up to 200 messages per channel, and they do not get sweeped

#

but you can change the limit and the sweep settings in clientoptions

hoary ether
#

do we have plans for a slash command permission builder in /builders?

loud jayBOT
#

pr_open #19 in discordjs/builders by Fyko opened <t:1628378012:R> (changes requested)
feat(SlashCommandBuilder): create setDefaultPermission function
📥 npm i Fyko/djs-builders#feat/setDefaultPermission

hoary ether
#

that's the defaultPermission. i was referring to permission overwrite

#

the object you would pass to GuildApplicationCommandManager.permissions.set() or .add()

ruby terrace
#

not a bad idea, kinda thought that was already in there. though they aren't that complex, and I wouldn't want to do it now when we've been told permissions are going to be overhauled

hoary ether
#

oh ouh

#

discord making a lot of rapid changes with this new interaction feature

ruby terrace
#

to be fair everyone has been complaining a lot about permissions

real jetty
solemn oyster
#

Is that a serious question?

#

Do you know how many bugs we had, over and over, because mismatching types all over the library, specially when we do breaking changes?

#

Besides, most of the development team are TS users, it's almost a miracle we can maintain discord.js at all, because we find JS hard to maintain

hoary ether
#

isn't the ts rewrite repo archived now?

solemn oyster
#

No

#

Just put on hold, we're working on /modules first

hoary ether
#

last i check it was.

#

ah i see

#

im assuming all the new modules like /rest and /builders are all written in ts?

solemn oyster
#

I mean the djs rewrite [was put on hold], the /modules has been progressing... slowly

real jetty
solemn oyster
#

Yeah, we're not starting new projects in JS

#

We're writing them all in TS since the very start, due to the aforementioned reasons

real jetty
#

But it's still going to use everything in js like sapphire, or?

copper laurel
#

The modules are essentially the component parts of a djs-rewrite, which will tie them all together

solemn oyster
copper laurel
#

Sapphire is TS I'm pretty sure

solemn oyster
#

It is

real jetty
ornate topaz
#

TS is not C#, it's not entirely different language.
It's just a superset of JS that adds types and everything around that, and it transpiles back to JS

dawn merlin
#

Also in addition to the other reasons given the typings in some areas are more specific than the jsdoc.

solemn oyster
#

Oh yeah, documentation with examples and everything in IntelliSense, the best part of TS libs

real jetty
#

So it won't limit discord.js users who work in JS in any way?

hoary ether
#

it shouldnt

ornate topaz
#

If it goes back to JS, why would it

hoary ether
#

there are tons of npm modules out there written in TS, and u can import them to ur js project and use it as js just fine

ornate topaz
#

You don't run TS at all, so it's all JS anyway

real jetty
#

Ok, then it's fine that it doesn't limit users in any way, it just adds more TS stuff to users.

real jetty
solemn oyster
#

And far better typings and documentation

dawn merlin
#

Microsoft does list TS as a language tho, not a framework. I don’t think just because it transpiles to JS it can’t be considered another language. Most truly compiled languages all technically transpile to VM bytcode or asm. That doesn’t mean asm and other compiled langs are the same language.

ornate topaz
#

JS is its limiting factor, they cannot change that due to nature of TS. All JS is valid TS.

real jetty
#

So then are you going to redo @discordjs/docgen to generate as well or use a completely different generator? (docgen uses jsdocs)

dawn merlin
#

JVM is the limiting factor between java and kotlin. They’re still different languages.

ornate topaz
#

ok you win, what did you want to prove again? This wasn't relevant to the convo at all.

real jetty
#

okay

copper laurel
#

You're literally responding to a discussion about how the docgen needs to be rewritten for TS while asking where the documentation for the TS modules are?

copper laurel
#

Not yet no

real jetty
vivid field
#

so that it doesn't have a constructor

empty viper
#

why not using a namespace ?

bronze sigil
vivid field
#

because the docgen doesn't parse that

outer raven
#

I commented on #6456 saying it wouldn't make much sense and would be hard to implement logistically but after giving it some thought I have an idea of how it could work but since it would involve returning a different object I'm not sure whether you guys would want this or not so I'd like to put this here for discussion before opening a PR

loud jayBOT
copper laurel
#

Yeah, not a fan of it returning a different object, like I said in that

#

raw access to resolved is available now, you can check for the existence of users/roles in that

outer raven
copper laurel
#

In a sense

outer raven
#

unrelated but if we want to link a static property (like FLAGS in MessageFlags) do we write it with the # like any other property or does it need to be referenced differently?

ionic plaza
#

The parameter name for Message.edit() is content, which is inconsistent with Channel.send() and other functions for sending messages (options). I'm assuming that this is a leftover from v12. Bug?

wild flax
#

Parameter names are honestly quite useless in JS

#

No such thing as named parameters

#

Wouldn’t really categorize this as a “bug”

ionic plaza
#

Maybe not a bug, but seems a bit off

#

Especially with VSCode's new parameter thingy

#

Hardly the end of the world 🤷

outer raven
#

how do you enable that

#

a few days ago a PR was opened to fix sth like that so if you have the time you could also do that yourself (considering that new feature)

#

but tbh the bug here is with options imo, it should just say content

ornate topaz
#

"bug"? it's just a name, really, it affects 0 code whatsoever

fallow crater
outer raven
ornate topaz
#

???

#

does that option break the library?
runtime errors?

outer raven
ornate topaz
#

then there is no bug. it's just that this is kind of the first time the name is actually used somewhere outside of the documentation, where even there it's just "options" on one line, and "options.something" on another, so you know it goes inside the object.

outer raven
#

You understood what I mean why is it such a big deal

ornate topaz
#

it might be an issue or inconvenience, not a bug

outer raven
#

😐

ionic plaza
#

If nothing else, parameter names should be consistent to avoid mistakes when developing D.JS

ornate topaz
#

idk man

fallow crater
#

It's something very minor, but if it's really needed, I can create a PR lol

oak quail
#

the thread permission getters are really broken wew

ruby terrace
#

how so

oak quail
#

editable and sendable both checked the old private thread type

#

sendable checked this.archived instead of this.archived && this.locked && !this.manageable

#

also why do all the permissions.has calls pass false to checkAdmin? shouldnt it be true?

ruby terrace
#

no, admin overwrite does nothing

ruby terrace
ruby terrace
#

none of that really matters anyways since they're getting redone

oak quail
oak quail
#

is there a djs bug?

ruby terrace
#

no

#

you also can't rename the flags without a major release

oak quail
#

ah... right i forgot about that

ruby terrace
#

let me see if I can find a good screenshot of the checkadmin thing

#

Okay, no good screenshots, let me explain. Channel overwrites can set the bit for admin but it doesn't do anything, the library already checks role perms for admin and splits it to all permissions before it gets to overwrites so all permissions are still granted when you have admin on the guild level. Setting it to false prevents returning true when the permission does not actually do anything.

oak quail
ruby terrace
#

the return value of that

oak quail
#

ah right blobfacepalm

#

so are users just expected to set it to false when checking channel permissions?

ruby terrace
#

not really, I'd consider it good practice, but its an exteremely rare edge case where someone had to intentionalyl add an overwrite with the admin permission via the API, you can't do it in client

unique axle
#

well, the issue really is not with checking channel permissions, because that's a tiny tiny use case
the issue is with checking permissions after overwrites, which should still factor in the global permissions
because the API accepts and sets overwrites for 8, even propagates them and additionally completely ignores them in the client

#

so you can end up with an 8 overwrite you can't remove without a bot, just because some bot screwed up overwrites, which however messes up all the perm calculation of other bots

wild flax
outer raven
low tide
#

I'm unsure if this is the right channel, or if it's a bug, but I get an INTERACTION_ALREADY_DEFERRED error (or something like that) whenever there's a small error in my code, such as a syntax error.

outer raven
low tide
#

I'm not deferring the same interaction twice. It only happens when I have a syntax error or similar small error.

outer raven
#

you are, you just probably don't know where, go on that channel and show your code, this channel is for developing djs

low tide
#

I don't appreciate you thinking of me as an idiot, I never get that error if I don't have any syntax errors in my code

outer raven
#

if I had to guess you have an error handler which defers interactions. Either way please don't continue this conversation here and move it to the channel I mentioned

low tide
#

No. I don't.

#
const Discord = require("discord.js");

module.exports = {
    name: 'ping',
    async execute(client, interaction, options) {
        await interaction.deferReply({ ephemeral: true });
        consle.log('test');
        await interaction.editReply({ content: `Pong! \`${client.ws.ping}ms\``, ephemeral: true });
    },
};

Note the consle. I don't have any code that defers this interaction before I execute the command file.
And this is the error I get: https://cdn.danielcatkins.studio/WAIh4OcwVb.png

Fix the typo:
https://cdn.danielcatkins.studio/Ze9AsRc8pE.png
https://cdn.danielcatkins.studio/hHvq7fufG5.png

outer raven
low tide
#

I don't have an error handler, but thanks. I'll make a reproducible example.

outer raven
#

Disabling the emoji manager completely breaks reacting to messages with guild emojis, should this be documented?

opaque vessel
outer raven
#

if you wanna see the error stack

#

would be nice if we could see what was actually sent to Discord but that's all I got

#

also please don't disable pings when replying

opaque vessel
opaque vessel
#

Did you provide an actual guild emoji object?

outer raven
outer raven
opaque vessel
#

Crashed with just the id

outer raven
#

yeah that's the issue then

#

because it tries to get the emoji from cache

opaque vessel
#

I think that's not something to document then? It clearly worked with the full custom emoji string, so it should be possible

#

Sounds more like a bug

outer raven
#

but why is it even doing this if we only need the id to react?

opaque vessel
#

Yeah, exactly

outer raven
#

can you look into it to see if it's possible to fix? I'm not really sure and might break something tbh

opaque vessel
#

So yeah, the problem is as you said, it's trying to get the emoji from the cache. This is intended, because emojis need to be URL encoded and sent across as a name:id format per the docs. If we only know the id, well, we don't have the name and that's pretty much what the cache check is for. I guess a way to ensure this works is to force-fetch the emoji somewhere. It'll fetch from the cache if already available, so

next bobcat
#

On v13 release ownerID was converted to ownerId, however the .displayAvatarURL method did not get the camelcase treatment. was this on purpose?

opaque vessel
#

URL stands for uniform resource locator. Id stands for identifier. It's fine

next bobcat
#

interesting

#

i was wondering if something like that was the reason

outer raven
opaque vessel
#

Yeah it's just a caching problem in general. If the bot isn't aware of the custom emoji (but has access to it) and you provide only the id, it'll fail

outer raven
#

Alright I'll just keep that cache enabled then, no worries

opaque vessel
#

I mean if you know the custom emoji beforehand, you could fetch it then use that, but unsure if this is... fixable

ruby terrace
outer raven
ruby terrace
#

it...does?

outer raven
#

and that was the full stack trace

oak quail
#

hmm

#

would making invite.channel nullable be considered a breaking change

#

if it currently throws an error where it would be nullable

copper laurel
#

Technically yes

#

People would be catching that error, not checking for null

oak quail
#

so support for fetching it cant be added until v14?

#

or would it have to be, like, an option to allow it for now

opal mauve
#

you could enable the new functionality with an option that can be removed in future versions

brisk remnant
#

How many digits are in a discord snowflake?

visual hornet
#

17-18, 19 in 2022, 20 in 2090
so 17-19 is sufficient for now

quiet viper
outer raven
quiet viper
outer raven
#

I’m pretty sure it does

wild flax
#

No

#

You can even do :_:12312312333123123123123:

#

Do you not test this before you say something

runic leaf
#

Installing @discordjs/opus returns an error

#

Can someone else try it and inform if they're facing it too?

analog prawn
#

Its @discord.js/opus

#

I think

wild flax
#

No its not

#

And without knowing the error god knows whats wrong

analog prawn
#

Not sure then.

#

I remember installing it once.

#

I need to find how i installed it.

analog prawn
outer night
runic leaf
analog prawn
wild flax
#

You are being so unhelpful its incredible

runic leaf
wild flax
#

Thats it? Nothing more?

runic leaf
#

it doesn't shows the entire log

#

bugged

#

the log is huge

wild flax
#

Well, with that alone no one can help you

patent cedar
#

Did I miss something or is BaseCommandInteraction#deferReply missing in the docs?

real jetty
#

Is it really necessary for everything a djs caches to be cached?

raven juniper
#

guilds is probably the only thing that "needs" to be cached for d.js to work properly a few caches should be kept for d.js to work properly, but they should overall not be that memory intensive. that's the point of adding the option to limit caches in v13, you can limit what is kept in memory otherwise

real jetty
void rivet
#

Overriding the cache used in GuildManager, ChannelManager, GuildChannelManager, RoleManager, and PermissionOverwriteManager is unsupported and will break functionality
other than that, it's judging by your use case and what you need

bitter peak
#

@copper laurel regarding #6469 (the resolver properties) I think we've been over this before like five different times already and the consensus every time is to just expose the method. But for the hoistedOptions, I could see that being useful, but maybe as a separate PR. What do you think?

swift trellis
wild flax
#

#6469 is pointless

#

We have .data to work with the data if you want to do your own parsing

swift trellis
#

Do you know the date?

swift trellis
#

But will it stop working? Or will it simply not be supported?

#

It really says: "Doesn't look like anything to me" that's why I don't quite understand it

#

@real jetty ^^

unique axle
#

v7 was a non-public api, yet a lot of people and libraries used it, because it had some much needed improvements
the API version has moved on to 9 in the meanwhile and accordingly the older versions 6 and 7 will stop working eventually™️
so while it still works for now, that won't always be the case and a swap should be made, which we did by progressing our library towards using v9 with version 13 of discord.js

copper laurel
loud jayBOT
copper laurel
#

Not sure if you're in this server but to answer why:

  • No top level await, so the snippet is incorrect
  • awaiting client.login() doesnt guarantee everything is ready to go, thats what the ready event is for
  • we wouldn't want to use the ready event either, we're intentionally discouraging people from setting commands on ready
  • @discordjs/rest doesn't require logging in an entire Client instance, which populates caches and connects to the gateway and various other overheads
outer raven
# copper laurel Not sure if you're in this server but to answer why: - No top level await, so t...

that PR doesn't seem ideal to me but neither does the current suggestion
Since this is shown as the most basic way to deploy commands, most users end up blindly copying it and have absolutely 0 clue what they're doing (because this is too advanced for the average user of the help channels), then come crying to #djs-help-v14 because something doesn't work
I think that once #6414 is merged the suggested code should be updated to run on the ready event and compare local commands with discord's commands and only edit them if changes are found, which is a much more reliable way and doesn't spam the API

copper laurel
#

I disagree, theres still no reason to be doing all that processing on ready

#

The "average user of the help channels" is a bar far to low for us to realistically aim for

#

People are always just going to copy and paste

outer raven
#

but the point of having this example is so that users can have some basic code to base themselves off of when starting using slash commands. The issue with deploying on ready was the API spam from what I understood and that PR fixes this

copper laurel
#

Not really no

outer raven
copper laurel
#

Yes

outer raven
#

unfortunately so, but I think providing code snippets this complicated isn't ideal

copper laurel
#

There's genuinely nothing complicated about it, it just dares to address a concept in a different way to the core discord.js library. It's otherwise an incredibly simple code snippet.

outer raven
#

Yeah but it involves installing another package that most users aren't familiar with, isn't properly documented (to my knowledge, correct me if I'm wrong) and is mainly used internally by the library or by people who actually know what they're doing.
The code snippet may be simple, but people don't know what they're doing and why they're doing it that way, which they should when using an example

copper laurel
#

Performing a delta would require

  • fetching commands, at least one API call to global, maybe more per guild
  • O(n) processing time to do a deep equality check on them all
  • 1 or more .create() calls per command where changes were found
#

Thats still quite a bit of API usage

#

The core of the concept is manually choosing to deploy your command changes, that's why its a separate script and not something that happens on ready

#

Regardless of which library it uses

#

Better documenting the example to explain why it's done that way, sure, that addresses the concerns

outer raven
# copper laurel Performing a delta would require - fetching commands, at least one API call to ...

ok yeah you would need to fetch all global commands, however the equals function doesn't seem like it would take too much time or resources to run, even if you have 100 commands
And keep in mind in most cases you'd only need to call .edit on 1 command, which seems fine
The issue is with guilds though. The way I've done it is just calling .set on startup since it's only 1 api call and these don't need to wait to be updated, but it becomes an issue if you're using permissions which I'm still figuring out myself

outer raven
#

Also, is it really necessary to install discord-api-types? Most users aren't even on TS and it isn't listed under the optional packages

copper laurel
#

I 100% agree theres a lot of room to improve the documentation around the example, how /rest works, adding permissions down the track, but I will always disagree that automatically doing anything on ready is the right way lol

outer raven
#

Well I did this because I personally like things to be documented and having to run a command to update others didn't seem ideal, but I do realize my approach also has its flaws and does hit a lot of rate limits sometimes

copper laurel
#

I also don't run a command, my CI/CD pipeline has a stage that runs the deploy script after build, before restarting the application

#

API types defines Routes

#

Thats why its there

outer raven
#

ah I see

outer raven
copper laurel
#

Yeah

outer raven
#

Can I take a look at that or is it closed source

copper laurel
#

I wouldnt want to share it right now lmao, its an old hacky thing I havent touched for a while

#

Off topic for this channel

#

Point is, discord.js in general is moving towards the modular design, there might be other instances in future where individual parts become suitable for use

#

@discordjs/rest is arguably the right way of doing all the client.api stuff that came about prior to core support for slash commands

outer raven
#

yeah but discord.js never recommended using client.api because it was a hacky way. I know that @discordjs/rest isn't technically hacky but it's more advanced than the library itself

#

I saw some people say the other day that the library is good for beginners and I also think that's why we see many people who don't even know what an if is in #djs-help-v14, but that is also why examples like these should be as simple as possible and not require other packages that aren't even in the optional packages list and are not explained anywhere

copper laurel
outer raven
#

which uses the same example

#

ill probably wait for the equals pr to be merged and try suggesting something there, let's see what the feedback is

copper laurel
#

Of course it does, the script is the approach we want to encourage lol

#

I goes into a lot more detail about how it all works though

#

The other thing I wanted to call out, is that I don't see telling people to install @discordjs/rest is in any way different to installing @discordjs/builders, we're already introducing that modular approach in other areas.

hoary ether
#

i'd like to chime in if yall dont mind.

#

most users end up blindly copying it and have absolutely 0 clue what they're doing (because this is too advanced for the average user of the help channels)
and
but people don't know what they're doing and why they're doing it that way

not sure if Rodry and Monbrey have looked at the restaurant analogy i suggested in #archive-guide-discussion , but TLDR, the goal is to make it as clear as possible to users that the deployment of commands can and should be separated from the bot itself. I do realize that the restaurant analogy i used probably wasn't the best idea since it seems very out of place, but at the very least we can include something along the lines of the following in the guide:

In order to make Slash Commands work, we need to do two things:

  1. Register the Slash Command: In this step, we are essentially telling Discord:
    "Hey Discord, I would like you to show these commands to the user when they type / in the chat"
    This step only needs to happen once. The only other time we would need to "register" the commands again is when we want to make some changes to the commands. By registering the commands again, we are essentially telling Discord:
    "Hey Discord, I would like you to show these new commands to the user instead"

  2. Reply to the Slash Command: In this step, we decide what and how to reply to the user who used our Slash Command. This will essentially be our "bot".

We can definitely word it in a better way if needed, but i hope i got my point across.

I also realize that the current readme already suggest what i wrote above, although not as explicit:

Register a slash command against the Discord API:
<insert deploy script>

Afterwards we can create a quite simple example bot:
<insert index.js script>

copper laurel
#

Yeah, I think once Sanc's changes land and restructure/reorder a lot of the pages we can then look further into revising content further

hoary ether
#

👍

short lark
wild flax
outer raven
outer raven
outer raven
#

Then?

wild flax
#

Nothing. I'm simply not going to accept it.

#

Registering your commands should be a separate process.

outer raven
#

Alright then if the recommended way can be automated I’ll be happy with that

wild flax
#

I don't see why it should.

#

The moment you need to do permissions, you need to manually interject anyway

outer raven
wild flax
#

What is automatic about "sepecific user & role"

hoary ether
#

The only scenario that could be automated (that I can think of) is if you want to defaultPermission:false and then whitelist the owner of the guild(s)

hoary ether
outer raven
outer raven
#

it should be explained better

wild flax
#

Not in a readme, no

wild flax
hoary ether
outer raven
outer raven
hoary ether
outer raven
#

You can make it automatic this way. Simply store the ids the user wants in a db and use them for all commands, otherwise it’s not possible to automate it in any way

hoary ether
#

I've been trying to make a boilerplate for v13 and I've ran into the same concerns with automating permissions as part of the deployment script (for global registration)

outer raven
#

The thing I was suggesting only works well for 1 guild bots

hoary ether
#

Right, exactly. The fact that you have to manually store the id of a role or a user makes it "not automated"

#

I think that was crawl's point

#

On that note, does anyone know if role id is unique across all of discord? Or can there be duplicates because of guild context?

unique axle
#

it is

hoary ether
#

Then it's technically possible for discord to allow us to do permission overwrite without specifying guild id, yeah? 🤔

unique axle
#

since the same endpoint is used for users: no

hoary ether
#

Sorry I meant in the future*
Maybe they can give us a different endpoint

unique axle
#

i don't see why they would, it needlessly complicates the procedure

hoary ether
#

you're right... the more i think about it, the more i realize how dumb my suggestion was

open flax
#

Any specific reason why <Message>.mentions.channels is a Channel type and not TextBasedChannel?

ornate topaz
open flax
#

WHAT

#

HOLY SHIT

#

I've been waiting for that

#

thanks

open flax
#

like textbased is #

ornate topaz
outer raven
ornate topaz
#

dude..

outer raven
#

oh wait u mean sth else nvm

rough roost
#

why does Webhook#send wait default to true and is not even an option

outer raven
#

someone forgot to deprecate the last v13.1 dev version

modest lodge
#

I posted the following in djs-help but didn't get very far. Should there be a channel for discussion of discord-js-modules? I see there is an announcement but no specific place to ask related questions. Like my question (for now) is will there be (or is there) support for deleting slash commands through it? I see that support for such a thing should be possible but there are no docs or even (as far as I can see) a document explaining the goals.

rough roost
outer raven
#

feel free to make a PR then but I think that'd be a semver major change

ruby terrace
#

For some reason I thought there was a PR open to provide that option (option defaults to true, making it semver minor), but I can't find it

outer raven
#

ye as long as u keep the default behavior it should be fine actually

#

will you open it?

modest lodge
#

Any idea where I should post questions about the ability to remove a command via the DiscordJs REST library?

outer night
modest lodge
#

@outer night That was in response to my question? Is the rest library solely around for slash command support?

outer night
#

this channel is about developing the library, please redirect any questions about using the library to a support channel

modest lodge
#

It wasn't about "using it" as much as it was about "documenting it". Where would discussions about the development of that library be appropriate?

outer night
#

oh i misunderstood, thought you were just using the main library instead of using @discordjs/rest from discord.js-modules. the reason that there's isn't much documentation is because the project is still very much a WIP, so we recommend most just use the main library and only advanced users who are willing to comb through github source to go ahead with the -modules library. documentation will be added once the project is in a more mature stage

solemn oyster
#

(And we get a docsgen for TypeScript as well)

modest lodge
#

no problem... I will point out that the DiscordJs Guide https://discordjs.guide/interactions/registering-slash-commands.html#guild-commands provides from what I can see only one example for registering slash commands and it uses/recommends the rest library. I really, really understand the issues related to new features. My original post suggested that "maybe" a channel associated with the library discussion would be a good thing. That way this one isn't clutter up and the level of help might be better than that offered on the slash-commands one. People who made things work suddenly think they are experts, it gets depressing. 🙂

hoary ether
outer raven
#

@ruby terrace about your #equals PR, I'm testing it and for some reason this part of the code is returning true when comparing two options with required set to true, any clue? (_optionEquals on line 222)

#

I'm honestly a bit lost because I've logged that entire condition and it does return true, but I've also logged option.required and existing.required and they return true as well, so true !== true should be false

ruby terrace
#

are you sure that's the param check that's causing the entire thing to be true?

outer raven
#

yep, I added this log after the if and it returns true true true

#

only happens in 3 of my commands, 1 of them only has 1 option and I have no clue what the issue is tbh

ruby terrace
#

I'm dumb

#

needs parens

outer raven
#

where?

ruby terrace
#

its nullish coalescing the entire thing !== check

outer raven
#

you did add parens but in the wrong place i think

#

lemme try

#

yep that's it, the parens after existing.required should be before the !== instead

ruby terrace
#

should be (option.required ?? (optionType === 'SUB_COMMAND' || optionType === 'SUB_COMMAND_GROUP' ? undefined : false)) !== existing.required

outer raven
#

yep

ruby terrace
#

I was wondering how I missed that and then I realized I forgot about required when I tested dead

outer raven
#

also, why not do ["SUB_COMMAND", "SUB_COMMAND_GROUP"].includes(optionType)?

#

would also make it easier to add more in the future

ruby terrace
#

mm, sure

outer raven
#

all working well now

outer magnet
#

Question will MessageEmbed constructor (along with MessageButton, MessageActionRow, MessageSelectMenu) go under builders in v14?

copper laurel
#

Yeah eventually

hoary ether
#

Curious: couldn't i just make a PR to /builders for MssageEmbed, MessageButton, etc right now? or do you guys want the migration of the constructors to happen at some milestone (say, builders v1.0.0)?

loud jayBOT
copper laurel
#

There's also a button one but I want to redesign that

#

We don't just want the existing ones moved though

opaque vessel
ruby terrace
#

Uh, probably from when ephemeral messages didnt send their full data

opaque vessel
#

I've tested this out from interactions where the bot wasn't in the guild & ephemeral messages and non-ephemeral messages - it always manages to find it. I don't see how this can possibly fail, even after looking through source code

#

It would be nice if it could change from being nullable - one less (pointless) check for me in my code [:

ruby terrace
#

ephemeral messages used to not contain components

wild flax
#

or a message in general for that matter

opaque vessel
#

Ooh, wonderful, so now that they both do exist, there really is no reason for this to be nullable anymore?

ruby terrace
#

TODO item for v14 mmLol

opaque vessel
#

Hot

#

Should I make a pull request to remove its nullability?

#

I suppose I'll make an issue instead, just in case more components come along and might not appear in ephemeral messages or whatever. When version 14 comes closer to fruition, a pull request can be made then. <:

wild flax
#

@opaque vessel p sure animated defaults to undefined because Member Screening doesn’t give you an animated property

#

Neither of its false or true

#

So defaulting this to false would be misleading

opaque vessel
#

Oh I see! But still in the case of a component, what I said still holds true. Maybe just don't use the utility function in that case?

wild flax
#

Maybe

pliant crater
#

hey why do they call it an intent

#

instead of something like an RPC

#

how is it an intent if the user already did it

opaque vessel
#

I think that question would be better asked at Discord rather than here >:

vernal atlas
#

do all interaction classes have a reply method? if that is so why isn't the reply method simply in the Interaction class in the typings

#

ghost ping.. ?

copper laurel
#

Because there might be a type of interaction that doesn't one day

vernal atlas
#

perhaps its worth creating an interface for all the reply methods in the typings then, unsure what a good name would be though

copper laurel
#

That's exactly what it is

rustic boughBOT
#

<:_:851461487498493952> InteractionResponses
Interface for classes that support shared interaction response types.

vernal atlas
#

in the typings

quiet viper
#

are colors such as PINK no more accepted?

#

TypeError [COLOR_CONVERT]: Unable to convert color to a number.

unique axle
#

well, you do have to pick one that exists.

rustic boughBOT
unique axle
#

and pink just doesn't

quiet viper
#

okay thx

outer raven
#

@solemn oyster why the semver major on the events PR?

#

if they never worked is it really breaking functionality

vernal atlas
#

i suppose technically if you added event listeners for them

#

using the constants, you'd now get an error providing undefined as an event, and of course in typescript you would get an error compiling

outer raven
#

v13.1 caused tons of typescript errors and was minor still

#

I don’t think that really matters

#

But if people were using them apparently they shouldn’t so I thought it wouldn’t be major

solemn oyster
#

For once, because constants changed to remove properties, as Sugden said

#

And that's a breaking change

#

What we can do is add a warning that those events don't work anymore, or undocument them (while keeping the code)

#

This channel is strictly for discord.js development, not support. @dark sonnet

outer raven
solemn oyster
#

Are you in a rush about getting your PR's merged ASAP?

outer raven
#

nah I'm not but at the same time I don't rly like having prs sitting for months lol

solemn oyster
#

We do proper software development, even if it means an update needs to wait for months before being landed

outer raven
#

yeye I get it, no worries

hoary ether
oak quail
#

which is why they were documented and added to d.js

outer raven
#

they never fired according to the discord dev

oak quail
#

well thats wrong

#

and afaik they didnt say that

outer raven
#

1 sec

oak quail
#

they might have stopped sending them to bots within the past month

outer raven
#

they said they're not supposed to be sent to bots, so I assumed they never worked

#

tbh now that i think about it I think it would've been better to add deprecation warnings instead

#

will probably do that if i see too many people using these events in help channels

sage frigate
#

The docs mention a .getMessage() method on the slashCommands.options builder but nothing about that method in the guide or in the github source. Anyone know what this is about?

opaque vessel
#

It is for context menu interactions

sage frigate
#

Ah, I see. Guessing that is relatively new then, saw the message type in the docs

opaque vessel
#

Where are you seeing this btw? Got a link?

opaque vessel
sage frigate
#

Awesome

worthy coral
#

what zlib library does djs use

#

nvm. I overlooked zlib-sync

solemn oyster
dawn basalt
#

message.awaitMessageComponent doesn't seem to collect Select menu interactions (even if componentType is set to 'SELECT_MENU'). Is this intended?

copper laurel
#

I dont know if you're actually asking if we developed it that way in this channel, or this is misplaced support

#

But no, it does collect them last I checked

dawn basalt
copper laurel
#

Just tested, it works fine. Whatever issue you're having is not the lib

dawn merlin
#

Yeah I’m pretty sure it should be any message component interaction.

outer raven
#

yeah just change it to MessageComponentInteraction

outer raven
#

Why is there VoiceStats#requestToSpeakTimestamp but not VoiceState#requestToSpeakAt like almost every other timestamp in the lib?

rough forge
#

why did they get rid of structures in v13 ?

zenith oracle
grizzled field
#

From what it seems, ContextMenuInteraction is not exported at all in the index.js of discord, but is exported from index.d.ts. Is there a reason to it not being exported, or is it not being exported an error?

slate nacelle
#

That sounds like an error to me.

grizzled field
#

nevermind, just wasn't on github version of djs. It was fixed a while ago.

copper laurel
burnt cradle
#

@copper laurel in regards to the context menu pr, in what ways could it be unified with the slash builder? I feel like theres not much overlap

#

the name validation is different

#

I may be just being dumb but it feels weird to add a bunch of logic and stuff to the slash builder to make it compatible with context menus when separating it would likely add less overhead and be easier to maintain

copper laurel
#

eh maybe I'm thinking more closely to the API design than a builder

tacit crypt
#

As much as I agree with Mon on this, personally I'd still have them separated... Tho it means we also have to rename slash commands to chatinoutcommands

wild flax
#

lol no

tacit crypt
wild flax
#

no to calling them like that

#

thats terrible lol

#

ChatInput is 1 out of 3 types, where the other 2 share the same builder, since user and message inputs can be combined

#

so keeping "SlashCommandBuilder" and "ContextCommandBuilder" seems sensible as is

burnt cradle
#

it's called ContextMenuCommandBuilder rn

wild flax
#

Yeah thats fine

tacit crypt
#

i see where you're going, don't get me wrong

wild flax
#

We don’t need to mirror the api for exposed builders though

#

What’s the point

tacit crypt
#

Fair

strange igloo
livid ridge
#

hmm

#

yes, i also opened a issue about it 😅

real jetty
#

I can make PR

livid ridge
#

also

#

why does userUpdate event gets emitted when i edit intents of my bot from developer portal

strange igloo
# real jetty I can make PR

already got changes ready to be published, but just wanted to know the global opinion since iirc the library shouldn't guard check for disabled cache issues

strange igloo
#

because discord updates the user that's associated to your client, and emits USER_UPDATE to your bot (which does not require any intent, so you will always receive it)
now why since there is no intents prop on the client user, idk, but that's probably internal to discord here too

livid ridge
#

ok

#

also the event is not emitted when u change about me of bot lol

#

😶‍🌫️

real jetty
livid ridge
#

ok

outer raven
#

@hallow ocean you resolved my conversations without really addressing them nor responding 🤔

#

Also you forgot to update the typings

hallow ocean
#

Sorry! For the first one, I don't really think it's needed. For the second one, I don't get what you're saying so I just did the suggestion regarding adding the default value. And yes, sorry about forgetting to update the typings, I'll do it ASAP. I hope I didn't get your expectations low

#

Solved your request regarding updating the typo again

outer raven
#

At least that’s how I read it

#

And for the first one I just said that the typo was already fixed so a rebase could remove that change as it is no longer needed

hallow ocean
outer raven
#

So that nothing changes if it’s a spoiler and you do setSpoiler(true)

hallow ocean
#

All good

outer raven
#

Just commented one more thing that I forgot, otherwise LGTM :)

hallow ocean
#

Sorry again for being stubborn

outer raven
#

All good, no worries

livid ridge
visual hornet
#

aren't they always cached already?

opaque vessel
#

It's possible to sweep yourself out of the cache. I guess a real fix would be to make checks to ensure the ClientUser is always cached, and throw an error if you try to set the manager's cache limit to 0 (1 minimum)

livid ridge
strange igloo
# livid ridge Uh no? If client was cached, then that error would not emit

Well actually it is, Client#user is an actual property assigned to the user object, and not a getter to client.users.resolve(...) like GuildMember#user would be
The issue here is that the action that compare changes between old and new user tries to get the user from the cache, that's here empty
But the user itself is "cached" in client.user, no matter if the UserManager cache is enabled or not

livid ridge
#

So client.user is always cached?
What about <guild>.me?

strange igloo
#

That wouldn't be that useful
The library doesn't guarantee that Guild#me exists all the time anyway

livid ridge
#

Hmm ok

#

But it will be useful for small bots

#

Cuz small bots can keep the member cache disabled as their bot check permission to send messae / embed links etc

strange igloo
#

You should always fetch the member associated to the client user anyway, as it's not guaranteed to be cached already
If you disabled caches, then you shouldn't, but you can still have something like that

const botMember = await guild.members.fetch(client.user.id);
if (!botMember.permissions.has("BLAH_BLAH")) throw new Error("...");
outer raven
#

Should the RESTManager class be documented?

wild flax
#

why

solemn oyster
#

No

#

One of my plans for v13 is to change the entire REST manager with @discordjs/rest, I'd like that possibility to not be destroyed

burnt cradle
#

@tacit crypt which enum are you referring to? because the only one I see is ApplicationCommandType and ts wont let me build because it doesnt think its exported

burnt cradle
#

well its erroring when i try to build it

tacit crypt
#

What's the error

burnt cradle
#

'"discord-api-types/v9"' has no exported member named 'ApplicationCommandType'.

tacit crypt
#

That's impossible

burnt cradle
#

clearly not

copper laurel
burnt cradle
#

0.22.0

#

hmm yeah seems context menus didnt exist in 0.22.0 think the version needs to be bumped

#

but 0.22.0 is latest release so

copper laurel
#

Yeah looks like it needs a release

tacit crypt
#

Ohhh

#

Right

outer raven
solemn oyster
#

It would

#

Making anything from djs REST public = replacing is a breaking change

muted aurora
#

Is this a issue of the typings or am I missing something?

lucid pasture
#

It is fine

muted aurora
#

I guess partial messages are missing the content but in the documentation it seems like content don't have to be present 4Shrug

lucid pasture
#

Yeah because of that reason, partial messages are missing content so it can be null

muted aurora
#

I seem to be the first to be confused by this - so nevermind then 🙈

visual hornet
#

wouldn't that be an empty string though, not null
tested for both embeds and attachments, although they are on v12 (haven't finished updating yet)

loud jayBOT
outer raven
#

Does anyone know the reason to this?

fallow crater
#

doesn't seem to be exported in src/index.js.

loud jayBOT
outer raven
#

Ah I thought the issue was with the typings, nvm

muted aurora
#

After my stupid thought earlier today, I might have a useful idea now. If users have entered a command incorrectly it can be exhausting to re-enter the command (I know command input is supposed to be done via interaction commands, for my use case it's not a command its pure user input). Have ever been considered to create a MessageEditCollector, I would actually find that quite helpful so users can easily adjust the input without having to rewrite everything 🙈

#

I'm also comfortable trying to implement this, but wanted to know opinions first before going into too much depth.

wild flax
#

Unlikely we’ll move into that direction with everything moving to slash commands

muted aurora
#

Okay, so it wouldn't be worth implementing that?

ornate topaz
#

Similar issue exists for slash commands as well, but since by design they are not messages, there is nothing to edit and you have to write again anyway

muted aurora
#

I don't think the implementation of interactions are bad, not even the privileged intent for messages, but especially for small bots that only have a few functions, it would be really helpful to have good things for handling classic messages as well 🙈

wild flax
#

Disagree.

muted aurora
#

All right, thanks for the fast responses 😅

dawn merlin
#

quick question for @discordjs/permissions-helpers do we want to extend the library classes in-place (i.e. Object.defineProperty) or should we create methods that simply take the objects like: isPrivate(channel): boolean?

copper laurel
#

For what now? Is this a new builder?

#

Definitely do not extend library classes though, thats why we removed structured

#

Utils should be functions

dawn merlin
#

For the permissions helpers Crawl suggested that we create a /permission-helpers module and put the code there

copper laurel
#

Functions

#

But should probably see what crawl thinks

wild flax
#

Yeah a always functions

severe sun
#

why is ban .ban(user, options) but unban is .unban(user, reason) ?

burnt cradle
#

because theres no other options besides reason for unban

grand eagle
#

Can someone explain how the discord slash command builder works? I think creating something similar for node-cron for cron times would be really useful.

hoary ether
grand eagle
hoary ether
#

discordjs/builders

grand eagle
hoary ether
#

Also, your question is off topic for this channel

grand eagle
#

is it? I thought this would be the best place to ask about how the library works.

#

I was also told to go here.

hoary ether
#

Serious discussion about developing discord.js

coarse ginkgo
#

Is v14 still going to be written in TS?

pastel magnet
#

v14 isn't -next.

grand eagle
unique axle
#

the typescript rewrite is not versioned yet

#

v14 will very likely not be the ts rewrite

coarse ginkgo
coarse ginkgo
grand eagle
unique axle
#

rewriting the entire library from ground up in typescript for ease of maintenance and less pesky bugs, this has no date or version yet
if we need to make breaking changes for new features we will do that, so v14 is not the ts rewrite, whatever you want to call it
modules (which will be composed and used in the rewrite) are developed under https://github.com/discordjs/discord.js-modules - we currently suggest using the rest portion to manage your application commands, for example (https://discordjs.guide/interactions/registering-slash-commands.html)

coarse ginkgo
unique axle
#

modules (which will be composed and used in the rewrite)

coarse ginkgo
#

gottcha thanks :D

fallow crater
#

iirc there are plans to implement modules into the main library?

solemn oyster
#

Yeah, eventually

grand eagle
solemn oyster
#

All volunteer

#

You're more than welcome to sponsor the project in GitHub

peak tree
#

For the library devs, I'm sure you have heard about discord.py shutting down and the reasons behind it. What are your thoughts on the issues raised by the head dev? I know you guys might not be able to answer because of NDAs, if that's the case (or if I'm asking in the wrong place) then sorry for bothering.

#

(please ping me with any replies)

solemn oyster
#

In my honest opinion, it was over-generalised, some of the points are childish and are clouded by past anger. Nevertheless, I think this fits better in another channel since Discord.py's endeavors don't have any effect on the development of Discord.js

peak tree
#

Okay, sorry. Thanks for the quick response!

outer raven
warped crater
#

even if it was, should be private.

#

it's just a field that you'll never need to use

#

when you create a message attachment on your own from a buffer/stream/whatever you can just keep a reference to it, no need to access it back from the structure

copper laurel
#

There are times when things are intentionally not documented

warped crater
#

when its constructed from an incoming message its the URL

#

its just a really weird field

#

it doesn't expose new information regardless

outer raven
warped crater
#

is there.. a benefit?

copper laurel
#

PR farming of course

outer raven
# warped crater is there.. a benefit?

everything in d.js is documented, even private properties and methods, so if this means users can actually see what properties a MessageAttachment really has then I'd say so yeah

wild flax
#

Nah not everything is

#

In the past we didn’t document privates really

#

Indicating they are private therefore

remote wasp
#

One can say that documenting private stuff might help contributors especially new ones in understanding how the lib works 👀
Don't know it's worth doing for current version but can be considered for ts rewrite?

solemn oyster
#

Just like you shouldn't be using discord.js when you're starting with JS, you shouldn't be trying to change internals on your own when you're starting to contribute to d.js, unless of course, you know very well what you're doing

#

Internals usually hide the most complex code of Discord.js

hoary ether
remote wasp
# solemn oyster Just like you shouldn't be using discord.js when you're starting with JS, you sh...

Exactly, we forget what our code is doing when we come back to it after a long break. A 100% documentation will not just help new but even let old contributors to quickly grasp what a private piece of code is doing.
It will also improve the developer experience, where a contributor writing a public method gets helpful documentation while calling private methods in it.
Documenting everything is a great thing and with ts rewrite we have a chance to start doing it. We aren't getting any runtime penalty for documenting so I'm unable to understand why it's being seen as a bad thing.

outer raven
outer raven
dawn basalt
#

What are the plans for something similar to @discordjs/permission-helpers?

lilac tulip
#

what do you guys think about a replyOrFollowUp() method on an interaction? what this method would essentially do is try to call .reply() , and if there already is a reply, instead of throwing an error it would call .followUp()

tacit crypt
#

Similar module to perm-helpers

lilac tulip
#

well yes it would just be for convenience

outer raven
lilac tulip
#

oh does it? if that's the case then the method would be useless xD

outer raven
#

Yeah I think that's done on Discord's side

lilac tulip
#

so reply() is basically redundant? since we can always call followUp()

outer raven
lilac tulip
#

apart from personal preferences, is it?

outer raven
#

whatever you wanna call it but Discord has an endpoint for that so it has to be there

lilac tulip
#

yeah I don't want to say it should be removed, just wondering because if I can always use followUp() in my code I will

lilac tulip
unique axle
#

that would be expected, because the follow up will reply to the reply - which it can't if there is none

lilac tulip
#

👍 I just wanted to say it because it would've made my idea useless if it worked

outer raven
grand eagle
#

What is being used for managing the commit messages for the library? Stuff like feat: or chore: , etc.

#

Is that all with Husky and commitlint?

#

or something else?

unique axle
outer raven
#

@opaque vessel how do you have an uncached guild to begin with?

opaque vessel
#

Hey hey, sorry my wording was a lil' off. I meant the guild member was uncached (hence the partial bug report) - thank you for pointing this out <: I edited it now

outer raven
#

Ahh alright. I will try to reproduce this and experiment a little tomorrow. If no one else opens a PR to fix it I might since I have a solution in mind but it may not work

#

Unfortunately any fix to this would be semver major though

#

So probably not worth the time now, just a minor inconvenience that we will have to deal with later

grand eagle
#

What is the scope field in the commitlint meant for in the repositories? Is it just what component was worked on?

#

So if I made changes to Message, would I do something like feat(Message): increase character limit

hallow ocean
#

yes, that's right, the area of which the commit was made in

#

usually it's the class or area of code affected

grand eagle
#

aha, kk thanks

#

Would rebasing commit messages be the only way of adhering to that standard? I have already made a lot of commits on a repo that did not adhere to the standard.

hallow ocean
#

the maintainers would edit the PR title most of the time before committing them, if it so happens that it's already pushed to the main branch then 🤷‍♂️. but if you can amend the commit then sure, not all rules are strictly followed though

grand eagle
#

ahh, yea, I heard about the squash and merge method of controlling PR's

ornate topaz
#

@outer raven "Scope" doesn't refer only to the files you edit. If a PR does one, specific thing, it should not become a sink for random commits you decide to dump into there regardless of what they do, just because "they touch the same file".
What happens if it turns out that your PR adding new ES features broke something for any reason? It could be reverted, but then we also lose every single thing you decided to dump there that was completely unrelated to the thing that was initially being changed at all.

#

Also lol, you went "why change 😕" on the PR for links, but then decided to dump it under your own PR

outer raven
ornate topaz
#

small or not, it doesn't change the fact if it's in scope or not

#

"why change" doesn't sound like "this could be handled in some bigger bulk"
"somewhere else" should still probably be somewhere in scope of fixing old links or a general, non-code chore

#

and i don't think it's for you to judge what is "too small" to have its own PR

outer raven
#

That’s why I’m not a maintainer, I just gave my opinion on it

#

Want me to revert it?

ornate topaz
#

IMO yes, but i'm not the one to speak for that

outer raven
#

Should I tag Crawl then

outer raven
#

Alright I just undid that commit and addressed the unresolved conversation, sorry for that

outer raven
loud jayBOT
#

pr_open #6551 in discordjs/discord.js by tignear opened <t:1630246622:R> (review required)
fix(xxxable): follow more properly with discord behavior
📥 npm i tignear/discord.js#fix/follow-discord

zenith oracle
#

Why is this a major and not just a patch 🤔

wild flax
#

It removes a method

zenith oracle
#

Uh, what method I didn't notice

burnt cradle
#

VoiceChannel#deletable

zenith oracle
#

If this, it's already implemented in GuildChannel... It was an override

#

Or is it considered major the same, even if it's implemented in the parent class? 🤔
I'm not really informed about this lol

solemn oyster
#

I mentioned it in internal a few hours ago, but Crawl didn't see it

#

It's corrected now, dw

zenith oracle
#

Oh nice, thx

outer raven
#

Why does awaitMessageComponent now return a collector??

#

Did anyone test #6476

#

If anyone knows suneettipirneni's discord please tag him, idk who they are in here

#

btw it seems like this only happens with awaitMessageComponent, not collectors

opaque vessel
#

Hullooooo @tacit crypt, are you talking to me there :eyes: what I do halp

tacit crypt
#

Run..uh, i think build:deno

#

And push the changes

opaque vessel
#

Ah wow I got 22 changed files :eyes:

#

You want me to push all of them?

tacit crypt
#

Can you..show them

#

Bc that sounds off

outer raven
#

oh hey

#

would've never guessed that tag lol

dawn merlin
#

I think ik what the issue is but lemme test it first

opaque vessel
outer raven
#

you essentially made awaitMessageComponent and createMessageComponentCollector return the same thing

opaque vessel
#

Pushed @tacit crypt

dawn merlin
#

yeah and unfortunately the tests I wrote checked the wrong types

tacit crypt
#

Can you also update v8? 😇

opaque vessel
#

Ya! Okay

#

Is done, am pro

outer raven
#

Would changing the possible type of a property from undefined to null be considered semver major?

copper laurel
#

yes

outer raven
#

alright, won't do that then

vast crystal
#

oh they are

#

thank you

#

😬

outer raven
copper laurel
#

Is it being used anywhere

#

Genuinely wonder how you stumble across this stuff

shrewd kelp
#

For interactions we have .isButton(), .isCommand(), etc, is there any reason things like channels don't have a simular thing? For channels I often have to do channel instanceof TextChannel to ensure its the correct type so it seems a bit oddly inconsistant that interactions use .isWhatever rather than also being interaction instanceof ButtonInteraction. Would be useful for consitancy to add it to channels as well

copper laurel
#

isText()

rustic boughBOT
#

<:_:874569335308431382> GuildChannel#isText()
Indicates whether this channel is TextBasedChannels text-based.

shrewd kelp
#

agony oh

#

Guessing that got added v13?

sharp wigeon
#

pretty sure that was added in 12.5.3

#

iirc

visual hornet
#

i don't think it would be included in the additions section if it wasn't added in v13...
also wouldn't that fall into a minor update, not a patch?

copper laurel
#

Who cares

glad sparrow
#

is invalidated event still a thing? Can't find anything about that in discord.dev

#

oh it is custom event of djs

grand eagle
#

Do we need to sign our commits when submitting PRs?

#

i'm like 38 commits deep and I just learned about signing commits

#

does that mean they get signed when the maintainers squash and merge then?

slate nacelle
#

I'm not sure how it works actually.

real jetty
#

Is signing commits really that important?

copper laurel
#

YES ITS CRUCIAL

solemn oyster
#

In Git, you can commit as anyone, which means you can also impersonate them. This is because Git is a decentralised system, and pushing other people's commits (e.g. rebasing a PR with commits from different authors) are required to work. To prevent impersonation, you use GPG/PGP signatures, so everyone can verify it's you the one who committed and pushed, and not somebody else.

obtuse hazel
#

Note that if you commit through the GitHub interface, the commits will be signed by the commiter (on merge for instance)

ornate topaz
#

Commiter? Thought it would be by GitHub

fallow crater
#

Yeah, those will be via GitHub itself Im pretty sure

obtuse hazel
#

Github displays it like if it was the commiter who signed it, but yeah

visual hornet
#

why doesn't ClientVoiceManager extend BaseManager? not really important, but just wondering, i don't see any reason for it to not do that

slate nacelle
#

I doubt there is a reason for it, probably just an oversight.

outer raven
vernal atlas
rustic boughBOT
#

<:_:874573855715385394> BaseManager
Manages the API methods of a data model.

outer raven
#

@wild flax what's the difference between types and typings and why do you always edit the title of PRs to say typings instead of types? When should types be used?

wild flax
#

I can’t remember if the changelog gen picks up types correct

#

So i change it whenever I remember

#

Lmao

outer raven
#

ahh ok

#

so maybe it should be removed from commitlint?

#

actually typings isn't even allowed now that I look at it

dawn merlin
#

is Message#createMessageComponentCollector supposed to be able to take InteractionCollectorOptions<T>? Because using the interactionType field and/or the channel and message fields doesn't affect the message component collector?

outer raven
dawn merlin
#

i closed it just now

outer raven
#

ah aight

copper laurel
#

Though isnt that componentType anyway?

dawn merlin
copper laurel
#

Right, yes

dawn merlin
#

So wouldn't MessageComponentCollectorOptions<T> be a better fit rather than InteractionCollectorOptions<T>?

copper laurel
#

Does that typing already exist?

#

Or are you suggesting making it

dawn merlin
#

it already exists

copper laurel
#

Then yeah probably

dawn merlin
#

ok cool, just wanted to make sure

visual hornet
visual hornet
#

I'd say it would still fit into BaseManager depending on how you interpret the wording though, and I think something like disconnectAll would be useful if discord would allow that (or if it's already in @discordjs/voice? i can't seem to find the docs for that)

zenith oracle
#

In the ws property of ClientOptions only large_threshold is documented but the createDefault static method in Options has other properties: compress, properties and version. Also, compress and properties don't seem to be used anywhere and version isn't in the typings...
What are correct the options for this object?

slate nacelle
#

I think what they currently are.

#

If anything compress and properties shouldn't be there at all, compressing is not supported by us and properties shouldn't be messed with.

zenith oracle
#

So only large_threshold should be used? Now I see that neither large_threshold is used 🤔
Only the version property is used in the websocket and it's the only which isn't in the typings 😂

zenith oracle
#

Ohh you're right, didn't notice that

#

Thanks for the clarification

outer raven
vernal atlas
#

perhaps a more useful change would be adding the id property to Base instead of assigning it in the constructor of every extending class

#

if you're looking to remove duplicated code

outer raven
#

id?

vernal atlas
#

the id of a structure

outer raven
vernal atlas
#

doesnt really make much sense for ClientVoiceManager to extend BaseManager

#

it doesnt manage any methods for any data model

outer raven
#

cache is from DataManager

vernal atlas
#

its not about the properties it has its about the description of the class

outer raven
#

that description should probably be changed then because a BaseManager doesn't manage much, that's probably a leftover from when it was moved to DataManager

outer raven
#

well yeah that manager does, but BaseManager has no properties or methods other than client, so the description could be updated

vernal atlas
#

its just not the same type of manager lol

outer raven
#

hm?

vernal atlas
#

all the other managers do what the description says

#

but the ClientVoiceManager simply manages voice state changes

outer raven
#

it holds the adapters for @discordjs/voice

#

so in a way it also manages that data

warped crater
#

one second

vernal atlas
#

why not tho

warped crater
#

can't find the conversation I'm thinking of

#

point is, there's structures that don't have IDs that extend base - which is why its not there

#

so if you wanna go about doing this you should make another "base" that adds the id and the structures that don't have an id to continue extending this class

vernal atlas
warped crater
#

this - Yeah that's def been talked about before

#

uh, "talked about", as in, brought up and not discussed further kek

#

I 100% remember a conversation about why id isn't on base and the jsdoc being weird, but I can't find it for the life of me no matter what search terms I try

burnt cradle
#

@tacit crypt when I switch to the enums in the context builder pr should I stick to inRange or should I switch it to oneOf, they would be the same right now but if discord adds more types later, oneOf would be more readable imo

tacit crypt
#

oneOf maybe?

visual hornet
#

got a list of classes that extend Base and don't have an id property btw

[
  'GuildBan',
  'GuildTemplate',
  'Invite',
  'InviteStageInstance',
  'Presence',
  'Typing',
  'WelcomeChannel',
  'WelcomeScreen'
]

||code i used to get this list if anyone wants to see actual hell: https://pastebin.com/LatwWFXQ||

#

so uhh yeah guess there are some classes that do extend base but don't have an id property

sick raft
#

why are the prerequisite modules for using /commands not installed by default

dusky reef
#

Because as wizo said, not every bot depends on commands (regular or slash). There are so many bots which just does specific things on ready like that and doesn’t rely on commands. Thus those modules are burden/extra for them.

Isn’t it the best practice to have only what i need? I guess that’s best to install slash modules only if he needs that.

sick raft
#

I hope you read the rest of what was said, but tl;dr not every bot depends on can be said about almost everything , but realistically, almost every bot uses commands

[and in the near future, /commands is expected to be the only available option for commands for most bots]

copper laurel
#

I dont really know what you mean

#

We just tell you to install the additional modules as you reach the concepts that need them

oak quail
#

hm

#

fetching invites to unknown channel types also causes an error lol

#

ig channel is null so its the same issue as fetching friend invites

stable sequoia
#

this looks like discord's bad but it essentially makes CommandInteractionOptionResolver#getMember unsafe/unusable with the second parameter as true as you can pass in an id into a USER option and if the id is a valid user id (but not a member [not sure if has to be member of the guild the interaction is in/didn't test]) the interaction will go through and the method throws the error ```
node_modules/discord.js/src/structures/CommandInteractionOptionResolver.js:100
throw new TypeError('COMMAND_INTERACTION_OPTION_EMPTY', name, option.type);
^

TypeError [COMMAND_INTERACTION_OPTION_EMPTY]: Required option "user" is of type: USER; expected a non-empty value.
at CommandInteractionOptionResolver._getTypedOption


`CommandInteractionOptionResolver#getUser`  seems to be working fine though
#

im on djs v13.1.0 btw, not sure if it's been addressed/fixed in master

copper laurel
#

Not sure what else you would expect it to do

#

If theres no member of the guild, getMember cant possibly have a value to get

#

And if you pass true to make it required, it will throw an error

#

Sounds entirely expected to me

stable sequoia
#

they why i said "this looks like discord's bad".

copper laurel
#

I mean... I also don't understand what you expect Discord to do about this

#

If you provide an ID of someone who is not in the guild, Discord cannot possibly give you a GuildMember

stable sequoia
#

if you pass in a channel id discord just doesnt send the interaction

copper laurel
#

To what type of option

stable sequoia
#

USER

copper laurel
#

Well duh, that wouldnt be a valid user ID

#

So no, it shouldnt send the interaction

stable sequoia
#

i guess yeah, thats true

#

but doesnt this make getMember unsafe

#

with the required field true atleast

copper laurel
#

So dont make it required

#

Or do, and catch the error, and handle it and tell the person using the command that this user isnt in the guild

#

This is entirely up to you how to control this behaviour

stable sequoia
#

mhm

copper laurel
#

Its unsafe not to handle an error, no matter why it happened

stable sequoia
#

i expected the error to be not possible because it should always be there if the option is required. but i guess with the nature of the method as its not based off of the option types provided by discord, it makes sense

copper laurel
#

The getUser will always be there if you make the option required

stable sequoia
#

yeah, i did test that

copper laurel
#

But a required option isnt the same thing as making the resolver required

#

In fact if its a required option, theres no reason to make it required in the resolver at all

#

The resolver gives you error control flow

stable sequoia
#

doesnt it provide type narrowing

copper laurel
#

eh I guess, if TS

stable sequoia
#

yea yea

#

i guess this would be a discussion for if this persists when/if discord introduces a member type for options

#

and still it wouldnt really have anything to do with djs i guess :p

vernal atlas
#

is it worth adding a note to the docs that it throws if the user isn't in the guild?

#

@stable sequoia @copper laurel ^^

copper laurel
#

No, that should be common sense

#

No guild member for someone who isn't a member of the guild

#

It also won't throw if you don't make it required

vernal atlas
#

it would be kind of a wacky workaround to mark a required parameter as optional, but yeah i agree that its obvious, but also might confuse someone seeing the error

#

which is why i think a warning wouldn't exactly be the worst idea

copper laurel
#

The option being required is not the same thing as forcing the resolver to resolve something or throw

#

A required USER option will have a User

#

I may or may not have a GuildMember

#

So you can resolve it without required:true and check undefined

#

Or resolve it with required:true and try/catch the possible exception

#

Like I said early, the resolver option is an error control flow, it doesn't really have anything to do with if the option is required or not

stable sequoia
vernal atlas
#

yea

stable sequoia
#

but i do agree marking a required param as optional feels weird, and i feel like most people wouldn't think of that

vernal atlas
#

is there really a point in even having the required parameter for getMember (although this isnt a change applicable for v13)

stable sequoia
#

i don't think so, unless you would prefer for it to error instead of returning a nullish value

#

i would definitely rather have the 2nd param yeeted and have it nullable so more people don't walk into this but you guys might know better than me

#

having it nullable just feels right compared to the current behaviour imo

#

because the required param is kinda irrelevant

copper laurel
#

You're not marking it as optional

#

You're simply choosing how the resolver should behave

#

They are not the same thing

#

If you want it nullable stop using the second param, there's literally nothing more to this

#

Why do you want to take freedom of choice away?

#

If you mark getMember() as required then you're telling the code that this function requires a GuildMember, and will throw if one cannot be resolved

outer raven
#

You could alternatively use getUser and resolve the member later, this way you can be sure if there is a member and make your own error if not

stable sequoia
#

that just makes it more complicated than using it with optional false though?

hoary ether
dawn merlin
#

There is? It’s a context menu command for messages

wild flax
#

Yeah strictly for context menus

hoary ether
#

oh. that makes sense. i was too tunnel vision on slash commands.

outer raven
#

I found another bug with Message but this one is about Message#pinnable, would that fix still be within the scope of #6581?

loud jayBOT
outer raven
#

the bug is that the getter returns false on replies and other messages that should be pinnable, so it's not related to the channel being missing which is the original scope of the PR

opaque vessel
#

Meh all these bugs about permission checks makes me think if they should exist in the first place

outer raven
#

same but they can't be removed now. I can't wait for that permission helpers lib tho

#

and I think this was missed because you can only crosspost DEFAULT messages, but you can pin types other than DEFAULT

#

also for ThreadMemberManager#add you can pass @me as the member which results in the function returning @me which isn't a Snowflake. Should the docs and types be updated to say this or should the function be updated to send the client user's ID?

zenith oracle
#

For types Snowflake is a string so @me is acceptable

copper garden
#

Snowflake is strictly typed as a numeric string, not as any string anymore

zenith oracle
#

Is it? Thought the ${bigint} was reverted

ornate topaz
#

Afair only in discord-api-types, or something like that

copper laurel
#

Which is where our typing comes from

#

So ours is also reverted

zenith oracle
#

Yeah, that's what I meant. Actually if I import the Snowflake type from discordjs I see that it's of type string and I see the discord-api-types description

outer raven
#

I wasn't aware of that change but the definition of a snowflake is a string with a bigint inside

#

so @me should not be considered one

outer raven
#

Yeah that only makes it easier to use for convenience, but doesn’t change what I said above

#

Also @unique axle why is the partials part in the issue template required?

unique axle
#

have you checked PRs?

outer raven
#

Oh I see it

#

My bad thumbs

outer raven
tacit crypt
#

I don't..see a question in that message

outer raven
#

message right above it

#

that one explains the bug

tacit crypt
#

The answer is simple: Is it related to the this.channel change? If yes, in the same PR, if not different PR (at least imo)

outer raven
#

yeah it's not, I'll make a separate one

cosmic pagoda
#

hello, i have a suggestion/request i dont know where to send this. anyway if you have a multiline string like this in embed, the indents are visible on mobile devices (pc discord seems like it parses automatically but not mobiles. it would be good if there was some middleware option which would allow us to remove indents in one place rather than for every message separately. its not big deal but it would be nice and helpful feature to have

unique axle
cosmic pagoda
#

i know that this is how js works and I know I can use some function but im asking for library implementation where it does this automatically because there is no good for it, or like I mentioned a middleware which gets called each time before a message gets send where we could handle it ourself in one place

unique axle
#

stripping indents from your strings is not something a discord library should do

cosmic pagoda
#

then the middleware :/

visual hornet
#

souji just linked you some

unique axle
#

then define a function somewhere and pass content to it before sending it?

#

.send({content: prepareContent(stringHere)})

cosmic pagoda
#

you dont understand forget it sorry for your time

unique axle
#

i understand, you want to define a middleware somewhere (client options, maybe) that every message content gets passed to before sending it off to discord

cosmic pagoda
#

thats not really how middleware should be made

visual hornet
#

sideone why do you think a library for interacting with a discord api would implement string cleanup

cosmic pagoda
#

there could also be middleware for kicking, banning deleting messages not just my request

cosmic pagoda
visual hornet
#

you know we have managers Thonk

cosmic pagoda
#

what does that mean?

visual hornet
#

MessageManager for managing messages (ie deletion), GuildMemberManager for managing guild members (ie kicking & banning)

cosmic pagoda
#

and how does that relate to middleware?

#

but yes the Manager classes could have have an optional middleware function which could be set (maybe like the makeCache thingy)

unique axle
#

adding middleware across the library that modifies options before making api calls is not something the library in its current structure supports.
if you want that feature i'd suggest opening a feature request on github, so it can be tracked https://github.com/discordjs/discord.js/issues/new/choose

cosmic pagoda
#

im banned on the repository 😦 thats why im asking here

#

ill actually respect the ban and not make new account but please could you reconsider with the staff my unban? I havent done anything terrible really it was stupid joke

swift zealot
#

I've encountered the following issue when my bot leaves a guild:

Trace Stack: DiscordAPIError: Unknown Guild
    at RequestHandler.execute (C:\goat\node_modules\discord.js\src\rest\RequestHandler.js:298:13)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async RequestHandler.push (C:\goat\node_modules\discord.js\src\rest\RequestHandler.js:50:14)
    at async Guild.leave (C:\goat\node_modules\discord.js\src\structures\Guild.js:1222:5)
buoyant umbra
#

is guild.channels.fetch() supposed to force-fetch the channels from the API everytime? The docs state that it does a force fetch unless the channels are cached, therefore returning the cache. I used guild.channels.fetch() in a loop and it got ratelimited after 8 iterations (for doing the force fetch). Providing {cache:true,force:false} to fetch options does nothing too

vivid field
#

the cache check is only done if you try to fetch a single channel

#

otherwise you can't tell if a channel is missing

outer raven
#

@grizzled scaffold wdym the plugin has been uninstalled? (#6587)

placid geyser
#

is it true that discord will only support slash commands?

raven juniper
#

Discord has indicated they will not approve bots for the message intent for regular commands if that's why you apply. This does not apply until your bot needs to be verified

placid geyser
pastel magnet
#

You will be rejected since message content is not required for any of those commands.

grizzled scaffold
grizzled scaffold
#

Yeah I tested it and the file isn't referenced anymore

modest lodge
#

Is there a channel I can ask about unit tests? Of a bot, not the library. It is proving quite a bit more difficult with slash commands as I pretty much need CommandInteraction objects. Is there a way to create one through the library with particular values? Can I "new" one somehow?

quiet viper
modest lodge
#

@quiet viper That is what I'm using. I'm trying to unit test my bot and so I need to generate the "responses" that such commands generate without (always) installing the commands and typing in multiple different responses. The unit tests run independent of the bot.

solemn oyster
modest lodge
#

It definitely looks like there is info there. Is that just a message though? I don't know what that thing is a special channel?

quiet viper
modest lodge
#

excellent... thank you

ruby terrace
hoary ether
#

@ruby terrace allow me to grab your attention while you're still here. you mentioned a while back something about discord making an overhaul for slash command permission. would you mind answering this? #archive-interactions message

unique axle
hoary ether
#

found it. thank you

#

i know im on the wrong channel but, im currently making a PR for the guide and i was wondering if it would be ok to include a little note in the section about slash command permission that links to that discussion? the note can say something like "Permissions for Slash Commands are getting updated by Discord. You can see the discussion here. For now, you can manage your slash command permission with the different methods explained in this guide"

unique axle
#

no, guide content is supposed to be long-term
this feature is not developed enough to even mention + the discussion itself is meant to be temporary to inform devs of "things to come potentially, hopefully soon™️"

hoary ether
#

no, guide content is supposed to be long-term
would you suggest keeping the current section about slash command permission as is then? I already wrote a more extensive explanation for that section, but now im not sure if it's worth including it in the PR because of what you said. I could include my extensive explanation in the PR, and simply omit the "little note that links to the github discussion".

unique axle
#

if you improved the current explanation sure, go for it
just that temporary notes should not be included
(there have historically been exceptions to that rule with the temporary intents explanation, just because of the sheer amount of people facing the problem)

hoary ether
#

👍

clever flicker
#

So I'm just kind of curious, why the hard requirement to bleeding edge NodeJS? What is it about this library that hinders support for LTS?

wild flax
#

Pretty sure that has been answered numerous times by now

#

check the issue or search for it on the server

real walrus
#

Was invite information removed from the guildMemberAdd event? As I know it worked just fine on V12, figured I would ask here as it's more of a library thing. Any thoughts?

#

I have searched the changelog ^ Nothing touches on it.

unique axle
#

there never was invite information on the guildMemberAdd event

real walrus
#

I used to be able to fetch invites when a user joined, and it could log who invited them, what happened to being able to fetch invites?

tacit crypt
#

You'll need to be more explicit than that, and I'm pretty sure this falls outside of this channel

#

Methods have changed and you'll need to update to the new ones iirc

spice sierra
#

Can I ask a question about a discord.js code here ?

copper laurel
#

This channel is about development of the library, or its source code

#

Questions about using discord.js go in the help channels

spice sierra
#

It's about its source code so ig I can

#

It's about the compression part of the ws client, the chunk size where did the number came from? I'm trying to understand why but no clue

#

Sorry I'm on phone rn

#

I'll check out thanks for the answer

outer magnet
#

imo the messageReactionRemove should emit if uncached and the partials are enabled similar to messageReactionAdd

i checked the code for messageReactionRemove.js and there is no place where it tries to check if partials are enabled

copper laurel