#discord.js
13588 messages · Page 14 of 14 (latest)
Which package is this bug report for?
discord.js
Issue description
When iterating over fields in a ModalSubmitInteraction, the following TypeScript code can potentially throw an error:
// ctx is a ModalSubmitInteraction
for (const field of ctx.fields.components.filter((c) => c.type === ComponentType.Label)) {
const component = field.component;
if (component.type === ComponentType.FileUpload) {
const fieldAttachments = component.attachments.values().toArray() || [];
...
Which application or package is this feature request for?
discord.js
Feature
Effectively, we have to ensure you can get things working via the pattern shown in the 2nd example of this section https://github.com/discordjs/discord.js/tree/main/packages/ws#specify-worker_threads
This will require some internal changes, as right now every client spawns its own WebSocketManager. Total feature parity can totally be accomplished, we just have to think a bit about what & how we provide ...
Users customize this themselves. But from what I can tell there should have been
- text input
- string select
- file upload
- text input
3adb943 refactor: remove builders and formatters re-export - didinele
people are gonna love me for this one
I need a hand here, I'm not sure how to deal with this:
Only usage
Do we just move that type to util and call it a day? "Re-implement" it in discord.js? builders has it written like so:
As a result, accessing
component.attachments.values()without an existence check can cause a runtime error.
So did you get one? Can you provide it?
Are you truncating it the stack trace? Have you set it up improperly in Sentry? It only gives 2 lines and nothing about discord.js, which is useless:
TypeError: undefined is not an object (evaluating 'comp.attachments.values')
at handleFormSubmit (/app/src/utils/ticketCreate.ts:161:27)
at processTicksAndRejections (native:7:39)
Regardless, managed to find a reproduction:
- Create a modal with an optional file upload component
- Submit it
- Check for the label component's...
Have you set it up improperly in Sentry?
Because I use bun, I didn't find a way to upload sourcemaps yet sadly due to the nature of bun (it transpiles TS to JS itelf and I can't execute a command for uploading sourcemaps between build and running)
Understood, to be fair, I'm not that versed in Bun.
haha thanks
btw what is the "Good first issue" label for? it's certainly not my first issue I created 🤔
Basically, it means this is a good first issue for new contributors here.
Thoughts on replacing the logic of role.memberCounts with a cached version of this?
We do the same elsewhere e.g. vanity data for a guild.
Hi, I'd like to work on this. Just to confirm the fix approach - should I make FileUploadModalData.attachments optional in the typings, or would you prefer a different approach (e.g., always initializing it as an empty Collection in the source code)?
Summary
Makes FileUploadModalData.attachments optional to match runtime behavior.
Problem
When a modal has an optional FileUpload component and the user doesn't upload a file, component.attachments is undefined at runtime. However, the TypeScript types marked it as required, causing no compile-time warning but runtime errors when accessing the property.
Solution
Add ? to the attachments field in FileUploadModalData interface:
// Before
attachments: R...
Summary
- Makes the
attachmentsproperty optional inFileUploadModalDatainterface - Aligns TypeScript types with runtime behavior where attachments may be undefined
- Adds type test to verify the optional property behavior
Issue
Fixes #11359
Test Plan
- [x] Added type test in
typings/index.test-d.tsto verifyattachmentscan be undefined - [x] All existing tests pass (
pnpm run test --filter=discord.js) - [x] Type definitions are valid (tsd passes)
Changes
- `pack...
For instance, passing an empty string to
RoleManager#fetch()will now make a request to the Get Guild Roles endpoint, but through the Get Guild Role path internally.
I think I understand so the original idea was that you would query the empty string with Discord but your saying since the endpoint is /guild_id/roles/role_id if you pass an empty string it would result in /guild_id/roles/ which is a different endpoint.
Side Note: This makes me think the REST package shouldn't al...
a897e54 feat: proper authorizing integration owners str... - vladfrangu
Please describe the changes this PR makes and why it should be merged:
Status and versioning classification:
f71884a chore: fix ci - vladfrangu
90dee0b chore: fix types - vladfrangu
596ebeb chore: fix types - vladfrangu
35a4f7f chore: nits - vladfrangu
This would be undefined if not guild installed, while guild would be null
This type doesn't need to be in APITypes.js anymore then.
Why doesn't this extend Base?
4d1b9f9 chore: tests - vladfrangu
6d2f6d9 chore: requested changes - vladfrangu
21fa928 chore: drop it from apitypes - vladfrangu
[discord.js] Branch feat/v15-proper-structure-for-authorization-map was force-pushed to `31ba6e9`
return this.userId && this.client.users.cache.get(this.userId);
return this.guildId && this.client.guilds.cache.get(this.guildId);
That already is null.
<img width="316" height="106" alt="iTerm2 - 2025-12-15 at 17-35-04-UTC" src="https://github.com/user-attachments/assets/cf53d386-9db7-4ba2-823c-ce7fc985bf6a" />
GuildInstall may return "0" if the interaction was initiated via direct messages
[discord.js] Branch feat/v15-proper-structure-for-authorization-map was force-pushed to `c3400b2`
757e179 chore: docs - vladfrangu
* Mapping of integration types that the application was authorized for the related user or guild ids
0b7f8c4 chore: docs - vladfrangu
Thank you for fixing the real issues.
return (this.guildId && this.client.guilds.cache.get(this.guildId)) ?? null;
Guess this is needed again, since the weird behavior with guildId being "0" in DMs.
Summary
This PR fixes issue #11359 by making the attachments property in FileUploadModalData optional to match the runtime behavior.
Changes
- Modified
FileUploadModalDatainterface: Changedattachments: ReadonlyCollectiontoattachments?: ReadonlyCollectioninpackages/discord.js/typings/index.d.ts - Added TypeScript tests: Added test cases to verify the fix works correctly in
packages/discord.js/typings/index.test-d.ts
Problem
The issue was that the TypeS...
Hi! I've created a fix for this issue.
Problem: The TypeScript typings for FileUploadModalData indicated that attachments was always present, but at runtime it could be undefined when there are no attachments, causing runtime errors.
Solution: Made the attachments property optional in the TypeScript definitions to match the actual runtime behavior.
PR: #11367
The fix allows developers to use optional chaining (component.attachments?.values()) without TypeScript comp...
✅ Resolved CodeRabbit AI feedback
Implemented the suggested improvements:
-
Added explicit type assertions: Added
expectAssignable(...)calls for both test cases to make type verification more explicit and consistent with existing test patterns. -
Added proper type parameters: Changed
new Collection()tonew Collection()to match the expected interface exactly.
These changes improve test quality and maintain consistency with the existing codebase patterns.
✅ Resolved: Added proper type parameters new Collection<Snowflake, Attachment>() and expectAssignable<FileUploadModalData>(fileUploadDataWithAttachments) for accurate type testing.
✅ Resolved: Added expectAssignable<FileUploadModalData>(fileUploadDataWithoutAttachments) for explicit type verification.
I feel like this is an AI response, but it seems fine.
const { Base } = require('./Base.js');
public get user(): User | null;
const { AuthorizingIntegrationOwners } = require('../structures/AuthorizingIntegrationOwners.js');
public get guild(): Guild | null;
This is needed in both getters to satisfy the current typings
return (this.userId && this.client.users.cache.get(this.userId)) ?? null;
51b5d38 feat: proper authorizing integration owners str... - vladfrangu
cad826f feat(RoleManager): add fetchMemberCounts (#11... - almeidx
427636e types(Message): specify rawData arg type (#11... - Pavel-Boyazov
I'm thinking maybe it would make sense to throw a Discord like error for empty strings manually (like you would get if you passed any other non-snowflake string to the API because we can't actually pass the empty string because it would be interpreted as a different endpoint).
We could throw an error in resolveId() if the input is a primitive value that is not a non-empty string
Which application or package is this feature request for?
discord.js
Feature
support for async sweeper functions ala
const client: WayaClient = new WayaClient({
intents: [
// ...
],
sweepers: {
...Options.DefaultSweeperSettings,
messages: {
interval: 24 * 60 * 60,
filter: async () => {
// Fetch data
const guilddbs = await pgdb
.selectFrom("guilds")
...
If we receive an empty array, we should make an empty collection.
When calling remove() or unban(), the ban is not removed from cache. Cache cleanup only happens via GUILD_BAN_REMOVE gateway event which requires GuildModeration intent, causing stale cache data. This fix adds cache. delete() after the successful REST call, consistent with other managers like RoleManager.delete().
You must be in a voice channel to use this command.
Player IP : [ 94.49.209.70 ]
Ban ID : [ None ]
Player Steam : [ None ]
Player XBL : [ None ]
12176224:-1042352:13815806:-4339402:-1850615:-6131188 ]
Please describe the changes this PR makes and why it should be merged:
getChannels can't return channel types that not in allowed
Status and versioning classification:
- Code changes have been tested against the Discord API, or there are no code changes
- I know how to update typings and have done so, or typings don't need updating
Why no description template?..
https://github.com/discordjs/discord.js/pull/10786#discussion_r1976598318 still stands, this PR is adding nothing, the cache already gets updated and the getter is fine.
Need to fix tests, but other than that LGTM
What's the best way to proceed? I've realized that for this change to work correctly, we need to modify type APIInteractionDataResolvedChannel in the discord-api-types. This type uses all channel types, but we need only option allowed.
- Should I open an PR in the
discord-api-typesrepository and link to it here? - Or would it be better to implement a temporary workaround within this PR to avoid blocking the changes?
- Or perhaps I'...
If pick first option, it need the @discordjs/builders dependency in discord-api-types repo, but it has no dependencies. Just copy ApplicationCommandOptionAllowedChannelType or add dependency and import it?
The type should be fixed in discord-api-types, and the ApplicationCommandOptionAllowedChannelType type should live in discord-api-types as well (which builders will consume instead once upgraded).
discord-api-types shouldn't have any dependency on @discordjs/builders.
3 PRs. Sounds like fun 😅 Okay, got it
Need to fix tests, but other than that LGTM
Update. Discord allows to use DM and DMGroup channels in DMs. Can anyone checks for GuildDirectory channel type?
DM usage shocked me, maybe and directory can be used in specific cases?
Which package is this bug report for?
discord.js
Issue description
Steps to reproduces
- Initialize client
await this.client.login(token);
console.log(this.client.user) // Clearly see the `user` object
- Add roles to a member
const guild = await this.discordClient.guilds.fetch(guildId);
const member = await guild.members.fetch(userId);
// Work like a charm!
// for (let role of uniqueRoles) {
// await member.roles.add(role);
// }
// Did work! Error provide ...
Are you not connected to the gateway?
I encountered an error when trying to add multiple roles to a guild member. The issue comes from client.user being null. The code runs smoothly after adding a null check for the user object.
I’ve reported the issue here: #11382
@Jiralite Thanks for the reply. Do you mean gateway intents? I think I’ve already enabled them, since I can listen to guild changes
Are you not connected to the gateway?
client.user being defined but not being defined later indicates to me something impossible. Have you confirmed you can reproduce this outside of your project? A reproducible sample is something anyone would be able to copy and past to reproduce the error.
client.userbeing defined but not being defined later indicates to me something not possible. Have you confirmed you can reproduce this outside of your project? A reproducible sample is something anyone would be able to copy and paste to reproduce the error.
Sorry, something is wrong with my code. It work well on a fresh project. Thanks you!
Bots aren't able to join servers with directory channnels. So this is irrelevant. Judging by your findings and the API documentation I'd say discord-api-types are correct and so were the typings. But the ApplicationCommandOptionAllowedChannelType type isn't.
Just checking - would you like me to switch to the alternate approach (always creating an empty collection at runtime)? Let me know and I can make that change.
When a modal has an optional
FileUploadcomponent and the user doesn't upload a file,component.attachmentsisundefinedat runtime. However, the TypeScript types marked it as required, causing no compile-time warning but runtime errors when accessing the property.
If Discord sends an empty array, we should be setting components.attachments to an empty collection. Can you verify if that behaviour?
@copilot apply changes based on this feedback
bc49a3a fix: reorder voiceServerUpdate test to maintain... - Copilot
Moved the voiceServerUpdate test to be between userUpdate and voiceStateUpdate to maintain alphabetical ordering. Fixed in bc49a3a.
7dab295 feat: emit voiceServerUpdate event - almeidx
We've always had a websocket handler and corresponding Events enum key for the VOICE_SERVER_UPDATE gateway event, but we didn't emit it
Resolves #11412
[discord.js] Branch feat/emit-voice-server-update was force-pushed to `e85436e`
30d6020 docs: add missing ApplicationCommandPermissions... - almeidx
ApplicationCommandPermissionsUpdateData is the type being used for the event parameter, which is correctly typed in typescript land, but doesn't have a corresponding JSDoc entry, meaning it doesn't have descriptions.
Regression from #10666
d8ea19e Update packages/discord.js/src/client/websocket... - almeidx
Not needed, see other comment.
This doesn't need the Partialize, since you only narrow the type of the getter here.
export interface PartialGuildMemberRoleManager extends GuildMemberRoleManager {
This isn't needed then either.
I'd say this should either never emit here or at least check for Partial.GuildMember being set in <Client>.options.partials. We won't ever have a full GuildMember here.
JSDoc has no notion of PartialGuildMember, since that only exists in TS typings.
I know that I was the one suggesting to turn member into a property in https://github.com/discordjs/discord.js/pull/10784#issuecomment-2692177930 but after reading this now again I believe this causes more issues than it solves. Instead we should add the user property like I suggested in that comment in the parantheses and keep member as a getter.
Since a GuildMemberRoleManager can only ever be accessed from the GuildMember#roles property of the partial GuildMember I'd say this getter is rather useless and redundant. you'd check the GuildMember#partial directly instead.
Why? GuildMemberRoleManager is the base for PartialGuildMemberRoleManager, like Poll for PartialPoll, PollAnswer for PartialPollAnswer and other
What getter? We specify member property without getter
You are right, I meant the type of the property.
Because AllowedPartials is only used as a type for Partialize. Since we don't need Partialize we don't need to add that here.
You are right, I meant the type of the property.
But member in GuildMemberRoleManager has different type and we get error without Partialize. I need to bypass with Omit or extend type of <GuildMemberRoleManager>.member?
[discordjs/discord.js] New review comment on pull request #11414: feat: emit voiceServerUpdate event
Is this intentionally removed? This is helpful for debugging voice related issues.
[discordjs/discord.js] New review comment on pull request #11414: feat: emit voiceServerUpdate event
I removed it intentionally. But if you believe it is still useful as a debug log I'll add it back.
Which package is this bug report for?
discord.js
Issue description
The issue started at 16:16 and continues to this day. Upon reloading and restarting, the code fails to connect, even though it was working normally beforehand and no code modifications were made. Please investigate the cause.
Code sample
Versions
discordjs lastet version,
nodejs v20.19.0
Issue priority
High (immediate attention needed)
Which partials do you have configu...
[discordjs/discord.js] New review comment on pull request #11414: feat: emit voiceServerUpdate event
Thought on this?
client.emit(Events.VoiceServerUpdate, {
guildId: data.guild_id,
...data,
});
I'm fine with either one. This one is more future-proof, I suppose, but it would still remain undocumented until we add JSDoc + typings to it I guess?
e59c28c refactor: censor token in debug logs - almeidx
[discordjs/discord.js] New review comment on pull request #11414: feat: emit voiceServerUpdate event
It wouldn't necessarily be future-proof, since we'd potentially need to change this anyways to make the key camelCase. And in that code snippet it would send both guildId and guild_id
[discordjs/discord.js] New review comment on pull request #11414: feat: emit voiceServerUpdate event
Ah, what I was thinking of was not waiting around for an update to receive new properties. Still fine with either!
Which package is this bug report for?
discord.js
Issue description
To reproduce:
Run this command on any Linux operating system with 'npm' and 'node' installed: sudo npm install [email protected]
The output will say:
added 25 packages, and audited 211 packages in 3s
39 packages are looking for funding
run `npm fund` for details
4 moderate severity vulnerabilities
To address all issues (including breaking changes), run:
npm audit fix --force
Run `npm audit` for detail...
The bug has no criticality to discord.js unless the Discord server was compromised in the manner detailed in the advisory. Therefore it's not worth releasing a patch just to address this.
I understand that it's unlikely to be exploited since Discord would need to be compromised, but I recommend fixing it since the effort required to fix it would be very low. You never know... I do not like using code with a known CVE in it so I am going to investigate alternatives like version 13 or manual API interaction until a fix is posted.
If you'd rather significantly rewrite your code to use a version of discord.js that hasn't been maintained for two years to avoid a bug that doesn't impact the current stable version and will be fixed whenever the next update is, then you're welcome to make that bad decision.
As I said, this will be fixed in the next release, but its unlikely that a release will be made just to fix this.
The overloads of ShardingManager#broadcastEval() were in the wrong order, causing usages of the form that passes context and shard being matched by the general version for no passed context causing àny` argument types of the passed function and wrong return type.
Will you turn this PR into a fix for ApplicationCommandOptionAllowedChannelType in @discordjs/builders or should this be closed and the fix will be a new PR?
wouldn't it be better for the docs to make this a specific type? type CategoryCreateChannelType = ChannelType.X | ...?
The "real" type already has such a name: GuildChannelTypes. This here is the original type which I didn't want to alter in case there was a reason why it includes GuildDirectory channel type. But I guess that is an oversight and GuildChannelTypes would be correct here?
Which application or package is this feature request for?
discord.js
Feature
676767 silly issue template
Ideal solution or implementation
fix the library
Alternative solutions or implementations
No response
Other context
No response
I have just verified this behaviour:
{
"type": 18,
"id": 9,
"component": {
"values": [],
"type": 19,
"id": 10,
"custom_id": "164"
}
}
An empty array is sent for values. The types are fine, it's JavaScript that needs to be fixed–an empty collection should be used.
Which package is this bug report for?
discord.js
Issue description
- User A installs Bot to their account.
- User A runs
/commandfrom Bot in their DMs with User B. - Bot tries to send a message to User A's DMs (via
user.send()). - Fails! 50001 Missing Access error because Bot tried to send message to User B's DMs with User A instead of Bot's DMs with User A.
The bot sends reminders and has been struggling with seemingly spontaneous 50001 Missing Access errors for a while ...
It's really not the library's job to do these kind of checks, it's you who should be doing it, dm channels have recipientId that you can use the match with invoking user, furthermore you can also restrict the commands context to BotDM or dissallow PrivateChannel
To be clear, the library is putting a channel in cache as the bot's DMs that actually doesn't have the bot as a recipient. That causes user.send() to throw a 50001 Missing Access because the bot doesn't actually have access to the channel that is in cache as a DM channel that it is a recipient to. I very strongly disagree with the idea that it's not the library's job to check for this.
You would have to modify the library internals to resolve this as a user.
To be clear, the library is putting a channel in cache as the bot's DMs that actually doesn't have the bot as a recipient. That causes
user.send()to throw a50001 Missing Accessbecause the bot doesn't actually have access to the channel that is in cache as a DM channel that it is a recipient to. I very strongly disagree with the idea that it's not the library's job to check for this.
Can I ask you to share a code sample or some more information about how you were able to determine ...
It's not a bug per-se, many thing in discord.js relies on cache. Ever since user-installable was introduced which made interactions possible in private channels, which was causing interaction to fail due to caching issues even with partials enabled. This was a deliberate choice. As I said, you need to do these checks yourself in your code or set the contexts appropriate
the library is putting a channel in cache as the bot's DMs that actually doesn't have the bot as a recipient
contexts solves this as @imnaiyar said. If that is not what you want your users to do, then you should disallow it.
You are right, this is indeed a bug and I found it:
This calls the following which will wrongly assume the interaction user and the bot are the two recipients in the DMChannel:
In INTERACTION_CREATE need to check interaction.channel.recipients[0].id === client.user.id, if the condition is true, then interaction.user is the recipient.
If that check was applicable the code I linked wouldn't even run. The issue arises from the partial channel data Discord sends which doesn't always contain the recipients field in the first place
In
INTERACTION_CREATEneed to checkinteraction.channel.recipients[0].id===client.user.id, if the condition is true, theninteraction.useris the recipient.
This check needs to be done in the library before caching the channel.
This shouldn't be needed anymore as of #1326626041397248113 message
return this._getTypedComponent(customId, [ComponentType.RadioGroup], ['value'], required).value;
I have only cherry-picked it, need to test if it works properly for v14 before marking it ready (though i imagine it should)
Backports #11395
Reviewing this I was wondering whether v14 would need XComponent classes for the new modal components. But looking through where they get used I found out that they wouldn't be used anywhere because LabelComponent isn't used anywhere either, so probably not needed.
Reviewing this I was wondering whether v14 would need
XComponentclasses for the new modal components. But looking through where they get used I found out that they wouldn't be used anywhere becauseLabelComponentisn't used anywhere either, so probably not needed.
Yeah it doesn't get used anywhere, i raised this internally here #1402934237358985246 message back when label component was introduced. The only reason i kept `Label...
Which package is this bug report for?
discord.js
Issue description
Our bot is unable to establish a voice connection. The connection begins normally but drops immediately after receiving OP 8 (Hello) from the voice gateway.
The networking state transitions from:
{"code":1,"ws":true,"udp":false}
to
{"code":6,"ws":false,"udp":false}
After this, the connection falls back to signalling and eventually times out with:
AbortError: The operation was aborted
The connection never rece...
I added additional debugging to try to capture the WebSocket close code, but the connection appears to drop immediately after OP 8 and before OP 2 is received.
The networking state transitions directly from:
{"code":1,"ws":true,"udp":false}
to
{"code":6,"ws":false,"udp":false}
without exposing a close code in the current debug output.
If there is a recommended way to surface the voice WebSocket close code from @discordjs/voice, I can capture and provide that as well.
This is not a logic change so if there is a bug here it sounds pre-existing and out of scope for this PR.
Do you really only have GuildVoiceStates intent? You should have Guilds intent too.
Possible fix
● Update(packages/discord.js/src/client/actions/Action.js)
⎿ Added 1 line, removed 1 line
36 if (!('recipients' in data)) { ...
This doesn't change anything. The issue is that when a user uses a command in the DMs with another user that isn't the client user then data.recipients will only contain that other user. So this code change would still incorrectly cache that DMChannel as if it was between the client user and that other user, not the interaction user and the other user.
Since user installed applications can run in DMChannels not containing the client user we need to account for that in case of partial DMChannels being cached.
This PR now stores the ids of all known recipients, not only one. That way we can discern between a DMChannel between the client user and another user or a DMChannel between two non-client users.
Fixes #11429
aware of both of these, but both are intended. If a user of the lib uses those methods on a DMChannel not containing the ClientUser then the resulting errors are on them.
Which package is this bug report for?
discord.js
Issue description
public delete(): Promise<OmitPartialGroupDMChannel>;
This should contain a reason, similar to some of the following:
public pin(reason?: string): Promise<OmitPartialGroupDMChannel>;
public unpin(reason?: string): Promise<OmitPartialGroupDMChannel>;
The delete function should have a reason as the endpoint accepts a reason, as shown here: https://docs.discord.com/developers/resourc...
- formatting pls, {} it up
- the every feels off, if every recipient is not the message author, add the message author?
"Every entry is not the recipient" means "the recipient is not yet in the array, so needs to be added"
Personally i'd use a some to make it clearer (and iirc it also exits early when a match is found) but its not a blocker
Makes attachments property optional to match runtime behavior and prevent TypeScript errors. Fixes #11359
All you did was amend documentation, so this doesn't do anything runtime or compile time. Now the documentation is out of synchronisation with the typings–this pull request actually worsens the issue.
If you want to make an actual fix, read this review: https://github.com/discordjs/discord.js/pull/11363#pullrequestreview-3837324366
This should be present with a suitable default–not otional.
Add guild messages search functionality.
- Discord API Docs: https://github.com/discord/discord-api-docs/pull/8010
- Depends on: https://github.com/discordjs/discord-api-types/pull/1583
Summary
- Fix
Collector.resetTimer({ idle: newValue })not properly resetting the idle timer - The old code only reset the idle timeout when
this._idletimeoutalready existed, and kept the clear and set coupled inside the same conditional - Now the existing idle timeout is always cleared first, then a new one is created if an idle value is provided (either via the argument or from the original options)
Test plan
- [ ] Call
resetTimer({ idle: 5000 })on a collector that was create...
I've updated the fix based on your feedback. Instead of just making the type optional, I've now ensured that FileUploadModalData.attachments is ALWAYS initialized as a Collection, even when empty.
Changes Made
Modified ModalSubmitInteraction.js to:
- Check if component type is FileUpload (type 19)
- ALWAYS create a Collection for attachments when processing a FileUpload component
- This ensures attachments is never undefined, matching the runtime behavior
Code Change
\\javascript
//...
[discordjs/discord.js] Pull request opened: #11462 feat: allow partial DMChannel without client user
Backport of #11443
To not be breaking DMChannel#recipientId can still return the wrong id. But UserManager#dmChannel and all methods relying on it won't return those wrong DMChannels anymore.
Move the [userId, this.client.user.id] outside the callback
Lets add a callout that this might be wrong and will return null in the next major
Which package is this bug report for?
discord.js
Issue description
- Create a discord bot and join a server with it.
- Start the code sample below with a .env like this
USER_ID=
GUILD_ID=
DISCORD_TOKEN=
- Watch how it always return "online" as the presence.
Code sample
require('dotenv').config();
const { Client, GatewayIntentBits } = require('discord.js');
const token = process.env.DISCORD_TOKEN;
const userId = process.env.USER_ID;
const guildId = pr...
Cannot reproduce:
<img width="1375" height="891" alt="Image" src="https://github.com/user-attachments/assets/988f0b9b-ff63-48fd-8f6c-1d5284e4e8ce" />
CNR
<img width="256" height="547" alt="Image" src="https://github.com/user-attachments/assets/0c136fae-4f80-4a75-8758-ead4c7b07f5b" />
I was worried other ppl could not repoduce it. Now i got myself a weird ass bug to fix. Either way. Thanks for looking at the bug report
<img width="594" height="215" alt="Image" src="https://github.com/user-attachments/assets/f7939011-f73f-4294-bc51-a6808df6a466" />
Good catch — added the null assignment after clearTimeout and pulled the idle value into a local variable to avoid the double evaluation.
Which package is this bug report for?
discord.js
Issue description
The latest release has a high severity fix from unicidi. Can this be fixed?
----- npm audit ------
npm audit report
undici <=6.23.0
Severity: high
Undici has an unbounded decompression chain in HTTP responses on Node.js Fetch API via Content-Encoding leads to resource exhaustion - https://github.com/advisories/GHSA-g9mf-h72j-4rw9
Undici: Malicious WebSocket 64-bit length overflows parser and crashes the client...
Might already exist a bug report for this one, but couldnt find one. Causes a lot of noise in a professional environment with vulnerability scanners.
We only use undici to query the Discord API. As such, so long as they aren't replying with malicious payloads, we are not vulnerable to this issue.
@didinele Any expected time frame for new version?
We do not provide ETAs for releases. Additionally, considering undici's track record recently, waiting for updates isn't gonna be a reliable solution if your environment demands no such "vulnerabilities" are present. If need be, all the major package managers allow you to override versions, e.g. for yarn - you should be able to do this for undici no problem so long as it's not a semver major bump.
Personally, I'd rather modify the makeURLSearchParams() function to accept arrays for object values. Preferably in a separate pull request, which would have to be merged before this one.
has?: MessageSearchHasType[];
This is not handling the 202 Accepted response.
TBD if we want to handle retries automatically here or just throw
We typically do not do this sort of in-depth input validatio
* <info>Due to speed optimizations, search may return slightly fewer results than the limit specified when messages have not been accessed for a long time.
The permission reference should be a link to the equivalent on PermissionFlagsBits (e.g., like the intent link below)
Do we really need all these checks here? personally, I think this should just be left to the api to return the error, unless the error is too broad (i have not checked).
Perhaps we can even delegate most of these to a MessagsSearchParamBuilder, which I think makes sense to have for this.
Ig it depends on what others will say 🤷
Removed validation. Not sure about the builder though, will wait for input from other reviewers.
I am fine with doing that, should I make a PR or wait for other reviewers to give their opinion on this?
c169ede feat(GuildMember): add collectibles, fix partia... - almeidx
Upstream:
Also fixes the handling of the property on User, since it is optional and nullable
[discord.js] Branch feat/guild-member-collectibles was force-pushed to `08eb474`
[discord.js] Branch feat/guild-member-collectibles was force-pushed to `48085ec`
[discordjs/discord.js] Issue opened: #11469 Incorrect overload typing in `GuildMessageManager.fetch`
Which package is this bug report for?
discord.js
Issue description
There's an issue with the overload types for GuildMessageManager.fetch, the return type becomes Message (or Message in dev) when using FetchMessagesOptions.
Code sample
(message.channel as Exclude).messages
.fetch({ amount: 100, cache: false })
.then((messages) => {
messages.filter()
})
Versions
- discord.js 14.25.1
- node 24.14.1
- ts 5.9.2
- macOS Ta...
Of course not. amount does not exist, so it doesn't match the overload.
Maybe keep the issue open and don't close it so quick?
The issue persists even when limit is used.
Cannot reproduce:
<img width="683" height="298" alt="Image" src="https://github.com/user-attachments/assets/dad6186e-8a8e-4d7b-a658-7a2ce4314a37" />
One thing I will call out is that amount should have been highlighted in your IDE stating that does not exist, but it didn't. This leads me to believe you are either using a corrupt installation of discord.js or some custom package.
Done multiple clean installs of Discord.js, the typings in the package is a bit funny. But maybe because options is left as any?
<img width="656" height="133" alt="Image" src="https://github.com/user-attachments/assets/575414ea-b7aa-4178-be6c-d4814839965a" />
What is your tsconfig.json?
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"rootDir": ".",
"outDir": "./dist",
"declaration": true,
"declarationDir": "./dist/types",
"baseUrl": "./src",
"paths": {
"src/*": ["./*"]
},
"moduleResolution": "node",
"allowImportingTsExtensions": true,
"preserveSymlinks": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true
},
"include": ["src"],
"exclude": ["node_modules", "dist"]
}
base con...
Are you using pnpm to install dependencies?
I believe it is a Discord source issue because upon modifying the source by switching the order of overloads, the typing issue is resolved.
+ public fetch(options?: FetchMessagesOptions): Promise<Collection<Snowflake, Message<InGuild>>>;
public fetch(options: MessageResolvable | FetchMessageOptions): Promise<Message<InGuild>>;
- public fetch(options?: FetchMessagesOptions): Promise<Collection<Snowflake, Message<InGuild>>>;
Side question, why does CategoryChannel not get excluded when message.channel.isTextBased()? Unless my definition of text based is different, you can't text in a category channel? It results in all sorts of jank type assertions which isn't ideal. Was there a reason for this?
I still cannot reproduce the issue with Bun. Here's a CI check for a neutral environment for you to see: https://github.com/Jiralite/11469/actions/runs/23683195081
Side question, why does
CategoryChannelnot get excluded whenmessage.channel.isTextBased()?
Because of the way your project is handled to perceive types. It's misconfigured somewhere, so you're going to have a lot more questions until you find the issue.
I cannot figure what is wrong now, thank you so much for your help. I noticed that ts was 5.9.3 in your project then switched it in my project and after reinstalling, the problem disappeared??? Could just be another Zed issue, frequently get type issues with this editor. Apologies for the wasted time.
008c176 feat(ShardingManager): allow setting custom api... - almeidx
Adds options for a custom API URL and version for the /gateway/bot request made by the ShardingManager.
Since this request does not use /rest, there is currently no way to customise this
b910799 Apply suggestion from @Jiralite - almeidx
It's using the same logic as REST
I brought up this topic here https://github.com/discordjs/discord.js/pull/11393#discussion_r2725534088 but didn't get a response. I also voiced my opinion there
@discordjs/core thoughts? I lean more towards includeNSFW
Haha just encountered the same issue, I was confused of some messages success to send with the same exact code and some messages fail for some people, weird I investigated the bot was trying to send the message to my DM with the user 😂
eee6f94 chore(discord.js): release [email protected] - vladfrangu
[discordjs/discord.js] New tag created: 14.26.0
MessagePayload.resolveBody() crashes with TypeError: Cannot read properties of undefined (reading 'push') when options.attachments is provided without options.files, because files?.map() returns undefined and .push() is then called on it.
This affects any message.edit({ attachments: [...] }) call that keeps existing attachments without uploading new files.
Fix: default the files?.map() result to [] with ?? [].
INVITE_CREATE and INVITE_DELETE gateway handlers crash with TypeError: Cannot read properties of undefined (reading 'invites') when the guild is not in cache.
Other handlers like GUILD_BAN_ADD correctly guard with if (!guild) return;.
Several getters access guild.members.me or guild.members.resolve() without guarding against null, causing TypeError when the bot's own member is not cached (e.g. without GuildMembers intent).
Add GuildUncachedMe checks consistent with the existing pattern in GuildMember.manageable, GuildEmoji.deletable, and GuildInvite.deletable.
Affected getters:
Role.editableGuildChannel.manageableMessage.deletableVoiceChannel.speakable- `BaseGuildVoiceChannel.jo...
This is not the correct fix. It would remove attachments on every message update unintentionally.
The appropriate fix is included in #11423
The changes to this file should be reverted
I do not think this is correct. Checking for permissions already checks for a member being cached. Did you run into an issue?
Did you actually test this and received that error? Or are you assuming it would? Because there should be no way to have a guild channel in cache when the Guild itself isn't cached. So the if (!channel) return false; should already assure the Guild is cached.
No I am sorry I should have, I didn't test it. I started reading the repo and tried to find a few things that need fixing or help out, as I started using it. Will make sure to create a dummy app and test it in the future.
Which package is this bug report for?
discord.js
Issue description
Steps to reproduce with below code sample:
- Create a file where the checkboxgroupbuilder & labelbuilder will be in. Create a modal with it and set it up with your needs.
- Send a button or select menu into a channel.
- You will see a pop up with the checkbox and you will see that the check boxes are disabled.
- There isn't any error logs.
Code sample
const check = new CheckboxGroupBuilder()
...
After fixing your invalid syntax and filling in the missing pieces of your steps to reproduce:
import { ButtonStyle, CheckboxGroupBuilder, Client, ComponentType, Events, GatewayIntentBits, LabelBuilder, ModalBuilder, TextChannel } from 'discord.js';
const client = new Client({ intents: GatewayIntentBits.Guilds });
client.on(Events.InteractionCreate, async (interaction) => {
if (!interaction.isButton()) return;
const check = new CheckboxGroupBuilder()
.setCust...
Fixes an issue that happens when another shard than shard 0 sent a DM to a new user.
This causes a DMChannel with only the ClientUser as known recpient to get cached on shard 0. The current logic introduced by #11462 returned this channel as valid DMChannel for all users then.
67566d0 fix: only return DMChannel that have the user a... - Qjuh
cd1b6a0 chore(discord.js): release [email protected] - Jiralite
[discordjs/discord.js] New tag created: 14.26.1
Fixes GuildChannels from another shard being cached as DMChannel on shard 0 when sending ephemeral interaaction replies with Channel partial enabled.
What happened before this fix:
- Interaction with an ephemeral reply is sent in a guild channel on shard != 0
- messageCreate emits on shard 0 because of the ephemeral message
- the Channel partial causes the guild channel to be cached as DMChannel because data.guild_id is null in the messageCreate and recipients gets added by the getChannel() ...
} else if (data.type === ChannelType.DM || data.type === ChannelType.GroupDM) {
} else if (data.type === ChannelType.DM || data.type === ChannelType.GroupDM) {
b86573d fix(Action): don't add recipients to guild chan... - Qjuh
e662290 chore(discord.js): release [email protected] - vladfrangu
[discordjs/discord.js] New tag created: 14.26.2
Its djs, lets make it a proper class and what not
Isn't that a bit overkill? What's the benefit?
proper getters for guild, user, channel
Which package is this bug report for?
discord.js
Issue description
When updating to 14.26.2, my doesn't seem to notice DM messages anymore. I could pin down the problem to this change. When I dumped data after writing, I saw that type was never part of the event and thus, always undefined. As the conditional doesn't include a fallback any...
Which package is this bug report for?
discord.js
Issue description
In latest djs version 14.26.2 dms dont trigger the messagecreate event anymore. I downgraded to older versions and they worked again. I have no idea whats causing this so cant go in detail but ive seen others report on it too.
Code sample
Versions
- discord js 14.26.2
- node version 23
Issue priority
High (immediate attention needed)
Which partials do you have configured?
C...
discord.js 14.25.2
Node.js 24
There seems to be an error here, the version 14.25.2 is indicated, but it says 14.26.2.
Which package is this bug report for?
discord.js
Issue description
See below code sample. All the versions of discord.js I've tested before 14.18 are broken when trying to install in 2026, which is an issue for updating legacy versions step-by-step to the latest release. The issues are significantly magnified before 14.18.
The source of this is probably the use of caret ranges - multiple dependenc...
666fce0 chore(discord.js): release [email protected] - Jiralite
[discordjs/discord.js] New tag created: 14.26.3
Backports #10462
This is fully just a cherry pick, so I figured it was fine to ignore, but just a heads up that there were some linting errors on some of the docs comments for waveform
.../discord.js/packages/discord.js/src/structures/Attachment.js
12:1 error This line has a length of 127. Maximum allowed is 120 max-len
.../discord.js/packages/discord.js/src/structures/AttachmentBuilder.js
172:1 error This line has a length of 126. Maximum allowed is 120 max-len
there were some linting errors on some of the docs comments for
waveform
we should fix them for this branch, otherwise CI will fail (as it is now in this pull request)
While fixing #11429 with the combination of #11462 and #11479 I accidentally broke receiving of messages sent to the bot in uncached DMChannels, because they aren't recognized as such anymore.
Fixes #11486
Needs further testing if there still is a fixable issue for reactions being added/removed on a message in such an uncached DMChannel.
While technically fixing the mentioned issue this is sadly reintroducing the issue that #11462 was fixing. Can you checkout #11495 if it fixes the issue for you?
Which application or package is this feature request for?
discord.js
Feature
EmbedBuilder#setColor accepts ColorResolvable values (e.g. hex strings like "#00af89"), while ContainerBuilder#setAccentColor only accepts number | RGBTuple as documented.
Although this difference is intentional, both methods represent the same concept (a color value), and the inconsistency can be surprising when working across builders.
Example:
new EmbedBuilder().setColor("#00af89"); // ...
While technically fixing the mentioned issue this is sadly reintroducing the issue that #11462 was fixing. Can you checkout #11495 if it fixes the issue for you?
updated the PR to take the same approach as your #11495, just pass channel_type from the gateway event into getChannel so the existing type check works as intended. The diff is now a single line in MessageCreate.js, nothing else touched. Should be equivalent to what you have in #11495.
Which package is this bug report for?
discord.js
Issue description
I'm new to Discord bots and I think I've discovered a bug that prevents the bot from properly receiving DMs (direct messages) sent from a user to the bot. I rolled back to version 14.23.1 and it works fine, but it's broken on v14.23.2 and v14.23.3. However, it's working in the latest dev build which I tested for this GitHub issue ([email protected]).
I've distilled this down to minimal code...
This may be related or duplicate of Issue #11486
If this is the same bug that I reported in my Issue #11497 then I can confirm dev build 58c5ebd is working for me, the bot receives DMs successfully again 😊
You don't need a string to use HEX. Remove the quotes or double quotes and then replace the hashtag with 0x.
- setAccentColor("#00af89");
+ setAccentColor(0x00af89);
See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Numbers_and_strings#hexadecimal_numbers for more details.
Summary
- Adds
Message#threadable, mirroring the existingdeletable/editable/crosspostable/pinnablegetters. It returns whether the client user can start a thread from the message (parent channel type supports threads, no pre-existing thread, channel viewable,CreatePublicThreadspermission). - Adds a matching
BaseGuildTextChannel#threadablegetter soTextChannelandAnnouncementChannelexpose the channel-level check (viewable +CreatePublicThreads). - Updates th...
Creating private threads requires the CreatePrivateThreads permission.
Maybe should remove this getter and leave it only in Message?
Good point, dropped the channel-level getter in 57ede0621. TextChannel can host both public and private threads (two separate permissions), so the boolean was ambiguous. Message#threadable stays because startThread on a message always creates a public thread, which makes the single CreatePublicThreads check unambiguous there. The PR body + description are also updated in scope accordingly.
Thanks for the quick implementation, really appreciate it!
You don't need a string to use hex. Remove the quotes or double quotes and then replace the hashtag with
0x.
- setAccentColor("#00af89");
- setAccentColor(0x00af89);
The same goes forEmbedBuilder.setColor().See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Numbers_and_strings#hexadecimal_numbers for more details.
You're right, 0x00af89 works.
My point was more about consistency with EmbedBuilder#setColor, which already accepts ColorResolvable, and a...
discord.js already exports the resolveColor function that does that for you. Since in the next version @discordjs/builders will be an optional package instead of a re-exported dependency we decided to not implement extensions of new builders in mainlib discord.js to make adoption of the new pattern easier once we release the next major version.
Got it, that makes sense.
It does feel a bit counterintuitive from a DX perspective that similar APIs handle color inputs differently.
Either consistently supporting ColorResolvable or keeping all builders strict would be more predictable.
That said, I understand the direction you're taking with the newer builders.
Closes #11286.
Root cause
`Collector#resetTimer` rebuilt `_timeout` / `_idletimeout` from its arguments but never wrote the new values back onto `this.options`. Any later code path that reads `this.options.idle` or `this.options.time` (the one in `handleCollect` resetting the idle timer after each collect is the loud one) kept using the old values, so the reset only held until the next collect came in.
It also returned early when the collector was started without a `time...
Waiting on staff response on whether we can use this field
Oof, this was a doozie to debug :) Confirming +1 this is definitely happening.
14.26.1is safe.14.26.2has the regression.
Confirming this bug independently on discord.js 14.26.3 (node 24 on macOS, bot connected via Gateway Intents: Guilds, GuildMessages, MessageContent, DirectMessages, GuildMessageReactions + Partials: Channel, Message).
Behaviour: Exact match — DM MESSAGE_CREATE packets arrive at the gateway (verified via a raw listener), but messageCreate never fires because createChannel() in util/Channels.js receives the message-shaped payload and checks data.type === ChannelType.DM (1), w...
Please describe the changes this PR makes and why it should be merged:
Fixes #11486. Also closes #11497 (duplicate report).
The bug
On v14, uncached DM channels never receive a messageCreate event. The first DM sent to a freshly-started bot is silently dropped; subsequent DMs from the same user hit the same path because the cache is never populated.
Reproducible with the minimal code sample from #11486 / #11497 against [email protected].
Root cause
Introduced in #11479. Tha...
Is this AI? The reasoning is completely wrong. main doesn't "already have this" nor was a fix introduced to main by #11462 since that was a backport into v14 branch and didn't even touch the else branch this is about.
main branch didn't merge the PR that introduced this yet because while it fixes a bug (that this PR would reintroduce) it also adds another bug (the one this PR claims to fix).
#11495 is the real fix for the issue without reintroducing any previous bugs that got fi...
This has been wrong ever since. ?string means nullable, but if name isn't set in data then it'll be undefined, not null. Same applies to description and the new fields. Both here and in the typings.
Either need an additional ?? null to match the documented type or fix the type to match the implementation.
Just dropping by to say that I'm also noticing/running into this regression on 14.26.3. @Qjuh
As a temporary fix I hooked a handler onto the raw gateway event handler that fetches the channel and message and re-sends the event to my messageCreate handler. Will keep an eye here to see when this is fixed.
Which package is this bug report for?
discord.js
Issue description
Hey, I'm trying to create a /ban command. I want the users to be able to appeal this ban with a /appeal command that they can execute in the bot's DM, but actually, the bot appears offline when they're banned.
So firtsly, I tried with the /ping command. When the users are on the guild, they can use the command in the bot's DM because it appears online. Then, when they're banned, the bot appears offline, so the user...
This doesn't appear to be a discord.js bug.
You forgot to add:
new SlashCommandBuilder().setIntegrationTypes([ApplicationIntegrationType.UserInstall])
Which package is this bug report for?
discord.js
Issue description
Starting in v14.26.2, the messageCreate event no longer fires for direct messages sent to a bot. The bot connects to the gateway, receives MESSAGE_CREATE packets, but the event handler is never invoked. No errors are emitted. Guild messages work normally; only DMs are affected.
I bisected across all v14.x patch releases by extracting each tarball and comparing source: 14.14.1 through 14.26.1 work correctly, 14....
Confirming this regression independently. Also reproduces on 14.26.3 (latest). I bisected by extracting tarballs and diffing source: 14.14.1 through 14.26.1 work correctly; 14.26.2 and 14.26.3 are broken. The change is the single } else { ... } → } else if (data.type === ChannelType.DM || data.type === ChannelType.GroupDM) { ... } modification you identified.
Notably, the v15 main branch (visible in 15.0.0-dev.1777075897-40ce0791a) already reverted this logic to:
if ...
Which package is this bug report for?
discord.js
Issue description
I don't really know how it happens, but my discord.js bots are not receiving some events sometimes. I have only seen it for GuildMemberAdd and GuildMemberUpdate. For example audit log event works for me perfectly and replaces GuildMemberUpdate when it comes to the roles.
Steps to reproduce:
- Create an event handler for one event
- Wait some time/events (it's not instant)
Code sample
// guildme...
0516dc7 chore(discord.js): release [email protected] - Jiralite
[discordjs/discord.js] New tag created: 14.26.4
Bumps api-extractor and api-extractor-model to current upstream version, including bugfixes done there.
This breaks things. e.g.
/docs/packages/core/main/ApplicationCommandsAPI:Class#bulkOverwriteGlobalCommands
There are multiple instances of this.
Potentially related to this review from coderabbit https://github.com/discordjs/discord.js/pull/11520#discussion_r3176815359
Please describe the changes this PR makes and why it should be merged:
Collector#resetTimer previously created new timers using the values
passed in but never wrote them back to this.options. As a result:
- The next automatic idle reset inside
handleCollect(Collector.js:153) read the stalethis.options.idleand re-armed the timer with the original construction-time value, soresetTimerwas effectively undone on the next collected element. - If a collector was cons...
Role#tags are RoleTagData in documentation but the JSDoc defines the type directly on the property instead of as typedef. So the docs don't merge correctly: https://discord.js.org/docs/packages/discord.js/main/RoleTagData:Interface
Which package is this bug report for?
discord.js
Issue description
The messages will time out trying to send files in messages when undici gets imported. When I remove the line importing undici, it works again. I rely on undici to make all my requests because I find it works better in my use cases than fetch, which is why I'm listing this as medium priority; otherwise I would need to rewrite the code of multiple of my bots to use fetch instead, which is more than slightly annoying....
ngl im also having this issue for some reason it doesn't like me attaching any image into containers 😔
Fixes modal fields unconditionally throwing when required is false/undefined.
* @param {boolean} [required=false] Whether to throw an error if the component value is not found or empty
An example jsdoc on most of the getters where it explicitly mentions the throwing on "not found", this implies that it shouldn't throw unconditionally.
This brings it inline with the command interaction options:
https://github.com/discordjs/discord.js/blob/40ce0791a8ed348189d9aefe0669ce...
Wouldn't this be a breaking change? And the behaviour is correct. The docs says it'll will throw an error if the values don't exist, which implies the component should exist first.
Historically modal components have always thrown an error if it was not found.
Though I do think its behaviour should be aligned to match command options, but perhaps on main since I think it would be breaking on v14
Wouldn't this be a breaking change
Yeah probably on the .getField
The docs says it'll will throw an error if the values don't exist, which implies the component should exist first.
At very least in the getters it documents the "not found" part. I could in theory make a private .getField instead so the public api stays the same. In current state those getters have no reason to even be able to return null?
https://github.com/discordjs/discord.js/blob/0516dc7862c71ffd2b49bde4e067...
At very least in the getters it documents the "not found" part. I could in theory make a private .getField instead so the public api stays the same. In current state some of those getters have no reason to even be able to return null?
You are right, that method shouldn't need required field, because I believe discord always returns a string (just empty). It should be like other fields with value as prop
@imnaiyar If I make the default value for .getField required true (so current code works the same), would that be a fair compromise. Like I'd be willing to say that people like me saw the jsdoc and understood it as the same as slash command one. But as this didn't mention it at all, it indeed shouldn't be changed
Or are you saying none of them can be seen as a bug fix as its still going to change peoples behavior? Like I'd argue it would cause more issues if we remove the "useless" param a...
There's something inherently different about what "required" means for Modal fields and for chatinput commands though.
- If a command has an option as
required: falsethen that option might be completely missing from the command interaction, if not used. So the check needs to account for that. - If a Modal has a component in it, then that component will also appear in the ModalSubmitInteraction's fields data. The values might be empty, but the field will always be present.
What you are...
@Qjuh that is a reasonable answer. However it does feel a little confusing considering consistency of knowing slash commands and the jsdoc mentioned. If you believe it's correct though, then I'll be happy to at very least fix that in a diff pr!
But required does make sense to me being actually need to be present vs just not empty. Logically it does make sense the reasoning behind slash commands are easy to have optional, however when making stateless options you may have many options again...
Which application or package is this feature request for?
discord.js
Feature
Discord modals with file inputs do not allow pre-filling existing files when opening the modal. This makes it impossible to build proper “edit message” workflows where a message already contains attachments, because there is no way to display those existing files inside the modal for modification.
Ideal solution or implementation
When opening a modal that contains a file input component, it should be...
@almeidx what do you think of adding id || "0" to the rest package route declarations so that if you do
Routes.applicationCommand("", "") you will get /applications/0/commands/0 instead of /applications//commands/?
Or even /applications/<empty>/commands/<empty> so its more informative if you see it in the logs?
Because I think there is actually a lot more places that empty strings will break typing guarantees then I initially thought and I don't think adding something like this ...
Also, I just realized it would be very easy to accidentally pass unsanitized user input into the URL since IDs are represented as strings. For example, if you want to check whether a user exists, you might naturally write users.fetch(input). The fact that input is ultimately interpolated into the URL is essentially an implementation detail, so it’s easy for someone using the API not to realize they’re introducing unsanitized input into a URL path. So I am thinking the routes should also do ...
Which package is this bug report for?
discord.js
Issue description
Reopening #11126.
This permission is now included in Discord's documentation, so it should be added to PermissionFlagsBits.
Code sample
Versions
discord.js 14.26.4
bun 1.3.13
tsc 5.9.3
Issue priority
Low (slightly annoying)
Which partials do you h...
Closes #11286.
resetTimer was passing the new time/idle values to setTimeout but never persisting them in this.options. After calling resetTimer({ time: X }), collector.options.time still showed the old value.
Which package is this bug report for?
discord.js
Issue description
The examples below reference to the data of a
UserSelectmenu for visualization but also apply to the data ofRoleSelect,ChannelSelectandMentionableSelect(especially its individual map properties).
If SelectMenuModalData has values, [FileUploadModalData](https://discord.js.org/docs/packages/discord.js/14.26....
Summary
RoleManager#edit already supports clearing gradient colors by passing null for secondaryColor/tertiaryColor — the runtime short-circuits on falsy values and sends secondary_color: null / tertiary_color: null in the PATCH body, which Discord interprets as "clear this color". However, RoleColorsResolvable typed those fields as ColorResolvable | undefined, so consumers couldn't pass null without a type error.
The output type RoleColors already exposes these a...
This type (both JSDoc and ts typings) is used for both create and edit of a Role. It should only be nullable for edit though. On create colors should either be omitted or valid colors, not null. So this would need a new type I guess.
ood catch — addressed. Split RoleColorsResolvable (unchanged, used for create) from a new RoleColorsEditResolvable that allows null on secondaryColor/tertiaryColor to clear gradient colors. RoleEditOptions now uses Omit<RoleData, 'colors'> to swap in the editable variant. JSDoc updated accordingly.
export interface RoleColorsResolvable extends RoleColorsEditResolvable {
to avoid duplication of the same properties. Just narrowing the type of secondary and tertiary to not include null here.
Extending an Omit<> type is bad for documentation. The inheritance hierarchy needs to be fixed here.
if (channel.type !== ChannelType.GuildText && channel.type !== ChannelType.GuildAnnouncement) return false;
1e88dcd feat(DMChannel)!: allow partial DMChannel witho... - Qjuh
This is two separate issues:
- the empty collections being present when there are submitted values for a different field. This is a bug in code and needs fixing there.
- the docs stating
FileUploadModalData#attachmentsis always present. This is actually a bug in typings and needs to be fixed there; the code and JSDoc are correct and show it as optional.
This is not an issue in the first place, since the response would be valid for all requests waiting on a response for that specific guild_id. Resolved.
status and voiceStartTime should be properties on GuildVoiceChannel and handled in GuildVoiceChabnel#_patch(...). The gateway events would then emit with just the patched channel(s), no wrapping plain object needed, nor is the Guild as extra parameter needed to emit, since it's already present as getter on the channel.
if (idle) {
This makes it consistent with how time and idle get handled in constructor.
70f22f4 fix(StageInstanceManager#create): correctly res... - almeidx
Passing an instance of a GuildScheduledEvent works now.
810b996 fix(ShardingManager): default api url - almeidx
RouteBases.api already includes the API version in the URL, which was resulting in https://discord.com/api/v10/v10
Which application or package is this feature request for?
discord.js
Feature
npm install discord.js
Ideal solution or implementation
npm install discord.js
Alternative solutions or implementations
No response
Other context
No response
Which package is this bug report for?
discord.js
Issue description
During sharding reconnection, if the bot leaves the guild, the guild will remain in the cache when the session is resumed.
I discovered this bug back on February 27, 2026, but because I was using my library, I only fixed this but for myself.
Steps:
- Wait for the ClientReady event
- Turn off the Internet
- Remove the app from the guild
- Turn on the Internet
- Wait for the ClientReady event
Code sampl...
https://github.com/discordjs/discord.js/blob/3d6121589f9c0d91f7cf4976307e8be07053a277/packages/discord.js/src/client/websocket/handlers/READY.js#L18
Furthermore, expected guilds are not cleared before being added.
If the shard is suddenly interrupted while the client is in the WaitingForGuilds status, and then guilds that haven't yet arrived in the GuildCreate event leave, the client will be stuck in the WaitingForGuilds status, waiting for the guild the bot left.
Mirrored the null/conditional pattern onto the time timeout. Left the per-collect reset idle-only — resetTimer also resets the overall time limit, which shouldn't restart on each collect.
Fixes #11541
RouteBases.api already includes the API version (e.g., https://discord.com/api/v10), so appending /v${version} was causing a double version in the URL. This fixes the URL construction in fetchRecommendedShardCount.
Not a maintainer, but one thing worth separating here is that audit log events working does not prove the member gateway events are configured correctly. GuildMemberAdd / GuildMemberUpdate depend on the GuildMembers privileged intent being enabled both in code and in the Discord Developer Portal for the application.
A couple of checks that would make this easier to triage:
- confirm the Server Members Intent is enabled in the Developer Portal, not only
GatewayIntentBits.GuildMembers...
Not a maintainer, but there are two version details here that seem important for narrowing this down.
For [email protected], @discordjs/rest depends on [email protected], while the repro imports [email protected] directly. The file-upload path in @discordjs/rest builds a new FormData() with Blobs, then the undici request strategy passes bodies through when body instanceof FormData.
So the useful split to test is whether this is caused by the app importing any undici, or specifical...