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

Fixing tests and content types for Telegram Bot API 7.2 update #1453

Merged
merged 2 commits into from
Apr 7, 2024

Conversation

RoLO0u
Copy link
Contributor

@RoLO0u RoLO0u commented Apr 7, 2024

Description

  • Adding SHARED_USER in ContentType enum
  • Adding tests for SharedUser, business_connection_id, is_from_offline, sender_business_bot

Fixes # (issue)
#1446

Type of change

  • Bug fix (non-breaking* change which fixes an issue)
  • This change requires a documentation update

* InputSticker now requires format as in Telegram Bot API

How Has This Been Tested?

  • Tested with sticker-bot project. It has instruction on how to start bot. Additionally, change aiogram from pip installed one to experimental.

Test Configuration:

  • Operating System: Arch Linux x86_64
  • Python version: 3.11.8

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Copy link

github-actions bot commented Apr 7, 2024

✔️ Changelog found.

Thank you for adding a description of the changes

@JrooTJunior
Copy link
Member

  1. Enums should not be modified manually because this part of the project was code-generated and should be re-generated (available only for core-developers).
  2. You don't need to add a changelog if you are submitting a PR to another PR.

@JrooTJunior JrooTJunior merged commit c96a4fc into aiogram:feature/bot-api-7.2 Apr 7, 2024
2 checks passed
@@ -238,6 +239,8 @@ class Message(MaybeInaccessibleMessage):
"""*Optional*. Message is an invoice for a `payment <https://core.telegram.org/bots/api#payments>`_, information about the invoice. `More about payments » <https://core.telegram.org/bots/api#payments>`_"""
successful_payment: Optional[SuccessfulPayment] = None
"""*Optional*. Message is a service message about a successful payment, information about the payment. `More about payments » <https://core.telegram.org/bots/api#payments>`_"""
shared_user: Optional[SharedUser] = None
Copy link
Member

Choose a reason for hiding this comment

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

WTF is this?

@@ -628,6 +633,12 @@ def content_type(self) -> str:
return ContentType.WRITE_ACCESS_ALLOWED
if self.boost_added:
return ContentType.BOOST_ADDED
if self.business_connection_id:
Copy link
Member

Choose a reason for hiding this comment

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

Is not event type.

@@ -628,6 +633,12 @@ def content_type(self) -> str:
return ContentType.WRITE_ACCESS_ALLOWED
if self.boost_added:
return ContentType.BOOST_ADDED
if self.business_connection_id:
return ContentType.BUSINESS_CONNECTION_ID
if self.is_from_offline:
Copy link
Member

Choose a reason for hiding this comment

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

Is not event type.

return ContentType.BUSINESS_CONNECTION_ID
if self.is_from_offline:
return ContentType.IS_FROM_OFFLINE
if self.sender_business_bot:
Copy link
Member

Choose a reason for hiding this comment

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

Is not event type.

JrooTJunior added a commit that referenced this pull request Apr 22, 2024
* Added base support of Bot API 7.2

* Added base support of Bot API 7.2

* Fixing tests and content types for Telegram Bot API 7.2 update (#1453)

* Fixing tests and content types for Telegram Bot API 7.2

* Adding changelog for 1453 PR

* Fixes + coverage

* Replace `BusinessConnection.date` type

* Reformat code

* Refactor UserContextMiddleware to use EventContext class

This update significantly refactors UserContextMiddleware to leverage a new class, EventContext. Instead of resolving event context as a tuple, it now produces an instance of EventContext. Additional adjustments include supporting a business connection ID for event context identification and facilitating backwards compatibility. Tests and other files were also updated accordingly for these changes.

* Cover FSM key builder (business_connection_id

* Added changelog

---------

Co-authored-by: RoLOQ <roman.fedunn@gmail.com>
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

2 participants