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(MessageManager): throw if delete param is not MessageResolvable #4825

Merged
merged 1 commit into from
Sep 25, 2020

Conversation

monbrey
Copy link
Member

@monbrey monbrey commented Sep 15, 2020

The MessageManager#delete method could silently resolve without making any API call if the supplied param was not MessageResolvable.

message.channel.messages.delete("755203620831756368") // successfully deletes message
message.channel.messages.delete("1") // throws DiscordAPIError: Unknown Message
message.channel.messages.delete() // would silently resolve
message.channel.messages.delete({ foo: "bar" }) // would silently resolve

This addresses case 3 and 4 above by throwing a TypeError for params which are not MessageResolvable

semver:major

Status

  • 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

Semantic versioning classification:

  • This PR changes the library's interface (methods or parameters added)
    • This PR includes breaking changes (methods removed or renamed, parameters moved or removed)
  • This PR only includes non-code changes, like changes to documentation, README, etc.

@iCrawl iCrawl merged commit 13d64e6 into discordjs:master Sep 25, 2020
@monbrey monbrey deleted the message-manager-typecheck branch September 25, 2020 22:44
GiorgioBrux pushed a commit to GiorgioBrux/discord.js that referenced this pull request Oct 1, 2020
GiorgioBrux pushed a commit to GiorgioBrux/discord.js that referenced this pull request Oct 17, 2020
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.

5 participants