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: assert channel types in message actions #6919

Merged

Conversation

SpaceEEC
Copy link
Member

Please describe the changes this PR makes and why it should be merged:

This PR ensures that message related actions take place in a channel that is supported to avoid throwing an unhandled exceptions. (Read: text in voice, also future-proofing)

Changed actions:

  • MessageCreate
  • MessageDelete
  • MessageReactionAdd
  • MessageReactionRemove
  • MessageReactionRemoveAll
  • MessageReactionRemoveEmoji
  • MessageUpdate
  • TypingStart

The reaction actions previously were ensuring that the action was not taking place in a voice channel (as per type) and the typing start action in a text channel (as per type).

I went with Channel#isText since it seems to be the less error-prone method to check whether messages can be accessed in said channel, since it's just return 'messages' in this.

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

@ImRodry
Copy link
Contributor

ImRodry commented Oct 29, 2021

Voice channels will soon have messages though, are you sure you wanna do this?

@SpaceEEC
Copy link
Member Author

Yes, I am.

@iCrawl iCrawl added this to the Version 13.4 milestone Oct 30, 2021
@iCrawl iCrawl requested review from a team, kyranet and vladfrangu and removed request for a team October 30, 2021 00:53
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.

None yet

3 participants