python-trueconf-bot 1.2.3__tar.gz → 1.3.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/PKG-INFO +2 -1
- python_trueconf_bot-1.3.0/docs/context7.json +4 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/docs/en/examples/index.md +6 -1
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/docs/en/features.md +5 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/docs/en/index.md +5 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/docs/en/learn/enums.md +5 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/docs/en/learn/files.md +1 -1
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/docs/en/learn/filters.md +1 -1
- python_trueconf_bot-1.3.0/docs/en/learn/getting-started.md +272 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/docs/en/learn/parse-messages.md +5 -0
- python_trueconf_bot-1.3.0/docs/en/learn/restrictions.md +45 -0
- python_trueconf_bot-1.3.0/docs/en/learn/send_message.md +224 -0
- python_trueconf_bot-1.3.0/docs/en/learn/shortcuts.md +71 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/docs/en/learn/types.md +5 -0
- python_trueconf_bot-1.3.0/docs/en/reference/Exceptions.md +5 -0
- python_trueconf_bot-1.3.0/docs/en/reference/Formatting.md +5 -0
- python_trueconf_bot-1.3.0/docs/en/release_notes.md +248 -0
- python_trueconf_bot-1.3.0/docs/overrides/main.html +28 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/docs/ru/examples/index.md +6 -1
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/docs/ru/features.md +5 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/docs/ru/index.md +5 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/docs/ru/learn/enums.md +5 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/docs/ru/learn/files.md +1 -1
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/docs/ru/learn/filters.md +1 -1
- python_trueconf_bot-1.3.0/docs/ru/learn/getting-started.md +270 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/docs/ru/learn/parse-messages.md +1 -1
- python_trueconf_bot-1.3.0/docs/ru/learn/restrictions.md +46 -0
- python_trueconf_bot-1.3.0/docs/ru/learn/send_message.md +224 -0
- python_trueconf_bot-1.3.0/docs/ru/learn/shortcuts.md +72 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/docs/ru/learn/types.md +5 -0
- python_trueconf_bot-1.3.0/docs/ru/release_notes.md +231 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/mkdocs.yml +7 -1
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/pyproject.toml +2 -1
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/python_trueconf_bot.egg-info/PKG-INFO +2 -1
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/python_trueconf_bot.egg-info/SOURCES.txt +14 -1
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/python_trueconf_bot.egg-info/requires.txt +1 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/_version.py +3 -3
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/client/bot.py +184 -34
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/exceptions.py +107 -10
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/types/message.py +57 -21
- python_trueconf_bot-1.3.0/trueconf/utils/_ssl.py +44 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/utils/_token.py +4 -4
- python_trueconf_bot-1.3.0/trueconf/utils/formatting/__init__.py +21 -0
- python_trueconf_bot-1.3.0/trueconf/utils/formatting/decorations.py +87 -0
- python_trueconf_bot-1.3.0/trueconf/utils/formatting/text.py +252 -0
- python_trueconf_bot-1.2.3/docs/en/learn/getting-started.md +0 -104
- python_trueconf_bot-1.2.3/docs/en/release_notes.md +0 -56
- python_trueconf_bot-1.2.3/docs/overrides/main.html +0 -8
- python_trueconf_bot-1.2.3/docs/ru/learn/getting-started.md +0 -105
- python_trueconf_bot-1.2.3/docs/ru/release_notes.md +0 -45
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/.github/workflows/docs.yml +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/.github/workflows/release-test.yml +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/.github/workflows/release.yml +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/.gitignore +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/LICENSE +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/README-PyPI.md +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/README-ru.md +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/README.md +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/assets/head_en.png +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/assets/head_ru.png +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/assets/logo.svg +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/docs/en/img/head.png +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/docs/en/img/router_scheme_en.svg +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/docs/en/reference/Bot.md +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/docs/en/reference/Dispatcher.md +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/docs/en/reference/Enums.md +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/docs/en/reference/Responses.md +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/docs/en/reference/Router.md +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/docs/en/reference/Types.md +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/docs/en/reference/index.md +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/docs/hooks/llms_txt.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/docs/img/chatbot.svg +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/docs/img/favicon.ico +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/docs/img/logo.svg +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/docs/ru/img/head.png +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/docs/ru/img/router_scheme_ru.svg +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/docs/stylesheets/extra.css +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/examples/README-ru.md +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/examples/README.md +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/examples/add_big_list_users_to_channel.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/examples/filters.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/examples/report_bot.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/examples/update_token.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/examples/webhook.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/python_trueconf_bot.egg-info/dependency_links.txt +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/python_trueconf_bot.egg-info/top_level.txt +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/requirements-docs.txt +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/requirements.txt +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/setup.cfg +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/__init__.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/client/__init__.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/client/context_controller.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/client/session.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/dispatcher/__init__.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/dispatcher/dispatcher.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/dispatcher/router.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/enums/__init__.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/enums/aouth_error.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/enums/chat_participant_role.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/enums/chat_type.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/enums/envelope_author_type.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/enums/file_ready_state.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/enums/incoming_update_method.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/enums/message_type.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/enums/parse_mode.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/enums/survey_type.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/enums/update_type.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/filters/__init__.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/filters/base.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/filters/command.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/filters/instance_of.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/filters/message.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/filters/method.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/loggers.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/methods/__init__.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/methods/add_participant_to_chat.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/methods/auth.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/methods/base.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/methods/change_participant_role.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/methods/clear_chat_history.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/methods/create_channel.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/methods/create_favorites_chat.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/methods/create_group_chat.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/methods/create_p2p_chat.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/methods/edit_chat_avatar.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/methods/edit_chat_title.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/methods/edit_message.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/methods/edit_survey.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/methods/forward_message.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/methods/get_chat_by_id.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/methods/get_chat_history.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/methods/get_chat_participant.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/methods/get_chat_participants.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/methods/get_chats.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/methods/get_file_info.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/methods/get_file_upload_limits.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/methods/get_message_by_id.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/methods/get_user_display_name.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/methods/has_chat_participant.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/methods/remove_chat.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/methods/remove_message.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/methods/remove_participant_from_chat.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/methods/send_file.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/methods/send_message.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/methods/send_survey.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/methods/subscribe_file_progress.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/methods/unsubscribe_file_progress.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/methods/upload_file.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/py.typed +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/types/__init__.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/types/author_box.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/types/chat_participant.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/types/content/__init__.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/types/content/attachment.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/types/content/base.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/types/content/chat_created.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/types/content/document.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/types/content/edit_chat_title.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/types/content/forward_message.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/types/content/location.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/types/content/photo.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/types/content/remove_participant.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/types/content/sticker.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/types/content/survey.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/types/content/text.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/types/content/video.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/types/input_file.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/types/last_message.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/types/parser.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/types/requests/__init__.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/types/requests/added_chat_participant.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/types/requests/changed_file_upload_limits.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/types/requests/changed_participant_role.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/types/requests/cleared_chat_history.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/types/requests/created_channel.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/types/requests/created_favorites_chat.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/types/requests/created_group_chat.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/types/requests/created_personal_chat.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/types/requests/edited_chat_avatar.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/types/requests/edited_chat_title.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/types/requests/edited_message.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/types/requests/removed_chat.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/types/requests/removed_chat_participant.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/types/requests/removed_message.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/types/requests/uploading_progress.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/types/responses/__init__.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/types/responses/add_chat_participant_response.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/types/responses/api_error.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/types/responses/auth_response_payload.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/types/responses/change_participant_role_response.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/types/responses/clear_chat_history_response.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/types/responses/create_channel_response.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/types/responses/create_favorites_chat_response.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/types/responses/create_group_chat_response.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/types/responses/create_p2p_chat_response.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/types/responses/edit_chat_avatar_response.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/types/responses/edit_chat_title_response.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/types/responses/edit_message_response.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/types/responses/edit_survey_response.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/types/responses/forward_message_response.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/types/responses/get_chat_by_id_response.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/types/responses/get_chat_history_response.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/types/responses/get_chat_participant_response.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/types/responses/get_chat_participants_response.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/types/responses/get_chats_response.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/types/responses/get_file_info_response.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/types/responses/get_file_upload_limits_response.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/types/responses/get_message_by_id_response.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/types/responses/get_user_display_name_response.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/types/responses/has_chat_participant_response.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/types/responses/remove_chat_participant_response.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/types/responses/remove_chat_response.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/types/responses/remove_message_response.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/types/responses/send_file_response.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/types/responses/send_message_response.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/types/responses/send_survey_response.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/types/responses/subscribe_file_progress_response.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/types/responses/unsubscribe_file_progress_response.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/types/responses/upload_file_response.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/types/update.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/utils/__init__.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/utils/_generate_secret_for_survey.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/utils/_version_checker.py +0 -0
- {python_trueconf_bot-1.2.3 → python_trueconf_bot-1.3.0}/trueconf/utils/split_text.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: python-trueconf-bot
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.3.0
|
|
4
4
|
Summary: Lightweight and powerful framework for the TrueConf Server Chatbot API
|
|
5
5
|
Author-email: TrueConf LLC <info@trueconf.com>, Anton Baadzhi <baadzhianton@gmail.com>
|
|
6
6
|
License-Expression: BSD-3-Clause-Clear
|
|
@@ -35,6 +35,7 @@ Requires-Dist: python-magic>=0.4.27; sys_platform != "win32"
|
|
|
35
35
|
Requires-Dist: python-magic-bin==0.4.14; sys_platform == "win32"
|
|
36
36
|
Requires-Dist: filetype
|
|
37
37
|
Requires-Dist: packaging
|
|
38
|
+
Requires-Dist: truststore
|
|
38
39
|
Dynamic: license-file
|
|
39
40
|
|
|
40
41
|
<p align="center">
|
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Getting Started
|
|
3
|
+
icon: material/run
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Getting Started
|
|
7
|
+
|
|
8
|
+
Before getting started, we recommend creating and activating a virtual environment to isolate your project dependencies:
|
|
9
|
+
|
|
10
|
+
```shell
|
|
11
|
+
python -m venv .venv
|
|
12
|
+
source .venv/bin/activate # Linux / macOS
|
|
13
|
+
.venv\Scripts\activate # Windows PowerShell
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Installing {{product_name}}
|
|
17
|
+
|
|
18
|
+
To begin working with {{product_name}}, install the package from the global PyPI repository:
|
|
19
|
+
|
|
20
|
+
```shell
|
|
21
|
+
pip install {{product_name}}
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
!!! info
|
|
25
|
+
Upon installation, dependencies will be automatically pulled in: `websockets`, `httpx`, `mashumaro`, `pillow`, `aiofiles`, `magic-filter`.
|
|
26
|
+
|
|
27
|
+
## Creating a Basic Echo Bot
|
|
28
|
+
|
|
29
|
+
First, import the required classes:
|
|
30
|
+
|
|
31
|
+
```python
|
|
32
|
+
from trueconf import Bot, Dispatcher, Router, F
|
|
33
|
+
from trueconf.types import Message
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Next, create instances of `Router` and `Dispatcher` and connect them:
|
|
37
|
+
|
|
38
|
+
```python
|
|
39
|
+
r = Router()
|
|
40
|
+
dp = Dispatcher()
|
|
41
|
+
# dp.include_router(r)
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
The bot supports two types of authentication: token-based or login/password. You can choose the most convenient method.
|
|
45
|
+
|
|
46
|
+
### Token-Based Authentication
|
|
47
|
+
|
|
48
|
+
If you're using token-based connection, obtain the token as described in the [official API documentation](https://trueconf.ru/docs/chatbot-connector/ru/connect-and-auth/#access-token).
|
|
49
|
+
|
|
50
|
+
It is recommended to store the token in an environment variable or `.env` file. Don’t forget to add `.env` to `.gitignore` if working with public repositories.
|
|
51
|
+
|
|
52
|
+
```python
|
|
53
|
+
from os import getenv
|
|
54
|
+
|
|
55
|
+
TOKEN = getenv("TOKEN")
|
|
56
|
+
bot = Bot(server="video.example.com", token=TOKEN, dispatcher=dp)
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
!!! Note
|
|
60
|
+
The token is valid for one month from the moment it is created.
|
|
61
|
+
However, an already authorized connection remains active until it is closed, even after the token has expired.
|
|
62
|
+
In theory, such a connection can persist for years.
|
|
63
|
+
|
|
64
|
+
### Login/Password Authentication
|
|
65
|
+
|
|
66
|
+
Use the `.from_credentials` method:
|
|
67
|
+
|
|
68
|
+
```python
|
|
69
|
+
bot = Bot.from_credentials(
|
|
70
|
+
username="echo_bot",
|
|
71
|
+
password="123tr",
|
|
72
|
+
server="10.110.2.240",
|
|
73
|
+
dispatcher=dp
|
|
74
|
+
)
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
!!! info
|
|
78
|
+
Each time **from\_credentials()** is called, the bot requests a new token from the server.
|
|
79
|
+
The token lifespan is 1 month.
|
|
80
|
+
|
|
81
|
+
### Message Handler
|
|
82
|
+
|
|
83
|
+
Now let’s create a simple handler for incoming messages. It will reply with the same text (a classic "echo bot"):
|
|
84
|
+
|
|
85
|
+
```python
|
|
86
|
+
@r.message(F.text)
|
|
87
|
+
async def echo(message: Message):
|
|
88
|
+
await message.answer(message.text)
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### Running the Bot
|
|
92
|
+
|
|
93
|
+
Run the bot inside an asynchronous `main()` function passed to `asyncio.run()`:
|
|
94
|
+
|
|
95
|
+
```python
|
|
96
|
+
async def main():
|
|
97
|
+
await bot.run()
|
|
98
|
+
|
|
99
|
+
import asyncio
|
|
100
|
+
|
|
101
|
+
if __name__ == "__main__":
|
|
102
|
+
asyncio.run(main())
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
!!! question "Why async/await?"
|
|
106
|
+
The **{{product_name}}** library is built on asyncio.
|
|
107
|
+
|
|
108
|
+
This means that all network operations (connecting to the server, receiving and sending messages) are asynchronous and non-blocking. Therefore:
|
|
109
|
+
|
|
110
|
+
* handlers are written as `async def`,
|
|
111
|
+
* method calls use `await`,
|
|
112
|
+
* the launch is managed via `asyncio.run(...)`.
|
|
113
|
+
|
|
114
|
+
This approach allows handling multiple events and messages in parallel — without delays or blocking.
|
|
115
|
+
|
|
116
|
+
### Automatic Connection Recovery
|
|
117
|
+
|
|
118
|
+
If the WebSocket connection to the server is interrupted, the bot will not stop immediately. Instead, it will automatically attempt to reconnect and continue receiving events.
|
|
119
|
+
|
|
120
|
+
Reconnection uses an exponential backoff strategy: after each failed attempt, the delay increases but does not exceed the `ws_max_delay` value. This helps prevent excessive requests to the server during temporary network issues.
|
|
121
|
+
|
|
122
|
+
By default, the following reconnection parameters are used:
|
|
123
|
+
|
|
124
|
+
```python hl_lines="5-6"
|
|
125
|
+
bot = Bot(
|
|
126
|
+
server="video.example.com",
|
|
127
|
+
token=TOKEN,
|
|
128
|
+
dispatcher=dp,
|
|
129
|
+
ws_max_retries=5,
|
|
130
|
+
ws_max_delay=60,
|
|
131
|
+
)
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
| Parameter | Type | Default | Description |
|
|
135
|
+
| ---------------- | ----- | ------- | --------------------------------------------------------------------------- |
|
|
136
|
+
| `ws_max_retries` | `int` | `5` | Maximum number of connection attempts on network/IP errors before giving up |
|
|
137
|
+
| `ws_max_delay` | `int` | `60` | Maximum delay between reconnection attempts (in seconds) |
|
|
138
|
+
|
|
139
|
+
If your bot runs in an unstable network environment or the server may be temporarily unavailable, you can increase these values:
|
|
140
|
+
|
|
141
|
+
```python hl_lines="5-6"
|
|
142
|
+
bot = Bot(
|
|
143
|
+
server="video.example.com",
|
|
144
|
+
token=TOKEN,
|
|
145
|
+
dispatcher=dp,
|
|
146
|
+
ws_max_retries=10,
|
|
147
|
+
ws_max_delay=120,
|
|
148
|
+
)
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
!!! note
|
|
152
|
+
In case of a normal WebSocket disconnection, the bot will attempt to reconnect using exponential backoff.
|
|
153
|
+
|
|
154
|
+
If the server address is incorrect, the bot will not be able to establish a connection. In this case, the number of retry attempts is limited by `ws_max_retries`, after which a connection error will be raised.
|
|
155
|
+
|
|
156
|
+
## Health-check
|
|
157
|
+
|
|
158
|
+
{{product_name}} supports two approaches for checking bot state:
|
|
159
|
+
|
|
160
|
+
- **push model** — the bot calls a callback function when the connection state changes;
|
|
161
|
+
- **pull model** — the application manually requests the current state via `bot.health_check()`.
|
|
162
|
+
|
|
163
|
+
### Push: callback on state changes
|
|
164
|
+
|
|
165
|
+
The callback is passed via the `on_health_check` parameter when creating the bot.
|
|
166
|
+
The function must be asynchronous and accept a dictionary with the current status:
|
|
167
|
+
|
|
168
|
+
```python
|
|
169
|
+
async def on_health_check(status: dict):
|
|
170
|
+
print("Bot status changed:", status)
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
bot = Bot.from_credentials(
|
|
174
|
+
server="video.example.com",
|
|
175
|
+
username="echo_bot",
|
|
176
|
+
password="123tr",
|
|
177
|
+
dispatcher=dp,
|
|
178
|
+
on_health_check=on_health_check,
|
|
179
|
+
)
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
The callback is triggered whenever the WebSocket connection or authorization state changes.
|
|
183
|
+
For example, the bot may emit the following statuses:
|
|
184
|
+
|
|
185
|
+
- `connected` — the WebSocket connection is established, but the bot is not authorized yet;
|
|
186
|
+
- `authorized` — the bot has successfully authenticated;
|
|
187
|
+
- `disconnected` — the connection has been lost.
|
|
188
|
+
|
|
189
|
+
Example payload:
|
|
190
|
+
|
|
191
|
+
```json
|
|
192
|
+
{
|
|
193
|
+
"status": "authorized",
|
|
194
|
+
"websocket_connected": true,
|
|
195
|
+
"authorized": true,
|
|
196
|
+
"user_id": "echo_bot@video.example.com",
|
|
197
|
+
"server": "video.example.com",
|
|
198
|
+
"port": 443,
|
|
199
|
+
"protocol": "https",
|
|
200
|
+
"timestamp": "2026-05-06T12:00:00+00:00",
|
|
201
|
+
}
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
The push model is useful when you need to react immediately to state changes: write logs, notify monitoring systems, update application state, or alert administrators.
|
|
205
|
+
|
|
206
|
+
### Pull: manual health check
|
|
207
|
+
|
|
208
|
+
The `bot.health_check()` method returns the current bot state at the moment it is called:
|
|
209
|
+
|
|
210
|
+
```python
|
|
211
|
+
status = bot.health_check()
|
|
212
|
+
print(status)
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
Example response:
|
|
216
|
+
|
|
217
|
+
```json
|
|
218
|
+
{
|
|
219
|
+
"status": "authorized",
|
|
220
|
+
"websocket_connected": true,
|
|
221
|
+
"authorized": true,
|
|
222
|
+
"server": "video.example.com",
|
|
223
|
+
"port": 443,
|
|
224
|
+
"protocol": "https",
|
|
225
|
+
"timestamp": "2026-05-06T12:00:00+00:00",
|
|
226
|
+
}
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
The pull model is useful for HTTP health-check endpoints, such as FastAPI, Zabbix, Kubernetes probes, or other monitoring systems:
|
|
230
|
+
|
|
231
|
+
```python
|
|
232
|
+
from fastapi import FastAPI
|
|
233
|
+
|
|
234
|
+
app = FastAPI()
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
@app.get("/health")
|
|
238
|
+
def health():
|
|
239
|
+
return bot.health_check()
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
### Combining push and pull
|
|
243
|
+
|
|
244
|
+
In practice, it is often convenient to use both approaches together.
|
|
245
|
+
The callback updates the latest known state, while the HTTP endpoint exposes it to monitoring systems:
|
|
246
|
+
|
|
247
|
+
```python
|
|
248
|
+
from fastapi import FastAPI
|
|
249
|
+
|
|
250
|
+
app = FastAPI()
|
|
251
|
+
bot_status = {"status": "disconnected"}
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
async def on_health_check(status: dict):
|
|
255
|
+
bot_status.update(status)
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
bot = Bot.from_credentials(
|
|
259
|
+
server="video.example.com",
|
|
260
|
+
username="echo_bot",
|
|
261
|
+
password="123tr",
|
|
262
|
+
dispatcher=dp,
|
|
263
|
+
on_health_check=on_health_check,
|
|
264
|
+
)
|
|
265
|
+
|
|
266
|
+
|
|
267
|
+
@app.get("/health")
|
|
268
|
+
def health():
|
|
269
|
+
return bot_status
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
In this setup, the bot reports state changes through the callback, while external monitoring systems retrieve the current status through HTTP requests.
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Restrictions
|
|
3
|
+
icon: material/alert-octagon-outline
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Restrictions
|
|
7
|
+
|
|
8
|
+
The library performs pre-validation of certain TrueConf Server limits and raises exceptions before sending a request if a value exceeds the allowed threshold.
|
|
9
|
+
|
|
10
|
+
#### Chat Title
|
|
11
|
+
|
|
12
|
+
The maximum chat title length is `255` characters. If a longer title is provided, a [`GroupTitleTooLongError`](../reference/Exceptions.md/#trueconf.exceptions.GroupTitleTooLongError) or [`ChannelTitleTooLongError`](../reference/Exceptions.md/#trueconf.exceptions.ChannelTitleTooLongError) will be raised.
|
|
13
|
+
|
|
14
|
+
#### Message Length
|
|
15
|
+
|
|
16
|
+
The maximum length of a text message is `4096` visible characters. If this limit is exceeded, a [`TextMessageTooLongError`](../reference/Exceptions.md/#trueconf.exceptions.TextMessageTooLongError) will be raised.
|
|
17
|
+
|
|
18
|
+
If you need to send a long message, for example an LLM-generated response, you can split it into multiple parts using `safe_split_text`:
|
|
19
|
+
|
|
20
|
+
```python
|
|
21
|
+
from trueconf.utils import safe_split_text
|
|
22
|
+
|
|
23
|
+
for chunk in safe_split_text(long_text):
|
|
24
|
+
await bot.send_message(
|
|
25
|
+
chat_id=chat_id,
|
|
26
|
+
text=chunk,
|
|
27
|
+
)
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
The `safe_split_text(text)` function returns a list of chunks that can be sent sequentially.
|
|
31
|
+
|
|
32
|
+
#### File Restrictions
|
|
33
|
+
|
|
34
|
+
Limits on file size and allowed extensions are configured by the TrueConf Server administrator. The bot retrieves these parameters from the server and updates them when the settings change:
|
|
35
|
+
|
|
36
|
+
```python
|
|
37
|
+
bot.max_file_size: int | None
|
|
38
|
+
bot.file_extension_filter_mode: str | None
|
|
39
|
+
bot.file_extensions_list: set | None
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
When sending a file, the library checks its size and extension. If the file exceeds the allowed size, a [`FileSizeTooLargeError`](../reference/Exceptions.md/#trueconf.exceptions.FileSizeTooLargeError) will be raised. If the file extension is not allowed by server settings, an [`InvalidFileExtensionError`](../reference/Exceptions.md/#trueconf.exceptions.InvalidFileExtensionError) will be raised.
|
|
43
|
+
|
|
44
|
+
!!! Note
|
|
45
|
+
File restrictions depend on the configuration of the specific TrueConf Server. If the administrator changes the maximum file size or the list of allowed extensions, the bot will automatically receive updated values on the next limits update event.
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Sending messages
|
|
3
|
+
icon: material/message-text-fast-outline
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Sending messages
|
|
7
|
+
|
|
8
|
+
To send a message, the bot must know the `chat_id` of the target chat: a personal chat, group chat, or channel.
|
|
9
|
+
|
|
10
|
+
## How to get `chat_id`?
|
|
11
|
+
|
|
12
|
+
### Personal chats (P2P)
|
|
13
|
+
|
|
14
|
+
To get the `chat_id` of a personal chat, use [`bot.create_personal_chat(user_id)`](../reference/Bot.md/#trueconf.Bot.create_personal_chat).
|
|
15
|
+
If a personal chat with the user does not exist yet, the server will create it.
|
|
16
|
+
If the chat already exists, the server will return the existing `chat_id`.
|
|
17
|
+
|
|
18
|
+
```python
|
|
19
|
+
chat = await bot.create_personal_chat(user_id="john_doe@video.example.com")
|
|
20
|
+
|
|
21
|
+
await bot.send_message(
|
|
22
|
+
chat_id=chat.chat_id,
|
|
23
|
+
text="Hello!",
|
|
24
|
+
)
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### Group chats and channels
|
|
28
|
+
|
|
29
|
+
Be careful with [group chats](../reference/Bot.md/#trueconf.Bot.create_group_chat) and [channels](../reference/Bot.md/#trueconf.Bot.create_channel). Methods that create group chats and channels always create a new chat:
|
|
30
|
+
|
|
31
|
+
```python
|
|
32
|
+
chat = await bot.create_group_chat(title="Support")
|
|
33
|
+
channel = await bot.create_channel(title="News")
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
If you call such a method again with the same title, another chat or channel with the same `title` will be created.
|
|
37
|
+
Therefore, after creating a group chat or channel, it is better to save its `chat_id` in a database, configuration file, or another persistent storage.
|
|
38
|
+
|
|
39
|
+
!!! Question "What if the chat already exists? How do I get its `chat_id`?"
|
|
40
|
+
|
|
41
|
+
### Finding an existing chat
|
|
42
|
+
|
|
43
|
+
You can get the list of available chats with [`bot.get_chats()`](../reference/Bot.md/#trueconf.Bot.get_chats):
|
|
44
|
+
|
|
45
|
+
```python
|
|
46
|
+
response = await bot.get_chats(count=10, page=1)
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
The method returns [`GetChatsResponse`](../reference/Responses.md/#trueconf.types.responses.GetChatsResponse) with the `list` parameter containing the list of chats.
|
|
50
|
+
You can find the required chat, for example by its title, and get its `chat_id`:
|
|
51
|
+
|
|
52
|
+
=== "Using a generator"
|
|
53
|
+
```python
|
|
54
|
+
response = await bot.get_chats(count=100, page=1)
|
|
55
|
+
|
|
56
|
+
chat = next(
|
|
57
|
+
(chat for chat in response.list if chat.title == "Support"),
|
|
58
|
+
None,
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
if chat is not None:
|
|
62
|
+
print(chat.chat_id)
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
=== "Using a loop"
|
|
66
|
+
```python
|
|
67
|
+
response = await bot.get_chats(count=100, page=1)
|
|
68
|
+
chat = None
|
|
69
|
+
|
|
70
|
+
for item in response.list:
|
|
71
|
+
if item.title == "Support":
|
|
72
|
+
chat = item
|
|
73
|
+
break
|
|
74
|
+
|
|
75
|
+
if chat is not None:
|
|
76
|
+
print(chat.chat_id)
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
After you find the required `chat_id`, it is also recommended to save it so that you do not have to search for the chat again on every application start.
|
|
80
|
+
|
|
81
|
+
### Getting `chat_id` from an incoming message
|
|
82
|
+
|
|
83
|
+
Another simple way is to send a message to the target chat and handle it with the bot. In the handler, you can print `message.chat_id`:
|
|
84
|
+
|
|
85
|
+
```python
|
|
86
|
+
from trueconf import Router
|
|
87
|
+
from trueconf.types import Message
|
|
88
|
+
|
|
89
|
+
router = Router()
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
@router.message()
|
|
93
|
+
async def print_chat_id(message: Message):
|
|
94
|
+
print(message.chat_id)
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
This approach is convenient for group chats and channels: add the bot to the required chat, send a message, and check the `chat_id` in the console.
|
|
98
|
+
|
|
99
|
+
## Text messages
|
|
100
|
+
|
|
101
|
+
To send a text message, use [`bot.send_message(...)`](../reference/Bot.md/#trueconf.Bot.send_message):
|
|
102
|
+
|
|
103
|
+
```python
|
|
104
|
+
await bot.send_message(
|
|
105
|
+
chat_id="chat_id",
|
|
106
|
+
text="Hello!",
|
|
107
|
+
)
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
If you send a message from an incoming message handler, you can use `Message` shortcut methods, such as `message.answer(...)` or `message.reply(...)`.
|
|
111
|
+
They automatically use `message.chat_id`, so you do not need to pass it manually. For details, see the [Shortcuts](shortcuts.md) section.
|
|
112
|
+
|
|
113
|
+
### Replying to a message
|
|
114
|
+
|
|
115
|
+
If you need to reply to a specific message, pass the source message identifier in the `reply_message_id` parameter:
|
|
116
|
+
|
|
117
|
+
```python
|
|
118
|
+
await bot.send_message(
|
|
119
|
+
chat_id="chat_id",
|
|
120
|
+
text="This is a reply",
|
|
121
|
+
reply_message_id="message_id",
|
|
122
|
+
)
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
This approach allows you to send regular messages and replies through a single API.
|
|
126
|
+
|
|
127
|
+
### Forwarding messages
|
|
128
|
+
|
|
129
|
+
To forward an existing message, use [`bot.forward_message(...)`](../reference/Bot.md/#trueconf.Bot.forward_message):
|
|
130
|
+
|
|
131
|
+
```python
|
|
132
|
+
await bot.forward_message(
|
|
133
|
+
chat_id="target_chat_id",
|
|
134
|
+
message_id="source_message_id",
|
|
135
|
+
)
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
Where:
|
|
139
|
+
|
|
140
|
+
- `chat_id` is the identifier of the chat where the message should be forwarded;
|
|
141
|
+
- `message_id` is the identifier of the message to forward.
|
|
142
|
+
|
|
143
|
+
### Text formatting
|
|
144
|
+
|
|
145
|
+
Messages can be sent as plain text, HTML, or Markdown by passing `parse_mode`:
|
|
146
|
+
|
|
147
|
+
```python
|
|
148
|
+
from trueconf.enums import ParseMode
|
|
149
|
+
|
|
150
|
+
await bot.send_message(
|
|
151
|
+
chat_id="chat_id",
|
|
152
|
+
text="<b>Important</b>",
|
|
153
|
+
parse_mode=ParseMode.HTML,
|
|
154
|
+
)
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
For convenient formatted text construction, the library provides the [`trueconf.utils.formatting`](../reference/Formatting.md) module.
|
|
158
|
+
It lets you build a message from classes instead of writing HTML or Markdown manually:
|
|
159
|
+
|
|
160
|
+
```python
|
|
161
|
+
from trueconf.enums import ParseMode
|
|
162
|
+
from trueconf.utils.formatting import (
|
|
163
|
+
Bold,
|
|
164
|
+
Italic,
|
|
165
|
+
Link,
|
|
166
|
+
Mention,
|
|
167
|
+
Text,
|
|
168
|
+
)
|
|
169
|
+
|
|
170
|
+
content = Text(
|
|
171
|
+
Bold("Important"),
|
|
172
|
+
" message for ",
|
|
173
|
+
Mention("John Doe", user_id="john_doe@video.example.com"),
|
|
174
|
+
"\n",
|
|
175
|
+
Link("Open website", url="https://trueconf.com"),
|
|
176
|
+
)
|
|
177
|
+
|
|
178
|
+
await bot.send_message(
|
|
179
|
+
chat_id="chat_id",
|
|
180
|
+
text=content.as_html(),
|
|
181
|
+
parse_mode=ParseMode.HTML,
|
|
182
|
+
)
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
The module supports:
|
|
186
|
+
|
|
187
|
+
- [`Bold(...)`](../reference/Formatting.md/#trueconf.utils.formatting.Bold)
|
|
188
|
+
- [`Italic(...)`](../reference/Formatting.md/#trueconf.utils.formatting.Italic)
|
|
189
|
+
- [`Underline(...)`](../reference/Formatting.md/#trueconf.utils.formatting.Underline)
|
|
190
|
+
- [`Strikethrough(...)`](../reference/Formatting.md/#trueconf.utils.formatting.Strikethrough)
|
|
191
|
+
- [`Link(...)`](../reference/Formatting.md/#trueconf.utils.formatting.Link)
|
|
192
|
+
- [`Mention(...)`](../reference/Formatting.md/#trueconf.utils.formatting.Mention)
|
|
193
|
+
- [`AllMention()`](../reference/Formatting.md/#trueconf.utils.formatting.AllMention)
|
|
194
|
+
- [`Text(...)`](../reference/Formatting.md/#trueconf.utils.formatting.Text)
|
|
195
|
+
|
|
196
|
+
### Message length limits
|
|
197
|
+
|
|
198
|
+
TrueConf Server limits text messages to `4096` characters.
|
|
199
|
+
|
|
200
|
+
If a message exceeds this limit, use the `safe_split_text(...)` helper function.
|
|
201
|
+
It safely splits long text while preserving HTML/Markdown markup:
|
|
202
|
+
|
|
203
|
+
```python
|
|
204
|
+
from trueconf.utils import safe_split_text
|
|
205
|
+
|
|
206
|
+
chunks = safe_split_text(long_text)
|
|
207
|
+
|
|
208
|
+
for chunk in chunks:
|
|
209
|
+
await bot.send_message(
|
|
210
|
+
chat_id="chat_id",
|
|
211
|
+
text=chunk,
|
|
212
|
+
parse_mode=ParseMode.HTML,
|
|
213
|
+
)
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
For more information about limits, see the [Restrictions](restrictions.md) section.
|
|
217
|
+
|
|
218
|
+
!!! Tip "Shortcut methods"
|
|
219
|
+
In message handlers, it is often more convenient to use `message.answer(...)`, `message.reply(...)`, and other shortcut methods instead of calling `bot.send_message(...)` directly.
|
|
220
|
+
For details, see the [Shortcuts](shortcuts.md) section.
|
|
221
|
+
|
|
222
|
+
!!! Tip "Sending files"
|
|
223
|
+
This section covers text messages.
|
|
224
|
+
To send documents, images, videos, voice messages, and other attachments, see the [Working with files](files.md) section.
|