1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-23 19:44:20 +00:00

Added set_chat_action

This commit is contained in:
Steffo 2017-03-27 12:48:41 +02:00
parent d98b4e919c
commit fb0d03ac51

View file

@ -234,6 +234,28 @@ class Chat:
await bot.api_request("sendMessage", text=text, chat_id=self.chat_id, **params) await bot.api_request("sendMessage", text=text, chat_id=self.chat_id, **params)
async def set_chat_action(self, bot, action):
"""Set a status for the chat.
Valid actions are:
typing
upload_photo
record_video
upload_video
record_audio
upload_audio
upload_document
find_location"""
# TODO: This could give problems if a class inherits Bot
if not isinstance(bot, Bot):
raise TypeError("bot is not an instance of Bot.")
# Check if the action is valid
if action not in ["typing", "upload_photo", "record_video", "upload_video", "record_audio", "upload_audio", "upload_document", "find_location"]:
raise ValueError("Invalid action")
# Send the request
await bot.api_request("sendChatAction", chat_id=self.chat_id, action=action)
class User: class User:
def __init__(self, user_dict): def __init__(self, user_dict):
self.user_id = user_dict["id"] self.user_id = user_dict["id"]