botapi-py 1.3.1__tar.gz → 1.3.2__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.1
3
+ Version: 1.3.2
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.1"
3
+ version = "1.3.2"
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 = [
@@ -1,5 +1,8 @@
1
1
  from .get_updates_handler import GetUpdatesAsyncDispatcher
2
- from .redis_pubsub_handler import RedisPubSubAsyncDispatcher
2
+ try:
3
+ from .redis_pubsub_handler import RedisPubSubAsyncDispatcher
4
+ except ImportError:
5
+ pass
3
6
 
4
7
  __all__ = [
5
8
  'GetUpdatesAsyncDispatcher',
@@ -11,8 +11,9 @@ try:
11
11
  import redis.asyncio as redis
12
12
  from redis.asyncio.client import PubSub
13
13
  _has_redis = True
14
- except ImportError:
14
+ except ImportError as e:
15
15
  _has_redis = False
16
+ raise e
16
17
 
17
18
  logger = logging.getLogger(__name__)
18
19
 
@@ -1,7 +1,5 @@
1
1
  import enum
2
2
 
3
- from . import boilerplate
4
-
5
3
  class ChatType(enum.StrEnum):
6
4
  PRIVATE = 'private'
7
5
  GROUP = 'group'
@@ -102,7 +100,7 @@ class ServiceMessage(enum.StrEnum):
102
100
  WEB_APP_DATA = 'web_app_data'
103
101
  SUGGESTED_POST = 'suggested_post_info'
104
102
 
105
- @boilerplate.extend_enum(MediaType, ServiceMessage)
103
+ # @boilerplate.extend_enum(MediaType, ServiceMessage)
106
104
  class MessageType(enum.StrEnum):
107
105
  '''
108
106
  The content of this message.
@@ -118,6 +116,69 @@ class MessageType(enum.StrEnum):
118
116
  LOCATION = 'location'
119
117
  CONTACT = 'contact'
120
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'
181
+
121
182
  class ChatMemberStatus(enum.StrEnum):
122
183
  '''
123
184
  Statuses of a chat member.
@@ -1,20 +0,0 @@
1
- import enum
2
-
3
- from typing import TypeVar, Callable
4
-
5
- # Enums
6
- E = TypeVar('E', bound=enum.Enum)
7
-
8
- def extend_enum(*sources: type[E]) -> Callable[..., type[E]]:
9
- '''
10
- Decorator that extends an Enum class with members
11
- from one or more source Enum classes.
12
- '''
13
- def decorator(target: type[E]) -> type[E]:
14
- for source in sources:
15
- for member in source:
16
- if member.name not in target.__members__:
17
- target._member_map_[member.name] = member
18
- return target
19
- return decorator
20
-
File without changes
File without changes
File without changes
File without changes