botapi-py 1.5.5__tar.gz → 1.5.7__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: botapi-py
3
- Version: 1.5.5
3
+ Version: 1.5.7
4
4
  Summary: A simple and flexible Python library to conveniently build fast Telegram bots using the Bot API.
5
5
  Requires-Dist: httpx>=0.28.1
6
6
  Requires-Dist: pydantic>=2.12.0
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "botapi-py"
3
- version = "1.5.5"
3
+ version = "1.5.7"
4
4
  description = "A simple and flexible Python library to conveniently build fast Telegram bots using the Bot API."
5
5
  # readme = "README.md"
6
6
  # authors = [
@@ -1455,8 +1455,7 @@ class Methods(core.BaseBot):
1455
1455
  '''
1456
1456
  Use this method to stream a partial message
1457
1457
  to a user while the message is being
1458
- generated; supported only for bots with forum topic
1459
- mode enabled. Returns True on success.
1458
+ generated. Returns True on success.
1460
1459
 
1461
1460
  Reference: https://core.telegram.org/bots/api#sendmessagedraft
1462
1461
  '''
@@ -1720,6 +1719,7 @@ class Methods(core.BaseBot):
1720
1719
  can_pin_messages: Optional[bool] = None,
1721
1720
  can_manage_topics: Optional[bool] = None,
1722
1721
  can_manage_direct_messages: Optional[bool] = None,
1722
+ can_manage_tags: Optional[bool] = None,
1723
1723
  ) -> bool:
1724
1724
  '''
1725
1725
  Use this method to promote or demote a
@@ -1752,6 +1752,7 @@ class Methods(core.BaseBot):
1752
1752
  'can_pin_messages': can_pin_messages,
1753
1753
  'can_manage_topics': can_manage_topics,
1754
1754
  'can_manage_direct_messages': can_manage_direct_messages,
1755
+ 'can_manage_tags': can_manage_tags,
1755
1756
  })
1756
1757
  return BoolAdapter.validate_python(response)
1757
1758
 
@@ -1776,6 +1777,30 @@ class Methods(core.BaseBot):
1776
1777
  })
1777
1778
  return BoolAdapter.validate_python(response)
1778
1779
 
1780
+ async def set_chat_member_tag(
1781
+ self,
1782
+ chat_id: Union[int, str],
1783
+ user_id: int,
1784
+ tag: Optional[str] = None,
1785
+ ) -> bool:
1786
+ '''
1787
+ Use this method to set a tag for
1788
+ a regular member in a group or a
1789
+ supergroup. The bot must be an administrator in
1790
+ the chat for this to work and must
1791
+ have the can_manage_tags administrator right. Returns True on
1792
+ success.
1793
+
1794
+ Reference: https://core.telegram.org/bots/api#setchatmembertag
1795
+ '''
1796
+
1797
+ response = await self._send_request('setChatMemberTag', {
1798
+ 'chat_id': chat_id,
1799
+ 'user_id': user_id,
1800
+ 'tag': tag,
1801
+ })
1802
+ return BoolAdapter.validate_python(response)
1803
+
1779
1804
  async def ban_chat_sender_chat(
1780
1805
  self,
1781
1806
  chat_id: Union[int, str],
@@ -36,6 +36,7 @@ class Message(MaybeInaccessibleMessage):
36
36
  sender_chat: Optional[Chat] = Field(default=None)
37
37
  sender_boost_count: Optional[int] = Field(default=None)
38
38
  sender_business_bot: Optional[User] = Field(default=None)
39
+ sender_tag: Optional[str] = Field(default=None)
39
40
  business_connection_id: Optional[str] = Field(default=None)
40
41
  forward_origin: Optional[_MessageOrigin] = Field(default=None)
41
42
  is_topic_message: Optional[bool] = Field(default=None)
@@ -635,8 +636,8 @@ class ChatMember(BaseModel):
635
636
  status: Literal['creator', 'administrator', 'member', 'restricted', 'left', 'kicked']
636
637
  user: User
637
638
 
638
- # @property
639
- async def is_participant(self) -> bool:
639
+ @property
640
+ def is_participant(self) -> bool:
640
641
  '''
641
642
  Returns a boolean indicating if the user is currently part of of the chat (i.e. not left/banned).
642
643
 
@@ -769,6 +770,7 @@ class ChatMemberAdministrator(ChatMember):
769
770
  can_pin_messages: Optional[bool] = Field(default=None)
770
771
  can_manage_topics: Optional[bool] = Field(default=None)
771
772
  can_manage_direct_messages: Optional[bool] = Field(default=None)
773
+ can_manage_tags: Optional[bool] = Field(default=None)
772
774
  custom_title: Optional[str] = Field(default=None)
773
775
 
774
776
  class ChatMemberMember(ChatMember):
@@ -781,6 +783,7 @@ class ChatMemberMember(ChatMember):
781
783
 
782
784
  status: Literal['member'] = 'member' # pyright: ignore[reportIncompatibleVariableOverride]
783
785
  user: User
786
+ tag: Optional[str] = Field(default=None)
784
787
  until_date: Optional[int] = Field(default=None)
785
788
 
786
789
  class ChatMemberRestricted(ChatMember):
@@ -804,11 +807,13 @@ class ChatMemberRestricted(ChatMember):
804
807
  can_send_polls: bool
805
808
  can_send_other_messages: bool
806
809
  can_add_web_page_previews: bool
810
+ can_edit_tag: bool
807
811
  can_change_info: bool
808
812
  can_invite_users: bool
809
813
  can_pin_messages: bool
810
814
  can_manage_topics: bool
811
- until_date: int
815
+ until_date: int
816
+ tag: Optional[str] = Field(default=None)
812
817
 
813
818
  class ChatMemberLeft(ChatMember):
814
819
  '''
@@ -2473,6 +2478,8 @@ class MessageEntity(BaseModel):
2473
2478
  user: Optional[User] = Field(default=None)
2474
2479
  language: Optional[str] = Field(default=None)
2475
2480
  custom_emoji_id: Optional[str] = Field(default=None)
2481
+ unix_time: Optional[int] = Field(default=None)
2482
+ date_time_format: Optional[str] = Field(default=None)
2476
2483
 
2477
2484
  @staticmethod
2478
2485
  def from_dict(
@@ -3706,7 +3713,8 @@ class ChatAdministratorRights(BaseModel):
3706
3713
  can_edit_messages: Optional[bool] = Field(default=None)
3707
3714
  can_pin_messages: Optional[bool] = Field(default=None)
3708
3715
  can_manage_topics: Optional[bool] = Field(default=None)
3709
- can_manage_direct_messages: Optional[bool] = Field(default=None)
3716
+ can_manage_direct_messages: Optional[bool] = Field(default=None)
3717
+ can_manage_tags: Optional[bool] = Field(default=None)
3710
3718
 
3711
3719
  class ChatMemberUpdated(BaseModel):
3712
3720
  '''
@@ -3782,6 +3790,7 @@ class ChatPermissions(BaseModel):
3782
3790
  can_send_polls: Optional[bool] = Field(default=None)
3783
3791
  can_send_other_messages: Optional[bool] = Field(default=None)
3784
3792
  can_add_web_page_previews: Optional[bool] = Field(default=None)
3793
+ can_edit_tag: Optional[bool] = Field(default=None)
3785
3794
  can_change_info: Optional[bool] = Field(default=None)
3786
3795
  can_invite_users: Optional[bool] = Field(default=None)
3787
3796
  can_pin_messages: Optional[bool] = Field(default=None)
File without changes
File without changes
File without changes