botapi-py 1.3.2__tar.gz → 1.3.3__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.3.2
3
+ Version: 1.3.3
4
4
  Summary: A simple and flexible Python library to conveniently build 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.3.2"
3
+ version = "1.3.3"
4
4
  description = "A simple and flexible Python library to conveniently build Telegram bots using the Bot API."
5
5
  # readme = "README.md"
6
6
  # authors = [
@@ -17,7 +17,7 @@ class GetUpdatesAsyncDispatcher:
17
17
  update_handler: UpdateHandler
18
18
  tasks_shutdown_timeout: float
19
19
  tasks: set[asyncio.Task] # prevent gc from collecting tasks before they finish
20
- bot: botapi.api.BotAPI
20
+ bot: 'botapi.api.BotAPI'
21
21
  reconnect_delay: float
22
22
  allowed_updates: list[str]
23
23
  offset: int
@@ -25,7 +25,7 @@ class GetUpdatesAsyncDispatcher:
25
25
  def __init__(
26
26
  self,
27
27
  update_handler: UpdateHandler,
28
- bot: botapi.api.BotAPI,
28
+ bot: 'botapi.api.BotAPI',
29
29
  allowed_updates: list[str], # botapi.enums.UpdateType
30
30
  reconnect_delay: float = 5,
31
31
  shutdown_wait_timeout: float = 3
@@ -1,4 +1,6 @@
1
1
  import enum
2
+ from typing import Union
3
+
2
4
 
3
5
  class ChatType(enum.StrEnum):
4
6
  PRIVATE = 'private'
@@ -100,11 +102,9 @@ class ServiceMessage(enum.StrEnum):
100
102
  WEB_APP_DATA = 'web_app_data'
101
103
  SUGGESTED_POST = 'suggested_post_info'
102
104
 
103
- # @boilerplate.extend_enum(MediaType, ServiceMessage)
104
- class MessageType(enum.StrEnum):
105
+ class OtherMessageType(enum.StrEnum):
105
106
  '''
106
- The content of this message.
107
- All of these fields should be mutually exclusive.
107
+ The type of this message (that does NOT contain multimedia or service content).
108
108
  '''
109
109
  TEXT = 'text'
110
110
  CHECKLIST = 'checklist'
@@ -116,68 +116,17 @@ class MessageType(enum.StrEnum):
116
116
  LOCATION = 'location'
117
117
  CONTACT = 'contact'
118
118
 
119
- # MediaType - Python sucks.
120
- ANIMATION = 'animation'
121
- AUDIO = 'audio'
122
- DOCUMENT = 'document'
123
- PHOTO = 'photo'
124
- STICKER = 'sticker'
125
- VIDEO = 'video'
126
- VIDEO_NOTE = 'video_note'
127
- VOICE = 'voice'
128
- STORY = 'story'
129
- PAID_MEDIA = 'paid_media'
130
-
131
- # ServiceMessage - Python sucks.
132
- NEW_CHAT_MEMBERS = 'new_chat_members'
133
- LEFT_CHAT_MEMBER = 'left_chat_member'
134
- NEW_CHAT_TITLE = 'new_chat_title'
135
- NEW_CHAT_PHOTO = 'new_chat_photo'
136
- DELETE_CHAT_PHOTO = 'delete_chat_photo'
137
- GROUP_CHAT_CREATED = 'group_chat_created'
138
- SUPERGROUP_CHAT_CREATED = 'supergroup_chat_created'
139
- CHANNEL_CHAT_CREATED = 'channel_chat_created'
140
- MESSAGE_AUTO_DELETE_TIMER_CHANGED = 'message_auto_delete_timer_changed'
141
- MIGRATE_TO_CHAT_ID = 'migrate_to_chat_id'
142
- MIGRATE_FROM_CHAT_ID = 'migrate_from_chat_id'
143
- PINNED_MESSAGE = 'pinned_message'
144
- SUCCESSFUL_PAYMENT = 'successful_payment'
145
- REFUNDED_PAYMENT = 'refunded_payment'
146
- USERS_SHARED = 'users_shared'
147
- CHAT_SHARED = 'chat_shared'
148
- GIFT = 'gift'
149
- UNIQUE_GIFT = 'unique_gift'
150
- CONNECTED_WEBSITE = 'connected_website'
151
- WRITE_ACCESS_ALLOWED = 'write_access_allowed'
152
- PASSPORT_DATA = 'passport_data'
153
- PROXIMITY_ALERT_TRIGGERED = 'proximity_alert_triggered'
154
- BOOST_ADDED = 'boost_added'
155
- CHAT_BACKGROUND_SET = 'chat_background_set'
156
- CHECKLIST_TASKS_DONE = 'checklist_tasks_done'
157
- CHECKLIST_TASKS_ADDED = 'checklist_tasks_added'
158
- DIRECT_MESSAGE_PRICE_CHANGED = 'direct_message_price_changed'
159
- FORUM_TOPIC_CREATED = 'forum_topic_created'
160
- FORUM_TOPIC_EDITED = 'forum_topic_edited'
161
- FORUM_TOPIC_CLOSED = 'forum_topic_closed'
162
- FORUM_TOPIC_REOPENED = 'forum_topic_reopened'
163
- GENERAL_FORUM_TOPIC_HIDDEN = 'general_forum_topic_hidden'
164
- GENERAL_FORUM_TOPIC_UNHIDDEN = 'general_forum_topic_unhidden'
165
- GIVEAWAY = 'giveaway'
166
- GIVEAWAY_CREATED = 'giveaway_created'
167
- GIVEAWAY_WINNERS = 'giveaway_winners'
168
- GIVEAWAY_COMPLETED = 'giveaway_completed'
169
- PAID_MESSAGE_PRICE_CHANGED = 'paid_message_price_changed'
170
- SUGGESTED_POST_APPROVED = 'suggested_post_approved'
171
- SUGGESTED_POST_APPROVAL_FAILED = 'suggested_post_approval_failed'
172
- SUGGESTED_POST_DECLINED = 'suggested_post_declined'
173
- SUGGESTED_POST_PAID = 'suggested_post_paid'
174
- SUGGESTED_POST_REFUNDED = 'suggested_post_refunded'
175
- VIDEO_CHAT_SCHEDULED = 'video_chat_scheduled'
176
- VIDEO_CHAT_STARTED = 'video_chat_started'
177
- VIDEO_CHAT_ENDED = 'video_chat_ended'
178
- VIDEO_CHAT_PARTICIPANTS_INVITED = 'video_chat_participants_invited'
179
- WEB_APP_DATA = 'web_app_data'
180
- SUGGESTED_POST = 'suggested_post_info'
119
+ MessageType = Union[
120
+ MediaType,
121
+ ServiceMessage,
122
+ OtherMessageType
123
+ ]
124
+ '''
125
+ The type of the **actual** message content.
126
+
127
+ All of the fields are mutually exclusive, since a message
128
+ can only be of one 'type' at a time.
129
+ '''
181
130
 
182
131
  class ChatMemberStatus(enum.StrEnum):
183
132
  '''
File without changes
File without changes
File without changes
File without changes