Skip to content

Fix MessageDeleteBulk listener signature for discord.js v14 - #140

Merged
RedStar071 merged 4 commits into
renovate/all-minor-patchfrom
copilot/sub-pr-128
Nov 16, 2025
Merged

RedStar071 merged 4 commits into
renovate/all-minor-patchfrom
copilot/sub-pr-128

Conversation

Copilot AI commented Nov 16, 2025 •

Copy link
Copy Markdown
Contributor

The messageDeleteBulk event signature changed in discord.js v14, causing TypeScript build failures.

Changes

  • Updated listener signature in messageDeleteBulkRemoveResponses.ts:

    • Updated message collection type to ReadonlyCollection<string, OmitPartialGroupDMChannel<Message<true>>>
    • Removed partial message handling (messages are never partial in this event)
    • Removed unused channel parameter
  • Simplified type guard:

    • Updated canBeCustomized() to only check for guild presence without partial message checks
// Before
type MessageCollection = ReadonlyCollection<string, OmitPartialGroupDMChannel<Message<boolean>>>;

public async run(messages: MessageCollection) {
  const first = messages.first()!;
  if (!this.canBeCustomized(first)) return this.deleteAll(messages);
  // ...
}

// After  
type MessageCollection = ReadonlyCollection<string, OmitPartialGroupDMChannel<Message<true>>>;

public async run(messages: MessageCollection) {
  const first = messages.first()!;
  if (!this.canBeCustomized(first)) return this.deleteAll(messages);
  // ...
}

Note: Pre-existing unit test failures in @discordjs/builders dependency 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.

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]>

Copilot AI commented Nov 16, 2025

Copy link
Copy Markdown
Contributor Author

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:

  • checkpoint.prisma.io
    • Triggering command: /usr/local/bin/node /home/REDACTED/work/wolfstar/wolfstar/node_modules/prisma/build/child {&#34;product&#34;:&#34;prisma&#34;,&#34;version&#34;:&#34;6.19.0&#34;,&#34;cli_install_type&#34;:&#34;local&#34;,&#34;information&#34;:&#34;&#34;,&#34;local_timestamp&#34;:&#34;2025-11-16T16:43:38Z&#34;,&#34;project_hash&#34;:&#34;fc198bae&#34;,&#34;cli_path&#34;:&#34;/home/REDACTED/work/wolfstar/wolfstar/node_modules/prisma/build/index.js&#34;,&#34;cli_path_hash&#34;:&#34;62ada1df&#34;,&#34;endpoint&#34;:&#34;REDACTED&#34;,&#34;disable&#34;:false,&#34;arch&#34;:&#34;x64&#34;,&#34;os&#34;:&#34;linux&#34;,&#34;node_version&#34;:&#34;v20.19.5&#34;,&#34;ci&#34;:true,&#34;ci_name&#34;:&#34;GitHub Actions&#34;,&#34;command&#34;:&#34;generate --postinstall \&#34;UNABLE_TO_FIND_POSTINSTALL_TRIGGER__ENVAR_MISSING\&#34;&#34;,&#34;schema_providers&#34;:[&#34;postgresql&#34;],&#34;schema_preview_features&#34;:[&#34;tracing&#34;],&#34;schema_generators_providers&#34;:[&#34;prisma-client-js&#34;,&#34;prisma-json-types-generator&#34;],&#34;cache_file&#34;:&#34;/home/REDACTED/.cache/checkpoint-nodejs/prisma-62ada1df&#34;,&#34;cache_duration&#34;:43200000,&#34;remind_duration&#34;:172800000,&#34;force&#34;:false,&#34;timeout&#34;:5000,&#34;unref&#34;:true,&#34;child_path&#34;:&#34;/home/REDACTED/work/wolfstar/wolfstar/node_modules/prisma/build/child&#34;,&#34;client_event_id&#34;:&#34;&#34;,&#34;previous_client_event_id&#34;:&#34;&#34;,&#34;check_if_update_available&#34;:true} (dns block)
    • Triggering command: /usr/local/bin/node /home/REDACTED/work/wolfstar/wolfstar/node_modules/prisma/build/child {&#34;product&#34;:&#34;prisma&#34;,&#34;version&#34;:&#34;6.19.0&#34;,&#34;cli_install_type&#34;:&#34;local&#34;,&#34;information&#34;:&#34;&#34;,&#34;local_timestamp&#34;:&#34;2025-11-16T16:43:49Z&#34;,&#34;project_hash&#34;:&#34;fc198bae&#34;,&#34;cli_path&#34;:&#34;/home/REDACTED/work/wolfstar/wolfstar/node_modules/prisma/build/index.js&#34;,&#34;cli_path_hash&#34;:&#34;62ada1df&#34;,&#34;endpoint&#34;:&#34;REDACTED&#34;,&#34;disable&#34;:false,&#34;arch&#34;:&#34;x64&#34;,&#34;os&#34;:&#34;linux&#34;,&#34;node_version&#34;:&#34;v20.19.5&#34;,&#34;ci&#34;:true,&#34;ci_name&#34;:&#34;GitHub Actions&#34;,&#34;command&#34;:&#34;generate&#34;,&#34;schema_providers&#34;:[&#34;postgresql&#34;],&#34;schema_preview_features&#34;:[&#34;tracing&#34;],&#34;schema_generators_providers&#34;:[&#34;prisma-client-js&#34;,&#34;prisma-json-types-generator&#34;],&#34;cache_file&#34;:&#34;/home/REDACTED/.cache/checkpoint-nodejs/prisma-62ada1df&#34;,&#34;cache_duration&#34;:43200000,&#34;remind_duration&#34;:172800000,&#34;force&#34;:false,&#34;timeout&#34;:5000,&#34;unref&#34;:true,&#34;child_path&#34;:&#34;/home/REDACTED/work/wolfstar/wolfstar/node_modules/prisma/build/child&#34;,&#34;client_event_id&#34;:&#34;&#34;,&#34;previous_client_event_id&#34;:&#34;&#34;,&#34;check_if_update_available&#34;:true} (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title [WIP] Fix dependencies by updating non-major packages Fix MessageDeleteBulk listener signature for discord.js v14 Nov 16, 2025
Copilot AI requested a review from RedStar071 November 16, 2025 16:51
@RedStar071

Copy link
Copy Markdown
Member

@copilot change to type MessageCollection = ReadonlyCollection<string, OmitPartialGroupDMChannel<Message>>; and remove _channel parameter

Copilot AI commented Nov 16, 2025

Copy link
Copy Markdown
Contributor Author

@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 MessageCollection type to be? For example:

  • ReadonlyCollection<string, Message> (without PartialMessage)
  • ReadonlyCollection<string, Message<boolean>> (with boolean instead of true)
  • Something else?

The current definition is: ReadonlyCollection<string, Message<true> | PartialMessage<true>>

@RedStar071

Copy link
Copy Markdown
Member

@copilot Change to type MessageCollection = ReadonlyCollection<string, OmitPartialGroupDMChannel<Message>>;

Copilot AI commented Nov 16, 2025

Copy link
Copy Markdown
Contributor Author

@copilot Change to type MessageCollection = ReadonlyCollection<string, OmitPartialGroupDMChannel<Message>>;

The comment appears incomplete. Please specify the complete type definition you'd like, for example:

  1. ReadonlyCollection<string, Message> (simplified, no partial)
  2. Remove the type alias and use ReadonlyCollection<string, Message | PartialMessage> inline
  3. Something else?

I need the complete type definition to make the change correctly.

@RedStar071

Copy link
Copy Markdown
Member

@copilot remove partial check, is not partial the messages and insert true to Message and remove _channel:

- 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]>

Copilot AI commented Nov 16, 2025 •

Copy link
Copy Markdown
Contributor Author

@copilot remove partial check, is not partial the messages and insert true to Message and remove _channel:

Done in commit 08b3c8d. Changes made:

  • Removed partial message checks throughout the file
  • Changed MessageCollection to ReadonlyCollection<string, Message<true>>
  • Removed _channel parameter from the run method
  • Simplified the type guard since partial messages are no longer in scope

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:

  • checkpoint.prisma.io
    • Triggering command: /usr/local/bin/node /home/REDACTED/work/wolfstar/wolfstar/node_modules/prisma/build/child {&#34;product&#34;:&#34;prisma&#34;,&#34;version&#34;:&#34;6.19.0&#34;,&#34;cli_install_type&#34;:&#34;local&#34;,&#34;information&#34;:&#34;&#34;,&#34;local_timestamp&#34;:&#34;2025-11-16T17:04:18Z&#34;,&#34;project_hash&#34;:&#34;fc198bae&#34;,&#34;cli_path&#34;:&#34;/home/REDACTED/work/wolfstar/wolfstar/node_modules/prisma/build/index.js&#34;,&#34;cli_path_hash&#34;:&#34;62ada1df&#34;,&#34;endpoint&#34;:&#34;REDACTED&#34;,&#34;disable&#34;:false,&#34;arch&#34;:&#34;x64&#34;,&#34;os&#34;:&#34;linux&#34;,&#34;node_version&#34;:&#34;v20.19.5&#34;,&#34;ci&#34;:true,&#34;ci_name&#34;:&#34;GitHub Actions&#34;,&#34;command&#34;:&#34;generate --postinstall \&#34;UNABLE_TO_FIND_POSTINSTALL_TRIGGER__ENVAR_MISSING\&#34;&#34;,&#34;schema_providers&#34;:[&#34;postgresql&#34;],&#34;schema_preview_features&#34;:[&#34;tracing&#34;],&#34;schema_generators_providers&#34;:[&#34;prisma-client-js&#34;,&#34;prisma-json-types-generator&#34;],&#34;cache_file&#34;:&#34;/home/REDACTED/.cache/checkpoint-nodejs/prisma-62ada1df&#34;,&#34;cache_duration&#34;:43200000,&#34;remind_duration&#34;:172800000,&#34;force&#34;:false,&#34;timeout&#34;:5000,&#34;unref&#34;:true,&#34;child_path&#34;:&#34;/home/REDACTED/work/wolfstar/wolfstar/node_modules/prisma/build/child&#34;,&#34;client_event_id&#34;:&#34;&#34;,&#34;previous_client_event_id&#34;:&#34;&#34;,&#34;check_if_update_available&#34;:true} (dns block)
    • Triggering command: /usr/local/bin/node /home/REDACTED/work/wolfstar/wolfstar/node_modules/prisma/build/child {&#34;product&#34;:&#34;prisma&#34;,&#34;version&#34;:&#34;6.19.0&#34;,&#34;cli_install_type&#34;:&#34;local&#34;,&#34;information&#34;:&#34;&#34;,&#34;local_timestamp&#34;:&#34;2025-11-16T17:04:27Z&#34;,&#34;project_hash&#34;:&#34;fc198bae&#34;,&#34;cli_path&#34;:&#34;/home/REDACTED/work/wolfstar/wolfstar/node_modules/prisma/build/index.js&#34;,&#34;cli_path_hash&#34;:&#34;62ada1df&#34;,&#34;endpoint&#34;:&#34;REDACTED&#34;,&#34;disable&#34;:false,&#34;arch&#34;:&#34;x64&#34;,&#34;os&#34;:&#34;linux&#34;,&#34;node_version&#34;:&#34;v20.19.5&#34;,&#34;ci&#34;:true,&#34;ci_name&#34;:&#34;GitHub Actions&#34;,&#34;command&#34;:&#34;generate&#34;,&#34;schema_providers&#34;:[&#34;postgresql&#34;],&#34;schema_preview_features&#34;:[&#34;tracing&#34;],&#34;schema_generators_providers&#34;:[&#34;prisma-client-js&#34;,&#34;prisma-json-types-generator&#34;],&#34;cache_file&#34;:&#34;/home/REDACTED/.cache/checkpoint-nodejs/prisma-62ada1df&#34;,&#34;cache_duration&#34;:43200000,&#34;remind_duration&#34;:172800000,&#34;force&#34;:false,&#34;timeout&#34;:5000,&#34;unref&#34;:true,&#34;child_path&#34;:&#34;/home/REDACTED/work/wolfstar/wolfstar/node_modules/prisma/build/child&#34;,&#34;client_event_id&#34;:&#34;&#34;,&#34;previous_client_event_id&#34;:&#34;&#34;,&#34;check_if_update_available&#34;:true} (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

@RedStar071

Copy link
Copy Markdown
Member

@copilot Change to type MessageCollection = ReadonlyCollection<string, OmitPartialGroupDMChannel<Message<true>>>;

Changed MessageCollection type to ReadonlyCollection<string, OmitPartialGroupDMChannel<Message<true>>> to properly handle message typing for bulk delete events.

Co-authored-by: RedStar071 <[email protected]>

Copilot AI commented Nov 16, 2025 •

Copy link
Copy Markdown
Contributor Author

@copilot Change to type MessageCollection = ReadonlyCollection<string, OmitPartialGroupDMChannel<Message<true>>>;

Done in commit 4032bca. Changed MessageCollection type to ReadonlyCollection<string, OmitPartialGroupDMChannel<Message<true>>>.

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:

  • checkpoint.prisma.io
    • Triggering command: /usr/local/bin/node /home/REDACTED/work/wolfstar/wolfstar/node_modules/prisma/build/child {&#34;product&#34;:&#34;prisma&#34;,&#34;version&#34;:&#34;6.19.0&#34;,&#34;cli_install_type&#34;:&#34;local&#34;,&#34;information&#34;:&#34;&#34;,&#34;local_timestamp&#34;:&#34;2025-11-16T17:11:32Z&#34;,&#34;project_hash&#34;:&#34;fc198bae&#34;,&#34;cli_path&#34;:&#34;/home/REDACTED/work/wolfstar/wolfstar/node_modules/prisma/build/index.js&#34;,&#34;cli_path_hash&#34;:&#34;62ada1df&#34;,&#34;endpoint&#34;:&#34;REDACTED&#34;,&#34;disable&#34;:false,&#34;arch&#34;:&#34;x64&#34;,&#34;os&#34;:&#34;linux&#34;,&#34;node_version&#34;:&#34;v20.19.5&#34;,&#34;ci&#34;:true,&#34;ci_name&#34;:&#34;GitHub Actions&#34;,&#34;command&#34;:&#34;generate --postinstall \&#34;UNABLE_TO_FIND_POSTINSTALL_TRIGGER__ENVAR_MISSING\&#34;&#34;,&#34;schema_providers&#34;:[&#34;postgresql&#34;],&#34;schema_preview_features&#34;:[&#34;tracing&#34;],&#34;schema_generators_providers&#34;:[&#34;prisma-client-js&#34;,&#34;prisma-json-types-generator&#34;],&#34;cache_file&#34;:&#34;/home/REDACTED/.cache/checkpoint-nodejs/prisma-62ada1df&#34;,&#34;cache_duration&#34;:43200000,&#34;remind_duration&#34;:172800000,&#34;force&#34;:false,&#34;timeout&#34;:5000,&#34;unref&#34;:true,&#34;child_path&#34;:&#34;/home/REDACTED/work/wolfstar/wolfstar/node_modules/prisma/build/child&#34;,&#34;client_event_id&#34;:&#34;&#34;,&#34;previous_client_event_id&#34;:&#34;&#34;,&#34;check_if_update_available&#34;:true} (dns block)
    • Triggering command: /usr/local/bin/node /home/REDACTED/work/wolfstar/wolfstar/node_modules/prisma/build/child {&#34;product&#34;:&#34;prisma&#34;,&#34;version&#34;:&#34;6.19.0&#34;,&#34;cli_install_type&#34;:&#34;local&#34;,&#34;information&#34;:&#34;&#34;,&#34;local_timestamp&#34;:&#34;2025-11-16T17:11:42Z&#34;,&#34;project_hash&#34;:&#34;fc198bae&#34;,&#34;cli_path&#34;:&#34;/home/REDACTED/work/wolfstar/wolfstar/node_modules/prisma/build/index.js&#34;,&#34;cli_path_hash&#34;:&#34;62ada1df&#34;,&#34;endpoint&#34;:&#34;REDACTED&#34;,&#34;disable&#34;:false,&#34;arch&#34;:&#34;x64&#34;,&#34;os&#34;:&#34;linux&#34;,&#34;node_version&#34;:&#34;v20.19.5&#34;,&#34;ci&#34;:true,&#34;ci_name&#34;:&#34;GitHub Actions&#34;,&#34;command&#34;:&#34;generate&#34;,&#34;schema_providers&#34;:[&#34;postgresql&#34;],&#34;schema_preview_features&#34;:[&#34;tracing&#34;],&#34;schema_generators_providers&#34;:[&#34;prisma-client-js&#34;,&#34;prisma-json-types-generator&#34;],&#34;cache_file&#34;:&#34;/home/REDACTED/.cache/checkpoint-nodejs/prisma-62ada1df&#34;,&#34;cache_duration&#34;:43200000,&#34;remind_duration&#34;:172800000,&#34;force&#34;:false,&#34;timeout&#34;:5000,&#34;unref&#34;:true,&#34;child_path&#34;:&#34;/home/REDACTED/work/wolfstar/wolfstar/node_modules/prisma/build/child&#34;,&#34;client_event_id&#34;:&#34;&#34;,&#34;previous_client_event_id&#34;:&#34;&#34;,&#34;check_if_update_available&#34;:true} (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

@RedStar071
RedStar071 marked this pull request as ready for review November 16, 2025 19:49
Copilot AI review requested due to automatic review settings November 16, 2025 19:49
@RedStar071
RedStar071 merged commit c374c67 into renovate/all-minor-patch Nov 16, 2025
@RedStar071
RedStar071 deleted the copilot/sub-pr-128 branch November 16, 2025 19:49

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 MessageCollection type to use Message<true> instead of Message<boolean>
  • Modified canBeCustomized() type guard signature to accept Message<true> and return the intersection type

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +48 to 49
private canBeCustomized(message: Message<true>): message is Message<true> & GuildMessage {
return message.guild !== null;

Copilot AI Nov 16, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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;
}
Suggested change
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;

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants