Repository navigation
Fix MessageDeleteBulk listener signature for discord.js v14 - #140
Conversation
Update listener signature to match discord.js v14 MessageDeleteBulk event which now provides both messages collection and channel parameter. Add handling for partial messages. Co-authored-by: RedStar071 <[email protected]>
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
@copilot change to type MessageCollection = ReadonlyCollection<string, OmitPartialGroupDMChannel<Message>>; and remove _channel parameter |
Your comment appears to be cut off. Could you clarify what you'd like the
The current definition is: |
|
@copilot Change to type MessageCollection = ReadonlyCollection<string, OmitPartialGroupDMChannel<Message>>; |
The comment appears incomplete. Please specify the complete type definition you'd like, for example:
I need the complete type definition to make the change correctly. |
|
@copilot remove partial check, is not partial the messages and insert true to Message and remove |
- Changed MessageCollection to ReadonlyCollection<string, Message<true>> - Removed PartialMessage from type union - Removed _channel parameter from run method - Removed all partial message checks (lines 20-21, 40-41, 71-72) - Simplified canBeCustomized type guard Co-authored-by: RedStar071 <[email protected]>
Done in commit 08b3c8d. Changes made:
Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
@copilot Change to |
Changed MessageCollection type to ReadonlyCollection<string, OmitPartialGroupDMChannel<Message<true>>> to properly handle message typing for bulk delete events. Co-authored-by: RedStar071 <[email protected]>
Done in commit 4032bca. Changed MessageCollection type to Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
There was a problem hiding this comment.
Pull Request Overview
This PR updates the messageDeleteBulk event listener to fix TypeScript build failures caused by signature changes in discord.js v14, where messages in this event are guaranteed to be non-partial (Message<true>).
Key changes:
- Updated
MessageCollectiontype to useMessage<true>instead ofMessage<boolean> - Modified
canBeCustomized()type guard signature to acceptMessage<true>and return the intersection type
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| private canBeCustomized(message: Message<true>): message is Message<true> & GuildMessage { | ||
| return message.guild !== null; |
There was a problem hiding this comment.
The type guard return type message is Message<true> & GuildMessage is redundant since GuildMessage is already defined as Message<true> & { member: GuildMember }. The return type should simply be message is GuildMessage.
Additionally, the type guard implementation only checks message.guild !== null but doesn't verify that message.member exists. According to the GuildMessage type definition, the member property is required. This could lead to type safety issues if a message from a guild doesn't have a member (which can happen in certain Discord.js scenarios).
Suggested fix:
private canBeCustomized(message: Message<true>): message is GuildMessage {
return message.guild !== null && message.member !== null;
}| private canBeCustomized(message: Message<true>): message is Message<true> & GuildMessage { | |
| return message.guild !== null; | |
| private canBeCustomized(message: Message<true>): message is GuildMessage { | |
| return message.guild !== null && message.member !== null; |
The
messageDeleteBulkevent signature changed in discord.js v14, causing TypeScript build failures.Changes
Updated listener signature in
messageDeleteBulkRemoveResponses.ts:ReadonlyCollection<string, OmitPartialGroupDMChannel<Message<true>>>Simplified type guard:
canBeCustomized()to only check for guild presence without partial message checksNote: Pre-existing unit test failures in
@discordjs/buildersdependency are unrelated to this fix.💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.