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 enums #371

Merged
merged 7 commits into from
Jan 24, 2019
Merged

Fix enums #371

merged 7 commits into from
Jan 24, 2019

Conversation

madsmtm
Copy link
Member

@madsmtm madsmtm commented Dec 12, 2018

Should fix #220 and fix #368. changeThreadColor and reactToMessage are not aware of this change yet.

I'm having trouble with Python 2.7 encoding. Narrowed it down to:

tree = '🎄'
u"abc_{}".format(tree)

If we can figure the encoding errors, we might be able to solve #302?

Copy link

@MrABKhan MrABKhan left a comment

Choose a reason for hiding this comment

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

Provides much more readable code than current. Creates meaningful logs with extra information.

Copy link

@Demindiro Demindiro left a comment

Choose a reason for hiding this comment

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

The changes seem to work alright, though reactToMessage with a custom emoji is effectively a no-op (I think it's something wrong on Facebook's end though).

@@ -26,12 +26,11 @@ def decode(self, s, _w=WHITESPACE.match):
def graphql_color_to_enum(color):
if color is None:
return None
if len(color) == 0:
if not color:
return ThreadColor.MESSENGER_BLUE
Copy link

@Demindiro Demindiro Dec 15, 2018

Choose a reason for hiding this comment

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

I think that line 30 won't execute because there is a None check before this one (or is the not color intended to catch another value?)

Copy link
Member Author

Choose a reason for hiding this comment

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

The not color is intended to catch the empty string, but I guess that could be clearer

@madsmtm
Copy link
Member Author

madsmtm commented Jan 24, 2019

I'll go ahead and merge this, I still don't really know what to do about the encoding errors yet, though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ValueError: '🎄' is not a valid MessageReaction ThreadColor Enums Error
3 participants