arpakitlib 1.8.17__py3-none-any.whl → 1.8.19__py3-none-any.whl
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.
- arpakitlib/_arpakit_project_template_v_5/arpakitlib_project_template_info.json +3 -0
- arpakitlib/_arpakit_project_template_v_5/command/alembic_revision_autogenerate.sh +2 -0
- arpakitlib/_arpakit_project_template_v_5/command/reinit_all_sqlalchemy_db.py +13 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/api/auth.py +5 -5
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/api/auth2.py +72 -25
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/api/exception_handler.py +10 -10
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/api/router/admin/get_arpakitlib_project_template_info.py +2 -2
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/api/router/client/get_errors_info.py +12 -2
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/api/router/client/now_utc_datetime.py +2 -2
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/api/schema/out/admin/common.py +1 -1
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/api/schema/out/admin/operation.py +2 -2
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/api/schema/out/admin/story_log.py +2 -2
- arpakitlib/_arpakit_project_template_v_5/project/api/schema/out/admin/user.py +22 -0
- arpakitlib/_arpakit_project_template_v_5/project/api/schema/out/admin/user_token.py +14 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/api/schema/out/client/common.py +1 -1
- arpakitlib/{_arpakit_project_template_v_4/project/api/schema/out/general → _arpakit_project_template_v_5/project/api/schema/out/common}/error.py +1 -1
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/operation_execution/operation_executor_worker.py +2 -2
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/sandbox/sandbox_1.py +3 -1
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/sqlalchemy_db_/sqlalchemy_model/user.py +1 -1
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/tg_bot/blank/admin.py +2 -8
- arpakitlib/_arpakit_project_template_v_5/project/tg_bot/blank/client.py +69 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/tg_bot/callback/client.py +4 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/tg_bot/const.py +7 -6
- arpakitlib/_arpakit_project_template_v_5/project/tg_bot/filter_/user_roles_has_admin.py +18 -0
- arpakitlib/_arpakit_project_template_v_5/project/tg_bot/filter_/user_roles_has_client.py +18 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/tg_bot/middleware/init_user.py +9 -8
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/tg_bot/router/admin/arpakitlib_project_template_info.py +6 -4
- arpakitlib/_arpakit_project_template_v_5/project/tg_bot/router/admin/clear_log_file.py +33 -0
- arpakitlib/_arpakit_project_template_v_5/project/tg_bot/router/admin/drop_sqlalchemy_db.py +31 -0
- arpakitlib/_arpakit_project_template_v_5/project/tg_bot/router/admin/init_sqlalchemy_db.py +28 -0
- arpakitlib/_arpakit_project_template_v_5/project/tg_bot/router/admin/kb_with_not_modified.py +59 -0
- arpakitlib/_arpakit_project_template_v_5/project/tg_bot/router/admin/kb_with_old_cd.py +40 -0
- arpakitlib/_arpakit_project_template_v_5/project/tg_bot/router/admin/kb_with_raise_error.py +48 -0
- arpakitlib/_arpakit_project_template_v_5/project/tg_bot/router/admin/kb_with_remove_message.py +35 -0
- arpakitlib/_arpakit_project_template_v_5/project/tg_bot/router/admin/log_file.py +37 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/tg_bot/router/admin/me.py +4 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/tg_bot/router/admin/raise_fake_error.py +5 -1
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/tg_bot/router/admin/reinit_sqlalchemy_db.py +7 -3
- arpakitlib/_arpakit_project_template_v_5/project/tg_bot/router/admin/set_tg_bot_commands.py +28 -0
- arpakitlib/_arpakit_project_template_v_5/project/tg_bot/router/client/about.py +30 -0
- arpakitlib/_arpakit_project_template_v_5/project/tg_bot/router/client/error_handler.py +91 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/tg_bot/router/client/healthcheck.py +3 -1
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/tg_bot/router/client/hello_world.py +5 -2
- arpakitlib/_arpakit_project_template_v_5/project/tg_bot/router/client/raw_callback_query.py +30 -0
- arpakitlib/_arpakit_project_template_v_5/project/tg_bot/router/client/raw_inline_query.py +14 -0
- arpakitlib/_arpakit_project_template_v_5/project/tg_bot/router/client/raw_message.py +15 -0
- arpakitlib/_arpakit_project_template_v_5/project/tg_bot/router/client/remove_message.py +28 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/tg_bot/router/client/start.py +3 -2
- arpakitlib/_arpakit_project_template_v_5/project/tg_bot/router/client/support.py +30 -0
- arpakitlib/_arpakit_project_template_v_5/project/tg_bot/router/main_router.py +36 -0
- arpakitlib/_arpakit_project_template_v_5/project/tg_bot/util/notify_admins.py +58 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/tg_bot/util/set_tg_bot_commands.py +26 -4
- arpakitlib/_arpakit_project_template_v_5/project/util/__init__.py +0 -0
- arpakitlib/ar_base_worker_util.py +7 -7
- arpakitlib/ar_blank_util.py +2 -2
- arpakitlib/ar_func_util.py +21 -14
- arpakitlib/ar_logging_util.py +2 -2
- arpakitlib/ar_sqlalchemy_util.py +9 -3
- {arpakitlib-1.8.17.dist-info → arpakitlib-1.8.19.dist-info}/METADATA +1 -1
- arpakitlib-1.8.19.dist-info/RECORD +347 -0
- arpakitlib/_arpakit_project_template_v_4/arpakitlib_project_template_info.json +0 -3
- arpakitlib/_arpakit_project_template_v_4/command/alembic_revision_autogenerate.sh +0 -2
- arpakitlib/_arpakit_project_template_v_4/project/api/schema/out/common.py +0 -5
- arpakitlib/_arpakit_project_template_v_4/project/tg_bot/blank/client.py +0 -44
- arpakitlib/_arpakit_project_template_v_4/project/tg_bot/error_handler.py +0 -37
- arpakitlib/_arpakit_project_template_v_4/project/tg_bot/filter_/user_roles_has_admin.py +0 -27
- arpakitlib/_arpakit_project_template_v_4/project/tg_bot/filter_/user_roles_has_client.py +0 -27
- arpakitlib/_arpakit_project_template_v_4/project/tg_bot/router/admin/main_router.py +0 -15
- arpakitlib/_arpakit_project_template_v_4/project/tg_bot/router/client/main_router.py +0 -14
- arpakitlib/_arpakit_project_template_v_4/project/tg_bot/router/main_router.py +0 -13
- arpakitlib-1.8.17.dist-info/RECORD +0 -330
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/.gitignore +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/.python-version +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/LICENSE +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/README.md +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/alembic/README +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/alembic/env.py +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/alembic/script.py.mako +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/alembic/versions/__init__.py +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/alembic.ini +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/command/__init__.py +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/command/alembic_history.sh +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/command/alembic_upgrade_head.sh +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/command/beautify_json.py +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/command/check_logging.py +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/command/check_sqlalchemy_db.py +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/command/demojize.py +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/command/docker_ps_a.sh +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/command/docker_rm_postgres.sh +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/command/docker_run_postgres.sh +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/command/docker_start_postgres.sh +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/command/docker_stop_postgres.sh +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/command/drop_json_db.py +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/command/drop_sqlalchemy_db.py +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/command/generate_settings_env_example.py +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/command/git_commit.sh +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/command/git_push_arpakit_company_github_1.sh +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/command/git_push_arpakit_company_gitlab_1.sh +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/command/git_push_arpakit_github_1.sh +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/command/git_push_arpakit_gitlab_1.sh +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/command/git_remote_v.sh +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/command/git_set_arpakit_company_origin.sh +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/command/git_set_arpakit_origin.sh +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/command/git_set_divarteam_origin.sh +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/command/git_status.sh +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/command/hello_world.py +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/command/init_json_db.py +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/command/init_sqlalchemy_db.py +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/command/poetry_check.sh +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/command/poetry_clear_cache.sh +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/command/poetry_config.sh +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/command/poetry_install.sh +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/command/poetry_lock.sh +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/command/poetry_remove_and_add_arpakitlib.sh +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/command/poetry_show.sh +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/command/poetry_show_arpakitlib.sh +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/command/poetry_update.sh +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/command/poetry_update_arpakitlib.sh +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/command/reinit_json_db.py +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/command/reinit_sqlalchemy_db.py +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/command/remove_operations.py +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/command/remove_story_logs.py +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/command/rm_all_records_in_json_db.py +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/command/set_tg_bot_commands.py +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/command/show_settings.py +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/command/start_api.py +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/command/start_api_for_prod.py +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/command/start_api_with_reload.py +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/command/start_operation_executor_worker.py +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/command/start_operation_executor_workers.py +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/command/start_scheduled_operation_creator_worker.py +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/command/start_sqladmin.py +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/command/start_sqladmin_for_prod.py +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/command/start_sqladmin_with_reload.py +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/command/start_tg_bot.py +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/command/start_tg_bot_for_prod.py +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/example.env +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/note/note_1.txt +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/note/note_2.txt +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/note/note_3.txt +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/note/note_4.txt +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/note/note_5.txt +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/__init__.py +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/additional_model/__init__.py +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/additional_model/common.py +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/api/__init__.py +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/api/asgi.py +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/api/const.py +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/api/create_api_app.py +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/api/event.py +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/api/exception.py +1 -1
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/api/openapi_ui.py +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/api/response.py +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/api/router/__init__.py +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/api/router/admin/__init__.py +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/api/router/admin/get_auth_data.py +1 -1
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/api/router/admin/main_router.py +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/api/router/client/__init__.py +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/api/router/client/main_router.py +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/api/router/general/__init__.py +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/api/router/general/healthcheck.py +1 -1
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/api/router/general/main_router.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/api/router/main_router.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/api/schema/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/api/schema/common.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/api/schema/in_/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/api/schema/in_/admin/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/api/schema/in_/admin/common.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/api/schema/in_/client/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/api/schema/in_/client/common.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4/project/api/schema/in_/general → _arpakit_project_template_v_5/project/api/schema/in_/common}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4/project/api/schema/out → _arpakit_project_template_v_5/project/api/schema/in_/general}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/api/schema/in_/general/common.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4/project/api/schema/out/admin → _arpakit_project_template_v_5/project/api/schema/out}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4/project/api/schema/out/client → _arpakit_project_template_v_5/project/api/schema/out/admin}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4/project/api/schema/out/common → _arpakit_project_template_v_5/project/api/schema/out/client}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4/project/api/schema/out/general → _arpakit_project_template_v_5/project/api/schema/out/common}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/api/schema/out/common/datetime_.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/api/schema/out/common/raw_data.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4/project/business_service → _arpakit_project_template_v_5/project/api/schema/out/general}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/api/schema/out/general/common.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/api/schema/out/general/errors_info_general.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/api/schema/out/general/healthcheck.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/api/util.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4/project/celery_ → _arpakit_project_template_v_5/project/business_service}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/business_service/hello_world.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/business_service/remove_operations.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4/project/core → _arpakit_project_template_v_5/project/celery_}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4/project/json_db → _arpakit_project_template_v_5/project/core}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/core/cache_file_storage_in_dir.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/core/const.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/core/dump_file_storage_in_dir.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/core/jinja2_templates.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/core/media_file_storage_in_dir.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/core/settings.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/core/util.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4/project/operation_execution → _arpakit_project_template_v_5/project/json_db}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/json_db/json_db.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/more/helloworld +0 -0
- /arpakitlib/{_arpakit_project_template_v_4/project/resource → _arpakit_project_template_v_5/project/operation_execution}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/operation_execution/const.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/operation_execution/scheduled_operation_creator_worker.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/operation_execution/scheduled_operations.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/operation_execution/util.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4/project/sandbox → _arpakit_project_template_v_5/project/resource}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/resource/static/1 +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/resource/static/healthcheck +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/resource/static/helloworld +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/resource/static/openapi-favicon.png +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/resource/static/redoc/redoc.standalone.js +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/resource/static/swagger-ui/favicon-16x16.png +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/resource/static/swagger-ui/favicon-32x32.png +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/resource/static/swagger-ui/index.css +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/resource/static/swagger-ui/index.html +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/resource/static/swagger-ui/oauth2-redirect.html +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/resource/static/swagger-ui/swagger-initializer.js +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/resource/static/swagger-ui/swagger-ui-bundle.js +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/resource/static/swagger-ui/swagger-ui-bundle.js.map +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/resource/static/swagger-ui/swagger-ui-es-bundle-core.js +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/resource/static/swagger-ui/swagger-ui-es-bundle-core.js.map +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/resource/static/swagger-ui/swagger-ui-es-bundle.js +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/resource/static/swagger-ui/swagger-ui-es-bundle.js.map +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/resource/static/swagger-ui/swagger-ui-standalone-preset.js +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/resource/static/swagger-ui/swagger-ui-standalone-preset.js.map +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/resource/static/swagger-ui/swagger-ui.css +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/resource/static/swagger-ui/swagger-ui.css.map +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/resource/static/swagger-ui/swagger-ui.js +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/resource/static/swagger-ui/swagger-ui.js.map +0 -0
- /arpakitlib/{_arpakit_project_template_v_4/project/site → _arpakit_project_template_v_5/project/sandbox}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/sandbox/sandbox_2.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/sandbox/sandbox_3.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/sandbox/sandbox_4.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/sandbox/sandbox_5.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/sandbox/sandbox_6.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/sandbox/sandbox_7.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4/project/site/router → _arpakit_project_template_v_5/project/site}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/site/asgi.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/site/consts.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/site/create_site_app.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/site/event.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/site/exception_handler.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4/project/sqladmin_ → _arpakit_project_template_v_5/project/site/router}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/site/router/main_router.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4/project/sqlalchemy_db_ → _arpakit_project_template_v_5/project/sqladmin_}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/sqladmin_/add_admin_in_app.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/sqladmin_/admin_auth.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/sqladmin_/asgi.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/sqladmin_/create_sqladmin_app.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/sqladmin_/event.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/sqladmin_/model_view/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/sqladmin_/model_view/common.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/sqladmin_/model_view/operation.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/sqladmin_/model_view/story_log.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4/project/test_data → _arpakit_project_template_v_5/project/sqlalchemy_db_}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/sqlalchemy_db_/const.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/sqlalchemy_db_/sqlalchemy_db.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/sqlalchemy_db_/sqlalchemy_model/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/sqlalchemy_db_/sqlalchemy_model/api_key.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/sqlalchemy_db_/sqlalchemy_model/common.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/sqlalchemy_db_/sqlalchemy_model/operation.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/sqlalchemy_db_/sqlalchemy_model/story_log.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/sqlalchemy_db_/sqlalchemy_model/user_token.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/sqlalchemy_db_/util.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4/project/tg_bot → _arpakit_project_template_v_5/project/test_data}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/test_data/make_test_data_1.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/test_data/make_test_data_2.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/test_data/make_test_data_3.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/test_data/make_test_data_4.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/test_data/make_test_data_5.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4/project/tg_bot/blank → _arpakit_project_template_v_5/project/tg_bot}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4/project/tg_bot/callback → _arpakit_project_template_v_5/project/tg_bot/blank}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/tg_bot/blank/common.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4/project/tg_bot/filter_ → _arpakit_project_template_v_5/project/tg_bot/callback}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/tg_bot/callback/admin.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/tg_bot/callback/common.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/tg_bot/event.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4/project/tg_bot/kb → _arpakit_project_template_v_5/project/tg_bot/filter_}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/tg_bot/filter_/is_private_chat.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/tg_bot/filter_/message_text.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/tg_bot/filter_/not_prod_mode_filter.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/tg_bot/filter_/prod_mode_filter.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4/project/tg_bot/kb/inline_ → _arpakit_project_template_v_5/project/tg_bot/kb}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4/project/tg_bot/kb/inline_/admin → _arpakit_project_template_v_5/project/tg_bot/kb/inline_}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4/project/tg_bot/kb/inline_/client → _arpakit_project_template_v_5/project/tg_bot/kb/inline_/admin}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/tg_bot/kb/inline_/admin/common.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4/project/tg_bot/kb/static_ → _arpakit_project_template_v_5/project/tg_bot/kb/inline_/client}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/tg_bot/kb/inline_/client/common.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/tg_bot/kb/inline_/client/hello_world.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/tg_bot/kb/inline_/common.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4/project/tg_bot/kb/static_/admin → _arpakit_project_template_v_5/project/tg_bot/kb/static_}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4/project/tg_bot/kb/static_/client → _arpakit_project_template_v_5/project/tg_bot/kb/static_/admin}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/tg_bot/kb/static_/admin/common.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4/project/tg_bot/middleware → _arpakit_project_template_v_5/project/tg_bot/kb/static_/client}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/tg_bot/kb/static_/client/common.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/tg_bot/kb/static_/client/hello_world.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/tg_bot/kb/static_/common.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4/project/tg_bot/router → _arpakit_project_template_v_5/project/tg_bot/middleware}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/tg_bot/middleware/common.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/tg_bot/middleware/middleware.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4/project/tg_bot/router/admin → _arpakit_project_template_v_5/project/tg_bot/router}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4/project/tg_bot/router/client → _arpakit_project_template_v_5/project/tg_bot/router/admin}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4/project/tg_bot/util → _arpakit_project_template_v_5/project/tg_bot/router/client}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/tg_bot/start_tg_bot.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/tg_bot/tg_bot.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/tg_bot/tg_bot_dispatcher.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4/project → _arpakit_project_template_v_5/project/tg_bot}/util/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/tg_bot/util/etc.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/util/arpakitlib_project_template.py +0 -0
- {arpakitlib-1.8.17.dist-info → arpakitlib-1.8.19.dist-info}/LICENSE +0 -0
- {arpakitlib-1.8.17.dist-info → arpakitlib-1.8.19.dist-info}/WHEEL +0 -0
- {arpakitlib-1.8.17.dist-info → arpakitlib-1.8.19.dist-info}/entry_points.txt +0 -0
@@ -0,0 +1,91 @@
|
|
1
|
+
import logging
|
2
|
+
|
3
|
+
import aiogram
|
4
|
+
from aiogram import Router
|
5
|
+
from aiogram.exceptions import TelegramBadRequest
|
6
|
+
|
7
|
+
from arpakitlib.ar_exception_util import exception_to_traceback_str
|
8
|
+
from project.sqlalchemy_db_.sqlalchemy_db import get_cached_sqlalchemy_db
|
9
|
+
from project.sqlalchemy_db_.sqlalchemy_model import StoryLogDBM
|
10
|
+
from project.tg_bot.blank.client import get_cached_client_tg_bot_blank
|
11
|
+
from project.tg_bot.middleware.common import MiddlewareDataTgBot
|
12
|
+
|
13
|
+
_logger = logging.getLogger(__name__)
|
14
|
+
|
15
|
+
tg_bot_router = Router()
|
16
|
+
|
17
|
+
|
18
|
+
@tg_bot_router.error()
|
19
|
+
async def _(
|
20
|
+
error_event: aiogram.types.ErrorEvent,
|
21
|
+
middleware_data_tg_bot: MiddlewareDataTgBot,
|
22
|
+
**kwargs
|
23
|
+
):
|
24
|
+
need_logging = True
|
25
|
+
need_create_story_log = True
|
26
|
+
|
27
|
+
if (
|
28
|
+
error_event.update.event_type == "message"
|
29
|
+
and isinstance(error_event.update.event, aiogram.types.Message)
|
30
|
+
):
|
31
|
+
try:
|
32
|
+
await error_event.update.event.answer(
|
33
|
+
text=get_cached_client_tg_bot_blank().error()
|
34
|
+
)
|
35
|
+
except Exception as exception:
|
36
|
+
_logger.error(exception)
|
37
|
+
|
38
|
+
if (
|
39
|
+
error_event.update.event_type == "callback_query"
|
40
|
+
and isinstance(error_event.update.event, aiogram.types.CallbackQuery)
|
41
|
+
):
|
42
|
+
|
43
|
+
if isinstance(error_event.exception, TelegramBadRequest) and (
|
44
|
+
error_event.exception.message
|
45
|
+
and "message is not modified".lower().strip() in error_event.exception.message.lower().strip()
|
46
|
+
):
|
47
|
+
error_linked_with_message_not_modified = True
|
48
|
+
else:
|
49
|
+
error_linked_with_message_not_modified = False
|
50
|
+
|
51
|
+
if error_linked_with_message_not_modified:
|
52
|
+
need_logging = False
|
53
|
+
need_create_story_log = False
|
54
|
+
|
55
|
+
try:
|
56
|
+
await error_event.update.event.answer()
|
57
|
+
except Exception as exception:
|
58
|
+
_logger.error(exception)
|
59
|
+
|
60
|
+
if not error_linked_with_message_not_modified:
|
61
|
+
|
62
|
+
try:
|
63
|
+
await error_event.update.event.message.edit_reply_markup(reply_markup=None)
|
64
|
+
except Exception as exception:
|
65
|
+
_logger.error(exception)
|
66
|
+
|
67
|
+
try:
|
68
|
+
await error_event.update.event.message.answer(
|
69
|
+
text=get_cached_client_tg_bot_blank().error()
|
70
|
+
)
|
71
|
+
except Exception as exception:
|
72
|
+
_logger.error(exception)
|
73
|
+
|
74
|
+
if need_logging:
|
75
|
+
_logger.exception(error_event.exception)
|
76
|
+
|
77
|
+
if need_create_story_log:
|
78
|
+
if get_cached_sqlalchemy_db() is not None:
|
79
|
+
async with get_cached_sqlalchemy_db().new_async_session() as session:
|
80
|
+
story_log_dbm = StoryLogDBM(
|
81
|
+
level=StoryLogDBM.Levels.error,
|
82
|
+
type=StoryLogDBM.Types.error_in_tg_bot,
|
83
|
+
title=f"{type(error_event.exception)}",
|
84
|
+
data={
|
85
|
+
"exception": str(error_event.exception),
|
86
|
+
"exception_traceback": exception_to_traceback_str(exception=error_event.exception)
|
87
|
+
}
|
88
|
+
)
|
89
|
+
session.add(story_log_dbm)
|
90
|
+
await session.commit()
|
91
|
+
await session.refresh(story_log_dbm)
|
@@ -7,7 +7,9 @@ from project.tg_bot.middleware.common import MiddlewareDataTgBot
|
|
7
7
|
tg_bot_router = aiogram.Router()
|
8
8
|
|
9
9
|
|
10
|
-
@tg_bot_router.message(
|
10
|
+
@tg_bot_router.message(
|
11
|
+
aiogram.filters.Command(ClientTgBotCommands.healthcheck),
|
12
|
+
)
|
11
13
|
async def _(
|
12
14
|
m: aiogram.types.Message,
|
13
15
|
middleware_data_tg_bot: MiddlewareDataTgBot,
|
@@ -17,7 +17,8 @@ tg_bot_router = aiogram.Router()
|
|
17
17
|
or_f(
|
18
18
|
aiogram.filters.Command(ClientTgBotCommands.hello_world),
|
19
19
|
MessageTextTgBotFilter(get_cached_client_tg_bot_blank().but_hello_world())
|
20
|
-
)
|
20
|
+
),
|
21
|
+
|
21
22
|
)
|
22
23
|
async def _(
|
23
24
|
m: aiogram.types.Message,
|
@@ -34,7 +35,9 @@ async def _(
|
|
34
35
|
)
|
35
36
|
|
36
37
|
|
37
|
-
@tg_bot_router.callback_query(
|
38
|
+
@tg_bot_router.callback_query(
|
39
|
+
HelloWorldClientCD.filter()
|
40
|
+
)
|
38
41
|
async def _(
|
39
42
|
cq: aiogram.types.CallbackQuery,
|
40
43
|
middleware_data_tg_bot: MiddlewareDataTgBot,
|
@@ -0,0 +1,30 @@
|
|
1
|
+
import logging
|
2
|
+
|
3
|
+
import aiogram.filters
|
4
|
+
from aiogram.exceptions import AiogramError
|
5
|
+
|
6
|
+
from project.tg_bot.blank.client import get_cached_client_tg_bot_blank
|
7
|
+
from project.tg_bot.middleware.common import MiddlewareDataTgBot
|
8
|
+
|
9
|
+
_logger = logging.getLogger(__name__)
|
10
|
+
tg_bot_router = aiogram.Router()
|
11
|
+
|
12
|
+
|
13
|
+
@tg_bot_router.callback_query()
|
14
|
+
async def _(
|
15
|
+
cq: aiogram.types.CallbackQuery,
|
16
|
+
middleware_data_tg_bot: MiddlewareDataTgBot,
|
17
|
+
**kwargs
|
18
|
+
):
|
19
|
+
try:
|
20
|
+
await cq.answer(
|
21
|
+
text=get_cached_client_tg_bot_blank().keyboard_is_old(),
|
22
|
+
show_alert=True
|
23
|
+
)
|
24
|
+
except AiogramError as exception:
|
25
|
+
_logger.error(exception)
|
26
|
+
|
27
|
+
try:
|
28
|
+
await cq.message.edit_reply_markup(reply_markup=None)
|
29
|
+
except AiogramError as e:
|
30
|
+
_logger.error(e)
|
@@ -0,0 +1,14 @@
|
|
1
|
+
import aiogram.filters
|
2
|
+
|
3
|
+
from project.tg_bot.middleware.common import MiddlewareDataTgBot
|
4
|
+
|
5
|
+
tg_bot_router = aiogram.Router()
|
6
|
+
|
7
|
+
|
8
|
+
@tg_bot_router.inline_query()
|
9
|
+
async def _(
|
10
|
+
iq: aiogram.types.InlineQuery,
|
11
|
+
middleware_data_tg_bot: MiddlewareDataTgBot,
|
12
|
+
**kwargs
|
13
|
+
):
|
14
|
+
pass
|
@@ -0,0 +1,15 @@
|
|
1
|
+
import aiogram.filters
|
2
|
+
|
3
|
+
from project.tg_bot.blank.client import get_cached_client_tg_bot_blank
|
4
|
+
from project.tg_bot.middleware.common import MiddlewareDataTgBot
|
5
|
+
|
6
|
+
tg_bot_router = aiogram.Router()
|
7
|
+
|
8
|
+
|
9
|
+
@tg_bot_router.message()
|
10
|
+
async def _(
|
11
|
+
m: aiogram.types.Message,
|
12
|
+
middleware_data_tg_bot: MiddlewareDataTgBot,
|
13
|
+
**kwargs
|
14
|
+
):
|
15
|
+
await m.answer(text=get_cached_client_tg_bot_blank().raw_message())
|
@@ -0,0 +1,28 @@
|
|
1
|
+
import logging
|
2
|
+
|
3
|
+
from aiogram import Router, types
|
4
|
+
from aiogram.exceptions import AiogramError
|
5
|
+
|
6
|
+
from project.tg_bot.callback.client import RemoveMessageCD
|
7
|
+
from project.tg_bot.middleware.common import MiddlewareDataTgBot
|
8
|
+
|
9
|
+
_logger = logging.getLogger(__name__)
|
10
|
+
tg_bot_router = Router()
|
11
|
+
|
12
|
+
|
13
|
+
@tg_bot_router.callback_query(
|
14
|
+
RemoveMessageCD.filter(),
|
15
|
+
)
|
16
|
+
async def _(
|
17
|
+
cq: types.CallbackQuery,
|
18
|
+
middleware_data_tg_bot: MiddlewareDataTgBot,
|
19
|
+
**kwargs
|
20
|
+
):
|
21
|
+
try:
|
22
|
+
await cq.message.delete()
|
23
|
+
except AiogramError as exception:
|
24
|
+
_logger.error(exception)
|
25
|
+
try:
|
26
|
+
await cq.answer()
|
27
|
+
except AiogramError as exception:
|
28
|
+
_logger.error(exception)
|
@@ -17,13 +17,14 @@ _logger = logging.getLogger(__name__)
|
|
17
17
|
or_f(
|
18
18
|
Command(ClientTgBotCommands.start),
|
19
19
|
MessageTextTgBotFilter([
|
20
|
+
ClientTgBotCommands.start,
|
20
21
|
"начать",
|
21
22
|
"старт",
|
22
23
|
"привет",
|
23
24
|
"запуск",
|
24
|
-
"start",
|
25
25
|
], ignore_case=True)
|
26
|
-
)
|
26
|
+
),
|
27
|
+
|
27
28
|
)
|
28
29
|
async def _(
|
29
30
|
m: aiogram.types.Message,
|
@@ -0,0 +1,30 @@
|
|
1
|
+
import logging
|
2
|
+
|
3
|
+
import aiogram
|
4
|
+
from aiogram import Router
|
5
|
+
from aiogram.filters import Command, or_f
|
6
|
+
|
7
|
+
from project.tg_bot.blank.client import get_cached_client_tg_bot_blank
|
8
|
+
from project.tg_bot.const import ClientTgBotCommands
|
9
|
+
from project.tg_bot.filter_.message_text import MessageTextTgBotFilter
|
10
|
+
from project.tg_bot.middleware.common import MiddlewareDataTgBot
|
11
|
+
|
12
|
+
tg_bot_router = Router()
|
13
|
+
_logger = logging.getLogger(__name__)
|
14
|
+
|
15
|
+
|
16
|
+
@tg_bot_router.message(
|
17
|
+
or_f(
|
18
|
+
Command(ClientTgBotCommands.support),
|
19
|
+
MessageTextTgBotFilter([
|
20
|
+
ClientTgBotCommands.support,
|
21
|
+
"поддержка"
|
22
|
+
], ignore_case=True)
|
23
|
+
)
|
24
|
+
)
|
25
|
+
async def _(
|
26
|
+
m: aiogram.types.Message,
|
27
|
+
middleware_data_tg_bot: MiddlewareDataTgBot,
|
28
|
+
**kwargs
|
29
|
+
):
|
30
|
+
await m.answer(text=get_cached_client_tg_bot_blank().support_info())
|
@@ -0,0 +1,36 @@
|
|
1
|
+
from aiogram import Router
|
2
|
+
|
3
|
+
from project.tg_bot.router.admin import reinit_sqlalchemy_db, arpakitlib_project_template_info, raise_fake_error, me, \
|
4
|
+
log_file, clear_log_file, set_tg_bot_commands, init_sqlalchemy_db, drop_sqlalchemy_db, kb_with_remove_message, \
|
5
|
+
kb_with_old_cd, kb_with_raise_error, kb_with_not_modified
|
6
|
+
from project.tg_bot.router.client import remove_message, start, about, healthcheck, hello_world, \
|
7
|
+
support, error_handler, raw_callback_query, raw_message, raw_inline_query
|
8
|
+
|
9
|
+
main_tg_bot_router = Router()
|
10
|
+
|
11
|
+
# admin
|
12
|
+
main_tg_bot_router.include_router(router=reinit_sqlalchemy_db.tg_bot_router)
|
13
|
+
main_tg_bot_router.include_router(router=arpakitlib_project_template_info.tg_bot_router)
|
14
|
+
main_tg_bot_router.include_router(router=raise_fake_error.tg_bot_router)
|
15
|
+
main_tg_bot_router.include_router(router=me.tg_bot_router)
|
16
|
+
main_tg_bot_router.include_router(router=log_file.tg_bot_router)
|
17
|
+
main_tg_bot_router.include_router(router=clear_log_file.tg_bot_router)
|
18
|
+
main_tg_bot_router.include_router(router=set_tg_bot_commands.tg_bot_router)
|
19
|
+
main_tg_bot_router.include_router(router=init_sqlalchemy_db.tg_bot_router)
|
20
|
+
main_tg_bot_router.include_router(router=drop_sqlalchemy_db.tg_bot_router)
|
21
|
+
main_tg_bot_router.include_router(router=kb_with_remove_message.tg_bot_router)
|
22
|
+
main_tg_bot_router.include_router(router=kb_with_old_cd.tg_bot_router)
|
23
|
+
main_tg_bot_router.include_router(router=kb_with_raise_error.tg_bot_router)
|
24
|
+
main_tg_bot_router.include_router(router=kb_with_not_modified.tg_bot_router)
|
25
|
+
|
26
|
+
# client
|
27
|
+
main_tg_bot_router.include_router(router=error_handler.tg_bot_router)
|
28
|
+
main_tg_bot_router.include_router(router=remove_message.tg_bot_router)
|
29
|
+
main_tg_bot_router.include_router(router=start.tg_bot_router)
|
30
|
+
main_tg_bot_router.include_router(router=about.tg_bot_router)
|
31
|
+
main_tg_bot_router.include_router(router=healthcheck.tg_bot_router)
|
32
|
+
main_tg_bot_router.include_router(router=hello_world.tg_bot_router)
|
33
|
+
main_tg_bot_router.include_router(router=support.tg_bot_router)
|
34
|
+
main_tg_bot_router.include_router(router=raw_message.tg_bot_router)
|
35
|
+
main_tg_bot_router.include_router(router=raw_inline_query.tg_bot_router)
|
36
|
+
main_tg_bot_router.include_router(router=raw_callback_query.tg_bot_router)
|
@@ -0,0 +1,58 @@
|
|
1
|
+
import asyncio
|
2
|
+
import logging
|
3
|
+
|
4
|
+
import sqlalchemy
|
5
|
+
from aiogram.exceptions import AiogramError
|
6
|
+
from emoji import emojize
|
7
|
+
|
8
|
+
from arpakitlib.ar_str_util import remove_tags_and_html
|
9
|
+
from project.core.settings import get_cached_settings
|
10
|
+
from project.core.util import setup_logging
|
11
|
+
from project.sqlalchemy_db_.sqlalchemy_db import get_cached_sqlalchemy_db
|
12
|
+
from project.sqlalchemy_db_.sqlalchemy_model import UserDBM
|
13
|
+
from project.tg_bot.tg_bot import get_cached_tg_bot
|
14
|
+
|
15
|
+
_logger = logging.getLogger(__name__)
|
16
|
+
|
17
|
+
|
18
|
+
async def notify_admins(text: str):
|
19
|
+
text = emojize(text.strip())
|
20
|
+
|
21
|
+
admin_tg_ids = set()
|
22
|
+
|
23
|
+
if get_cached_sqlalchemy_db() is not None:
|
24
|
+
async with get_cached_sqlalchemy_db().new_async_session() as async_session:
|
25
|
+
admin_user_dbms: list[UserDBM] = (await async_session.scalars(
|
26
|
+
sqlalchemy.select(UserDBM).filter(UserDBM.roles.any(UserDBM.Roles.admin))
|
27
|
+
)).all()
|
28
|
+
for admin_user_dbm in admin_user_dbms:
|
29
|
+
admin_tg_ids.add(admin_user_dbm.tg_id)
|
30
|
+
|
31
|
+
for tg_id in get_cached_settings().tg_bot_admin_tg_ids:
|
32
|
+
admin_tg_ids.add(tg_id)
|
33
|
+
|
34
|
+
for admin_tg_id in admin_tg_ids:
|
35
|
+
try:
|
36
|
+
await get_cached_tg_bot().send_message(
|
37
|
+
chat_id=admin_tg_id,
|
38
|
+
text=text
|
39
|
+
)
|
40
|
+
except AiogramError as exception:
|
41
|
+
_logger.error(exception)
|
42
|
+
try:
|
43
|
+
await get_cached_tg_bot().send_message(
|
44
|
+
chat_id=admin_tg_id,
|
45
|
+
text=remove_tags_and_html(text)
|
46
|
+
)
|
47
|
+
except AiogramError as exception:
|
48
|
+
_logger.error(exception)
|
49
|
+
|
50
|
+
|
51
|
+
async def __async_example():
|
52
|
+
setup_logging()
|
53
|
+
await notify_admins("Hello world")
|
54
|
+
await get_cached_tg_bot().session.close()
|
55
|
+
|
56
|
+
|
57
|
+
if __name__ == '__main__':
|
58
|
+
asyncio.run(__async_example())
|
@@ -4,6 +4,7 @@ import logging
|
|
4
4
|
from aiogram.types import BotCommand, BotCommandScopeChat
|
5
5
|
|
6
6
|
from arpakitlib.ar_str_util import return_str_if_none
|
7
|
+
from project.core.settings import get_cached_settings
|
7
8
|
from project.core.util import setup_logging
|
8
9
|
from project.sqlalchemy_db_.sqlalchemy_db import get_cached_sqlalchemy_db
|
9
10
|
from project.sqlalchemy_db_.sqlalchemy_model import UserDBM
|
@@ -29,6 +30,13 @@ def get_client_tg_bot_commands_to_set() -> list[BotCommand]:
|
|
29
30
|
get_cached_client_tg_bot_blank().command_to_desc().get(ClientTgBotCommands.about),
|
30
31
|
ClientTgBotCommands.about
|
31
32
|
)
|
33
|
+
),
|
34
|
+
BotCommand(
|
35
|
+
command=ClientTgBotCommands.support,
|
36
|
+
description=return_str_if_none(
|
37
|
+
get_cached_client_tg_bot_blank().command_to_desc().get(ClientTgBotCommands.support),
|
38
|
+
ClientTgBotCommands.support
|
39
|
+
)
|
32
40
|
)
|
33
41
|
]
|
34
42
|
return res
|
@@ -53,18 +61,32 @@ async def set_client_tg_bot_commands():
|
|
53
61
|
async def set_admin_tg_bot_commands():
|
54
62
|
_logger.info(f"start")
|
55
63
|
|
56
|
-
|
57
|
-
|
64
|
+
user_tg_ids = set()
|
65
|
+
for tg_bot_admin_tg_id in get_cached_settings().tg_bot_admin_tg_ids:
|
66
|
+
user_tg_ids.add(tg_bot_admin_tg_id)
|
67
|
+
|
68
|
+
if get_cached_sqlalchemy_db() is not None:
|
69
|
+
with get_cached_sqlalchemy_db().new_session() as session:
|
70
|
+
user_dbms: list[UserDBM] = session.query(UserDBM).filter(UserDBM.roles.any(UserDBM.Roles.admin)).all()
|
71
|
+
for user_dbm in user_dbms:
|
72
|
+
user_tg_ids.add(user_dbm.tg_id)
|
58
73
|
|
59
|
-
for
|
74
|
+
for user_tg_id in user_tg_ids:
|
60
75
|
await get_cached_tg_bot().set_my_commands(
|
61
76
|
commands=get_client_tg_bot_commands_to_set() + get_admin_tg_bot_commands_to_set(),
|
62
|
-
scope=BotCommandScopeChat(chat_id=
|
77
|
+
scope=BotCommandScopeChat(chat_id=user_tg_id)
|
63
78
|
)
|
64
79
|
|
65
80
|
_logger.info("finish")
|
66
81
|
|
67
82
|
|
83
|
+
async def set_all_tg_bot_commands():
|
84
|
+
_logger.info(f"start")
|
85
|
+
await set_client_tg_bot_commands()
|
86
|
+
await set_admin_tg_bot_commands()
|
87
|
+
_logger.info("finish")
|
88
|
+
|
89
|
+
|
68
90
|
async def __async_example():
|
69
91
|
setup_logging()
|
70
92
|
await set_client_tg_bot_commands()
|
File without changes
|
@@ -11,7 +11,7 @@ from typing import Any
|
|
11
11
|
from uuid import uuid4
|
12
12
|
|
13
13
|
from arpakitlib.ar_enumeration_util import Enumeration
|
14
|
-
from arpakitlib.ar_func_util import
|
14
|
+
from arpakitlib.ar_func_util import is_async_func, is_sync_func, is_coroutine
|
15
15
|
from arpakitlib.ar_sleep_util import sync_safe_sleep, async_safe_sleep
|
16
16
|
|
17
17
|
_ARPAKIT_LIB_MODULE_VERSION = "3.0"
|
@@ -48,14 +48,14 @@ class BaseWorker(ABC):
|
|
48
48
|
def sync_run_startup_funcs(self):
|
49
49
|
self._logger.info("start")
|
50
50
|
for startup_func in self.startup_funcs:
|
51
|
-
if
|
51
|
+
if is_async_func(startup_func):
|
52
52
|
asyncio.run(startup_func())
|
53
|
-
elif
|
53
|
+
elif is_coroutine(startup_func):
|
54
54
|
async def __func():
|
55
55
|
await startup_func
|
56
56
|
|
57
57
|
asyncio.run(__func())
|
58
|
-
elif
|
58
|
+
elif is_sync_func(startup_func):
|
59
59
|
startup_func()
|
60
60
|
else:
|
61
61
|
raise TypeError("unknown startup_func type")
|
@@ -93,11 +93,11 @@ class BaseWorker(ABC):
|
|
93
93
|
async def async_run_startup_funcs(self):
|
94
94
|
self._logger.info("start")
|
95
95
|
for startup_func in self.startup_funcs:
|
96
|
-
if
|
96
|
+
if is_async_func(startup_func):
|
97
97
|
await startup_func()
|
98
|
-
elif
|
98
|
+
elif is_coroutine(startup_func):
|
99
99
|
await startup_func
|
100
|
-
elif
|
100
|
+
elif is_sync_func(startup_func):
|
101
101
|
startup_func()
|
102
102
|
else:
|
103
103
|
raise TypeError("unknown startup_func type")
|
arpakitlib/ar_blank_util.py
CHANGED
arpakitlib/ar_func_util.py
CHANGED
@@ -5,36 +5,43 @@ from typing import Callable
|
|
5
5
|
_ARPAKIT_LIB_MODULE_VERSION = "3.0"
|
6
6
|
|
7
7
|
|
8
|
-
def
|
9
|
-
if inspect.ismethod(
|
10
|
-
return inspect.iscoroutinefunction(
|
11
|
-
if isinstance(
|
12
|
-
return inspect.iscoroutinefunction(
|
8
|
+
def is_async_func(func: Callable) -> bool:
|
9
|
+
if inspect.ismethod(func) or inspect.isfunction(func):
|
10
|
+
return inspect.iscoroutinefunction(func)
|
11
|
+
if isinstance(func, (staticmethod, classmethod)):
|
12
|
+
return inspect.iscoroutinefunction(func.__func__)
|
13
13
|
return False
|
14
14
|
|
15
15
|
|
16
|
-
def
|
17
|
-
if not
|
18
|
-
raise TypeError(f"
|
16
|
+
def raise_if_not_async_func(func: Callable):
|
17
|
+
if not is_async_func(func):
|
18
|
+
raise TypeError(f"the provided callable '{func.__name__}' is not an async")
|
19
19
|
|
20
20
|
|
21
21
|
# ---
|
22
22
|
|
23
23
|
|
24
|
-
def
|
24
|
+
def is_coroutine(obj: object) -> bool:
|
25
25
|
return asyncio.iscoroutine(obj)
|
26
26
|
|
27
27
|
|
28
28
|
# ---
|
29
29
|
|
30
30
|
|
31
|
-
def
|
32
|
-
return callable(
|
31
|
+
def is_sync_func(func: Callable) -> bool:
|
32
|
+
return callable(func) and not is_async_func(func=func)
|
33
33
|
|
34
34
|
|
35
|
-
def
|
36
|
-
if not
|
37
|
-
raise TypeError(f"
|
35
|
+
def raise_if_not_sync_func(func: Callable):
|
36
|
+
if not is_sync_func(func):
|
37
|
+
raise TypeError(f"the provided callable '{func.__name__}' is not an sync")
|
38
|
+
|
39
|
+
|
40
|
+
#
|
41
|
+
|
42
|
+
|
43
|
+
def get_func_name(func: Callable) -> str:
|
44
|
+
return func.__name__
|
38
45
|
|
39
46
|
|
40
47
|
def __example():
|
arpakitlib/ar_logging_util.py
CHANGED
@@ -33,8 +33,8 @@ def setup_normal_logging(log_filepath: Optional[str] = None):
|
|
33
33
|
stream_handler = logging.StreamHandler()
|
34
34
|
stream_handler.setLevel(logging.INFO)
|
35
35
|
stream_formatter = logging.Formatter(
|
36
|
-
"%(asctime)s | %(levelname)s | %(filename)s | %(funcName)s:%(lineno)d - %(message)s",
|
37
|
-
datefmt="%d.%m.%Y %I:%M:%S%p"
|
36
|
+
"%(asctime)s %(msecs)03d | %(levelname)s | %(filename)s | %(funcName)s:%(lineno)d - %(message)s",
|
37
|
+
datefmt="%d.%m.%Y %I:%M:%S %p"
|
38
38
|
)
|
39
39
|
stream_handler.setFormatter(stream_formatter)
|
40
40
|
logger.addHandler(stream_handler)
|
arpakitlib/ar_sqlalchemy_util.py
CHANGED
@@ -189,16 +189,22 @@ class SQLAlchemyDb:
|
|
189
189
|
|
190
190
|
def init(self):
|
191
191
|
self.base_dbm.metadata.create_all(bind=self.engine, checkfirst=True)
|
192
|
-
self._logger.info("
|
192
|
+
self._logger.info("inited")
|
193
193
|
|
194
194
|
def drop(self):
|
195
195
|
self.base_dbm.metadata.drop_all(bind=self.engine, checkfirst=True)
|
196
|
-
self._logger.info("
|
196
|
+
self._logger.info("dropped")
|
197
197
|
|
198
198
|
def reinit(self):
|
199
199
|
self.base_dbm.metadata.drop_all(bind=self.engine, checkfirst=True)
|
200
200
|
self.base_dbm.metadata.create_all(bind=self.engine, checkfirst=True)
|
201
|
-
self._logger.info("
|
201
|
+
self._logger.info("reinited")
|
202
|
+
|
203
|
+
def reinit_all(self):
|
204
|
+
self.reinit()
|
205
|
+
self.remove_alembic_tables_data()
|
206
|
+
self.remove_celery_tables_data()
|
207
|
+
self._logger.info("all reinited")
|
202
208
|
|
203
209
|
def check_conn(self):
|
204
210
|
self.engine.connect()
|