botapi-py 1.4.12__tar.gz → 1.4.14__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.4.12
3
+ Version: 1.4.14
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.4.12"
3
+ version = "1.4.14"
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 = [
@@ -57,7 +57,7 @@ class MediaType(enum.StrEnum):
57
57
  VIDEO = 'video'
58
58
  VIDEO_NOTE = 'video_note'
59
59
  VOICE = 'voice'
60
- STORY = 'story'
60
+ STORY = 'story' # does not have `file_id`, only `id`
61
61
  PAID_MEDIA = 'paid_media'
62
62
 
63
63
  class ServiceMessage(enum.StrEnum):
@@ -18,7 +18,7 @@ class BotShortcuts:
18
18
  self,
19
19
  chat_id: Union[int, str],
20
20
  media: Union[types.InputFile, str, None],
21
- file_type: Optional[enums.MediaType],
21
+ file_type: Optional[enums.MediaType | str],
22
22
  caption: Optional[str] = None,
23
23
  parse_mode: Optional[enums.ParseMode] = enums.ParseMode.HTML,
24
24
  caption_entities: Optional[List[types.MessageEntity]] = None,
@@ -355,6 +355,32 @@ class Message(MaybeInaccessibleMessage, frozen=True):
355
355
 
356
356
  return None
357
357
 
358
+ @property
359
+ def media_type(self) -> Optional[enums.MediaType]:
360
+ '''
361
+ Type of the actual multimedia message content (e.g., `photo`, `sticker`, `video`, etc.).
362
+
363
+ See `enums.MediaType` for all available media
364
+ '''
365
+ for media_type in enums.MediaType:
366
+ if getattr(self, media_type.value) is not None:
367
+ return media_type
368
+
369
+ return None
370
+
371
+ @property
372
+ def service_message_type(self) -> Optional[enums.ServiceMessage]:
373
+ '''
374
+ Type of the actual service message content (e.g., `new_chat_title`, `new_chat_title`, `pinned_message`, etc.).
375
+
376
+ See `enums.ServiceMessage` for all available service message
377
+ '''
378
+ for message_type in enums.ServiceMessage:
379
+ if getattr(self, message_type.value) is not None:
380
+ return message_type
381
+
382
+ return None
383
+
358
384
  @property
359
385
  def message_type(self) -> Optional[enums.MessageType]:
360
386
  '''