mirror of
https://github.com/aiogram/aiogram.git
synced 2025-12-15 20:02:22 +00:00
Refactor send document
This commit is contained in:
parent
a3f1056f52
commit
23863c587c
1 changed files with 12 additions and 0 deletions
|
|
@ -158,3 +158,15 @@ class AIOGramBot:
|
|||
|
||||
payload = generate_payload(**locals(), exclude=[_METHOD])
|
||||
return await self._send_file(_METHOD, audio, payload)
|
||||
|
||||
async def send_document(self, chat_id, document, caption=None, disable_notification=None, reply_to_message_id=None,
|
||||
reply_markup=None):
|
||||
_METHOD = 'document'
|
||||
if reply_markup and hasattr(reply_markup, 'to_json'):
|
||||
reply_markup = json.dumps(reply_markup.to_json())
|
||||
|
||||
if hasattr(reply_to_message_id, 'message_id'):
|
||||
reply_to_message_id = reply_to_message_id.message_id
|
||||
|
||||
payload = generate_payload(**locals(), exclude=['document'])
|
||||
return await self._send_file(_METHOD, document, payload)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue