#archive-library-discussion
1 messages · Page 14 of 1
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
This is still not on topic of this channel
Serious discussions about developing discord.js
So its good for 99% bots? Thats good enough for me as a goal.
I'm waiting to see any serious suggestions, other than modularisation which we've indicated is happening
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
should I PR and add that as private?
Neither do they update d.js very often, so in the end they use their own fork with their own modifications
is there any plan on adding InteractionOptionResolver to sub command options?
Theres no need for it, the subcommand options are hoisted to top level
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
I dont know about documenting set, but extends Presence should probably be there
yeah I'm adding that and I'll leave set as public, will see what the reviews say
#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
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
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
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"
How 'bout we don't make up random facts to push your personal agenda, just saying
Signed, a dev that works on Rythm
Also there is #874411732527886336 for memory related discussions, if you are interested
(that might take a while, given that they were muted for 3 days)

Is there a plan on replacing TSLint with ESLint?
TSLint has been deprecated for a while now.
Yes, whenever we rewrite d.js to TS
iirc there is/was an issue open about that
#5337 in discordjs/discord.js by JMTK closed <t:1627085624:R>
After v8 gateway PR, bot doesn't initially receive DMs
you need the channel partial for that to work.
https://github.com/discordjs/discord.js/issues/6411 can someone give this a has pr
Also the upstream PR for https://github.com/discordjs/discord.js/issues/6379 has been merged cc @ruby terrace
I saw (heh, edit pings don't ping), I'll get it in for the next minor
How long does djs cache messages for?
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
do we have plans for a slash command permission builder in /builders?
There's a 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
that's the defaultPermission. i was referring to permission overwrite
the object you would pass to GuildApplicationCommandManager.permissions.set() or .add()
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
to be fair everyone has been complaining a lot about permissions
If I may ask. What would be the point of rewriting the whole thing in TS? Will it help more with typings or?
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
isn't the ts rewrite repo archived now?
last i check it was.
ah i see
im assuming all the new modules like /rest and /builders are all written in ts?
I mean the djs rewrite [was put on hold], the /modules has been progressing... slowly
Yes, now you may think I'm some kind of idiot but I've never worked in ts before. That's why I'm asking you if it's worth rewriting at all.
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
But it's still going to use everything in js like sapphire, or?
The modules are essentially the component parts of a djs-rewrite, which will tie them all together
With my second point, you may realise that people who use and embrace TS never work on JS unless forced to
Sapphire is TS I'm pretty sure
It is
Yes
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
Also in addition to the other reasons given the typings in some areas are more specific than the jsdoc.
Oh yeah, documentation with examples and everything in IntelliSense, the best part of TS libs
Yes, I know that
So it won't limit discord.js users who work in JS in any way?
it shouldnt
If it goes back to JS, why would it
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
You don't run TS at all, so it's all JS anyway
Ok, then it's fine that it doesn't limit users in any way, it just adds more TS stuff to users.
Yes, this is then built into js.
And far better typings and documentation
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.
JS is its limiting factor, they cannot change that due to nature of TS. All JS is valid TS.
So then are you going to redo @discordjs/docgen to generate as well or use a completely different generator? (docgen uses jsdocs)
JVM is the limiting factor between java and kotlin. They’re still different languages.
ok you win, what did you want to prove again? This wasn't relevant to the convo at all.
okay
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?
Not yet no
https://github.com/discordjs/discord.js/blob/main/src/util/Formatters.js#L27
why does the Formatters class extend null?
so that it doesn't have a constructor
why not using a namespace ?
why not using plain object with methods?
because the docgen doesn't parse that
else you'll end up with a giant typedef like at https://github.com/discordjs/discord.js/blob/main/src/util/Constants.js#L1049-L1079
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
#6456 in discordjs/discord.js by SquareIsNotCool opened <t:1629107884:R>
Missing type property for interaction#options#getMentionable
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
but I think what they wanted was just a simpler way to tell which one it was. Having access to resolved is basically the same thing isn't it
In a sense
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?
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?
Parameter names are honestly quite useless in JS
No such thing as named parameters
Wouldn’t really categorize this as a “bug”
Maybe not a bug, but seems a bit off
Especially with VSCode's new parameter thingy
Hardly the end of the world 🤷
wait thats a thing?
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
"bug"? it's just a name, really, it affects 0 code whatsoever
"typescript.inlayHints.parameterNames.enabled": "all" in settings.json. Or search for parameter in vscode settings. You need TS 4.4+ for it
Not with that option enabled
Yeah I found it later. Won’t be using v4.4 yet but ty
No jeez
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.
You understood what I mean why is it such a big deal
it might be an issue or inconvenience, not a bug
😐
If nothing else, parameter names should be consistent to avoid mistakes when developing D.JS
idk man
it's in the typings
It's something very minor, but if it's really needed, I can create a PR lol
the thread permission getters are really broken wew
how so
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?
no, admin overwrite does nothing
I assume missng some parentheses there?
lol, looks like whoever did that rename PR missed those
none of that really matters anyways since they're getting redone
well i fixed those when adding the new permissions https://github.com/discordjs/discord.js/pull/6466
ah... right i forgot about that
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.
hm, now that i look into it there isnt even a checkAdmin param documented https://advaith.is-in-hyper.space/ed009a75ad.png
the return value of that
ah right 
so are users just expected to set it to false when checking channel permissions?
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
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
https://github.com/discord/discord-api-docs/issues/640 and i'm to this day not sure if night even understood the problem

pretty sure they didn't exist when I made the PR because i went through them all tons of times
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.
sounds like you're deferring the same interaction twice, use #djs-help-v14 instead
I'm not deferring the same interaction twice. It only happens when I have a syntax error or similar small error.
you are, you just probably don't know where, go on that channel and show your code, this channel is for developing djs
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
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
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
The error you are getting is, like I said, because you are replying to the interaction in your error handler using .reply instead of .editReply. Please stop flooding this chat now
I don't have an error handler, but thanks. I'll make a reproducible example.
Disabling the emoji manager completely breaks reacting to messages with guild emojis, should this be documented?
What do you mean by 'completely breaks' here? I set my BaseGuildEmojiManager to 0 and managed to react to a message with a custom emoji, or did you mean something else?
I set mine to 0 too and tried to react using an emoji ID and it crashed my bot
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
Odd https://gyazo.com/52b37b8d8ccdf9bbdc7c427138338688
What did I do wrong?
You could log line the resolved emoji at line 191 in the message manager I guess. Or maybe I did something wrong, idk, have a look
Did you provide an actual guild emoji object?
try passing just the ID, which is what I did
will do in a bit but try that first to see if u can repro
Crashed with just the id
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
but why is it even doing this if we only need the id to react?
Yeah, exactly
can you look into it to see if it's possible to fix? I'm not really sure and might break something tbh
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
On v13 release ownerID was converted to ownerId, however the .displayAvatarURL method did not get the camelcase treatment. was this on purpose?
URL stands for uniform resource locator. Id stands for identifier. It's fine
ah I thought it'd just be the emoji ID.
Well making another call is against the lib's standards of 1 call per method so I guess that's not possible, so a warning in the docs would be best
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
Alright I'll just keep that cache enabled then, no worries
I mean if you know the custom emoji beforehand, you could fetch it then use that, but unsure if this is... fixable
The DiscordAPIError Class does actually have this, it just depends on how it gets logged whether or not it is part of the log
well then would it be possible to update all the dapi errors to include the request path?
it...does?
it didn't in the error i showed
and that was the full stack trace
hmm
would making invite.channel nullable be considered a breaking change
if it currently throws an error where it would be nullable
so support for fetching it cant be added until v14?
or would it have to be, like, an option to allow it for now
you could enable the new functionality with an option that can be removed in future versions
How many digits are in a discord snowflake?
17-18, 19 in 2022, 20 in 2090
so 17-19 is sufficient for now
probably bc the emoji name is missing, did you tried passing a name?
bc the request needs a (random) emoji name and and id.
and when the emoji cache is limited, you can get the name anymore
I didn’t bc passing an id is more reliable that using the name because we don’t need to change the code if the name changes
The name can be a random name, it doesnt have to match to the emoji name.
I’m pretty sure it does
No
You can even do :_:12312312333123123123123:
Do you not test this before you say something
Installing @discordjs/opus returns an error
Can someone else try it and inform if they're facing it too?
What Node.JS ver are you running?
#archive-voice for further discussion thanks
16
Look around here, this may help. https://www.npmjs.com/package/@discordjs/opus
You are being so unhelpful its incredible
Thats it? Nothing more?
Well, with that alone no one can help you
Did I miss something or is BaseCommandInteraction#deferReply missing in the docs?
Is it really necessary for everything a djs caches to be cached?
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
Okay, because for example if my bot doesn't need to cache GuildMember roles so I can turn it off
Overriding the cache used in
GuildManager,ChannelManager,GuildChannelManager,RoleManager, andPermissionOverwriteManageris unsupported and will break functionality
other than that, it's judging by your use case and what you need
@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?
What day does the deprecation of this apply: https://discord.com/developers/docs/reference#api-versioning ?
#6469 is pointless
We have .data to work with the data if you want to do your own parsing
Do you know the date?
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 ^^
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
It should probably be called hoistedData then, not options
Agreed
#6472 in discordjs/discord.js by Richienb closed <t:1629331610:R>
Meta tweak
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
readyevent either, we're intentionally discouraging people from setting commands on ready @discordjs/restdoesn't require logging in an entire Client instance, which populates caches and connects to the gateway and various other overheads
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
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
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
Not really no
but you realize that is the majority of the lib's users right
Yes
unfortunately so, but I think providing code snippets this complicated isn't ideal
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.
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
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
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
yeah that is also a better way. Either add comments along the way or document the package itself like collection and the main lib are
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
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
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
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
ah I see
I assume you're using some version of this script which is why you can call the API without logging in right
Yeah
Can I take a look at that or is it closed source
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
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
https://github.com/discordjs/guide/pull/826 theres still this PR too
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
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.
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:
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"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>
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
👍
Maintainers: see #archive-commando-deprecated please
Don’t bother. I won’t be accepting any other examples that involve the ready event.
I like that idea but wouldn’t that be the same as what we have rn? Or is the code to deploy different?
But what’s the problem with the ready event if it doesn’t spam the api
There is no problem.
Then?
Nothing. I'm simply not going to accept it.
Registering your commands should be a separate process.
Alright then if the recommended way can be automated I’ll be happy with that
I don't see why it should.
The moment you need to do permissions, you need to manually interject anyway
why would you? My permissions are all done automatically
What is automatic about "sepecific user & role"
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)
I think the script itself isn't the problem, but explaining what the script is doing and the reasoning behind it are
you put the ids in an array and automatically apply the permissions automatically when deploying
yeah thats what im saying
it should be explained better
Not in a readme, no
Thats assuming all commands have the same perms 👎
If the bot is in multiple guilds, you'll also have to specify the guild id of every guild the bot is in. (Unless you loop through the guild cache, at which point you'll have to use .login(), and we've already discussed why it's not good to use .login() for deployment)
No it’s not? I’m saying have an array of ids per command, which is what I do, and you can customize it freely
You can also not apply guild permissions and let the owner of each guild customize them through a command
That is possible, but that's not automated anymore, is it? We're discussing how to automate permissions overwrite during deployment
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
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)
The thing I was suggesting only works well for 1 guild bots
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?
it is
Then it's technically possible for discord to allow us to do permission overwrite without specifying guild id, yeah? 🤔
since the same endpoint is used for users: no
Sorry I meant in the future*
Maybe they can give us a different endpoint
i don't see why they would, it needlessly complicates the procedure
you're right... the more i think about it, the more i realize how dumb my suggestion was
Any specific reason why <Message>.mentions.channels is a Channel type and not TextBasedChannel?
because you can mention voice. look: #222078108977594369
what is the keysymbol to mention a voice channel?
like textbased is #
#! and there is #archive-offtopic for offtopic
pretty sure it's just <#id>
dude..
oh wait u mean sth else nvm
why does Webhook#send wait default to true and is not even an option
someone forgot to deprecate the last v13.1 dev version
probably because that has to be true for the api to return the sent message
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.
ye but it still should be an option, you don't always need the message
feel free to make a PR then but I think that'd be a semver major change
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
ye as long as u keep the default behavior it should be fine actually
will you open it?
Any idea where I should post questions about the ability to remove a command via the DiscordJs REST library?
@outer night That was in response to my question? Is the rest library solely around for slash command support?
this channel is about developing the library, please redirect any questions about using the library to a support channel
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?
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
(And we get a docsgen for TypeScript as well)
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. 🙂
there's a PR for the guide that addresses most of what you pointed out
@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
are you sure that's the param check that's causing the entire thing to be true?
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
where?
its nullish coalescing the entire thing !== check
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
should be (option.required ?? (optionType === 'SUB_COMMAND' || optionType === 'SUB_COMMAND_GROUP' ? undefined : false)) !== existing.required
yep
I was wondering how I missed that and then I realized I forgot about required when I tested 
also, why not do ["SUB_COMMAND", "SUB_COMMAND_GROUP"].includes(optionType)?
would also make it easier to add more in the future
mm, sure
Question will MessageEmbed constructor (along with MessageButton, MessageActionRow, MessageSelectMenu) go under builders in v14?
Yeah eventually
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)?
#11 in discordjs/builders by Fyko opened <t:1626131905:R> (changes requested)
feat: create Embed builder
📥 npm i Fyko/djs-builders#embed
There's also a button one but I want to redesign that
We don't just want the existing ones moved though
When is this going to be null?
https://discord.js.org/#/docs/main/stable/class/SelectMenuInteraction?scrollTo=component
The same is with buttons. These interactions only arrive if one was interacted in the first place, right? How can it be null?
Uh, probably from when ephemeral messages didnt send their full data
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 [:
ephemeral messages used to not contain components
or a message in general for that matter
Ooh, wonderful, so now that they both do exist, there really is no reason for this to be nullable anymore?
TODO item for v14 
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. <:
@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
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?
Maybe
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
I think that question would be better asked at Discord rather than here >:
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.. ?
Because there might be a type of interaction that doesn't one day
perhaps its worth creating an interface for all the reply methods in the typings then, unsure what a good name would be though
That's exactly what it is
<:_:851461487498493952> InteractionResponses
Interface for classes that support shared interaction response types.
in the typings
are colors such as PINK no more accepted?
TypeError [COLOR_CONVERT]: Unable to convert color to a number.
well, you do have to pick one that exists.
<:_:874569310025179188> ColorResolvable
Can be a number, hex string, an RGB array like: ```js (more...)
and pink just doesn't
okay thx
@solemn oyster why the semver major on the events PR?
if they never worked is it really breaking functionality
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
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
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
do you think that's worth it tho? If anything that should be a separate PR cuz they will need to be removed for v14
Are you in a rush about getting your PR's merged ASAP?
nah I'm not but at the same time I don't rly like having prs sitting for months lol
We do proper software development, even if it means an update needs to wait for months before being landed
yeye I get it, no worries
I know my question is probably off topic for this channel but, what's your definition of "proper" in this context? Genuine question because I'm trying to learn
well they did work
which is why they were documented and added to d.js
they never fired according to the discord dev
1 sec
they might have stopped sending them to bots within the past month
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
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?
It is for context menu interactions
Ah, I see. Guessing that is relatively new then, saw the message type in the docs
Where are you seeing this btw? Got a link?
It's to-do for builders https://github.com/discordjs/builders/issues/28
Awesome
It's... hard to explain actually. But for the most part, we're adhering to standards and being conscious about the impact changes have on our userbase.
message.awaitMessageComponent doesn't seem to collect Select menu interactions (even if componentType is set to 'SELECT_MENU'). Is this intended?
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

Just tested, it works fine. Whatever issue you're having is not the lib
Yeah I’m pretty sure it should be any message component interaction.
yeah just change it to MessageComponentInteraction
Why is there VoiceStats#requestToSpeakTimestamp but not VoiceState#requestToSpeakAt like almost every other timestamp in the lib?
why did they get rid of structures in v13 ?
Check this comment https://github.com/discordjs/discord.js/pull/6027#issuecomment-874919431
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?
That sounds like an error to me.
nevermind, just wasn't on github version of djs. It was fixed a while ago.
I'm incredibly bad at forgetting to export new classes I make from the index, glad someone has fixed it 😄
@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
eh maybe I'm thinking more closely to the API design than a builder
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
lol no
So keep it separated as is?
?
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
it's called ContextMenuCommandBuilder rn
Yeah thats fine
but slash commands are called ChatInputCommands 
i see where you're going, don't get me wrong
Fair
Couldn't https://github.com/discordjs/discord.js/blob/main/src/client/actions/UserUpdate.js#L10 be replaced with
const newUser = data.id === client.user.id ? client.user : client.users.cache.get(data.id);
(or equivalent)
so it can not crash if user cache was disabled? (when client user gets updated)
I can make PR
also
why does userUpdate event gets emitted when i edit intents of my bot from developer portal
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
¯\_(ツ)_/¯
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
Yes, I think they are still speculating about whether it is possible to get about me only via oauth2 etc.
ok
@hallow ocean you resolved my conversations without really addressing them nor responding 🤔
Also you forgot to update the typings
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
I’m just saying that with the current code if you have an attachment with a name that starts with SPOILER_ and do setSpoiler() it will remove that text, making it not a spoiler
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
So that means it should be validated if spoiler is false, right? 😄
Yeah on the second if condition you should check if spoiler is false
So that nothing changes if it’s a spoiler and you do setSpoiler(true)
All good
Just commented one more thing that I forgot, otherwise LGTM :)
Sorry again for being stubborn
All good, no worries
What if we keep client.user (user) and guild.me (client as guild member) always cached?
aren't they always cached already?
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)
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
So client.user is always cached?
What about <guild>.me?
That wouldn't be that useful
The library doesn't guarantee that Guild#me exists all the time anyway
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
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("...");
Should the RESTManager class be documented?
why
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
@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
The one in -types is exported
well its erroring when i try to build it
What's the error
'"discord-api-types/v9"' has no exported member named 'ApplicationCommandType'.
That's impossible
clearly not
Which version of that do you have installed?
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
Yeah looks like it needs a release
Oh no it wouldn’t, just said that because some properties reference that class and the link was missing that’s all
It is fine
I guess partial messages are missing the content but in the documentation it seems like content don't have to be present 
Yeah because of that reason, partial messages are missing content so it can be null
I seem to be the first to be confused by this - so nevermind then 🙈
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)
#6525 in discordjs/discord.js by danii opened <t:1629908355:R>
BaseGuildTextChannel Is Typed but Not Exported
Does anyone know the reason to this?
It seems like the class is exported just fine https://github.com/discordjs/discord.js/blob/d0bc4d7ff037035d4f315a0286b06f0a1ade29c1/typings/index.d.ts#L303
doesn't seem to be exported in src/index.js.
#6527 in discordjs/discord.js by Dev-CasperTheGhost opened <t:1629911999:R> (review required)
fix(BaseGuildTextChannel): export BaseGuildTextChannel
📥 npm i Dev-CasperTheGhost/discord.js#fix/fix-6525
Ah I thought the issue was with the typings, nvm
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.
Unlikely we’ll move into that direction with everything moving to slash commands
Okay, so it wouldn't be worth implementing that?
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
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 🙈
Disagree.
All right, thanks for the fast responses 😅
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?
For what now? Is this a new builder?
Definitely do not extend library classes though, thats why we removed structured
Utils should be functions
For the permissions helpers Crawl suggested that we create a /permission-helpers module and put the code there
Yeah a always functions
why is ban .ban(user, options) but unban is .unban(user, reason) ?
because theres no other options besides reason for unban
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.
I'm sorry, am I missing something here? What does a json object have to do with cron jobs?
I want to create something that can simulate the compositional nature of the builders for cron strings.
You can look at the source code in GitHub
discordjs/builders
ofc i know I can do that. I was looking for more insight rather than trying to completely figure it out on my own. This is not super helpful.
I guess you're right. But at the same time, i don't think it's that hard to figure out what the builder does by simply looking at the source code. The job that it does is relatively very simple and straightforward.
Also, your question is off topic for this channel
is it? I thought this would be the best place to ask about how the library works.
I was also told to go here.
Serious discussion about developing discord.js
Is v14 still going to be written in TS?
v14 isn't -next.
Why would it not be? Have you heard something?
the typescript rewrite is not versioned yet
v14 will very likely not be the ts rewrite
yeah, but was just a question
is the rewrite public for people to work on?
what does ts rewrite mean exactly?
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)
so is https://github.com/discordjs/discord.js-modules the rewrite?
modules (which will be composed and used in the rewrite)
gottcha thanks :D
iirc there are plans to implement modules into the main library?
Yeah, eventually
are you guys paid to develop the library? or is this all volunteer work?
for sure
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)
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
Okay, sorry. Thanks for the quick response!
Why is this not documented? https://github.com/discordjs/discord.js/blob/main/src/structures/MessageAttachment.js#L15
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
There are times when things are intentionally not documented
when its constructed from an incoming message its the URL
its just a really weird field
it doesn't expose new information regardless
it would be easy to doc tho and it can be private
is there.. a benefit?
PR farming of course
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
Nah not everything is
In the past we didn’t document privates really
Indicating they are private therefore
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?
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
Didn't expect you to call out Rodry like that lmfao
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.
I don’t PR farm tho, I just open PRs for stuff I stumble across and think is worth fixing/changing, and most get accepted
Yeah I agree but tbf for this specific property it’s pretty easy to understand what it does, just saying it could be documented if everything else is. Not gonna open a PR solely for that but if I find many others I might, if it’s worth it ofc
What are the plans for something similar to @discordjs/permission-helpers?
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()
Similar module to perm-helpers
Hmm, helper method.
well yes it would just be for convenience
Doesn't followUp just replicate the behavior of reply if there is no reply yet/if the reply has been deferred?
oh does it? if that's the case then the method would be useless xD
Yeah I think that's done on Discord's side
so reply() is basically redundant? since we can always call followUp()
I personally dislike followUp so no not really
apart from personal preferences, is it?
whatever you wanna call it but Discord has an endpoint for that so it has to be there
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
btw, I just tested it and calling followUp() on an interaction that hasn't been replied to throws an error
that would be expected, because the follow up will reply to the reply - which it can't if there is none
👍 I just wanted to say it because it would've made my idea useless if it worked
Ah nvm, only acts as editReply if it was deferred then
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?
husky enforcing commitlint https://github.com/discordjs/discord.js/blob/main/.commitlintrc.json
@opaque vessel how do you have an uncached guild to begin with?
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
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
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
yes, that's right, the area of which the commit was made in
usually it's the class or area of code affected
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.
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
ahh, yea, I heard about the squash and merge method of controlling PR's
@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
Yeah I get it but this was a very small thing and it’s ok if that gets reverted.
I said “why change” because the other lad opened a PR just to fix some links in the tests, when it could’ve been bundled somewhere else
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
IMO yes, but i'm not the one to speak for that
Should I tag Crawl then
Alright I just undid that commit and addressed the unresolved conversation, sorry for that
Also considering this is still pinned, @unique axle have you considered updating this issue? https://github.com/discordjs/discord.js/issues/4961
It still references stuff that was removed in v13 so it's probably better to do so
#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
Why is this a major and not just a patch 🤔
It removes a method
Uh, what method I didn't notice
VoiceChannel#deletable
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
I mentioned it in internal a few hours ago, but Crawl didn't see it
It's corrected now, dw
Oh nice, thx
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
Hullooooo @tacit crypt, are you talking to me there :eyes: what I do halp
You install deps
Run..uh, i think build:deno
And push the changes
thats me
I think ik what the issue is but lemme test it first
I managed to sort it out :D It now changes the deno/payloads/v9/ file, the same one as mine
you essentially made awaitMessageComponent and createMessageComponentCollector return the same thing
Pushed @tacit crypt
yeah and unfortunately the tests I wrote checked the wrong types
Can you also update v8? 😇
Would changing the possible type of a property from undefined to null be considered semver major?
yes
alright, won't do that then
any plans to add the bulk overwrite endpoints (
https://discord.com/developers/docs/interactions/application-commands#bulk-overwrite-global-application-commands
and
https://discord.com/developers/docs/interactions/application-commands#bulk-overwrite-guild-application-commands)
to ApplicationCommandManager?
oh they are
thank you
😬
Shouldn't https://github.com/discordjs/discord.js/blob/main/docs/logo.svg be updated or does this logo not even matter
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
isText()
<:_:874569335308431382> GuildChannel#isText()
Indicates whether this channel is TextBasedChannels text-based.
oh
Guessing that got added v13?
https://discordjs.guide/additional-info/changes-in-v13.html#channel-1 ah yeah, looks like ill have to read through the docs see if thers any other super helpful things iv missed
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?
Who cares
is invalidated event still a thing? Can't find anything about that in discord.dev
oh it is custom event of djs
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?
I'm not sure how it works actually.
Is signing commits really that important?
YES ITS CRUCIAL
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.
Note that if you commit through the GitHub interface, the commits will be signed by the commiter (on merge for instance)
Commiter? Thought it would be by GitHub
Yeah, those will be via GitHub itself Im pretty sure
Github displays it like if it was the commiter who signed it, but yeah
why doesn't ClientVoiceManager extend BaseManager? not really important, but just wondering, i don't see any reason for it to not do that
I doubt there is a reason for it, probably just an oversight.
was just looking at the docs folder lmao
I think it used to be used on the old website but now it isn't since the logo is correct on the new one
because its not a cache manager
(see below, ClientVoiceManager doesn't really do what the description for BaseManager says)
<:_:874573855715385394> BaseManager
Manages the API methods of a data model.
@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?
I can’t remember if the changelog gen picks up types correct
So i change it whenever I remember
Lmao
ahh ok
so maybe it should be removed from commitlint?
actually typings isn't even allowed now that I look at it
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?
https://github.com/discordjs/discord.js/issues/6409 has the has pr label but the PR was closed, should this be closed as well?
i closed it just now
ah aight
interactionType should work, message and channel would not
Though isnt that componentType anyway?
But wouldn’t interactiontype always be the same? It would always be a message_component interaction, right?
Right, yes
So wouldn't MessageComponentCollectorOptions<T> be a better fit rather than InteractionCollectorOptions<T>?
it already exists
Then yeah probably
ok cool, just wanted to make sure
I can see the second one but uhh.
BaseManager doesn't have cache, DataManager does
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)
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?
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.
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 😂
BaseManager only has the client property and ClientVoiceManager also defines its client property so it could extend that so that the code doesn't need to be duped
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
id?
the id of a structure
that would be a bigger refactor, would you like to do that and do this ClientVoiceManager thing too?
doesnt really make much sense for ClientVoiceManager to extend BaseManager
it doesnt manage any methods for any data model
BaseManager only has the client property
cache is from DataManager
its not about the properties it has its about the description of the class
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
well yeah that manager does, but BaseManager has no properties or methods other than client, so the description could be updated
its just not the same type of manager lol
hm?
all the other managers do what the description says
but the ClientVoiceManager simply manages voice state changes
iirc this isn't really feasible 
one second
why not tho
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
there should be some changes needed there then?
Represents a data model that is identifiable by a Snowflake (i.e. Discord API data models).
and https://github.com/discordjs/discord.js/blob/08419561edd710a6574b5e1449bf5dc1040580d5/src/structures/Base.js#L38-L40 returning undefined
- Yeah that's def been talked about before
uh, "talked about", as in, brought up and not discussed further 
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
it might've been in #archive-offtopic or something but that'd be a pain to dig out
@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
oneOf maybe?
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
why are the prerequisite modules for using /commands not installed by default
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.
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]
I dont really know what you mean
We just tell you to install the additional modules as you reach the concepts that need them
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
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
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
they why i said "this looks like discord's bad".
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
if you pass in a channel id discord just doesnt send the interaction
To what type of option
USER
i guess yeah, thats true
but doesnt this make getMember unsafe
with the required field true atleast
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
mhm
Its unsafe not to handle an error, no matter why it happened
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
The getUser will always be there if you make the option required
yeah, i did test that
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
doesnt it provide type narrowing
eh I guess, if TS
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
is it worth adding a note to the docs that it throws if the user isn't in the guild?
@stable sequoia @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
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
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
looks like not everyone knows that the user param takes ids. it would be nice if the guide or docs had a note specifying that (if it doesn't already)
yea
but i do agree marking a required param as optional feels weird, and i feel like most people wouldn't think of that
is there really a point in even having the required parameter for getMember (although this isnt a change applicable for v13)
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
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
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
that just makes it more complicated than using it with optional false though?
in what scenario would i use <CommandInteractionOptionResolver>.getMessage()? https://discord.js.org/#/docs/main/stable/class/CommandInteractionOptionResolver?scrollTo=getMessage
i don't think there's an option of type MESSAGE for slash commands
There is? It’s a context menu command for messages
Yeah strictly for context menus
oh. that makes sense. i was too tunnel vision on slash commands.
I found another bug with Message but this one is about Message#pinnable, would that fix still be within the scope of #6581?
#6581 in discordjs/discord.js by ImRodry opened <t:1630614289:R> (review required)
fix(Message): throw error on missing channel
📥 npm i ImRodry/discord.js#fix-edit-no-channel
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
Meh all these bugs about permission checks makes me think if they should exist in the first place
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?
For types Snowflake is a string so @me is acceptable
Snowflake is strictly typed as a numeric string, not as any string anymore
Is it? Thought the ${bigint} was reverted
Afair only in discord-api-types, or something like that
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
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
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?
have you checked PRs?
@tacit crypt since you reviewed, can I get your opinion on this?
here
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)
yeah it's not, I'll make a separate one
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
that's how js works, dude
you can use common-tags to do that with a tagged template string, but that really has nothing to do in lib discussion
https://www.npmjs.com/package/common-tags#stripindents
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
stripping indents from your strings is not something a discord library should do
then the middleware :/
souji just linked you some
then define a function somewhere and pass content to it before sending it?
.send({content: prepareContent(stringHere)})
you dont understand forget it sorry for your time
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
yes but this doesnt solve it, i'd have to go to every single place where message is sent (rougly 2000lines) and pass the content into the "fake" middleware function. I could just use the strip intent at that point.
thats not really how middleware should be made
sideone why do you think a library for interacting with a discord api would implement string cleanup
there could also be middleware for kicking, banning deleting messages not just my request
if you didnt notice we are already talking about middleware
you know we have managers 
what does that mean?
MessageManager for managing messages (ie deletion), GuildMemberManager for managing guild members (ie kicking & banning)
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)
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
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
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)
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
the cache check is only done if you try to fetch a single channel
otherwise you can't tell if a channel is missing
@grizzled scaffold wdym the plugin has been uninstalled? (#6587)
is it true that discord will only support slash commands?
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
Well, my bot is already verified, so probabbly i will have to reapply for the message intent since i use regular commands like ban, kick, mute
You will be rejected since message content is not required for any of those commands.
I meant the plugin specified in the jsdoc.json file, jsdoc-strip-async-await
U sure it isn’t needed tho?
Yeah I tested it and the file isn't referenced anymore
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?
You can use @discordjs/builders for building slash commands (like Embeds), when you meant this.
@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.
#869655843958821005 might be useful for you 
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?
its a thread, you can discuss there about it, share your ideas....
excellent... thank you
Its not, I was kinda wondering how long it would take someone to notice it should be removed 
@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
https://github.com/discord/discord-api-docs/discussions/3581 as well as the FAQ they held on the ddev server some time ago
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"
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™️"
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".
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)
👍
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?
Pretty sure that has been answered numerous times by now
check the issue or search for it on the server
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.
there never was invite information on the guildMemberAdd event
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?
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
Can I ask a question about a discord.js code here ?
This channel is about development of the library, or its source code
Questions about using discord.js go in the help channels
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
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
https://github.com/discordjs/discord.js/blob/main/src/client/actions/MessageReactionRemove.js
The action handler specifies partials in it's calls to Action#getChannel, Action#getMessage and Action#getReaction, all of which internally call Action#getPayload where partial handling happens
