mirror of
https://github.com/aiogram/aiogram.git
synced 2025-12-15 20:02:22 +00:00
Add send contact and chat action
This commit is contained in:
parent
7c7778489a
commit
5534b5b802
2 changed files with 21 additions and 4 deletions
|
|
@ -98,10 +98,10 @@ class ApiMethods:
|
|||
SEND_VIDEO = 'sendVideo'
|
||||
SEND_VOICE = 'sendVoice'
|
||||
SEND_VIDEO_NOTE = 'sendVideoNote'
|
||||
SEND_LOCATION = 'sendLocation' # TODO
|
||||
SEND_VENUE = 'sendVenue' # TODO
|
||||
SEND_CONTACT = 'sendContact' # TODO
|
||||
SEND_CHAT_ACTION = 'sendChatAction' # TODO
|
||||
SEND_LOCATION = 'sendLocation'
|
||||
SEND_VENUE = 'sendVenue'
|
||||
SEND_CONTACT = 'sendContact'
|
||||
SEND_CHAT_ACTION = 'sendChatAction'
|
||||
GET_USER_PROFILE_PHOTOS = 'getUserProfilePhotos' # TODO
|
||||
GET_FILE = 'getFile' # TODO
|
||||
KICK_CHAT_MEMBER = 'kickChatMember' # TODO
|
||||
|
|
|
|||
|
|
@ -242,3 +242,20 @@ class AIOGramBot:
|
|||
payload = generate_payload(**locals())
|
||||
message = await self.request(ApiMethods.SEND_VENUE, payload)
|
||||
return self.prepare_object(Message.de_json(message))
|
||||
|
||||
async def send_contact(self, chat_id, phone_number, first_name, last_name=None, disable_notification=None,
|
||||
reply_to_message_id=None, reply_markup=None):
|
||||
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())
|
||||
message = await self.request(ApiMethods.SEND_CONTACT, payload)
|
||||
return self.prepare_object(Message.de_json(message))
|
||||
|
||||
async def send_chat_action(self, chat_id, action):
|
||||
payload = generate_payload(**locals())
|
||||
message = await self.request(ApiMethods.SEND_CHAT_ACTION, payload)
|
||||
return self.prepare_object(Message.de_json(message))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue