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(GuildEmojiManager): check for guild in methods that use it #4917

Closed
wants to merge 1 commit into from
Closed

fix(GuildEmojiManager): check for guild in methods that use it #4917

wants to merge 1 commit into from

Conversation

vaporoxx
Copy link
Contributor

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

Client#emojis and Guild#emojis both return a GuildEmojiManager, however the current code base does not account for former not having a valid guild property. client.emojis.create(...) before resulted in DiscordAPIError: 405: Method Not Allowed, this PR aims to fix that by checking if a guild is present before using it for methods and throwing a custom error.

Consideration

There's also the option to create two separate classes for Client#emojis and Guild#emojis, I've decided to take this approach for now but I'm open to suggestions.

Status

  • Code changes have been tested against the Discord API
  • I know how to update typings and have done so

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.

@SpaceEEC
Copy link
Member

Wouldn't it be more elegant to move resolve, resolveID, and resolveIdentifier to a new class (maybe just EmojiManager?) and have GuildEmojiManager extend that?

That way there wouldn't be any add or create methods to call there to begin with.

@vaporoxx vaporoxx closed this Oct 24, 2020
@vaporoxx vaporoxx mentioned this pull request Oct 24, 2020
5 tasks
@iCrawl iCrawl added this to the Version 13 milestone Jun 27, 2021
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