From 25aafbca491e88dc9f4062524d00239cdac6a0ab Mon Sep 17 00:00:00 2001 From: ShiroNoHaga Date: Mon, 3 Jan 2022 05:58:30 +0200 Subject: [PATCH] Add class helper ChatAction --- aiogram/types/__init__.py | 2 ++ aiogram/types/chat_action.py | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 aiogram/types/chat_action.py diff --git a/aiogram/types/__init__.py b/aiogram/types/__init__.py index ebf4c839..6c44fae1 100644 --- a/aiogram/types/__init__.py +++ b/aiogram/types/__init__.py @@ -13,6 +13,7 @@ from .bot_command_scope_default import BotCommandScopeDefault from .callback_game import CallbackGame from .callback_query import CallbackQuery from .chat import Chat +from .chat_action import ChatAction from .chat_invite_link import ChatInviteLink from .chat_join_request import ChatJoinRequest from .chat_location import ChatLocation @@ -259,6 +260,7 @@ __all__ = ( "Game", "CallbackGame", "GameHighScore", + "ChatAction" ) # Load typing forward refs for every TelegramObject diff --git a/aiogram/types/chat_action.py b/aiogram/types/chat_action.py new file mode 100644 index 00000000..1529f5e1 --- /dev/null +++ b/aiogram/types/chat_action.py @@ -0,0 +1,35 @@ +from ..utils import helper + + +class ChatAction(helper.Helper): + """ + This object represents bot actions. + + Choose one, depending on what the user is about to receive: + • typing for text messages, + • upload_photo for photos, + • record_video or upload_video for videos, + • record_voice or upload_voice for voice notes, + • upload_document for general files, + • choose_sticker for stickers, + • find_location for location data, + • record_video_note or upload_video_note for video notes. + + Source: https://core.telegram.org/bots/api#sendchataction + """ + + mode = helper.HelperMode.snake_case + + TYPING: str = helper.Item() # typing + UPLOAD_PHOTO: str = helper.Item() # upload_photo + RECORD_VIDEO: str = helper.Item() # record_video + UPLOAD_VIDEO: str = helper.Item() # upload_video + RECORD_AUDIO: str = helper.Item() # record_audio + UPLOAD_AUDIO: str = helper.Item() # upload_audio + RECORD_VOICE: str = helper.Item() # record_voice + UPLOAD_VOICE: str = helper.Item() # upload_voice + UPLOAD_DOCUMENT: str = helper.Item() # upload_document + FIND_LOCATION: str = helper.Item() # find_location + RECORD_VIDEO_NOTE: str = helper.Item() # record_video_note + UPLOAD_VIDEO_NOTE: str = helper.Item() # upload_video_note + CHOOSE_STICKER: str = helper.Item() # choose_sticker