Skip to content

Commit

Permalink
new method: send_media_from_file_id
Browse files Browse the repository at this point in the history
  • Loading branch information
z44d committed Jul 6, 2024
1 parent 50c2b89 commit 236f094
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions tgram/methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -2387,3 +2387,42 @@ async def ask(
filters=filters or tgram.filters.all,
)
)

async def send_media_from_file_id(
self: "tgram.TgBot",
chat_id: Union[int, str],
file_id: str,
business_connection_id: str = None,
message_thread_id: int = None,
caption: str = None,
parse_mode: str = None,
caption_entities: List[MessageEntity] = None,
show_caption_above_media: bool = None,
disable_notification: bool = None,
protect_content: bool = None,
message_effect_id: str = None,
reply_parameters: ReplyParameters = None,
reply_markup: Union[
InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply
] = None,
) -> Message:
file = await self.get_file(file_id)
file_type = file.file_path.split("/")[0][:-1].title()

result = await self._send_request(
f"send{file_type}",
chat_id=chat_id,
business_connection_id=business_connection_id,
message_thread_id=message_thread_id,
caption=caption,
parse_mode=parse_mode,
caption_entities=caption_entities,
show_caption_above_media=show_caption_above_media,
disable_notification=disable_notification,
protect_content=protect_content,
message_effect_id=message_effect_id,
reply_parameters=reply_parameters,
reply_markup=reply_markup,
)

return Message._parse(me=self, d=result["result"])
Empty file added tgram/tes
Empty file.

0 comments on commit 236f094

Please sign in to comment.