Какую роль играет types импорттированный из telebot?
Начал значит я учить как создавать ботов в telegram, и в ресурсе где я учу не уточняется многие термины связанные с telebot было бы круто если бы кто-то скинул сайт где все подробно расписано, так как я чайник, а основной вопрос это - "Какую роль играет types импорттированный из telebot?"
Ответы (1 шт):
Открыл репозиторий библиотеки и там есть документация: https://github.com/eternnoir/pyTelegramBotAPI#types
All types are defined in types.py. They are all completely in line with the Telegram API's definition of the types, except for the Message's from field, which is renamed to from_user (because from is a Python reserved token). Thus, attributes such as message_id can be accessed directly with message.message_id. Note that message.chat can be either an instance of User or GroupChat (see How can I distinguish a User and a GroupChat in message.chat?).
The Message object also has a content_typeattribute, which defines the type of the Message. content_type can be one of the following strings: text, audio, document, photo, sticker, video, video_note, voice, location, contact, new_chat_members, left_chat_member, new_chat_title, new_chat_photo, delete_chat_photo, group_chat_created, supergroup_chat_created, channel_chat_created, migrate_to_chat_id, migrate_from_chat_id, pinned_message.
You can use some types in one function. Example:
content_types=["text", "sticker", "pinned_message", "photo", "audio"]