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 is_forward method to Message #390

Merged
merged 4 commits into from
Sep 13, 2020
Merged

Conversation

uburuntu
Copy link
Contributor

Add is_forward method to Message

Only forward_date is required to be in forwarded message (https://core.telegram.org/bots/api#message).

But code like

if message.forward_date:
     return True

looks ambigous, so I added this method

if message.is_forward():
     return True

Also I added some return types at nearest code.

Type of change

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

On my bot.

Copy link
Contributor

@uwinx uwinx left a comment

Choose a reason for hiding this comment

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

LGTM. thank you for your contributions.

@uwinx uwinx added the enhancement Make it better! label Jul 25, 2020
"""
Check message text is command

:return: bool
"""
return self.text and self.text.startswith("/")

def get_full_command(self):
def is_forward(self) -> bool:
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
def is_forward(self) -> bool:
@property
def is_forward(self) -> bool:

@JrooTJunior JrooTJunior merged commit 0cc6a2c into aiogram:dev-2.x Sep 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Make it better!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants