python-trueconf-bot 1.4.4__tar.gz → 1.5.1__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.4.4 → python_trueconf_bot-1.5.1}/.gitignore +6 -2
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/PKG-INFO +7 -6
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/README-PyPI.md +3 -2
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/README-ru.md +4 -2
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/README.md +4 -3
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/docs/en/examples/index.md +16 -16
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/docs/en/features.md +5 -2
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/docs/en/index.md +2 -2
- python_trueconf_bot-1.5.1/docs/en/learn/authentication.md +103 -0
- python_trueconf_bot-1.5.1/docs/en/learn/buttons.md +301 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/docs/en/learn/enums.md +3 -6
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/docs/en/learn/files.md +13 -21
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/docs/en/learn/filters.md +15 -12
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/docs/en/learn/fsm.md +37 -26
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/docs/en/learn/getting-started.md +17 -10
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/docs/en/learn/middleware.md +9 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/docs/en/learn/parse-messages.md +65 -7
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/docs/en/learn/restrictions.md +13 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/docs/en/learn/send_message.md +7 -1
- python_trueconf_bot-1.5.1/docs/en/learn/shortcuts.md +137 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/docs/en/learn/types.md +11 -6
- python_trueconf_bot-1.5.1/docs/en/learn/typing_indicator.md +54 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/docs/en/reference/Types.md +54 -1
- python_trueconf_bot-1.5.1/docs/en/reference/chat_activity.md +11 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/docs/en/release_notes.md +94 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/docs/hooks/llms_txt.py +13 -36
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/docs/hooks/sitemap_dates.py +1 -1
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/docs/ru/examples/index.md +16 -16
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/docs/ru/features.md +32 -4
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/docs/ru/index.md +2 -2
- python_trueconf_bot-1.5.1/docs/ru/learn/authentication.md +103 -0
- python_trueconf_bot-1.5.1/docs/ru/learn/buttons.md +301 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/docs/ru/learn/enums.md +4 -6
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/docs/ru/learn/files.md +12 -21
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/docs/ru/learn/filters.md +14 -12
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/docs/ru/learn/fsm.md +37 -26
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/docs/ru/learn/getting-started.md +16 -10
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/docs/ru/learn/middleware.md +9 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/docs/ru/learn/parse-messages.md +67 -9
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/docs/ru/learn/restrictions.md +14 -1
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/docs/ru/learn/send_message.md +7 -1
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/docs/ru/learn/shortcuts.md +68 -4
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/docs/ru/learn/types.md +7 -4
- python_trueconf_bot-1.5.1/docs/ru/learn/typing_indicator.md +54 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/docs/ru/release_notes.md +94 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/examples/add_big_list_users_to_channel.py +6 -3
- python_trueconf_bot-1.5.1/examples/buttons_bot.py +1317 -0
- python_trueconf_bot-1.5.1/examples/contacts.py +48 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/examples/filters.py +30 -12
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/examples/report_bot.py +14 -15
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/examples/update_token.py +7 -7
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/examples/webhook.py +11 -10
- python_trueconf_bot-1.5.1/justfile +77 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/mkdocs.yml +4 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/pyproject.toml +34 -6
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/python_trueconf_bot.egg-info/PKG-INFO +7 -6
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/python_trueconf_bot.egg-info/SOURCES.txt +55 -3
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/python_trueconf_bot.egg-info/requires.txt +3 -3
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/python_trueconf_bot.egg-info/scm_file_list.json +55 -3
- python_trueconf_bot-1.5.1/python_trueconf_bot.egg-info/scm_version.json +8 -0
- python_trueconf_bot-1.5.1/tests/test_answer_command.py +135 -0
- python_trueconf_bot-1.5.1/tests/test_auth_via_oauth.py +135 -0
- python_trueconf_bot-1.5.1/tests/test_callback_query_edit.py +182 -0
- python_trueconf_bot-1.5.1/tests/test_callback_query_routing.py +215 -0
- python_trueconf_bot-1.5.1/tests/test_chat_activity.py +231 -0
- python_trueconf_bot-1.5.1/tests/test_download_limit.py +144 -0
- python_trueconf_bot-1.5.1/tests/test_download_url_logging.py +200 -0
- python_trueconf_bot-1.5.1/tests/test_event_raw_routing.py +85 -0
- python_trueconf_bot-1.5.1/tests/test_formatting.py +17 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/tests/test_fsm.py +97 -23
- python_trueconf_bot-1.5.1/tests/test_inline_keyboard.py +561 -0
- python_trueconf_bot-1.5.1/tests/test_last_message.py +92 -0
- python_trueconf_bot-1.5.1/tests/test_message_binding.py +242 -0
- python_trueconf_bot-1.5.1/tests/test_parse_update.py +328 -0
- python_trueconf_bot-1.5.1/tests/test_public_contract_blockers.py +426 -0
- python_trueconf_bot-1.5.1/tests/test_reply_quote.py +280 -0
- python_trueconf_bot-1.5.1/tests/test_send_file_response.py +41 -0
- python_trueconf_bot-1.5.1/tests/test_shutdown.py +265 -0
- python_trueconf_bot-1.5.1/tests/test_split_text.py +218 -0
- python_trueconf_bot-1.5.1/tests/test_system_message_routing.py +67 -0
- python_trueconf_bot-1.5.1/tests/test_upload_errors.py +103 -0
- python_trueconf_bot-1.5.1/tests/test_user_agent.py +405 -0
- python_trueconf_bot-1.5.1/tests/test_vcard.py +291 -0
- python_trueconf_bot-1.5.1/tests/test_ws_retries.py +93 -0
- python_trueconf_bot-1.5.1/trueconf/__init__.py +29 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/_version.py +3 -3
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/client/bot.py +682 -419
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/client/context_controller.py +13 -4
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/client/session.py +8 -6
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/dispatcher/dispatcher.py +25 -19
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/dispatcher/router.py +185 -165
- python_trueconf_bot-1.5.1/trueconf/enums/__init__.py +34 -0
- python_trueconf_bot-1.5.1/trueconf/enums/button.py +18 -0
- python_trueconf_bot-1.5.1/trueconf/enums/chat_activity.py +14 -0
- python_trueconf_bot-1.5.1/trueconf/enums/command.py +32 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/enums/incoming_update_method.py +1 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/enums/message_type.py +2 -1
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/exceptions.py +84 -13
- python_trueconf_bot-1.5.1/trueconf/filters/__init__.py +11 -0
- python_trueconf_bot-1.5.1/trueconf/filters/base.py +8 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/filters/command.py +8 -7
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/filters/instance_of.py +2 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/filters/message.py +1 -0
- python_trueconf_bot-1.5.1/trueconf/filters/raw_update.py +24 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/fsm/filters.py +1 -3
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/fsm/key_builder.py +2 -4
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/fsm/middleware.py +2 -4
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/fsm/state.py +2 -7
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/fsm/storage/base.py +2 -2
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/loggers.py +2 -6
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/methods/__init__.py +37 -33
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/methods/add_participant_to_chat.py +2 -0
- python_trueconf_bot-1.5.1/trueconf/methods/answer_command.py +60 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/methods/auth.py +3 -1
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/methods/base.py +30 -20
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/methods/change_participant_role.py +2 -1
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/methods/clear_chat_history.py +2 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/methods/create_channel.py +2 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/methods/create_favorites_chat.py +2 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/methods/create_group_chat.py +2 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/methods/create_p2p_chat.py +2 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/methods/edit_chat_avatar.py +2 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/methods/edit_chat_title.py +2 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/methods/edit_message.py +13 -5
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/methods/edit_survey.py +9 -7
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/methods/forward_message.py +2 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/methods/get_chat_by_id.py +3 -3
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/methods/get_chat_history.py +2 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/methods/get_chat_participant.py +3 -4
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/methods/get_chat_participants.py +2 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/methods/get_chats.py +2 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/methods/get_file_info.py +3 -3
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/methods/get_file_upload_limits.py +4 -2
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/methods/get_message_by_id.py +3 -3
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/methods/get_user_display_name.py +2 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/methods/has_chat_participant.py +3 -4
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/methods/remove_chat.py +2 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/methods/remove_message.py +3 -5
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/methods/remove_participant_from_chat.py +3 -6
- python_trueconf_bot-1.5.1/trueconf/methods/send_chat_activity.py +26 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/methods/send_file.py +4 -11
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/methods/send_message.py +14 -8
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/methods/send_survey.py +4 -3
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/methods/subscribe_file_progress.py +3 -4
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/methods/unsubscribe_file_progress.py +3 -4
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/methods/upload_file.py +2 -1
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/middleware.py +1 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/types/__init__.py +14 -9
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/types/author_box.py +2 -0
- python_trueconf_bot-1.5.1/trueconf/types/callback_query.py +168 -0
- python_trueconf_bot-1.5.1/trueconf/types/chat.py +15 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/types/chat_participant.py +2 -0
- python_trueconf_bot-1.5.1/trueconf/types/contact.py +189 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/types/content/__init__.py +22 -18
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/types/content/attachment.py +14 -3
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/types/content/base.py +2 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/types/content/chat_created.py +2 -0
- python_trueconf_bot-1.4.4/trueconf/types/content/text.py → python_trueconf_bot-1.5.1/trueconf/types/content/clear_chat_history.py +4 -3
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/types/content/document.py +26 -9
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/types/content/edit_chat_avatar.py +2 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/types/content/edit_chat_title.py +2 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/types/content/forward_message.py +4 -3
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/types/content/location.py +3 -1
- python_trueconf_bot-1.5.1/trueconf/types/content/parser.py +82 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/types/content/photo.py +29 -11
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/types/content/remove_participant.py +1 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/types/content/sticker.py +29 -11
- python_trueconf_bot-1.5.1/trueconf/types/content/survey.py +19 -0
- python_trueconf_bot-1.5.1/trueconf/types/content/text.py +23 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/types/content/video.py +29 -12
- python_trueconf_bot-1.5.1/trueconf/types/content/voice.py +81 -0
- python_trueconf_bot-1.5.1/trueconf/types/envelope_parser.py +26 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/types/input_file.py +81 -75
- python_trueconf_bot-1.5.1/trueconf/types/keyboard.py +149 -0
- python_trueconf_bot-1.5.1/trueconf/types/last_message.py +51 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/types/message.py +292 -145
- python_trueconf_bot-1.5.1/trueconf/types/parser.py +67 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/types/requests/__init__.py +13 -13
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/types/requests/added_chat_participant.py +3 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/types/requests/changed_file_upload_limits.py +6 -3
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/types/requests/changed_participant_role.py +3 -1
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/types/requests/cleared_chat_history.py +5 -1
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/types/requests/created_channel.py +5 -1
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/types/requests/created_favorites_chat.py +5 -1
- python_trueconf_bot-1.5.1/trueconf/types/requests/created_group_chat.py +46 -0
- python_trueconf_bot-1.5.1/trueconf/types/requests/created_personal_chat.py +46 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/types/requests/edited_chat_avatar.py +4 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/types/requests/edited_chat_title.py +4 -0
- python_trueconf_bot-1.5.1/trueconf/types/requests/edited_message.py +41 -0
- python_trueconf_bot-1.5.1/trueconf/types/requests/removed_chat.py +36 -0
- python_trueconf_bot-1.5.1/trueconf/types/requests/removed_chat_participant.py +43 -0
- python_trueconf_bot-1.5.1/trueconf/types/requests/removed_message.py +41 -0
- python_trueconf_bot-1.5.1/trueconf/types/requests/uploading_progress.py +38 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/types/responses/__init__.py +36 -33
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/types/responses/add_chat_participant_response.py +2 -0
- python_trueconf_bot-1.5.1/trueconf/types/responses/answer_command_response.py +8 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/types/responses/api_error.py +15 -3
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/types/responses/auth_response_payload.py +2 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/types/responses/change_participant_role_response.py +2 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/types/responses/clear_chat_history_response.py +2 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/types/responses/create_channel_response.py +2 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/types/responses/create_favorites_chat_response.py +2 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/types/responses/create_group_chat_response.py +2 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/types/responses/create_p2p_chat_response.py +2 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/types/responses/edit_chat_avatar_response.py +4 -2
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/types/responses/edit_chat_title_response.py +3 -1
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/types/responses/edit_message_response.py +3 -1
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/types/responses/edit_survey_response.py +2 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/types/responses/forward_message_response.py +2 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/types/responses/get_chat_by_id_response.py +3 -0
- python_trueconf_bot-1.5.1/trueconf/types/responses/get_chat_history_response.py +26 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/types/responses/get_chat_participant_response.py +3 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/types/responses/get_chat_participants_response.py +4 -3
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/types/responses/get_chats_response.py +4 -3
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/types/responses/get_file_info_response.py +7 -4
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/types/responses/get_file_upload_limits_response.py +3 -1
- python_trueconf_bot-1.5.1/trueconf/types/responses/get_message_by_id_response.py +40 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/types/responses/get_user_display_name_response.py +2 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/types/responses/has_chat_participant_response.py +2 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/types/responses/remove_chat_participant_response.py +2 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/types/responses/remove_chat_response.py +3 -1
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/types/responses/remove_message_response.py +2 -0
- python_trueconf_bot-1.5.1/trueconf/types/responses/send_chat_activity_response.py +12 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/types/responses/send_file_response.py +3 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/types/responses/send_message_response.py +2 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/types/responses/send_survey_response.py +2 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/types/responses/subscribe_file_progress_response.py +2 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/types/responses/unsubscribe_file_progress_response.py +2 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/types/responses/upload_file_response.py +2 -0
- python_trueconf_bot-1.5.1/trueconf/types/system_message.py +33 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/types/update.py +3 -0
- python_trueconf_bot-1.5.1/trueconf/utils/__init__.py +7 -0
- python_trueconf_bot-1.5.1/trueconf/utils/_auth/__init__.py +0 -0
- python_trueconf_bot-1.5.1/trueconf/utils/_auth/_token.py +141 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/utils/_generate_secret_for_survey.py +1 -1
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/utils/_ssl.py +5 -4
- python_trueconf_bot-1.5.1/trueconf/utils/_url.py +8 -0
- python_trueconf_bot-1.5.1/trueconf/utils/_user_agent.py +36 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/utils/_version_checker.py +10 -6
- python_trueconf_bot-1.5.1/trueconf/utils/chat_activity.py +120 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/utils/formatting/__init__.py +4 -2
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/utils/formatting/decorations.py +12 -3
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/utils/formatting/text.py +105 -24
- python_trueconf_bot-1.5.1/trueconf/utils/split_text.py +706 -0
- python_trueconf_bot-1.4.4/docs/en/learn/shortcuts.md +0 -72
- python_trueconf_bot-1.4.4/python_trueconf_bot.egg-info/scm_version.json +0 -8
- python_trueconf_bot-1.4.4/requirements.txt +0 -22
- python_trueconf_bot-1.4.4/trueconf/__init__.py +0 -20
- python_trueconf_bot-1.4.4/trueconf/enums/__init__.py +0 -23
- python_trueconf_bot-1.4.4/trueconf/filters/__init__.py +0 -11
- python_trueconf_bot-1.4.4/trueconf/filters/base.py +0 -8
- python_trueconf_bot-1.4.4/trueconf/filters/method.py +0 -12
- python_trueconf_bot-1.4.4/trueconf/types/content/survey.py +0 -19
- python_trueconf_bot-1.4.4/trueconf/types/last_message.py +0 -46
- python_trueconf_bot-1.4.4/trueconf/types/parser.py +0 -121
- python_trueconf_bot-1.4.4/trueconf/types/requests/created_group_chat.py +0 -42
- python_trueconf_bot-1.4.4/trueconf/types/requests/created_personal_chat.py +0 -42
- python_trueconf_bot-1.4.4/trueconf/types/requests/edited_message.py +0 -37
- python_trueconf_bot-1.4.4/trueconf/types/requests/removed_chat.py +0 -32
- python_trueconf_bot-1.4.4/trueconf/types/requests/removed_chat_participant.py +0 -39
- python_trueconf_bot-1.4.4/trueconf/types/requests/removed_message.py +0 -37
- python_trueconf_bot-1.4.4/trueconf/types/requests/uploading_progress.py +0 -34
- python_trueconf_bot-1.4.4/trueconf/types/responses/get_chat_history_response.py +0 -13
- python_trueconf_bot-1.4.4/trueconf/types/responses/get_message_by_id_response.py +0 -26
- python_trueconf_bot-1.4.4/trueconf/utils/__init__.py +0 -1
- python_trueconf_bot-1.4.4/trueconf/utils/_token.py +0 -79
- python_trueconf_bot-1.4.4/trueconf/utils/split_text.py +0 -603
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/.github/workflows/docs.yml +0 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/.github/workflows/release-test.yml +0 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/.github/workflows/release.yml +0 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/LICENSE +0 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/assets/head_en.png +0 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/assets/head_ru.png +0 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/assets/logo.svg +0 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/context7.json +0 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/docs/context7.json +0 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/docs/en/img/head.png +0 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/docs/en/img/router_scheme_en.svg +0 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/docs/en/reference/Bot.md +0 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/docs/en/reference/Dispatcher.md +0 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/docs/en/reference/Enums.md +0 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/docs/en/reference/Exceptions.md +0 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/docs/en/reference/Formatting.md +0 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/docs/en/reference/Responses.md +0 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/docs/en/reference/Router.md +0 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/docs/en/reference/index.md +0 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/docs/img/chatbot.svg +0 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/docs/img/favicon.ico +0 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/docs/img/logo.svg +0 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/docs/overrides/main.html +0 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/docs/overrides/sitemap.xml +0 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/docs/ru/img/head.png +0 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/docs/ru/img/router_scheme_ru.svg +0 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/docs/stylesheets/extra.css +0 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/examples/README-ru.md +0 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/examples/README.md +0 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/python_trueconf_bot.egg-info/dependency_links.txt +0 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/python_trueconf_bot.egg-info/top_level.txt +0 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/setup.cfg +0 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/client/__init__.py +0 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/dispatcher/__init__.py +0 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/enums/aouth_error.py +0 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/enums/chat_participant_role.py +0 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/enums/chat_type.py +0 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/enums/envelope_author_type.py +0 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/enums/file_ready_state.py +0 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/enums/parse_mode.py +0 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/enums/survey_type.py +0 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/enums/update_type.py +0 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/fsm/__init__.py +2 -2
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/fsm/context.py +0 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/fsm/manager.py +0 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/fsm/storage/__init__.py +0 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/fsm/storage/memory.py +0 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/fsm/strategy.py +0 -0
- {python_trueconf_bot-1.4.4 → python_trueconf_bot-1.5.1}/trueconf/py.typed +0 -0
|
@@ -98,7 +98,7 @@ ipython_config.py
|
|
|
98
98
|
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
|
|
99
99
|
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
100
100
|
# commonly ignored for libraries.
|
|
101
|
-
|
|
101
|
+
uv.lock
|
|
102
102
|
|
|
103
103
|
# poetry
|
|
104
104
|
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
@@ -182,7 +182,11 @@ trueconf/_version.py
|
|
|
182
182
|
.idea
|
|
183
183
|
.workfiles
|
|
184
184
|
*.DS_Store
|
|
185
|
+
graphify-out
|
|
186
|
+
.agents
|
|
187
|
+
|
|
185
188
|
|
|
186
189
|
.venv*
|
|
187
190
|
venv*
|
|
188
|
-
/gitignore/
|
|
191
|
+
/gitignore/
|
|
192
|
+
.superpowers/superpowers/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: python-trueconf-bot
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.5.1
|
|
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
|
|
@@ -24,13 +24,13 @@ Requires-Python: >=3.10
|
|
|
24
24
|
Description-Content-Type: text/markdown
|
|
25
25
|
License-File: LICENSE
|
|
26
26
|
Requires-Dist: websockets
|
|
27
|
-
Requires-Dist:
|
|
28
|
-
Requires-Dist: mashumaro
|
|
27
|
+
Requires-Dist: httpx2>=2.13.0
|
|
28
|
+
Requires-Dist: mashumaro>=3.23
|
|
29
29
|
Requires-Dist: aiofiles
|
|
30
30
|
Requires-Dist: magic-filter
|
|
31
31
|
Requires-Dist: aiohttp
|
|
32
32
|
Requires-Dist: async-property
|
|
33
|
-
Requires-Dist: typing_extensions>=4.
|
|
33
|
+
Requires-Dist: typing_extensions>=4.16.0
|
|
34
34
|
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
|
|
@@ -100,9 +100,10 @@ uv add python-trueconf-bot
|
|
|
100
100
|
|
|
101
101
|
| TrueConf Server Version | Required Library Version |
|
|
102
102
|
|:------------------------|:-------------------------|
|
|
103
|
-
| < 5.5.0 | ❌ Not supported
|
|
103
|
+
| < 5.5.0 | ❌ Not supported |
|
|
104
104
|
| 5.5.0 — 5.5.2 | v1.1.x |
|
|
105
|
-
|
|
|
105
|
+
| 5.5.3 — 5.5.5 | v1.2.1-1.4.x |
|
|
106
|
+
| >= 5.5.6 | **v1.5.0** (or higher) |
|
|
106
107
|
|
|
107
108
|
## 📌 Key Features
|
|
108
109
|
|
|
@@ -60,9 +60,10 @@ uv add python-trueconf-bot
|
|
|
60
60
|
|
|
61
61
|
| TrueConf Server Version | Required Library Version |
|
|
62
62
|
|:------------------------|:-------------------------|
|
|
63
|
-
| < 5.5.0 | ❌ Not supported
|
|
63
|
+
| < 5.5.0 | ❌ Not supported |
|
|
64
64
|
| 5.5.0 — 5.5.2 | v1.1.x |
|
|
65
|
-
|
|
|
65
|
+
| 5.5.3 — 5.5.5 | v1.2.1-1.4.x |
|
|
66
|
+
| >= 5.5.6 | **v1.5.0** (or higher) |
|
|
66
67
|
|
|
67
68
|
## 📌 Key Features
|
|
68
69
|
|
|
@@ -59,11 +59,13 @@ uv add python-trueconf-bot
|
|
|
59
59
|
|
|
60
60
|
|
|
61
61
|
## 📦 Совместимость версий
|
|
62
|
+
|
|
62
63
|
| Версия сервера TrueConf | Требуемая версия библиотеки |
|
|
63
64
|
|:------------------------|:----------------------------|
|
|
64
|
-
| < 5.5.0 | ❌ Не поддерживается
|
|
65
|
+
| < 5.5.0 | ❌ Не поддерживается |
|
|
65
66
|
| 5.5.0 — 5.5.2 | v1.1.x |
|
|
66
|
-
|
|
|
67
|
+
| 5.5.3 — 5.5.5 | v1.2.1-1.4.x |
|
|
68
|
+
| >= 5.5.6 | **v1.5.0** (или выше) |
|
|
67
69
|
|
|
68
70
|
## 📌 Ключевые возможности
|
|
69
71
|
|
|
@@ -60,13 +60,14 @@ Or with `uv` (recommended):
|
|
|
60
60
|
uv add python-trueconf-bot
|
|
61
61
|
```
|
|
62
62
|
|
|
63
|
-
## 📦
|
|
63
|
+
## 📦 Version Compatibility
|
|
64
64
|
|
|
65
65
|
| TrueConf Server Version | Required Library Version |
|
|
66
66
|
|:------------------------|:-------------------------|
|
|
67
|
-
| < 5.5.0 | ❌ Not supported
|
|
67
|
+
| < 5.5.0 | ❌ Not supported |
|
|
68
68
|
| 5.5.0 — 5.5.2 | v1.1.x |
|
|
69
|
-
|
|
|
69
|
+
| 5.5.3 — 5.5.5 | v1.2.1-1.4.x |
|
|
70
|
+
| >= 5.5.6 | **v1.5.0** (or higher) |
|
|
70
71
|
|
|
71
72
|
## 📌 Key Features
|
|
72
73
|
|
|
@@ -60,25 +60,24 @@ logging.basicConfig(
|
|
|
60
60
|
encoding="utf-8",
|
|
61
61
|
)
|
|
62
62
|
|
|
63
|
+
|
|
63
64
|
@asynccontextmanager
|
|
64
65
|
async def lifespan(app: FastAPI):
|
|
65
66
|
bot_task = asyncio.create_task(bot.run())
|
|
66
67
|
yield
|
|
67
68
|
|
|
69
|
+
|
|
68
70
|
app = FastAPI(lifespan=lifespan)
|
|
69
|
-
bot = Bot.from_credentials(
|
|
70
|
-
server="10.140.1.255",
|
|
71
|
-
username="echo_bot",
|
|
72
|
-
password="123tr",
|
|
73
|
-
verify_ssl=False)
|
|
71
|
+
bot = Bot.from_credentials(server="10.140.1.255", username="echo_bot", password="123tr", verify_ssl=False)
|
|
74
72
|
|
|
75
73
|
|
|
76
74
|
@app.post("/send")
|
|
77
75
|
async def read_root(data: dict[str, Any]):
|
|
78
76
|
r = await bot.create_personal_chat(user_id="user")
|
|
79
|
-
r = await bot.send_message(chat_id
|
|
77
|
+
r = await bot.send_message(chat_id=r.chat_id, text=str(data))
|
|
80
78
|
print(r.message_id)
|
|
81
79
|
|
|
80
|
+
|
|
82
81
|
if __name__ == "__main__":
|
|
83
82
|
uvicorn.run(app, host="0.0.0.0", port=8000)
|
|
84
83
|
```
|
|
@@ -114,6 +113,7 @@ logging.basicConfig(
|
|
|
114
113
|
encoding="utf-8",
|
|
115
114
|
)
|
|
116
115
|
|
|
116
|
+
|
|
117
117
|
async def main():
|
|
118
118
|
await bot.start()
|
|
119
119
|
await bot.connected_event.wait()
|
|
@@ -132,6 +132,7 @@ async def main():
|
|
|
132
132
|
|
|
133
133
|
await bot.shutdown()
|
|
134
134
|
|
|
135
|
+
|
|
135
136
|
if __name__ == "__main__":
|
|
136
137
|
asyncio.run(main())
|
|
137
138
|
```
|
|
@@ -174,12 +175,9 @@ router_list_for_report = {}
|
|
|
174
175
|
list_message_for_report = {}
|
|
175
176
|
|
|
176
177
|
bot = trueconf.Bot.from_credentials(
|
|
177
|
-
server="10.110.2.241",
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
dispatcher=dp,
|
|
181
|
-
https=True,
|
|
182
|
-
verify_ssl=False)
|
|
178
|
+
server="10.110.2.241", username="report_bot", password="123tr", dispatcher=dp, https=True, verify_ssl=False
|
|
179
|
+
)
|
|
180
|
+
|
|
183
181
|
|
|
184
182
|
async def handle_report(msg: Message):
|
|
185
183
|
if msg.from_user.id in router_list_for_report.keys():
|
|
@@ -189,7 +187,7 @@ async def handle_report(msg: Message):
|
|
|
189
187
|
|
|
190
188
|
@r1.message(Command("report"))
|
|
191
189
|
async def on_report(msg: Message):
|
|
192
|
-
number = uuid.uuid4()
|
|
190
|
+
number = uuid.uuid4() # генерация номера обращения с помощью uuid
|
|
193
191
|
await msg.answer(f"Your ticket number is {number}. All subsequent messages will be added to this ticket.")
|
|
194
192
|
r = Router(name=str(number))
|
|
195
193
|
dp.include_router(r)
|
|
@@ -212,7 +210,7 @@ async def on_cancel(msg: Message):
|
|
|
212
210
|
await msg.answer("You don’t have an active report.")
|
|
213
211
|
|
|
214
212
|
|
|
215
|
-
def build_message_and_send_email(messages:list):
|
|
213
|
+
def build_message_and_send_email(messages: list):
|
|
216
214
|
"""
|
|
217
215
|
In Python, there are built-in libraries for working with email messages:
|
|
218
216
|
https://docs.python.org/3/library/email.examples.html
|
|
@@ -226,12 +224,13 @@ def build_message_and_send_email(messages:list):
|
|
|
226
224
|
# You can put the text into the email body
|
|
227
225
|
case MessageType.ATTACHMENT:
|
|
228
226
|
# Download the files from TrueConf Server via:
|
|
229
|
-
# msg.download(
|
|
227
|
+
# msg.download(file_path="path/to/file")
|
|
230
228
|
|
|
231
229
|
Once the email is assembled correctly, send it using the smtplib module:
|
|
232
230
|
https://docs.python.org/3/library/smtplib.html#smtp-example
|
|
233
231
|
"""
|
|
234
232
|
|
|
233
|
+
|
|
235
234
|
@r1.message(Command("send"))
|
|
236
235
|
async def send_report(msg: Message):
|
|
237
236
|
if msg.from_user.id in router_list_for_report.keys():
|
|
@@ -243,6 +242,7 @@ async def send_report(msg: Message):
|
|
|
243
242
|
await msg.answer("You don’t have an active report.")
|
|
244
243
|
return
|
|
245
244
|
|
|
245
|
+
|
|
246
246
|
if __name__ == "__main__":
|
|
247
247
|
asyncio.run(bot.run())
|
|
248
248
|
```
|
|
@@ -411,6 +411,7 @@ bot = Bot.from_credentials(
|
|
|
411
411
|
)
|
|
412
412
|
|
|
413
413
|
import asyncio
|
|
414
|
+
|
|
414
415
|
if __name__ == "__main__":
|
|
415
416
|
asyncio.run(bot.run())
|
|
416
417
|
```
|
|
@@ -424,4 +425,3 @@ Execution order for each message:
|
|
|
424
425
|
4. Handler — cmd_start or echo
|
|
425
426
|
```
|
|
426
427
|
|
|
427
|
-
|
|
@@ -29,13 +29,15 @@ from trueconf.filters import F
|
|
|
29
29
|
|
|
30
30
|
router = Router()
|
|
31
31
|
|
|
32
|
+
|
|
32
33
|
@router.message(F.text.startswith("/start"))
|
|
33
34
|
async def on_start(msg: Message):
|
|
34
|
-
|
|
35
|
+
await msg.answer("Hello! I'm TrueConf bot 👋")
|
|
36
|
+
|
|
35
37
|
|
|
36
38
|
@router.message(F.document.mime_type == "application/pdf")
|
|
37
39
|
async def on_pdf(msg: Message):
|
|
38
|
-
|
|
40
|
+
await msg.reply("Thanks for the PDF!")
|
|
39
41
|
```
|
|
40
42
|
|
|
41
43
|
## Two Connection Options
|
|
@@ -78,6 +80,7 @@ Exactly the same as in aiogram:
|
|
|
78
80
|
@router.message(F.photo)
|
|
79
81
|
async def on_photo(msg: Message): ...
|
|
80
82
|
|
|
83
|
+
|
|
81
84
|
@router.message(F.document.mime_type.in_(["application/pdf", "application/msword"]))
|
|
82
85
|
async def on_doc(msg: Message): ...
|
|
83
86
|
```
|
|
@@ -25,7 +25,7 @@ This library is designed to simplify the development of chatbots by providing re
|
|
|
25
25
|
### Requirements
|
|
26
26
|
|
|
27
27
|
* Python **3.10+**
|
|
28
|
-
* Installed dependencies: `websockets`, `
|
|
28
|
+
* Installed dependencies: `websockets`, `httpx2`, `mashumaro`, `pillow`, `aiofiles`, `magic-filter`
|
|
29
29
|
* It is recommended to use [virtualenv](https://docs.python.org/3/library/venv.html) or [poetry](https://python-poetry.org/) for dependency isolation.
|
|
30
30
|
|
|
31
31
|
### Installation using pip
|
|
@@ -51,4 +51,4 @@ pip install {{product_name}}
|
|
|
51
51
|
## LLM Files
|
|
52
52
|
|
|
53
53
|
- [llms.txt](llms.txt)
|
|
54
|
-
- [llms-full.txt](llms-full.txt)
|
|
54
|
+
- [llms-full.txt](llms-full.txt)
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Authentication
|
|
3
|
+
description: 'Bot authentication methods: token, login and password, and OAuth2'
|
|
4
|
+
icon: material/key
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Authentication
|
|
8
|
+
|
|
9
|
+
The library supports three ways to authenticate a bot on TrueConf Server:
|
|
10
|
+
|
|
11
|
+
| Method | API | When to use it |
|
|
12
|
+
| --- | --- | --- |
|
|
13
|
+
| Token | `Bot(server, token=...)` | You already have a token obtained manually or through the API |
|
|
14
|
+
| Login and password | `Bot.from_credentials(...)` | Login and password authentication is enabled on the server |
|
|
15
|
+
| OAuth2 | `Bot.from_oauth(...)` | Login and password authentication is disabled on the server |
|
|
16
|
+
|
|
17
|
+
## Token authentication
|
|
18
|
+
|
|
19
|
+
Obtain a token as described in the [official API documentation](https://trueconf.com/docs/chatbot-connector/en/connect-and-auth/#access-token).
|
|
20
|
+
|
|
21
|
+
We recommend storing the token in an environment variable or a `.env` file. If you use a public repository, remember to add `.env` to `.gitignore`.
|
|
22
|
+
|
|
23
|
+
```python
|
|
24
|
+
from os import getenv
|
|
25
|
+
|
|
26
|
+
TOKEN = getenv("TOKEN")
|
|
27
|
+
bot = Bot(server="video.example.com", token=TOKEN, dispatcher=dp)
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
!!! note
|
|
31
|
+
A token is valid for one month from the time it is created.
|
|
32
|
+
However, an authenticated connection remains active until it is closed, even after the token expires.
|
|
33
|
+
In theory, such a connection can remain active for years.
|
|
34
|
+
|
|
35
|
+
## Login and password authentication
|
|
36
|
+
|
|
37
|
+
The `Bot.from_credentials()` method authenticates the bot with a login and password:
|
|
38
|
+
|
|
39
|
+
```python
|
|
40
|
+
bot = Bot.from_credentials(
|
|
41
|
+
username="echo_bot",
|
|
42
|
+
password="123tr",
|
|
43
|
+
server="video.example.com",
|
|
44
|
+
dispatcher=dp,
|
|
45
|
+
)
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
!!! info
|
|
49
|
+
Every call to **from_credentials()** requests a new token from the server.
|
|
50
|
+
Each token is valid for one month.
|
|
51
|
+
|
|
52
|
+
The main parameters after `password` are keyword-only:
|
|
53
|
+
|
|
54
|
+
| Parameter | Type | Default | Description |
|
|
55
|
+
| --- | --- | --- | --- |
|
|
56
|
+
| `dispatcher` | `Dispatcher` | `None` | Dispatcher used to register handlers |
|
|
57
|
+
| `receive_unread_messages` | `bool` | `False` | Whether to receive messages that arrived while the bot was offline |
|
|
58
|
+
| `receive_system_messages` | `bool` | `False` | Whether to receive system messages |
|
|
59
|
+
| `skip_self_messages` | `bool` | `True` | Whether to ignore messages sent by the bot itself |
|
|
60
|
+
| `verify_ssl` | `bool | str | ssl.SSLContext` | `True` | SSL certificate verification settings |
|
|
61
|
+
| `https` | `bool` | `True` | Whether to use HTTPS |
|
|
62
|
+
| `web_port` | `int` | `None` | WebSocket port (`443` with HTTPS and `4309` without HTTPS by default) |
|
|
63
|
+
| `ws_max_retries` | `int` | `5` | Maximum number of connection attempts after network errors |
|
|
64
|
+
| `ws_max_delay` | `int` | `60` | Maximum delay between connection attempts, in seconds |
|
|
65
|
+
| `timeout` | `float | int` | `10.0` | Server response timeout |
|
|
66
|
+
| `on_health_check` | `Callable` | `None` | Callback invoked when the connection state changes |
|
|
67
|
+
|
|
68
|
+
For the complete parameter list, see the [`Bot.from_credentials()` reference](../reference/Bot.md/#trueconf.Bot.from_credentials).
|
|
69
|
+
|
|
70
|
+
If login and password authentication is disabled on the server, the method raises `PasswordAuthDisabledError`. Use `Bot.from_oauth()` instead.
|
|
71
|
+
|
|
72
|
+
## OAuth2 authentication
|
|
73
|
+
|
|
74
|
+
If login and password authentication is disabled on the server for security reasons, the bot cannot use `from_credentials()`. It does not support authentication through NTLM, Kerberos, other SSO protocols, or MFA.
|
|
75
|
+
|
|
76
|
+
In this case, create an OAuth application on the server and authenticate the bot with `Bot.from_oauth()`. In addition to the login and password, you need the application's `client_id`:
|
|
77
|
+
|
|
78
|
+
```python
|
|
79
|
+
bot = Bot.from_oauth(
|
|
80
|
+
username="elisa",
|
|
81
|
+
password="123tr",
|
|
82
|
+
client_id="application_client_id",
|
|
83
|
+
server="video.example.com",
|
|
84
|
+
dispatcher=dp,
|
|
85
|
+
)
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Requirements:
|
|
89
|
+
|
|
90
|
+
- TrueConf Server 5.5.3 or later;
|
|
91
|
+
- an OAuth application created on the server;
|
|
92
|
+
- at least one scope configured for the application. The `version:read` scope is sufficient and does not expose sensitive information. A token cannot be obtained for an application without a scope.
|
|
93
|
+
|
|
94
|
+
`Bot.from_oauth()` accepts the same parameters as `from_credentials()` and additionally requires `client_id`. See the [`Bot.from_oauth()` reference](../reference/Bot.md/#trueconf.Bot.from_oauth).
|
|
95
|
+
|
|
96
|
+
### Authentication errors
|
|
97
|
+
|
|
98
|
+
| Exception | When it occurs | What to do |
|
|
99
|
+
| --- | --- | --- |
|
|
100
|
+
| `PasswordAuthDisabledError` | The server rejects the token request with `403 auth_method_disabled` because login and password authentication is disabled | Use `Bot.from_oauth()` |
|
|
101
|
+
| `OAuthMissingScopeError` | The server rejects the OAuth token request with `400 invalidScope` because the OAuth application has no configured scope | Add a scope, such as `version:read`, to the application settings on the server |
|
|
102
|
+
|
|
103
|
+
Both exceptions inherit from `TrueConfChatBotError` and can be imported from `trueconf.exceptions`. For details, see the [exceptions reference](../reference/Exceptions.md).
|
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Interactive Buttons
|
|
3
|
+
description: How to add inline buttons to a message and handle commands from them
|
|
4
|
+
icon: material/gesture-tap-button
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Interactive Buttons
|
|
8
|
+
|
|
9
|
+
Inline buttons appear below a message and let users interact with a bot without typing: they can choose a command, open a link, send prepared text, or copy data.
|
|
10
|
+
|
|
11
|
+
We will start with one button, then build a menu and handle button clicks.
|
|
12
|
+
|
|
13
|
+
!!! info "Requirements"
|
|
14
|
+
- TrueConf Server 5.5.6 or later;
|
|
15
|
+
- TrueConf for Windows, macOS, and Linux 8.6.0 or later;
|
|
16
|
+
- TrueConf for Android 3.3.0 or later;
|
|
17
|
+
- TrueConf for iOS 4.2.0 or later.
|
|
18
|
+
|
|
19
|
+
!!! caution
|
|
20
|
+
Buttons can only be attached to plain text messages, and only chatbots can send messages with buttons.
|
|
21
|
+
|
|
22
|
+
For a complete description of the button format at the WebSocket API level, see the [TrueConf Server API documentation](https://trueconf.com/docs/chatbot-connector/en/buttons/).
|
|
23
|
+
|
|
24
|
+
## Your First Button
|
|
25
|
+
|
|
26
|
+
Create a button with `InlineKeyboardButton` and a keyboard with `InlineKeyboardMarkup`:
|
|
27
|
+
|
|
28
|
+
```python
|
|
29
|
+
from trueconf import InlineKeyboardButton, InlineKeyboardMarkup
|
|
30
|
+
|
|
31
|
+
keyboard = InlineKeyboardMarkup(
|
|
32
|
+
buttons=[
|
|
33
|
+
[InlineKeyboardButton(text="Help", command="menu:help")],
|
|
34
|
+
]
|
|
35
|
+
)
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Here, `text` is the button label and `command` is the command the bot receives when the button is clicked.
|
|
39
|
+
|
|
40
|
+
The `buttons` parameter contains a list of rows. This means that even a single button requires two nested lists: the outer list defines the keyboard, and the inner list defines its first row.
|
|
41
|
+
|
|
42
|
+
Pass the keyboard to the `buttons` parameter when sending a message:
|
|
43
|
+
|
|
44
|
+
```python
|
|
45
|
+
await bot.send_message(
|
|
46
|
+
chat_id="chat_id",
|
|
47
|
+
text="Choose an action:",
|
|
48
|
+
buttons=keyboard,
|
|
49
|
+
)
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
You can also pass a keyboard to `message.answer(...)` and `message.reply(...)`.
|
|
53
|
+
|
|
54
|
+
!!! tip
|
|
55
|
+
If several handlers use the same keyboard, create it once at module level and pass it to the methods that need it.
|
|
56
|
+
|
|
57
|
+
## Button Actions
|
|
58
|
+
|
|
59
|
+
The previous example used a `command` button, which sends a command to the bot. The library supports four actions, and each button must specify exactly one of them:
|
|
60
|
+
|
|
61
|
+
| Parameter | What happens when the button is clicked |
|
|
62
|
+
| --- | --- |
|
|
63
|
+
| `command` | The bot receives a `CallbackQuery` event; no message is posted to the chat |
|
|
64
|
+
| `url` | Opens a link using the `http`, `https`, `mailto`, or `trueconf` scheme |
|
|
65
|
+
| `message` | Sends the prepared message on behalf of the user |
|
|
66
|
+
| `copy_data` | Copies the specified data to the clipboard |
|
|
67
|
+
|
|
68
|
+
You can arrange buttons in multiple rows:
|
|
69
|
+
|
|
70
|
+
```python
|
|
71
|
+
from trueconf import ButtonStyle, InlineKeyboardButton, InlineKeyboardMarkup
|
|
72
|
+
|
|
73
|
+
keyboard = InlineKeyboardMarkup(
|
|
74
|
+
buttons=[
|
|
75
|
+
[
|
|
76
|
+
InlineKeyboardButton(
|
|
77
|
+
text="Help",
|
|
78
|
+
command="menu:help",
|
|
79
|
+
style=ButtonStyle.PRIMARY,
|
|
80
|
+
),
|
|
81
|
+
InlineKeyboardButton(
|
|
82
|
+
text="Open website",
|
|
83
|
+
url="https://trueconf.com",
|
|
84
|
+
),
|
|
85
|
+
],
|
|
86
|
+
[
|
|
87
|
+
InlineKeyboardButton(
|
|
88
|
+
text="Prepare a question",
|
|
89
|
+
message="Tell me more",
|
|
90
|
+
draft=True,
|
|
91
|
+
),
|
|
92
|
+
InlineKeyboardButton(
|
|
93
|
+
text="Copy code",
|
|
94
|
+
copy_data="code-42",
|
|
95
|
+
),
|
|
96
|
+
],
|
|
97
|
+
]
|
|
98
|
+
)
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
In this example:
|
|
102
|
+
|
|
103
|
+
- `Help` sends the `menu:help` command to the bot;
|
|
104
|
+
- `Open website` opens a link;
|
|
105
|
+
- `Prepare a question` places text in the input field because `draft=True`;
|
|
106
|
+
- `Copy code` copies the `code-42` string.
|
|
107
|
+
|
|
108
|
+
If `draft=True` is omitted from a `message` button, the prepared text is sent to the chat immediately on behalf of the user.
|
|
109
|
+
|
|
110
|
+
!!! tip
|
|
111
|
+
The `text` parameter is required for every action except `url`. If a URL button has no label, the client displays the URL itself.
|
|
112
|
+
|
|
113
|
+
!!! caution
|
|
114
|
+
Only a `command` button sends an event to the bot. The client application handles `url`, `message`, and `copy_data` buttons, so clicking them does not create a `CallbackQuery`.
|
|
115
|
+
|
|
116
|
+
## Additional Parameters
|
|
117
|
+
|
|
118
|
+
When the basic action is not enough, use additional parameters to customize the button's behavior and appearance:
|
|
119
|
+
|
|
120
|
+
| Parameter | Available for | Purpose |
|
|
121
|
+
| --- | --- | --- |
|
|
122
|
+
| `style` | All buttons | Sets `ButtonStyle.DEFAULT`, `ButtonStyle.PRIMARY`, `ButtonStyle.DANGER`, or `ButtonStyle.SUCCESS` |
|
|
123
|
+
| `button_id` | All buttons | Sets the button identifier; for a `command` button, it is included in the click event |
|
|
124
|
+
| `draft` | `message` only | Places text in the input field instead of sending it immediately |
|
|
125
|
+
| `custom_data` | `command` only | Sends additional data to the bot together with the command |
|
|
126
|
+
| `to` | `command` only | Directs the command to another bot |
|
|
127
|
+
|
|
128
|
+
For example, `custom_data` can carry the identifier of a selected object separately from the command:
|
|
129
|
+
|
|
130
|
+
```python
|
|
131
|
+
button = InlineKeyboardButton(
|
|
132
|
+
text="Add to cart",
|
|
133
|
+
command="cart:add",
|
|
134
|
+
custom_data="product-42",
|
|
135
|
+
button_id="add-product",
|
|
136
|
+
)
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
!!! warning
|
|
140
|
+
The `wait_reply=True` parameter and the `CallbackQuery.answer()` method cannot be used yet because TrueConf client applications do not currently support this scenario. The library therefore raises `NotImplementedError` when they are used.
|
|
141
|
+
|
|
142
|
+
## Handling a Command
|
|
143
|
+
|
|
144
|
+
After the user clicks a `command` button, the bot receives a `CallbackQuery` object. Register a `@router.callback_query()` handler and add a filter for the command value:
|
|
145
|
+
|
|
146
|
+
```python
|
|
147
|
+
from trueconf import CallbackQuery, F, Router
|
|
148
|
+
|
|
149
|
+
router = Router()
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
@router.callback_query(F.command == "menu:help")
|
|
153
|
+
async def show_help(callback: CallbackQuery):
|
|
154
|
+
await callback.edit_message(text="Help", buttons=help_keyboard)
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
The `F.command == "menu:help"` filter ensures that the handler responds only to the intended button. For a group of related commands, use a common prefix and an `F.command.startswith(...)` filter:
|
|
158
|
+
|
|
159
|
+
```python
|
|
160
|
+
@router.callback_query(F.command.startswith("menu:"))
|
|
161
|
+
async def handle_menu(callback: CallbackQuery):
|
|
162
|
+
...
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
The click data is available through the properties of the `CallbackQuery` object:
|
|
166
|
+
|
|
167
|
+
- `callback.command` — the command of the clicked button;
|
|
168
|
+
- `callback.custom_data` — the data from `custom_data`;
|
|
169
|
+
- `callback.message` — the message containing the button;
|
|
170
|
+
- `callback.chat` — the chat in which the button was clicked;
|
|
171
|
+
- `callback.command_source.button_id` — the `button_id` value, if specified.
|
|
172
|
+
|
|
173
|
+
## Updating a Menu After a Click
|
|
174
|
+
|
|
175
|
+
Buttons are often used for navigation: the user opens a section, and the bot changes the message text and displays a new set of actions. From a callback handler, use `callback.edit_message(...)`:
|
|
176
|
+
|
|
177
|
+
```python
|
|
178
|
+
@router.callback_query(F.command == "menu:catalog")
|
|
179
|
+
async def show_catalog(callback: CallbackQuery):
|
|
180
|
+
await callback.edit_message(
|
|
181
|
+
text="Choose a category:",
|
|
182
|
+
buttons=catalog_keyboard,
|
|
183
|
+
)
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
You can update the text and keyboard independently:
|
|
187
|
+
|
|
188
|
+
```python
|
|
189
|
+
# Update only the text and keep the current buttons
|
|
190
|
+
await callback.edit_message(text="New text")
|
|
191
|
+
|
|
192
|
+
# Update only the buttons and keep the current text
|
|
193
|
+
await callback.edit_message(buttons=new_keyboard)
|
|
194
|
+
|
|
195
|
+
# Update the text and buttons together
|
|
196
|
+
await callback.edit_message(
|
|
197
|
+
text="New text",
|
|
198
|
+
buttons=new_keyboard,
|
|
199
|
+
)
|
|
200
|
+
|
|
201
|
+
# Remove the buttons and keep the current text
|
|
202
|
+
await callback.edit_message(buttons=None)
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
If the `buttons` parameter is omitted, the current buttons are preserved. To remove them, explicitly pass `buttons=None`.
|
|
206
|
+
|
|
207
|
+
To edit a message outside a `CallbackQuery` handler, use `bot.edit_message(...)`. In this case, you must provide the message text:
|
|
208
|
+
|
|
209
|
+
```python
|
|
210
|
+
await bot.edit_message(
|
|
211
|
+
message_id="message_id",
|
|
212
|
+
text="Updated text",
|
|
213
|
+
buttons=new_keyboard,
|
|
214
|
+
)
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
## Getting a Message Keyboard
|
|
218
|
+
|
|
219
|
+
The keyboard of a received text message is available through `TextContent.buttons`:
|
|
220
|
+
|
|
221
|
+
```python
|
|
222
|
+
message = await bot.get_message_by_id(message_id)
|
|
223
|
+
|
|
224
|
+
if message.content.buttons is not None:
|
|
225
|
+
keyboard = message.content.buttons
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
## Restrictions
|
|
229
|
+
|
|
230
|
+
Observe the following restrictions when creating a keyboard:
|
|
231
|
+
|
|
232
|
+
- no more than 8 rows and 8 buttons per row;
|
|
233
|
+
- no more than 64 buttons in a keyboard;
|
|
234
|
+
- `text` must contain 1 to 32 characters when a label is provided;
|
|
235
|
+
- `command` must contain 1 to 255 ASCII characters;
|
|
236
|
+
- `custom_data` must contain 1 to 4096 ASCII characters;
|
|
237
|
+
- `copy_data` must contain 1 to 4095 Unicode characters;
|
|
238
|
+
- `url` must contain 8 to 8095 ASCII characters;
|
|
239
|
+
- HTML and Markdown in button labels are not processed, and line breaks are replaced with spaces.
|
|
240
|
+
|
|
241
|
+
## Complete Example
|
|
242
|
+
|
|
243
|
+
!!! tip "Ready-to-use bots"
|
|
244
|
+
More ready-to-use button scenarios are available in the [examples on GitHub](https://github.com/TrueConf/python-trueconf-bot/tree/master/examples/buttons_bot.py).
|
|
245
|
+
|
|
246
|
+
This bot sends a menu in response to the `/menu` command and then handles the `Say hello` button:
|
|
247
|
+
|
|
248
|
+
```python
|
|
249
|
+
import asyncio
|
|
250
|
+
|
|
251
|
+
from trueconf import (
|
|
252
|
+
Bot,
|
|
253
|
+
CallbackQuery,
|
|
254
|
+
Dispatcher,
|
|
255
|
+
F,
|
|
256
|
+
InlineKeyboardButton,
|
|
257
|
+
InlineKeyboardMarkup,
|
|
258
|
+
Message,
|
|
259
|
+
Router,
|
|
260
|
+
)
|
|
261
|
+
from trueconf.filters import Command
|
|
262
|
+
|
|
263
|
+
router = Router()
|
|
264
|
+
dispatcher = Dispatcher()
|
|
265
|
+
|
|
266
|
+
MAIN_MENU = InlineKeyboardMarkup(
|
|
267
|
+
buttons=[
|
|
268
|
+
[
|
|
269
|
+
InlineKeyboardButton(text="Say hello", command="menu:hello"),
|
|
270
|
+
InlineKeyboardButton(text="Open website", url="https://trueconf.com"),
|
|
271
|
+
],
|
|
272
|
+
[InlineKeyboardButton(text="Copy", copy_data="trueconf")],
|
|
273
|
+
]
|
|
274
|
+
)
|
|
275
|
+
|
|
276
|
+
|
|
277
|
+
@router.message(Command("menu"))
|
|
278
|
+
async def show_menu(message: Message):
|
|
279
|
+
await message.answer("Choose an action:", buttons=MAIN_MENU)
|
|
280
|
+
|
|
281
|
+
|
|
282
|
+
@router.callback_query(F.command == "menu:hello")
|
|
283
|
+
async def say_hello(callback: CallbackQuery):
|
|
284
|
+
await callback.edit_message(text="Hello!", buttons=MAIN_MENU)
|
|
285
|
+
|
|
286
|
+
|
|
287
|
+
async def main():
|
|
288
|
+
dispatcher.include_router(router)
|
|
289
|
+
|
|
290
|
+
bot = Bot.from_credentials(
|
|
291
|
+
username="echo_bot",
|
|
292
|
+
password="123tr",
|
|
293
|
+
server="video.example.com",
|
|
294
|
+
dispatcher=dispatcher,
|
|
295
|
+
)
|
|
296
|
+
await bot.run()
|
|
297
|
+
|
|
298
|
+
|
|
299
|
+
if __name__ == "__main__":
|
|
300
|
+
asyncio.run(main())
|
|
301
|
+
```
|