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

Add and document Guild.get_emoji #9296

Merged
merged 1 commit into from Mar 13, 2023
Merged

Conversation

fretgfr
Copy link
Contributor

@fretgfr fretgfr commented Mar 11, 2023

Summary

Adds a Guild.get_emoji method for getting emojis from a Guild by id.

Checklist

  • If code changes were made then they have been tested.
    • I have updated the documentation to reflect the changes.
  • This PR fixes an issue.
  • This PR adds something new (e.g. new method or parameters).
  • This PR is a breaking change (e.g. methods or parameters removed/renamed)
  • This PR is not a code change (e.g. documentation, README, ...)

Comment on lines +756 to +758
if emoji and emoji.guild == self:
return emoji
return None
Copy link
Contributor

Choose a reason for hiding this comment

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

Check with if x is not None rather than with if x if you want to check if emoji is not None.
Also return emoji at the end for better readability.

Suggested change
if emoji and emoji.guild == self:
return emoji
return None
if emoji is not None and emoji.guild != self:
return None
return emoji

Copy link
Owner

Choose a reason for hiding this comment

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

I partially agree with this but I think the current code is also fine.

@Rapptz Rapptz merged commit 1984257 into Rapptz:master Mar 13, 2023
8 checks passed
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.

None yet

3 participants