Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(InteractionCreateAction): Ensure text-based channel for caching messages #7755

Merged

Conversation

Jiralite
Copy link
Member

@Jiralite Jiralite commented Apr 6, 2022

Please describe the changes this PR makes and why it should be merged:
Text-in-Voice channels are gradually rolling out. When an interaction from a component is received in such a channel, discord.js will crash as it attempts to cache the respective message as we do not provide a message cache for voice channels.

This has been resolved by verifying that the channel an interaction came from is text-based (if it is going to cache the respective message). This logic has been applied to message context menu command interactions too despite being currently unusable in text-in-voice channels, but it is better to be safe than sorry.

This pull request resolves #7749.

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

@Jiralite Jiralite changed the title fix: Ensure text-based channel for caching messages fix(InteractionCreateAction): Ensure text-based channel for caching messages Apr 6, 2022
@Jiralite Jiralite marked this pull request as draft April 6, 2022 19:58
The event will emit for these types of bots. However, as the channel is not from a cached guild, they are safe from this crash.
@Jiralite Jiralite marked this pull request as ready for review April 6, 2022 20:11
Copy link
Member

@kyranet kyranet left a comment

Choose a reason for hiding this comment

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

Just one thing

@Jiralite Jiralite requested a review from kyranet April 6, 2022 21:57
@iCrawl iCrawl added this to the discord.js v14 milestone Apr 12, 2022
@iCrawl iCrawl merged commit 25fdb38 into discordjs:main Apr 12, 2022
@Jiralite Jiralite deleted the fix/resilient-interaction-message-cache branch April 12, 2022 15:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

TypeError: Cannot read properties of undefined (reading '_add')
6 participants