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

Swap around checking of VENUE and LOCATION content #27

Merged
merged 1 commit into from
Mar 25, 2018

Conversation

Olegt0rr
Copy link
Contributor

Fix for issue #26

Venue Message consists of location and venue fields.
If you check location first - you always set message type = location

@@ -95,10 +95,10 @@ def content_type(self):
return ContentType.VOICE[0]
if self.contact:
return ContentType.CONTACT[0]
if self.location:
return ContentType.LOCATION[0]
if self.venue:
Copy link

@senpos senpos Mar 25, 2018

Choose a reason for hiding this comment

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

Since Venue contains location and venue properties, isn't it better to check for both of them, rather than rely on checks positioning in the code?

if self.location:
    if self.venue:
         return ContentType.VENUE[0]
    return ContentType.LOCATION[0]

@JrooTJunior JrooTJunior changed the base branch from master to dev-1.x March 25, 2018 11:20
@JrooTJunior JrooTJunior merged commit 014271c into aiogram:dev-1.x Mar 25, 2018
@Olegt0rr Olegt0rr deleted the patch-3 branch August 7, 2018 06:57
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