From f435d3dd48b74c373d7d5e8955537a65ad93d28e Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Fri, 13 Oct 2023 17:10:00 +0200 Subject: [PATCH] Moved folders #405 --- .gitmodules | 18 +- {kdb-bot => bot}/.cpl/schematic_db_table.py | 0 {kdb-bot => bot}/.cpl/schematic_migration.py | 0 {kdb-bot => bot}/.cpl/schematic_query.py | 0 {kdb-bot => bot}/src/bot/__init__.py | 0 {kdb-bot => bot}/src/bot/application.py | 26 ++- {kdb-bot => bot}/src/bot/bot | 0 {kdb-bot => bot}/src/bot/bot.json | 0 .../src/bot/extension/__init__.py | 0 .../src/bot/extension/init_bot_extension.py | 4 +- {kdb-bot => bot}/src/bot/main.py | 0 {kdb-bot => bot}/src/bot/module_list.py | 0 {kdb-bot => bot}/src/bot/startup.py | 4 +- .../src/bot/startup_discord_extension.py | 8 +- .../src/bot/startup_migration_extension.py | 84 +++++-- .../src/bot/startup_module_extension.py | 8 +- .../src/bot/startup_settings_extension.py | 28 ++- {kdb-bot => bot}/src/bot/translation/de.json | 0 {kdb-bot => bot}/src/bot_api/__init__.py | 0 {kdb-bot => bot}/src/bot_api/abc/__init__.py | 0 .../src/bot_api/abc/auth_service_abc.py | 8 +- {kdb-bot => bot}/src/bot_api/abc/dto_abc.py | 0 .../src/bot_api/abc/select_criteria_abc.py | 4 +- .../src/bot_api/abc/transformer_abc.py | 0 {kdb-bot => bot}/src/bot_api/api.py | 17 +- {kdb-bot => bot}/src/bot_api/api_module.py | 12 +- {kdb-bot => bot}/src/bot_api/api_thread.py | 0 .../src/bot_api/app_api_extension.py | 4 +- {kdb-bot => bot}/src/bot_api/bot-api.json | 0 .../src/bot_api/configuration/__init__.py | 0 .../src/bot_api/configuration/api_settings.py | 0 .../configuration/authentication_settings.py | 4 +- .../discord_authentication_settings.py | 0 .../configuration/frontend_settings.py | 0 .../src/bot_api/controller/__init__.py | 0 .../src/bot_api/controller/auth_controller.py | 32 ++- .../controller/auth_discord_controller.py | 0 .../bot_api/controller/graphql_controller.py | 0 .../src/bot_api/controller/gui_controller.py | 0 .../src/bot_api/event/__init__.py | 0 .../bot_api/event/bot_api_on_ready_event.py | 0 .../src/bot_api/exception/__init__.py | 0 .../exception/service_error_code_enum.py | 0 .../bot_api/exception/service_exception.py | 0 .../src/bot_api/filter/__init__.py | 0 .../filter/auth_user_select_criteria.py | 4 +- .../src/bot_api/filter/discord/__init__.py | 0 .../filter/discord/server_select_criteria.py | 4 +- .../src/bot_api/json_processor.py | 0 .../src/bot_api/logging/__init__.py | 0 .../src/bot_api/logging/api_logger.py | 0 .../src/bot_api/model/__init__.py | 0 .../src/bot_api/model/auth_user_dto.py | 0 .../model/auth_user_filtered_result_dto.py | 0 .../src/bot_api/model/discord/__init__.py | 0 .../src/bot_api/model/discord/server_dto.py | 0 .../discord/server_filtered_result_dto.py | 0 .../src/bot_api/model/email_string_dto.py | 0 .../src/bot_api/model/error_dto.py | 4 +- .../src/bot_api/model/o_auth_dto.py | 0 .../src/bot_api/model/reset_password_dto.py | 0 .../src/bot_api/model/settings_dto.py | 0 .../src/bot_api/model/token_dto.py | 6 +- .../src/bot_api/model/update_auth_user_dto.py | 4 +- .../src/bot_api/model/user_dto.py | 0 .../src/bot_api/model/version_dto.py | 0 .../src/bot_api/route/__init__.py | 0 {kdb-bot => bot}/src/bot_api/route/route.py | 35 ++- .../src/bot_api/service/__init__.py | 0 .../src/bot_api/service/auth_service.py | 165 +++++++++---- .../src/bot_api/service/discord_service.py | 27 ++- .../src/bot_api/transformer/__init__.py | 0 .../transformer/auth_user_transformer.py | 16 +- .../bot_api/transformer/server_transformer.py | 4 +- {kdb-bot => bot}/src/bot_core/__init__.py | 0 {kdb-bot => bot}/src/bot_core/abc/__init__.py | 0 .../src/bot_core/abc/client_utils_abc.py | 10 +- .../bot_core/abc/custom_file_logger_abc.py | 8 +- .../src/bot_core/abc/message_service_abc.py | 4 +- .../src/bot_core/abc/module_abc.py | 0 {kdb-bot => bot}/src/bot_core/abc/task_abc.py | 4 +- {kdb-bot => bot}/src/bot_core/bot-core.json | 0 .../src/bot_core/configuration/__init__.py | 0 .../configuration/bot_logging_settings.py | 0 .../configuration/feature_flags_enum.py | 0 .../configuration/feature_flags_settings.py | 0 .../configuration/file_logging_settings.py | 4 +- .../src/bot_core/core_extension/__init__.py | 0 .../bot_core/core_extension/core_extension.py | 4 +- .../core_extension/core_extension_module.py | 12 +- .../core_extension_on_ready_event.py | 0 {kdb-bot => bot}/src/bot_core/core_module.py | 8 +- .../src/bot_core/events/__init__.py | 0 .../bot_core/events/core_on_ready_event.py | 0 .../src/bot_core/exception/__init__.py | 0 .../src/bot_core/exception/check_error.py | 0 .../src/bot_core/helper/__init__.py | 0 .../src/bot_core/helper/command_checks.py | 12 +- .../src/bot_core/helper/event_checks.py | 0 .../src/bot_core/helper/log_message_helper.py | 0 .../src/bot_core/logging/__init__.py | 0 .../src/bot_core/logging/command_logger.py | 0 .../src/bot_core/logging/database_logger.py | 0 .../src/bot_core/logging/message_logger.py | 0 .../src/bot_core/logging/task_logger.py | 0 .../src/bot_core/pipes/__init__.py | 0 .../bot_core/pipes/date_time_offset_pipe.py | 0 .../src/bot_core/service/__init__.py | 0 .../bot_core/service/client_utils_service.py | 54 ++++- .../src/bot_core/service/config_service.py | 8 +- .../service/data_integrity_service.py | 145 +++++++++--- .../src/bot_core/service/message_service.py | 88 +++++-- {kdb-bot => bot}/src/bot_data/__init__.py | 0 {kdb-bot => bot}/src/bot_data/abc/__init__.py | 0 .../abc/achievement_repository_abc.py | 4 +- .../bot_data/abc/api_key_repository_abc.py | 0 .../bot_data/abc/auth_user_repository_abc.py | 4 +- .../bot_data/abc/auto_role_repository_abc.py | 0 .../src/bot_data/abc/client_repository_abc.py | 4 +- .../src/bot_data/abc/data_seeder_abc.py | 0 .../abc/game_server_repository_abc.py | 0 .../src/bot_data/abc/history_table_abc.py | 0 .../bot_data/abc/known_user_repository_abc.py | 0 .../src/bot_data/abc/level_repository_abc.py | 0 .../src/bot_data/abc/migration_abc.py | 0 .../abc/server_config_repository_abc.py | 24 +- .../src/bot_data/abc/server_repository_abc.py | 0 .../abc/short_role_name_repository_abc.py | 0 .../abc/steam_special_offer_repository_abc.py | 0 .../src/bot_data/abc/table_with_id_abc.py | 0 .../abc/technician_config_repository_abc.py | 12 +- .../abc/user_game_ident_repository_abc.py | 0 .../user_joined_game_server_repository_abc.py | 28 ++- .../abc/user_joined_server_repository_abc.py | 12 +- ...ser_joined_voice_channel_repository_abc.py | 28 ++- ...r_message_count_per_hour_repository_abc.py | 4 +- .../src/bot_data/abc/user_repository_abc.py | 8 +- .../abc/user_warnings_repository_abc.py | 0 {kdb-bot => bot}/src/bot_data/bot-data.json | 0 {kdb-bot => bot}/src/bot_data/data_module.py | 76 ++++-- {kdb-bot => bot}/src/bot_data/db_context.py | 0 .../src/bot_data/filtered_result.py | 0 .../src/bot_data/migration/__init__.py | 0 .../migration/achievements_migration.py | 32 ++- .../bot_data/migration/api_key_migration.py | 0 .../src/bot_data/migration/api_migration.py | 0 .../migration/auto_role_fix1_migration.py | 0 .../bot_data/migration/auto_role_migration.py | 0 .../bot_data/migration/birthday_migration.py | 0 .../config_feature_flags_migration.py | 8 +- .../bot_data/migration/config_migration.py | 0 .../migration/db_history_migration.py | 0 .../migration/db_history_scripts/api_keys.sql | 0 .../auth_user_users_relation.sql | 0 .../db_history_scripts/auth_users.sql | 0 .../db_history_scripts/auto_role_rules.sql | 0 .../db_history_scripts/auto_roles.sql | 0 .../migration/db_history_scripts/clients.sql | 0 .../db_history_scripts/config/server.sql | 0 .../config/server_afk_channels.sql | 0 .../config/server_team_roles.sql | 0 .../db_history_scripts/config/technician.sql | 0 .../config/technician_ids.sql | 0 .../config/technician_ping_urls.sql | 0 .../db_history_scripts/game_servers.sql | 0 .../db_history_scripts/known_users.sql | 0 .../migration/db_history_scripts/levels.sql | 0 .../migration/db_history_scripts/servers.sql | 0 .../db_history_scripts/short_rule_names.sql | 0 .../db_history_scripts/user_game_idents.sql | 0 .../user_joined_game_servers.sql | 0 .../user_joined_servers.sql | 0 .../user_joined_voice_channel.sql | 0 .../user_message_count_per_hour.sql | 0 .../db_history_scripts/user_warnings.sql | 0 .../migration/db_history_scripts/users.sql | 0 .../migration/default_role_migration.py | 0 .../migration/fix_updates_migration.py | 4 +- .../migration/fix_user_history_migration.py | 0 .../bot_data/migration/initial_migration.py | 0 .../src/bot_data/migration/level_migration.py | 0 .../migration/remove_stats_migration.py | 0 .../migration/short_role_name_migration.py | 0 .../short_role_name_only_highest_migration.py | 0 .../src/bot_data/migration/stats_migration.py | 0 .../steam_special_offer_migration.py | 0 .../user_joined_game_server_migration.py | 0 .../user_message_count_per_hour_migration.py | 0 .../migration/user_warning_migration.py | 0 .../src/bot_data/model/__init__.py | 0 .../src/bot_data/model/achievement.py | 4 +- .../src/bot_data/model/achievement_history.py | 0 .../src/bot_data/model/api_key.py | 4 +- .../src/bot_data/model/auth_role_enum.py | 0 .../src/bot_data/model/auth_user.py | 4 +- .../model/auth_user_users_relation.py | 4 +- .../src/bot_data/model/auto_role.py | 4 +- .../src/bot_data/model/auto_role_history.py | 0 .../src/bot_data/model/auto_role_rule.py | 4 +- .../bot_data/model/auto_role_rule_history.py | 0 {kdb-bot => bot}/src/bot_data/model/client.py | 4 +- .../src/bot_data/model/client_history.py | 0 .../src/bot_data/model/game_server.py | 4 +- .../src/bot_data/model/known_user.py | 4 +- .../src/bot_data/model/known_user_history.py | 0 {kdb-bot => bot}/src/bot_data/model/level.py | 4 +- .../src/bot_data/model/level_history.py | 0 .../src/bot_data/model/migration_history.py | 0 {kdb-bot => bot}/src/bot_data/model/server.py | 4 +- .../model/server_afk_channel_ids_config.py | 4 +- .../src/bot_data/model/server_config.py | 8 +- .../bot_data/model/server_config_history.py | 4 +- .../src/bot_data/model/server_history.py | 0 .../model/server_team_role_ids_config.py | 4 +- .../src/bot_data/model/short_role_name.py | 4 +- .../bot_data/model/short_role_name_history.py | 0 .../model/short_role_name_position_enum.py | 0 .../src/bot_data/model/steam_special_offer.py | 4 +- .../bot_data/model/team_member_type_enum.py | 0 .../src/bot_data/model/technician_config.py | 4 +- .../model/technician_config_history.py | 0 .../bot_data/model/technician_id_config.py | 4 +- .../model/technician_id_config_history.py | 0 .../model/technician_ping_url_config.py | 4 +- .../technician_ping_url_config_history.py | 0 {kdb-bot => bot}/src/bot_data/model/user.py | 20 +- .../src/bot_data/model/user_game_ident.py | 4 +- .../bot_data/model/user_got_achievement.py | 4 +- .../src/bot_data/model/user_history.py | 16 +- .../bot_data/model/user_joined_game_server.py | 4 +- .../model/user_joined_game_server_history.py | 0 .../src/bot_data/model/user_joined_server.py | 4 +- .../model/user_joined_server_history.py | 0 .../model/user_joined_voice_channel.py | 4 +- .../user_joined_voice_channel_history.py | 0 .../model/user_message_count_per_hour.py | 4 +- .../src/bot_data/model/user_role_enum.py | 0 .../src/bot_data/model/user_warnings.py | 4 +- .../bot_data/model/user_warnings_history.py | 0 .../src/bot_data/service/__init__.py | 0 .../achievements_repository_service.py | 41 +++- .../service/api_key_repository_service.py | 24 +- .../service/auth_user_repository_service.py | 42 +++- .../service/auto_role_repository_service.py | 110 +++++++-- .../src/bot_data/service/cache_service.py | 0 .../service/client_repository_service.py | 29 ++- .../service/game_server_repository_service.py | 8 +- .../service/known_user_repository_service.py | 16 +- .../service/level_repository_service.py | 12 +- .../src/bot_data/service/migration_service.py | 16 +- .../src/bot_data/service/seeder_service.py | 0 .../server_config_repository_service.py | 108 +++++++-- .../bot_data/service/server_config_seeder.py | 0 .../service/server_repository_service.py | 43 +++- .../short_role_name_repository_service.py | 37 ++- .../steam_special_offer_repository_service.py | 29 ++- .../technician_config_repository_service.py | 53 +++-- .../service/technician_config_seeder.py | 13 +- .../user_game_ident_repository_service.py | 28 ++- ...r_joined_game_server_repository_service.py | 68 ++++-- .../user_joined_server_repository_service.py | 40 +++- ...joined_voice_channel_repository_service.py | 68 ++++-- ...ssage_count_per_hour_repository_service.py | 20 +- .../service/user_repository_service.py | 28 ++- .../user_warnings_repository_service.py | 17 +- {kdb-bot => bot}/src/bot_graphql/__init__.py | 0 .../src/bot_graphql/abc/__init__.py | 0 .../src/bot_graphql/abc/data_query_abc.py | 0 .../abc/data_query_with_history_abc.py | 0 .../src/bot_graphql/abc/filter_abc.py | 10 +- .../src/bot_graphql/abc/history_query_abc.py | 0 .../src/bot_graphql/abc/query_abc.py | 55 ++++- .../src/bot_graphql/bot-graphql.json | 0 .../src/bot_graphql/filter/__init__.py | 0 .../bot_graphql/filter/achievement_filter.py | 14 +- .../bot_graphql/filter/auto_role_filter.py | 13 +- .../filter/auto_role_rule_filter.py | 4 +- .../src/bot_graphql/filter/client_filter.py | 9 +- .../src/bot_graphql/filter/level_filter.py | 9 +- .../src/bot_graphql/filter/page.py | 0 .../src/bot_graphql/filter/server_filter.py | 6 +- .../filter/short_role_name_filter.py | 9 +- .../src/bot_graphql/filter/sort.py | 0 .../src/bot_graphql/filter/user_filter.py | 25 +- .../filter/user_joined_game_server_filter.py | 4 +- .../filter/user_joined_server_filter.py | 14 +- .../user_joined_voice_channel_filter.py | 18 +- .../bot_graphql/filter/user_warning_filter.py | 13 +- .../src/bot_graphql/graphql/achievement.gql | 0 .../src/bot_graphql/graphql/autoRole.gql | 0 .../src/bot_graphql/graphql/autoRoleRule.gql | 0 .../src/bot_graphql/graphql/base.gql | 0 .../src/bot_graphql/graphql/client.gql | 0 .../src/bot_graphql/graphql/discord.gql | 0 .../src/bot_graphql/graphql/featureFlags.gql | 0 .../src/bot_graphql/graphql/knownUser.gql | 0 .../src/bot_graphql/graphql/level.gql | 0 .../src/bot_graphql/graphql/mutation.gql | 0 .../src/bot_graphql/graphql/query.gql | 0 .../src/bot_graphql/graphql/server.gql | 0 .../src/bot_graphql/graphql/serverConfig.gql | 0 .../src/bot_graphql/graphql/shortRoleName.gql | 0 .../bot_graphql/graphql/technicianConfig.gql | 0 .../src/bot_graphql/graphql/user.gql | 0 .../graphql/userJoinedGameServer.gql | 0 .../bot_graphql/graphql/userJoinedServer.gql | 0 .../graphql/userJoinedVoiceChannel.gql | 0 .../src/bot_graphql/graphql/userWarning.gql | 0 .../src/bot_graphql/graphql_module.py | 44 +++- .../src/bot_graphql/graphql_service.py | 0 .../src/bot_graphql/model/__init__.py | 0 .../src/bot_graphql/model/discord.py | 0 {kdb-bot => bot}/src/bot_graphql/mutation.py | 4 +- .../src/bot_graphql/mutations/__init__.py | 0 .../mutations/achievement_mutation.py | 18 +- .../mutations/auto_role_mutation.py | 20 +- .../mutations/auto_role_rule_mutation.py | 32 ++- .../bot_graphql/mutations/level_mutation.py | 10 +- .../mutations/server_config_mutation.py | 99 ++++++-- .../mutations/short_role_name_mutation.py | 20 +- .../mutations/technician_config_mutation.py | 43 +++- .../user_joined_game_server_mutation.py | 44 +++- .../bot_graphql/mutations/user_mutation.py | 34 ++- .../src/bot_graphql/queries/__init__.py | 0 .../queries/achievement_attribute_query.py | 0 .../queries/achievement_history_query.py | 0 .../bot_graphql/queries/achievement_query.py | 4 +- .../queries/auto_role_history_query.py | 0 .../bot_graphql/queries/auto_role_query.py | 8 +- .../queries/auto_role_rule_history_query.py | 0 .../queries/auto_role_rule_query.py | 11 +- .../queries/client_history_query.py | 0 .../src/bot_graphql/queries/client_query.py | 4 +- .../bot_graphql/queries/discord/__init__.py | 0 .../queries/discord/channel_query.py | 0 .../queries/discord/discord_query.py | 0 .../queries/discord/discord_user_query.py | 0 .../queries/discord/emoji_query.py | 0 .../queries/discord/guild_query.py | 5 +- .../bot_graphql/queries/discord/role_query.py | 0 .../bot_graphql/queries/game_server_query.py | 0 .../queries/known_user_history_query.py | 0 .../bot_graphql/queries/known_user_query.py | 4 +- .../queries/level_history_query.py | 0 .../src/bot_graphql/queries/level_query.py | 4 +- .../queries/server_config_query.py | 53 ++++- .../queries/server_history_query.py | 0 .../src/bot_graphql/queries/server_query.py | 55 ++++- .../queries/short_role_name_history_query.py | 0 .../queries/short_role_name_query.py | 4 +- .../technician_config_history_query.py | 13 +- .../queries/technician_config_query.py | 25 +- .../technician_id_config_history_query.py | 0 ...echnician_ping_url_config_history_query.py | 0 .../bot_graphql/queries/user_history_query.py | 0 .../user_joined_game_server_history_query.py | 0 .../queries/user_joined_game_server_query.py | 6 +- .../user_joined_server_history_query.py | 0 .../queries/user_joined_server_query.py | 6 +- ...user_joined_voice_channel_history_query.py | 0 .../user_joined_voice_channel_query.py | 10 +- .../src/bot_graphql/queries/user_query.py | 28 ++- .../queries/user_warning_history_query.py | 0 .../bot_graphql/queries/user_warning_query.py | 4 +- {kdb-bot => bot}/src/bot_graphql/query.py | 67 ++++-- {kdb-bot => bot}/src/bot_graphql/schema.py | 4 +- {kdb-bot => bot}/src/modules/__init__.py | 0 .../src/modules/achievements/__init__.py | 0 .../achievement_attribute_resolver.py | 27 ++- .../achievements/achievement_service.py | 72 ++++-- .../modules/achievements/achievements.json | 0 .../achievements/achievements_module.py | 46 +++- .../modules/achievements/commands/__init__.py | 0 .../commands/achievements_group.py | 4 +- .../modules/achievements/events/__init__.py | 0 .../events/achievement_on_message_event.py | 8 +- .../achievement_on_reaction_add_event.py | 10 +- .../achievement_on_reaction_remove_event.py | 10 +- ...achievement_on_voice_state_update_event.py | 9 +- .../modules/achievements/model/__init__.py | 0 .../model/achievement_attribute.py | 0 .../src/modules/auto_role/__init__.py | 0 .../src/modules/auto_role/auto-role.json | 0 .../src/modules/auto_role/auto_role_module.py | 8 +- .../src/modules/auto_role/command/__init__.py | 0 .../auto_role/command/auto_role_group.py | 218 +++++++++++++----- .../src/modules/auto_role/events/__init__.py | 0 .../events/auto_role_on_raw_reaction_add.py | 8 +- .../auto_role_on_raw_reaction_remove.py | 8 +- .../src/modules/auto_role/helper/__init__.py | 0 .../helper/auto_role_reaction_handler.py | 12 +- {kdb-bot => bot}/src/modules/base/__init__.py | 0 {kdb-bot => bot}/src/modules/base/base.json | 0 .../src/modules/base/base_module.py | 40 +++- .../src/modules/base/birthday_watcher.py | 8 +- .../src/modules/base/command/__init__.py | 0 .../src/modules/base/command/afk_command.py | 12 +- .../modules/base/command/game_server_group.py | 96 ++++++-- .../src/modules/base/command/help_command.py | 4 +- .../src/modules/base/command/info_command.py | 5 +- .../base/command/make_coffee_command.py | 0 .../modules/base/command/mass_move_command.py | 4 +- .../src/modules/base/command/ping_command.py | 8 +- .../modules/base/command/presence_command.py | 8 +- .../src/modules/base/command/purge_command.py | 12 +- .../modules/base/command/register_group.py | 15 +- .../src/modules/base/command/submit_group.py | 4 +- .../modules/base/command/unregister_group.py | 8 +- .../src/modules/base/command/user_group.py | 165 +++++++++---- .../src/modules/base/events/__init__.py | 0 .../events/base_on_command_error_event.py | 16 +- .../base/events/base_on_command_event.py | 20 +- .../base/events/base_on_guild_join_event.py | 0 .../base/events/base_on_member_join_event.py | 28 ++- .../events/base_on_member_remove_event.py | 16 +- .../events/base_on_message_delete_event.py | 16 +- .../base/events/base_on_message_event.py | 20 +- .../base/events/base_on_raw_reaction_add.py | 0 .../events/base_on_raw_reaction_remove.py | 0 .../base_on_scheduled_event_update_event.py | 7 +- .../base_on_voice_state_update_event.py | 54 +++-- ...n_voice_state_update_event_help_channel.py | 12 +- ...tate_update_event_scheduled_event_bonus.py | 0 .../src/modules/base/forms/__init__.py | 0 .../src/modules/base/forms/bug_report_form.py | 12 +- .../src/modules/base/forms/complaint_form.py | 8 +- .../src/modules/base/helper/__init__.py | 0 .../base/helper/base_reaction_handler.py | 16 +- .../base/helper/voice_channel_transformer.py | 21 +- .../src/modules/base/model/__init__.py | 0 .../src/modules/base/model/active_event.py | 0 .../src/modules/base/service/__init__.py | 0 .../src/modules/base/service/event_service.py | 12 +- .../base/service/user_warnings_service.py | 103 +++++++-- .../src/modules/base/thread/__init__.py | 0 .../src/modules/boot_log/__init__.py | 0 .../src/modules/boot_log/boot-log.json | 0 .../modules/boot_log/boot_log_extension.py | 4 +- .../src/modules/boot_log/boot_log_module.py | 12 +- .../boot_log/boot_log_on_ready_event.py | 17 +- .../src/modules/config/__init__.py | 0 .../src/modules/config/config.json | 0 .../src/modules/config/config_extension.py | 4 +- .../src/modules/config/config_module.py | 8 +- .../src/modules/config/events/__init__.py | 0 .../config/events/config_on_ready_event.py | 4 +- .../src/modules/config/service/__init__.py | 0 .../src/modules/database/__init__.py | 0 .../src/modules/database/database.json | 0 .../modules/database/database_extension.py | 4 +- .../src/modules/database/database_module.py | 12 +- .../database/database_on_ready_event.py | 13 +- .../src/modules/level/__init__.py | 0 .../src/modules/level/command/__init__.py | 0 .../src/modules/level/command/level_group.py | 185 +++++++++++---- .../modules/level/configuration/__init__.py | 0 .../configuration/default_level_settings.py | 0 .../src/modules/level/default-level.json | 0 .../src/modules/level/events/__init__.py | 0 .../events/level_on_member_join_event.py | 12 +- .../level/events/level_on_message_event.py | 12 +- .../events/level_on_raw_reaction_add_event.py | 8 +- .../level_on_raw_reaction_remove_event.py | 8 +- .../level_on_voice_state_update_event.py | 12 +- {kdb-bot => bot}/src/modules/level/level.json | 0 .../src/modules/level/level_module.py | 33 ++- .../src/modules/level/level_seeder.py | 41 +++- .../src/modules/level/service/__init__.py | 0 .../modules/level/service/level_service.py | 44 +++- .../src/modules/permission/__init__.py | 0 .../src/modules/permission/abc/__init__.py | 0 .../permission/abc/permission_service_abc.py | 0 .../src/modules/permission/permission.json | 0 .../modules/permission/permission_module.py | 8 +- .../modules/permission/service/__init__.py | 0 .../permission/service/permission_service.py | 20 +- .../src/modules/short_role_name/__init__.py | 0 .../short_role_name/events/__init__.py | 0 .../short_role_name_on_member_update_event.py | 4 +- .../short_role_name/service/__init__.py | 0 .../service/short_role_name_service.py | 16 +- .../short_role_name/short-role-name.json | 0 .../short_role_name_check_command.py | 16 +- .../short_role_name/short_role_name_module.py | 21 +- .../short_role_name/short_role_name_seeder.py | 0 .../src/modules/special_offers/__init__.py | 0 .../special_offers/special-offers.json | 0 .../special_offers/special_offers_module.py | 8 +- .../special_offers/steam_offer_watcher.py | 53 ++++- .../src/modules/technician/__init__.py | 0 .../src/modules/technician/api_key_seeder.py | 4 +- .../modules/technician/command/__init__.py | 0 .../technician/command/api_key_group.py | 36 ++- .../modules/technician/command/log_command.py | 5 +- .../technician/command/restart_command.py | 4 +- .../technician/command/shutdown_command.py | 4 +- .../technician/command/sync_xp_command.py | 58 +++-- .../src/modules/technician/technician.json | 0 .../modules/technician/technician_module.py | 8 +- .../tools/checks/UserJoinedVoiceChannel.json | 0 {kdb-bot => bot}/tools/checks/__init__.py | 0 {kdb-bot => bot}/tools/checks/checks.json | 0 .../tools/checks/get_ontime_overlaps.py | 0 .../tools/get_version/__init__.py | 0 .../tools/get_version/application.py | 0 .../tools/get_version/get-version.json | 0 {kdb-bot => bot}/tools/get_version/main.py | 0 {kdb-bot => bot}/tools/get_version/startup.py | 8 +- {kdb-bot => bot}/tools/post_build/__init__.py | 0 .../tools/post_build/application.py | 0 .../tools/post_build/appsettings.json | 0 {kdb-bot => bot}/tools/post_build/main.py | 0 .../tools/post_build/post-build.json | 0 .../tools/post_build/post_build_settings.py | 8 +- .../tools/post_build/service/__init__.py | 0 .../tools/post_build/service/dependencies.py | 4 +- .../tools/post_build/service/remove_config.py | 0 {kdb-bot => bot}/tools/post_build/startup.py | 8 +- .../tools/set_version/__init__.py | 0 .../tools/set_version/application.py | 50 +++- .../tools/set_version/git_service.py | 0 {kdb-bot => bot}/tools/set_version/main.py | 0 .../tools/set_version/set-version.json | 0 {kdb-bot => bot}/tools/set_version/startup.py | 8 +- .../set_version/version_setter_service.py | 18 +- kdb-bot/LICENSE | 9 - kdb-bot/README.md | 2 - kdb-bot/cpl-workspace.json | 46 ---- kdb-bot/docker | 1 - kdb-bot/dockerfile | 21 -- kdb-bot/pyproject.toml | 2 - kdb-bot/src/bot/config | 1 - kdb-bot/src/bot_api/config | 1 - {kdb-web => web}/.browserslistrc | 0 {kdb-web => web}/.editorconfig | 0 {kdb-web => web}/.gitignore | 0 {kdb-web => web}/.prettierrc | 0 {kdb-web => web}/README.md | 0 {kdb-web => web}/angular.json | 0 {kdb-web => web}/dockerfile | 0 {kdb-web => web}/karma.conf.js | 0 {kdb-web => web}/nginx.conf.template | 0 {kdb-web => web}/package-lock.json | 0 {kdb-web => web}/package.json | 0 .../src/app/app-routing.module.ts | 0 {kdb-web => web}/src/app/app.component.html | 0 {kdb-web => web}/src/app/app.component.scss | 0 .../src/app/app.component.spec.ts | 0 {kdb-web => web}/src/app/app.component.ts | 0 {kdb-web => web}/src/app/app.module.ts | 0 .../src/app/base/component-with-table.spec.ts | 0 .../src/app/base/component-with-table.ts | 0 .../error/not-found/not-found.component.html | 0 .../error/not-found/not-found.component.scss | 0 .../not-found/not-found.component.spec.ts | 0 .../error/not-found/not-found.component.ts | 0 .../components/footer/footer.component.html | 0 .../components/footer/footer.component.scss | 0 .../footer/footer.component.spec.ts | 0 .../app/components/footer/footer.component.ts | 0 .../components/header/header.component.html | 0 .../components/header/header.component.scss | 0 .../header/header.component.spec.ts | 0 .../app/components/header/header.component.ts | 0 .../components/sidebar/sidebar.component.html | 0 .../components/sidebar/sidebar.component.scss | 0 .../sidebar/sidebar.component.spec.ts | 0 .../components/sidebar/sidebar.component.ts | 0 .../components/spinner/spinner.component.html | 0 .../components/spinner/spinner.component.scss | 0 .../spinner/spinner.component.spec.ts | 0 .../components/spinner/spinner.component.ts | 0 .../app/models/auth/admin-update-user.dto.ts | 0 .../models/auth/auth-error-messages.enum.ts | 0 .../src/app/models/auth/auth-roles.enum.ts | 0 .../app/models/auth/auth-user-atr-errors.ts | 0 .../src/app/models/auth/auth-user.dto.ts | 0 .../app/models/auth/discord-auth-url.dto.ts | 0 .../src/app/models/auth/email-string.dto.ts | 0 .../src/app/models/auth/oauth.dto.ts | 0 .../auth/register-error-messages.enum.ts | 0 .../src/app/models/auth/reset-password.dto.ts | 0 .../src/app/models/auth/token.dto.ts | 0 .../src/app/models/auth/update-user.dto.ts | 0 .../src/app/models/config/api-version.ts | 0 .../src/app/models/config/app-settings.ts | 0 .../app/models/config/feature-flags.model.ts | 0 .../app/models/config/server-config.model.ts | 0 .../src/app/models/config/settings.dto.ts | 0 .../app/models/config/software-version.dto.ts | 0 .../src/app/models/config/software-version.ts | 0 .../models/config/technician-config.model.ts | 0 .../src/app/models/data/achievement.model.ts | 0 .../src/app/models/data/auto_role.model.ts | 0 .../src/app/models/data/client.model.ts | 0 .../src/app/models/data/data.model.ts | 0 .../src/app/models/data/discord.model.ts | 0 .../src/app/models/data/level.model.ts | 0 .../src/app/models/data/server.model.ts | 0 .../app/models/data/short_role_name.model.ts | 0 .../src/app/models/data/user.model.ts | 0 .../data/user_joined_game_server.model.ts | 0 .../models/data/user_joined_server.model.ts | 0 .../data/user_joined_voice_channel.model.ts | 0 .../src/app/models/data/user_warning.model.ts | 0 .../src/app/models/error/error-dto.ts | 0 .../models/error/service-error-code.enum.ts | 0 .../app/models/graphql/filter/page.model.ts | 0 .../app/models/graphql/filter/sort.model.ts | 0 .../src/app/models/graphql/mutations.model.ts | 0 .../src/app/models/graphql/queries.model.ts | 0 .../src/app/models/graphql/query.model.ts | 0 .../src/app/models/graphql/result.model.ts | 0 .../src/app/models/graphql/variables.model.ts | 0 .../auth-user-select-criterion.dto.ts | 0 .../get-filtered-auth-users-result.dto.ts | 0 .../selection/select-criterion.model.ts | 0 .../app/models/utils/confirmation-dialog.ts | 0 .../src/app/models/utils/toast-options.ts | 0 {kdb-web => web}/src/app/models/view/theme.ts | 0 .../src/app/models/view/themes.enum.ts | 0 .../auth-users/auth-user-routing.module.ts | 0 .../admin/auth-users/auth-user.module.ts | 0 .../auth-user/auth-user.component.html | 0 .../auth-user/auth-user.component.scss | 0 .../auth-user/auth-user.component.spec.ts | 0 .../auth-user/auth-user.component.ts | 0 .../settings/settings.component.html | 0 .../settings/settings.component.scss | 0 .../settings/settings.component.spec.ts | 0 .../components/settings/settings.component.ts | 0 .../admin/settings/settings-routing.module.ts | 0 .../modules/admin/settings/settings.module.ts | 0 .../app/modules/auth/auth-routing.module.ts | 0 .../src/app/modules/auth/auth.module.ts | 0 .../auth-footer/auth-footer.component.html | 0 .../auth-footer/auth-footer.component.scss | 0 .../auth-footer/auth-footer.component.spec.ts | 0 .../auth-footer/auth-footer.component.ts | 0 .../auth-header/auth-header.component.html | 0 .../auth-header/auth-header.component.scss | 0 .../auth-header/auth-header.component.spec.ts | 0 .../auth-header/auth-header.component.ts | 0 .../forget-password.component.html | 0 .../forget-password.component.scss | 0 .../forget-password.component.spec.ts | 0 .../forget-password.component.ts | 0 .../components/login/login.component.html | 0 .../components/login/login.component.scss | 0 .../components/login/login.component.spec.ts | 0 .../auth/components/login/login.component.ts | 0 .../registration/registration.component.html | 0 .../registration/registration.component.scss | 0 .../registration.component.spec.ts | 0 .../registration/registration.component.ts | 0 .../shared/base/hideable-component.spec.ts | 0 .../modules/shared/base/hideable-component.ts | 0 .../multi-select-columns.component.html | 0 .../multi-select-columns.component.scss | 0 .../multi-select-columns.component.spec.ts | 0 .../multi-select-columns.component.ts | 0 .../config-list/config-list.component.html | 0 .../config-list/config-list.component.scss | 0 .../config-list/config-list.component.spec.ts | 0 .../config-list/config-list.component.ts | 0 .../feature-flag-list.component.html | 0 .../feature-flag-list.component.scss | 0 .../feature-flag-list.component.spec.ts | 0 .../feature-flag-list.component.ts | 0 .../hideable-column.component.html | 0 .../hideable-column.component.scss | 0 .../hideable-column.component.spec.ts | 0 .../hideable-column.component.ts | 0 .../hideable-header.component.html | 0 .../hideable-header.component.scss | 0 .../hideable-header.component.spec.ts | 0 .../hideable-header.component.ts | 0 .../history-btn/history-btn.component.html | 0 .../history-btn/history-btn.component.scss | 0 .../history-btn/history-btn.component.spec.ts | 0 .../history-btn/history-btn.component.ts | 0 .../shared/guards/auth/auth.guard.spec.ts | 0 .../modules/shared/guards/auth/auth.guard.ts | 0 .../modules/shared/pipes/auth-role.pipe.ts | 0 .../modules/shared/pipes/bool.pipe.spec.ts | 0 .../src/app/modules/shared/pipes/bool.pipe.ts | 0 .../modules/shared/pipes/ip-address.pipe.ts | 0 .../src/app/modules/shared/shared.module.ts | 0 .../change-password-routing.module.ts | 0 .../change-password/change-password.module.ts | 0 .../change-password.component.html | 0 .../change-password.component.scss | 0 .../change-password.component.spec.ts | 0 .../change-password.component.ts | 0 .../dashboard/dashboard.component.html | 0 .../dashboard/dashboard.component.scss | 0 .../dashboard/dashboard.component.spec.ts | 0 .../dashboard/dashboard.component.ts | 0 .../dashboard/dashboard-routing.module.ts | 0 .../view/dashboard/dashboard.module.ts | 0 .../achievements-routing.module.ts | 0 .../achievements/achievements.module.ts | 0 .../achievement/achievement.component.html | 0 .../achievement/achievement.component.scss | 0 .../achievement/achievement.component.spec.ts | 0 .../achievement/achievement.component.ts | 0 .../auto-role/auto-role-routing.module.ts | 0 .../view/server/auto-role/auto-role.module.ts | 0 .../auto-roles-rules.component.html | 0 .../auto-roles-rules.component.scss | 0 .../auto-roles-rules.component.spec.ts | 0 .../auto-roles-rules.component.ts | 0 .../auto-roles/auto-roles.component.html | 0 .../auto-roles/auto-roles.component.scss | 0 .../auto-roles/auto-roles.component.spec.ts | 0 .../auto-roles/auto-roles.component.ts | 0 .../components/config/config.component.html | 0 .../components/config/config.component.scss | 0 .../config/config.component.spec.ts | 0 .../components/config/config.component.ts | 0 .../server/config/config-routing.module.ts | 0 .../view/server/config/config.module.ts | 0 .../components/levels/levels.component.html | 0 .../components/levels/levels.component.scss | 0 .../levels/levels.component.spec.ts | 0 .../components/levels/levels.component.ts | 0 .../server/levels/levels-routing.module.ts | 0 .../view/server/levels/levels.module.ts | 0 .../server/members/members.component.html | 0 .../server/members/members.component.scss | 0 .../server/members/members.component.spec.ts | 0 .../view/server/members/members.component.ts | 0 .../server/profile/profile.component.html | 0 .../server/profile/profile.component.scss | 0 .../server/profile/profile.component.spec.ts | 0 .../view/server/profile/profile.component.ts | 0 .../components/client/client.component.html | 0 .../components/client/client.component.scss | 0 .../client/client.component.spec.ts | 0 .../components/client/client.component.ts | 0 .../server-dashboard.component.html | 0 .../server-dashboard.component.scss | 0 .../server-dashboard.component.spec.ts | 0 .../server-dashboard.component.ts | 0 .../view/server/server-routing.module.ts | 0 .../app/modules/view/server/server.module.ts | 0 .../short-role-names.component.html | 0 .../short-role-names.component.scss | 0 .../short-role-names.component.spec.ts | 0 .../short-role-names.component.ts | 0 .../short-role-name-routing.module.ts | 0 .../short-role-name/short-role-name.module.ts | 0 .../user-settings.component.html | 0 .../user-settings.component.scss | 0 .../user-settings.component.spec.ts | 0 .../user-settings/user-settings.component.ts | 0 .../user-settings-routing.module.ts | 0 .../user-settings/user-settings.module.ts | 0 .../app/services/auth/auth.service.spec.ts | 0 .../src/app/services/auth/auth.service.ts | 0 .../confirmation-dialog.service.spec.ts | 0 .../confirmation-dialog.service.ts | 0 .../app/services/data/data.service.spec.ts | 0 .../src/app/services/data/data.service.ts | 0 .../error-handler.service.spec.ts | 0 .../error-handler/error-handler.service.ts | 0 .../src/app/services/gui/gui.service.spec.ts | 0 .../src/app/services/gui/gui.service.ts | 0 .../src/app/services/server.service.spec.ts | 0 .../src/app/services/server.service.ts | 0 .../settings/settings.service.spec.ts | 0 .../app/services/settings/settings.service.ts | 0 .../services/sidebar/sidebar.service.spec.ts | 0 .../app/services/sidebar/sidebar.service.ts | 0 .../services/socket/socket.service.spec.ts | 0 .../src/app/services/socket/socket.service.ts | 0 .../services/spinner/spinner.service.spec.ts | 0 .../app/services/spinner/spinner.service.ts | 0 .../app/services/theme/theme.service.spec.ts | 0 .../src/app/services/theme/theme.service.ts | 0 .../app/services/toast/toast.service.spec.ts | 0 .../src/app/services/toast/toast.service.ts | 0 {kdb-web => web}/src/assets/config.json | 0 {kdb-web => web}/src/assets/i18n/de.json | 0 {kdb-web => web}/src/assets/i18n/en.json | 0 .../src/assets/images/favicon.ico | Bin {kdb-web => web}/src/assets/version.json | 0 .../environments/environment.development.ts | 0 .../src/environments/environment.prod.ts | 0 .../src/environments/environment.staging.ts | 0 .../src/environments/environment.ts | 0 {kdb-web => web}/src/favicon.ico | Bin {kdb-web => web}/src/index.html | 0 {kdb-web => web}/src/main.ts | 0 {kdb-web => web}/src/polyfills.ts | 0 {kdb-web => web}/src/styles.scss | 0 {kdb-web => web}/src/styles/constants.scss | 0 .../src/styles/primeng-fixes.scss | 0 .../src/styles/themes/default-dark-theme.scss | 0 .../styles/themes/default-light-theme.scss | 0 .../styles/themes/sh-edraft-dark-theme.scss | 0 .../styles/themes/sh-edraft-light-theme.scss | 0 {kdb-web => web}/src/test.ts | 0 {kdb-web => web}/tsconfig.app.json | 0 {kdb-web => web}/tsconfig.json | 0 {kdb-web => web}/tsconfig.spec.json | 0 {kdb-web => web}/update-version.ts | 0 807 files changed, 3801 insertions(+), 1297 deletions(-) rename {kdb-bot => bot}/.cpl/schematic_db_table.py (100%) rename {kdb-bot => bot}/.cpl/schematic_migration.py (100%) rename {kdb-bot => bot}/.cpl/schematic_query.py (100%) rename {kdb-bot => bot}/src/bot/__init__.py (100%) rename {kdb-bot => bot}/src/bot/application.py (87%) rename {kdb-bot => bot}/src/bot/bot (100%) rename {kdb-bot => bot}/src/bot/bot.json (100%) rename {kdb-bot => bot}/src/bot/extension/__init__.py (100%) rename {kdb-bot => bot}/src/bot/extension/init_bot_extension.py (79%) rename {kdb-bot => bot}/src/bot/main.py (100%) rename {kdb-bot => bot}/src/bot/module_list.py (100%) rename {kdb-bot => bot}/src/bot/startup.py (95%) rename {kdb-bot => bot}/src/bot/startup_discord_extension.py (67%) rename {kdb-bot => bot}/src/bot/startup_migration_extension.py (52%) rename {kdb-bot => bot}/src/bot/startup_module_extension.py (86%) rename {kdb-bot => bot}/src/bot/startup_settings_extension.py (64%) rename {kdb-bot => bot}/src/bot/translation/de.json (100%) rename {kdb-bot => bot}/src/bot_api/__init__.py (100%) rename {kdb-bot => bot}/src/bot_api/abc/__init__.py (100%) rename {kdb-bot => bot}/src/bot_api/abc/auth_service_abc.py (92%) rename {kdb-bot => bot}/src/bot_api/abc/dto_abc.py (100%) rename {kdb-bot => bot}/src/bot_api/abc/select_criteria_abc.py (68%) rename {kdb-bot => bot}/src/bot_api/abc/transformer_abc.py (100%) rename {kdb-bot => bot}/src/bot_api/api.py (92%) rename {kdb-bot => bot}/src/bot_api/api_module.py (86%) rename {kdb-bot => bot}/src/bot_api/api_thread.py (100%) rename {kdb-bot => bot}/src/bot_api/app_api_extension.py (93%) rename {kdb-bot => bot}/src/bot_api/bot-api.json (100%) rename {kdb-bot => bot}/src/bot_api/configuration/__init__.py (100%) rename {kdb-bot => bot}/src/bot_api/configuration/api_settings.py (100%) rename {kdb-bot => bot}/src/bot_api/configuration/authentication_settings.py (89%) rename {kdb-bot => bot}/src/bot_api/configuration/discord_authentication_settings.py (100%) rename {kdb-bot => bot}/src/bot_api/configuration/frontend_settings.py (100%) rename {kdb-bot => bot}/src/bot_api/controller/__init__.py (100%) rename {kdb-bot => bot}/src/bot_api/controller/auth_controller.py (83%) rename {kdb-bot => bot}/src/bot_api/controller/auth_discord_controller.py (100%) rename {kdb-bot => bot}/src/bot_api/controller/graphql_controller.py (100%) rename {kdb-bot => bot}/src/bot_api/controller/gui_controller.py (100%) rename {kdb-bot => bot}/src/bot_api/event/__init__.py (100%) rename {kdb-bot => bot}/src/bot_api/event/bot_api_on_ready_event.py (100%) rename {kdb-bot => bot}/src/bot_api/exception/__init__.py (100%) rename {kdb-bot => bot}/src/bot_api/exception/service_error_code_enum.py (100%) rename {kdb-bot => bot}/src/bot_api/exception/service_exception.py (100%) rename {kdb-bot => bot}/src/bot_api/filter/__init__.py (100%) rename {kdb-bot => bot}/src/bot_api/filter/auth_user_select_criteria.py (80%) rename {kdb-bot => bot}/src/bot_api/filter/discord/__init__.py (100%) rename {kdb-bot => bot}/src/bot_api/filter/discord/server_select_criteria.py (72%) rename {kdb-bot => bot}/src/bot_api/json_processor.py (100%) rename {kdb-bot => bot}/src/bot_api/logging/__init__.py (100%) rename {kdb-bot => bot}/src/bot_api/logging/api_logger.py (100%) rename {kdb-bot => bot}/src/bot_api/model/__init__.py (100%) rename {kdb-bot => bot}/src/bot_api/model/auth_user_dto.py (100%) rename {kdb-bot => bot}/src/bot_api/model/auth_user_filtered_result_dto.py (100%) rename {kdb-bot => bot}/src/bot_api/model/discord/__init__.py (100%) rename {kdb-bot => bot}/src/bot_api/model/discord/server_dto.py (100%) rename {kdb-bot => bot}/src/bot_api/model/discord/server_filtered_result_dto.py (100%) rename {kdb-bot => bot}/src/bot_api/model/email_string_dto.py (100%) rename {kdb-bot => bot}/src/bot_api/model/error_dto.py (87%) rename {kdb-bot => bot}/src/bot_api/model/o_auth_dto.py (100%) rename {kdb-bot => bot}/src/bot_api/model/reset_password_dto.py (100%) rename {kdb-bot => bot}/src/bot_api/model/settings_dto.py (100%) rename {kdb-bot => bot}/src/bot_api/model/token_dto.py (82%) rename {kdb-bot => bot}/src/bot_api/model/update_auth_user_dto.py (89%) rename {kdb-bot => bot}/src/bot_api/model/user_dto.py (100%) rename {kdb-bot => bot}/src/bot_api/model/version_dto.py (100%) rename {kdb-bot => bot}/src/bot_api/route/__init__.py (100%) rename {kdb-bot => bot}/src/bot_api/route/route.py (84%) rename {kdb-bot => bot}/src/bot_api/service/__init__.py (100%) rename {kdb-bot => bot}/src/bot_api/service/auth_service.py (82%) rename {kdb-bot => bot}/src/bot_api/service/discord_service.py (83%) rename {kdb-bot => bot}/src/bot_api/transformer/__init__.py (100%) rename {kdb-bot => bot}/src/bot_api/transformer/auth_user_transformer.py (84%) rename {kdb-bot => bot}/src/bot_api/transformer/server_transformer.py (81%) rename {kdb-bot => bot}/src/bot_core/__init__.py (100%) rename {kdb-bot => bot}/src/bot_core/abc/__init__.py (100%) rename {kdb-bot => bot}/src/bot_core/abc/client_utils_abc.py (86%) rename {kdb-bot => bot}/src/bot_core/abc/custom_file_logger_abc.py (92%) rename {kdb-bot => bot}/src/bot_core/abc/message_service_abc.py (92%) rename {kdb-bot => bot}/src/bot_core/abc/module_abc.py (100%) rename {kdb-bot => bot}/src/bot_core/abc/task_abc.py (85%) rename {kdb-bot => bot}/src/bot_core/bot-core.json (100%) rename {kdb-bot => bot}/src/bot_core/configuration/__init__.py (100%) rename {kdb-bot => bot}/src/bot_core/configuration/bot_logging_settings.py (100%) rename {kdb-bot => bot}/src/bot_core/configuration/feature_flags_enum.py (100%) rename {kdb-bot => bot}/src/bot_core/configuration/feature_flags_settings.py (100%) rename {kdb-bot => bot}/src/bot_core/configuration/file_logging_settings.py (78%) rename {kdb-bot => bot}/src/bot_core/core_extension/__init__.py (100%) rename {kdb-bot => bot}/src/bot_core/core_extension/core_extension.py (96%) rename {kdb-bot => bot}/src/bot_core/core_extension/core_extension_module.py (67%) rename {kdb-bot => bot}/src/bot_core/core_extension/core_extension_on_ready_event.py (100%) rename {kdb-bot => bot}/src/bot_core/core_module.py (87%) rename {kdb-bot => bot}/src/bot_core/events/__init__.py (100%) rename {kdb-bot => bot}/src/bot_core/events/core_on_ready_event.py (100%) rename {kdb-bot => bot}/src/bot_core/exception/__init__.py (100%) rename {kdb-bot => bot}/src/bot_core/exception/check_error.py (100%) rename {kdb-bot => bot}/src/bot_core/helper/__init__.py (100%) rename {kdb-bot => bot}/src/bot_core/helper/command_checks.py (85%) rename {kdb-bot => bot}/src/bot_core/helper/event_checks.py (100%) rename {kdb-bot => bot}/src/bot_core/helper/log_message_helper.py (100%) rename {kdb-bot => bot}/src/bot_core/logging/__init__.py (100%) rename {kdb-bot => bot}/src/bot_core/logging/command_logger.py (100%) rename {kdb-bot => bot}/src/bot_core/logging/database_logger.py (100%) rename {kdb-bot => bot}/src/bot_core/logging/message_logger.py (100%) rename {kdb-bot => bot}/src/bot_core/logging/task_logger.py (100%) rename {kdb-bot => bot}/src/bot_core/pipes/__init__.py (100%) rename {kdb-bot => bot}/src/bot_core/pipes/date_time_offset_pipe.py (100%) rename {kdb-bot => bot}/src/bot_core/service/__init__.py (100%) rename {kdb-bot => bot}/src/bot_core/service/client_utils_service.py (87%) rename {kdb-bot => bot}/src/bot_core/service/config_service.py (89%) rename {kdb-bot => bot}/src/bot_core/service/data_integrity_service.py (77%) rename {kdb-bot => bot}/src/bot_core/service/message_service.py (70%) rename {kdb-bot => bot}/src/bot_data/__init__.py (100%) rename {kdb-bot => bot}/src/bot_data/abc/__init__.py (100%) rename {kdb-bot => bot}/src/bot_data/abc/achievement_repository_abc.py (91%) rename {kdb-bot => bot}/src/bot_data/abc/api_key_repository_abc.py (100%) rename {kdb-bot => bot}/src/bot_data/abc/auth_user_repository_abc.py (94%) rename {kdb-bot => bot}/src/bot_data/abc/auto_role_repository_abc.py (100%) rename {kdb-bot => bot}/src/bot_data/abc/client_repository_abc.py (93%) rename {kdb-bot => bot}/src/bot_data/abc/data_seeder_abc.py (100%) rename {kdb-bot => bot}/src/bot_data/abc/game_server_repository_abc.py (100%) rename {kdb-bot => bot}/src/bot_data/abc/history_table_abc.py (100%) rename {kdb-bot => bot}/src/bot_data/abc/known_user_repository_abc.py (100%) rename {kdb-bot => bot}/src/bot_data/abc/level_repository_abc.py (100%) rename {kdb-bot => bot}/src/bot_data/abc/migration_abc.py (100%) rename {kdb-bot => bot}/src/bot_data/abc/server_config_repository_abc.py (64%) rename {kdb-bot => bot}/src/bot_data/abc/server_repository_abc.py (100%) rename {kdb-bot => bot}/src/bot_data/abc/short_role_name_repository_abc.py (100%) rename {kdb-bot => bot}/src/bot_data/abc/steam_special_offer_repository_abc.py (100%) rename {kdb-bot => bot}/src/bot_data/abc/table_with_id_abc.py (100%) rename {kdb-bot => bot}/src/bot_data/abc/technician_config_repository_abc.py (79%) rename {kdb-bot => bot}/src/bot_data/abc/user_game_ident_repository_abc.py (100%) rename {kdb-bot => bot}/src/bot_data/abc/user_joined_game_server_repository_abc.py (51%) rename {kdb-bot => bot}/src/bot_data/abc/user_joined_server_repository_abc.py (76%) rename {kdb-bot => bot}/src/bot_data/abc/user_joined_voice_channel_repository_abc.py (50%) rename {kdb-bot => bot}/src/bot_data/abc/user_message_count_per_hour_repository_abc.py (91%) rename {kdb-bot => bot}/src/bot_data/abc/user_repository_abc.py (81%) rename {kdb-bot => bot}/src/bot_data/abc/user_warnings_repository_abc.py (100%) rename {kdb-bot => bot}/src/bot_data/bot-data.json (100%) rename {kdb-bot => bot}/src/bot_data/data_module.py (74%) rename {kdb-bot => bot}/src/bot_data/db_context.py (100%) rename {kdb-bot => bot}/src/bot_data/filtered_result.py (100%) rename {kdb-bot => bot}/src/bot_data/migration/__init__.py (100%) rename {kdb-bot => bot}/src/bot_data/migration/achievements_migration.py (84%) rename {kdb-bot => bot}/src/bot_data/migration/api_key_migration.py (100%) rename {kdb-bot => bot}/src/bot_data/migration/api_migration.py (100%) rename {kdb-bot => bot}/src/bot_data/migration/auto_role_fix1_migration.py (100%) rename {kdb-bot => bot}/src/bot_data/migration/auto_role_migration.py (100%) rename {kdb-bot => bot}/src/bot_data/migration/birthday_migration.py (100%) rename {kdb-bot => bot}/src/bot_data/migration/config_feature_flags_migration.py (74%) rename {kdb-bot => bot}/src/bot_data/migration/config_migration.py (100%) rename {kdb-bot => bot}/src/bot_data/migration/db_history_migration.py (100%) rename {kdb-bot => bot}/src/bot_data/migration/db_history_scripts/api_keys.sql (100%) rename {kdb-bot => bot}/src/bot_data/migration/db_history_scripts/auth_user_users_relation.sql (100%) rename {kdb-bot => bot}/src/bot_data/migration/db_history_scripts/auth_users.sql (100%) rename {kdb-bot => bot}/src/bot_data/migration/db_history_scripts/auto_role_rules.sql (100%) rename {kdb-bot => bot}/src/bot_data/migration/db_history_scripts/auto_roles.sql (100%) rename {kdb-bot => bot}/src/bot_data/migration/db_history_scripts/clients.sql (100%) rename {kdb-bot => bot}/src/bot_data/migration/db_history_scripts/config/server.sql (100%) rename {kdb-bot => bot}/src/bot_data/migration/db_history_scripts/config/server_afk_channels.sql (100%) rename {kdb-bot => bot}/src/bot_data/migration/db_history_scripts/config/server_team_roles.sql (100%) rename {kdb-bot => bot}/src/bot_data/migration/db_history_scripts/config/technician.sql (100%) rename {kdb-bot => bot}/src/bot_data/migration/db_history_scripts/config/technician_ids.sql (100%) rename {kdb-bot => bot}/src/bot_data/migration/db_history_scripts/config/technician_ping_urls.sql (100%) rename {kdb-bot => bot}/src/bot_data/migration/db_history_scripts/game_servers.sql (100%) rename {kdb-bot => bot}/src/bot_data/migration/db_history_scripts/known_users.sql (100%) rename {kdb-bot => bot}/src/bot_data/migration/db_history_scripts/levels.sql (100%) rename {kdb-bot => bot}/src/bot_data/migration/db_history_scripts/servers.sql (100%) rename {kdb-bot => bot}/src/bot_data/migration/db_history_scripts/short_rule_names.sql (100%) rename {kdb-bot => bot}/src/bot_data/migration/db_history_scripts/user_game_idents.sql (100%) rename {kdb-bot => bot}/src/bot_data/migration/db_history_scripts/user_joined_game_servers.sql (100%) rename {kdb-bot => bot}/src/bot_data/migration/db_history_scripts/user_joined_servers.sql (100%) rename {kdb-bot => bot}/src/bot_data/migration/db_history_scripts/user_joined_voice_channel.sql (100%) rename {kdb-bot => bot}/src/bot_data/migration/db_history_scripts/user_message_count_per_hour.sql (100%) rename {kdb-bot => bot}/src/bot_data/migration/db_history_scripts/user_warnings.sql (100%) rename {kdb-bot => bot}/src/bot_data/migration/db_history_scripts/users.sql (100%) rename {kdb-bot => bot}/src/bot_data/migration/default_role_migration.py (100%) rename {kdb-bot => bot}/src/bot_data/migration/fix_updates_migration.py (93%) rename {kdb-bot => bot}/src/bot_data/migration/fix_user_history_migration.py (100%) rename {kdb-bot => bot}/src/bot_data/migration/initial_migration.py (100%) rename {kdb-bot => bot}/src/bot_data/migration/level_migration.py (100%) rename {kdb-bot => bot}/src/bot_data/migration/remove_stats_migration.py (100%) rename {kdb-bot => bot}/src/bot_data/migration/short_role_name_migration.py (100%) rename {kdb-bot => bot}/src/bot_data/migration/short_role_name_only_highest_migration.py (100%) rename {kdb-bot => bot}/src/bot_data/migration/stats_migration.py (100%) rename {kdb-bot => bot}/src/bot_data/migration/steam_special_offer_migration.py (100%) rename {kdb-bot => bot}/src/bot_data/migration/user_joined_game_server_migration.py (100%) rename {kdb-bot => bot}/src/bot_data/migration/user_message_count_per_hour_migration.py (100%) rename {kdb-bot => bot}/src/bot_data/migration/user_warning_migration.py (100%) rename {kdb-bot => bot}/src/bot_data/model/__init__.py (100%) rename {kdb-bot => bot}/src/bot_data/model/achievement.py (97%) rename {kdb-bot => bot}/src/bot_data/model/achievement_history.py (100%) rename {kdb-bot => bot}/src/bot_data/model/api_key.py (95%) rename {kdb-bot => bot}/src/bot_data/model/auth_role_enum.py (100%) rename {kdb-bot => bot}/src/bot_data/model/auth_user.py (98%) rename {kdb-bot => bot}/src/bot_data/model/auth_user_users_relation.py (95%) rename {kdb-bot => bot}/src/bot_data/model/auto_role.py (96%) rename {kdb-bot => bot}/src/bot_data/model/auto_role_history.py (100%) rename {kdb-bot => bot}/src/bot_data/model/auto_role_rule.py (96%) rename {kdb-bot => bot}/src/bot_data/model/auto_role_rule_history.py (100%) rename {kdb-bot => bot}/src/bot_data/model/client.py (97%) rename {kdb-bot => bot}/src/bot_data/model/client_history.py (100%) rename {kdb-bot => bot}/src/bot_data/model/game_server.py (96%) rename {kdb-bot => bot}/src/bot_data/model/known_user.py (93%) rename {kdb-bot => bot}/src/bot_data/model/known_user_history.py (100%) rename {kdb-bot => bot}/src/bot_data/model/level.py (96%) rename {kdb-bot => bot}/src/bot_data/model/level_history.py (100%) rename {kdb-bot => bot}/src/bot_data/model/migration_history.py (100%) rename {kdb-bot => bot}/src/bot_data/model/server.py (95%) rename {kdb-bot => bot}/src/bot_data/model/server_afk_channel_ids_config.py (94%) rename {kdb-bot => bot}/src/bot_data/model/server_config.py (98%) rename {kdb-bot => bot}/src/bot_data/model/server_config_history.py (96%) rename {kdb-bot => bot}/src/bot_data/model/server_history.py (100%) rename {kdb-bot => bot}/src/bot_data/model/server_team_role_ids_config.py (95%) rename {kdb-bot => bot}/src/bot_data/model/short_role_name.py (96%) rename {kdb-bot => bot}/src/bot_data/model/short_role_name_history.py (100%) rename {kdb-bot => bot}/src/bot_data/model/short_role_name_position_enum.py (100%) rename {kdb-bot => bot}/src/bot_data/model/steam_special_offer.py (96%) rename {kdb-bot => bot}/src/bot_data/model/team_member_type_enum.py (100%) rename {kdb-bot => bot}/src/bot_data/model/technician_config.py (97%) rename {kdb-bot => bot}/src/bot_data/model/technician_config_history.py (100%) rename {kdb-bot => bot}/src/bot_data/model/technician_id_config.py (94%) rename {kdb-bot => bot}/src/bot_data/model/technician_id_config_history.py (100%) rename {kdb-bot => bot}/src/bot_data/model/technician_ping_url_config.py (94%) rename {kdb-bot => bot}/src/bot_data/model/technician_ping_url_config_history.py (100%) rename {kdb-bot => bot}/src/bot_data/model/user.py (94%) rename {kdb-bot => bot}/src/bot_data/model/user_game_ident.py (96%) rename {kdb-bot => bot}/src/bot_data/model/user_got_achievement.py (95%) rename {kdb-bot => bot}/src/bot_data/model/user_history.py (89%) rename {kdb-bot => bot}/src/bot_data/model/user_joined_game_server.py (96%) rename {kdb-bot => bot}/src/bot_data/model/user_joined_game_server_history.py (100%) rename {kdb-bot => bot}/src/bot_data/model/user_joined_server.py (96%) rename {kdb-bot => bot}/src/bot_data/model/user_joined_server_history.py (100%) rename {kdb-bot => bot}/src/bot_data/model/user_joined_voice_channel.py (97%) rename {kdb-bot => bot}/src/bot_data/model/user_joined_voice_channel_history.py (100%) rename {kdb-bot => bot}/src/bot_data/model/user_message_count_per_hour.py (96%) rename {kdb-bot => bot}/src/bot_data/model/user_role_enum.py (100%) rename {kdb-bot => bot}/src/bot_data/model/user_warnings.py (95%) rename {kdb-bot => bot}/src/bot_data/model/user_warnings_history.py (100%) rename {kdb-bot => bot}/src/bot_data/service/__init__.py (100%) rename {kdb-bot => bot}/src/bot_data/service/achievements_repository_service.py (76%) rename {kdb-bot => bot}/src/bot_data/service/api_key_repository_service.py (77%) rename {kdb-bot => bot}/src/bot_data/service/auth_user_repository_service.py (84%) rename {kdb-bot => bot}/src/bot_data/service/auto_role_repository_service.py (59%) rename {kdb-bot => bot}/src/bot_data/service/cache_service.py (100%) rename {kdb-bot => bot}/src/bot_data/service/client_repository_service.py (89%) rename {kdb-bot => bot}/src/bot_data/service/game_server_repository_service.py (93%) rename {kdb-bot => bot}/src/bot_data/service/known_user_repository_service.py (83%) rename {kdb-bot => bot}/src/bot_data/service/level_repository_service.py (91%) rename {kdb-bot => bot}/src/bot_data/service/migration_service.py (78%) rename {kdb-bot => bot}/src/bot_data/service/seeder_service.py (100%) rename {kdb-bot => bot}/src/bot_data/service/server_config_repository_service.py (54%) rename {kdb-bot => bot}/src/bot_data/service/server_config_seeder.py (100%) rename {kdb-bot => bot}/src/bot_data/service/server_repository_service.py (74%) rename {kdb-bot => bot}/src/bot_data/service/short_role_name_repository_service.py (76%) rename {kdb-bot => bot}/src/bot_data/service/steam_special_offer_repository_service.py (74%) rename {kdb-bot => bot}/src/bot_data/service/technician_config_repository_service.py (69%) rename {kdb-bot => bot}/src/bot_data/service/technician_config_seeder.py (85%) rename {kdb-bot => bot}/src/bot_data/service/user_game_ident_repository_service.py (85%) rename {kdb-bot => bot}/src/bot_data/service/user_joined_game_server_repository_service.py (65%) rename {kdb-bot => bot}/src/bot_data/service/user_joined_server_repository_service.py (78%) rename {kdb-bot => bot}/src/bot_data/service/user_joined_voice_channel_repository_service.py (68%) rename {kdb-bot => bot}/src/bot_data/service/user_message_count_per_hour_repository_service.py (89%) rename {kdb-bot => bot}/src/bot_data/service/user_repository_service.py (81%) rename {kdb-bot => bot}/src/bot_data/service/user_warnings_repository_service.py (85%) rename {kdb-bot => bot}/src/bot_graphql/__init__.py (100%) rename {kdb-bot => bot}/src/bot_graphql/abc/__init__.py (100%) rename {kdb-bot => bot}/src/bot_graphql/abc/data_query_abc.py (100%) rename {kdb-bot => bot}/src/bot_graphql/abc/data_query_with_history_abc.py (100%) rename {kdb-bot => bot}/src/bot_graphql/abc/filter_abc.py (83%) rename {kdb-bot => bot}/src/bot_graphql/abc/history_query_abc.py (100%) rename {kdb-bot => bot}/src/bot_graphql/abc/query_abc.py (86%) rename {kdb-bot => bot}/src/bot_graphql/bot-graphql.json (100%) rename {kdb-bot => bot}/src/bot_graphql/filter/__init__.py (100%) rename {kdb-bot => bot}/src/bot_graphql/filter/achievement_filter.py (84%) rename {kdb-bot => bot}/src/bot_graphql/filter/auto_role_filter.py (87%) rename {kdb-bot => bot}/src/bot_graphql/filter/auto_role_rule_filter.py (93%) rename {kdb-bot => bot}/src/bot_graphql/filter/client_filter.py (84%) rename {kdb-bot => bot}/src/bot_graphql/filter/level_filter.py (84%) rename {kdb-bot => bot}/src/bot_graphql/filter/page.py (100%) rename {kdb-bot => bot}/src/bot_graphql/filter/server_filter.py (83%) rename {kdb-bot => bot}/src/bot_graphql/filter/short_role_name_filter.py (91%) rename {kdb-bot => bot}/src/bot_graphql/filter/sort.py (100%) rename {kdb-bot => bot}/src/bot_graphql/filter/user_filter.py (80%) rename {kdb-bot => bot}/src/bot_graphql/filter/user_joined_game_server_filter.py (96%) rename {kdb-bot => bot}/src/bot_graphql/filter/user_joined_server_filter.py (80%) rename {kdb-bot => bot}/src/bot_graphql/filter/user_joined_voice_channel_filter.py (82%) rename {kdb-bot => bot}/src/bot_graphql/filter/user_warning_filter.py (85%) rename {kdb-bot => bot}/src/bot_graphql/graphql/achievement.gql (100%) rename {kdb-bot => bot}/src/bot_graphql/graphql/autoRole.gql (100%) rename {kdb-bot => bot}/src/bot_graphql/graphql/autoRoleRule.gql (100%) rename {kdb-bot => bot}/src/bot_graphql/graphql/base.gql (100%) rename {kdb-bot => bot}/src/bot_graphql/graphql/client.gql (100%) rename {kdb-bot => bot}/src/bot_graphql/graphql/discord.gql (100%) rename {kdb-bot => bot}/src/bot_graphql/graphql/featureFlags.gql (100%) rename {kdb-bot => bot}/src/bot_graphql/graphql/knownUser.gql (100%) rename {kdb-bot => bot}/src/bot_graphql/graphql/level.gql (100%) rename {kdb-bot => bot}/src/bot_graphql/graphql/mutation.gql (100%) rename {kdb-bot => bot}/src/bot_graphql/graphql/query.gql (100%) rename {kdb-bot => bot}/src/bot_graphql/graphql/server.gql (100%) rename {kdb-bot => bot}/src/bot_graphql/graphql/serverConfig.gql (100%) rename {kdb-bot => bot}/src/bot_graphql/graphql/shortRoleName.gql (100%) rename {kdb-bot => bot}/src/bot_graphql/graphql/technicianConfig.gql (100%) rename {kdb-bot => bot}/src/bot_graphql/graphql/user.gql (100%) rename {kdb-bot => bot}/src/bot_graphql/graphql/userJoinedGameServer.gql (100%) rename {kdb-bot => bot}/src/bot_graphql/graphql/userJoinedServer.gql (100%) rename {kdb-bot => bot}/src/bot_graphql/graphql/userJoinedVoiceChannel.gql (100%) rename {kdb-bot => bot}/src/bot_graphql/graphql/userWarning.gql (100%) rename {kdb-bot => bot}/src/bot_graphql/graphql_module.py (93%) rename {kdb-bot => bot}/src/bot_graphql/graphql_service.py (100%) rename {kdb-bot => bot}/src/bot_graphql/model/__init__.py (100%) rename {kdb-bot => bot}/src/bot_graphql/model/discord.py (100%) rename {kdb-bot => bot}/src/bot_graphql/mutation.py (97%) rename {kdb-bot => bot}/src/bot_graphql/mutations/__init__.py (100%) rename {kdb-bot => bot}/src/bot_graphql/mutations/achievement_mutation.py (85%) rename {kdb-bot => bot}/src/bot_graphql/mutations/auto_role_mutation.py (77%) rename {kdb-bot => bot}/src/bot_graphql/mutations/auto_role_rule_mutation.py (77%) rename {kdb-bot => bot}/src/bot_graphql/mutations/level_mutation.py (91%) rename {kdb-bot => bot}/src/bot_graphql/mutations/server_config_mutation.py (67%) rename {kdb-bot => bot}/src/bot_graphql/mutations/short_role_name_mutation.py (86%) rename {kdb-bot => bot}/src/bot_graphql/mutations/technician_config_mutation.py (79%) rename {kdb-bot => bot}/src/bot_graphql/mutations/user_joined_game_server_mutation.py (86%) rename {kdb-bot => bot}/src/bot_graphql/mutations/user_mutation.py (80%) rename {kdb-bot => bot}/src/bot_graphql/queries/__init__.py (100%) rename {kdb-bot => bot}/src/bot_graphql/queries/achievement_attribute_query.py (100%) rename {kdb-bot => bot}/src/bot_graphql/queries/achievement_history_query.py (100%) rename {kdb-bot => bot}/src/bot_graphql/queries/achievement_query.py (84%) rename {kdb-bot => bot}/src/bot_graphql/queries/auto_role_history_query.py (100%) rename {kdb-bot => bot}/src/bot_graphql/queries/auto_role_query.py (91%) rename {kdb-bot => bot}/src/bot_graphql/queries/auto_role_rule_history_query.py (100%) rename {kdb-bot => bot}/src/bot_graphql/queries/auto_role_rule_query.py (81%) rename {kdb-bot => bot}/src/bot_graphql/queries/client_history_query.py (100%) rename {kdb-bot => bot}/src/bot_graphql/queries/client_query.py (94%) rename {kdb-bot => bot}/src/bot_graphql/queries/discord/__init__.py (100%) rename {kdb-bot => bot}/src/bot_graphql/queries/discord/channel_query.py (100%) rename {kdb-bot => bot}/src/bot_graphql/queries/discord/discord_query.py (100%) rename {kdb-bot => bot}/src/bot_graphql/queries/discord/discord_user_query.py (100%) rename {kdb-bot => bot}/src/bot_graphql/queries/discord/emoji_query.py (100%) rename {kdb-bot => bot}/src/bot_graphql/queries/discord/guild_query.py (88%) rename {kdb-bot => bot}/src/bot_graphql/queries/discord/role_query.py (100%) rename {kdb-bot => bot}/src/bot_graphql/queries/game_server_query.py (100%) rename {kdb-bot => bot}/src/bot_graphql/queries/known_user_history_query.py (100%) rename {kdb-bot => bot}/src/bot_graphql/queries/known_user_query.py (83%) rename {kdb-bot => bot}/src/bot_graphql/queries/level_history_query.py (100%) rename {kdb-bot => bot}/src/bot_graphql/queries/level_query.py (91%) rename {kdb-bot => bot}/src/bot_graphql/queries/server_config_query.py (53%) rename {kdb-bot => bot}/src/bot_graphql/queries/server_history_query.py (100%) rename {kdb-bot => bot}/src/bot_graphql/queries/server_query.py (72%) rename {kdb-bot => bot}/src/bot_graphql/queries/short_role_name_history_query.py (100%) rename {kdb-bot => bot}/src/bot_graphql/queries/short_role_name_query.py (82%) rename {kdb-bot => bot}/src/bot_graphql/queries/technician_config_history_query.py (60%) rename {kdb-bot => bot}/src/bot_graphql/queries/technician_config_query.py (76%) rename {kdb-bot => bot}/src/bot_graphql/queries/technician_id_config_history_query.py (100%) rename {kdb-bot => bot}/src/bot_graphql/queries/technician_ping_url_config_history_query.py (100%) rename {kdb-bot => bot}/src/bot_graphql/queries/user_history_query.py (100%) rename {kdb-bot => bot}/src/bot_graphql/queries/user_joined_game_server_history_query.py (100%) rename {kdb-bot => bot}/src/bot_graphql/queries/user_joined_game_server_query.py (90%) rename {kdb-bot => bot}/src/bot_graphql/queries/user_joined_server_history_query.py (100%) rename {kdb-bot => bot}/src/bot_graphql/queries/user_joined_server_query.py (87%) rename {kdb-bot => bot}/src/bot_graphql/queries/user_joined_voice_channel_history_query.py (100%) rename {kdb-bot => bot}/src/bot_graphql/queries/user_joined_voice_channel_query.py (85%) rename {kdb-bot => bot}/src/bot_graphql/queries/user_query.py (88%) rename {kdb-bot => bot}/src/bot_graphql/queries/user_warning_history_query.py (100%) rename {kdb-bot => bot}/src/bot_graphql/queries/user_warning_query.py (80%) rename {kdb-bot => bot}/src/bot_graphql/query.py (70%) rename {kdb-bot => bot}/src/bot_graphql/schema.py (78%) rename {kdb-bot => bot}/src/modules/__init__.py (100%) rename {kdb-bot => bot}/src/modules/achievements/__init__.py (100%) rename {kdb-bot => bot}/src/modules/achievements/achievement_attribute_resolver.py (80%) rename {kdb-bot => bot}/src/modules/achievements/achievement_service.py (68%) rename {kdb-bot => bot}/src/modules/achievements/achievements.json (100%) rename {kdb-bot => bot}/src/modules/achievements/achievements_module.py (55%) rename {kdb-bot => bot}/src/modules/achievements/commands/__init__.py (100%) rename {kdb-bot => bot}/src/modules/achievements/commands/achievements_group.py (97%) rename {kdb-bot => bot}/src/modules/achievements/events/__init__.py (100%) rename {kdb-bot => bot}/src/modules/achievements/events/achievement_on_message_event.py (94%) rename {kdb-bot => bot}/src/modules/achievements/events/achievement_on_reaction_add_event.py (90%) rename {kdb-bot => bot}/src/modules/achievements/events/achievement_on_reaction_remove_event.py (90%) rename {kdb-bot => bot}/src/modules/achievements/events/achievement_on_voice_state_update_event.py (90%) rename {kdb-bot => bot}/src/modules/achievements/model/__init__.py (100%) rename {kdb-bot => bot}/src/modules/achievements/model/achievement_attribute.py (100%) rename {kdb-bot => bot}/src/modules/auto_role/__init__.py (100%) rename {kdb-bot => bot}/src/modules/auto_role/auto-role.json (100%) rename {kdb-bot => bot}/src/modules/auto_role/auto_role_module.py (86%) rename {kdb-bot => bot}/src/modules/auto_role/command/__init__.py (100%) rename {kdb-bot => bot}/src/modules/auto_role/command/auto_role_group.py (74%) rename {kdb-bot => bot}/src/modules/auto_role/events/__init__.py (100%) rename {kdb-bot => bot}/src/modules/auto_role/events/auto_role_on_raw_reaction_add.py (89%) rename {kdb-bot => bot}/src/modules/auto_role/events/auto_role_on_raw_reaction_remove.py (89%) rename {kdb-bot => bot}/src/modules/auto_role/helper/__init__.py (100%) rename {kdb-bot => bot}/src/modules/auto_role/helper/auto_role_reaction_handler.py (88%) rename {kdb-bot => bot}/src/modules/base/__init__.py (100%) rename {kdb-bot => bot}/src/modules/base/base.json (100%) rename {kdb-bot => bot}/src/modules/base/base_module.py (81%) rename {kdb-bot => bot}/src/modules/base/birthday_watcher.py (92%) rename {kdb-bot => bot}/src/modules/base/command/__init__.py (100%) rename {kdb-bot => bot}/src/modules/base/command/afk_command.py (87%) rename {kdb-bot => bot}/src/modules/base/command/game_server_group.py (75%) rename {kdb-bot => bot}/src/modules/base/command/help_command.py (93%) rename {kdb-bot => bot}/src/modules/base/command/info_command.py (95%) rename {kdb-bot => bot}/src/modules/base/command/make_coffee_command.py (100%) rename {kdb-bot => bot}/src/modules/base/command/mass_move_command.py (96%) rename {kdb-bot => bot}/src/modules/base/command/ping_command.py (89%) rename {kdb-bot => bot}/src/modules/base/command/presence_command.py (85%) rename {kdb-bot => bot}/src/modules/base/command/purge_command.py (84%) rename {kdb-bot => bot}/src/modules/base/command/register_group.py (90%) rename {kdb-bot => bot}/src/modules/base/command/submit_group.py (93%) rename {kdb-bot => bot}/src/modules/base/command/unregister_group.py (94%) rename {kdb-bot => bot}/src/modules/base/command/user_group.py (78%) rename {kdb-bot => bot}/src/modules/base/events/__init__.py (100%) rename {kdb-bot => bot}/src/modules/base/events/base_on_command_error_event.py (94%) rename {kdb-bot => bot}/src/modules/base/events/base_on_command_event.py (86%) rename {kdb-bot => bot}/src/modules/base/events/base_on_guild_join_event.py (100%) rename {kdb-bot => bot}/src/modules/base/events/base_on_member_join_event.py (88%) rename {kdb-bot => bot}/src/modules/base/events/base_on_member_remove_event.py (90%) rename {kdb-bot => bot}/src/modules/base/events/base_on_message_delete_event.py (88%) rename {kdb-bot => bot}/src/modules/base/events/base_on_message_event.py (86%) rename {kdb-bot => bot}/src/modules/base/events/base_on_raw_reaction_add.py (100%) rename {kdb-bot => bot}/src/modules/base/events/base_on_raw_reaction_remove.py (100%) rename {kdb-bot => bot}/src/modules/base/events/base_on_scheduled_event_update_event.py (84%) rename {kdb-bot => bot}/src/modules/base/events/base_on_voice_state_update_event.py (75%) rename {kdb-bot => bot}/src/modules/base/events/base_on_voice_state_update_event_help_channel.py (92%) rename {kdb-bot => bot}/src/modules/base/events/base_on_voice_state_update_event_scheduled_event_bonus.py (100%) rename {kdb-bot => bot}/src/modules/base/forms/__init__.py (100%) rename {kdb-bot => bot}/src/modules/base/forms/bug_report_form.py (81%) rename {kdb-bot => bot}/src/modules/base/forms/complaint_form.py (90%) rename {kdb-bot => bot}/src/modules/base/helper/__init__.py (100%) rename {kdb-bot => bot}/src/modules/base/helper/base_reaction_handler.py (87%) rename {kdb-bot => bot}/src/modules/base/helper/voice_channel_transformer.py (62%) rename {kdb-bot => bot}/src/modules/base/model/__init__.py (100%) rename {kdb-bot => bot}/src/modules/base/model/active_event.py (100%) rename {kdb-bot => bot}/src/modules/base/service/__init__.py (100%) rename {kdb-bot => bot}/src/modules/base/service/event_service.py (87%) rename {kdb-bot => bot}/src/modules/base/service/user_warnings_service.py (66%) rename {kdb-bot => bot}/src/modules/base/thread/__init__.py (100%) rename {kdb-bot => bot}/src/modules/boot_log/__init__.py (100%) rename {kdb-bot => bot}/src/modules/boot_log/boot-log.json (100%) rename {kdb-bot => bot}/src/modules/boot_log/boot_log_extension.py (94%) rename {kdb-bot => bot}/src/modules/boot_log/boot_log_module.py (68%) rename {kdb-bot => bot}/src/modules/boot_log/boot_log_on_ready_event.py (88%) rename {kdb-bot => bot}/src/modules/config/__init__.py (100%) rename {kdb-bot => bot}/src/modules/config/config.json (100%) rename {kdb-bot => bot}/src/modules/config/config_extension.py (95%) rename {kdb-bot => bot}/src/modules/config/config_module.py (77%) rename {kdb-bot => bot}/src/modules/config/events/__init__.py (100%) rename {kdb-bot => bot}/src/modules/config/events/config_on_ready_event.py (85%) rename {kdb-bot => bot}/src/modules/config/service/__init__.py (100%) rename {kdb-bot => bot}/src/modules/database/__init__.py (100%) rename {kdb-bot => bot}/src/modules/database/database.json (100%) rename {kdb-bot => bot}/src/modules/database/database_extension.py (96%) rename {kdb-bot => bot}/src/modules/database/database_module.py (68%) rename {kdb-bot => bot}/src/modules/database/database_on_ready_event.py (80%) rename {kdb-bot => bot}/src/modules/level/__init__.py (100%) rename {kdb-bot => bot}/src/modules/level/command/__init__.py (100%) rename {kdb-bot => bot}/src/modules/level/command/level_group.py (81%) rename {kdb-bot => bot}/src/modules/level/configuration/__init__.py (100%) rename {kdb-bot => bot}/src/modules/level/configuration/default_level_settings.py (100%) rename {kdb-bot => bot}/src/modules/level/default-level.json (100%) rename {kdb-bot => bot}/src/modules/level/events/__init__.py (100%) rename {kdb-bot => bot}/src/modules/level/events/level_on_member_join_event.py (75%) rename {kdb-bot => bot}/src/modules/level/events/level_on_message_event.py (79%) rename {kdb-bot => bot}/src/modules/level/events/level_on_raw_reaction_add_event.py (88%) rename {kdb-bot => bot}/src/modules/level/events/level_on_raw_reaction_remove_event.py (88%) rename {kdb-bot => bot}/src/modules/level/events/level_on_voice_state_update_event.py (78%) rename {kdb-bot => bot}/src/modules/level/level.json (100%) rename {kdb-bot => bot}/src/modules/level/level_module.py (68%) rename {kdb-bot => bot}/src/modules/level/level_seeder.py (79%) rename {kdb-bot => bot}/src/modules/level/service/__init__.py (100%) rename {kdb-bot => bot}/src/modules/level/service/level_service.py (73%) rename {kdb-bot => bot}/src/modules/permission/__init__.py (100%) rename {kdb-bot => bot}/src/modules/permission/abc/__init__.py (100%) rename {kdb-bot => bot}/src/modules/permission/abc/permission_service_abc.py (100%) rename {kdb-bot => bot}/src/modules/permission/permission.json (100%) rename {kdb-bot => bot}/src/modules/permission/permission_module.py (78%) rename {kdb-bot => bot}/src/modules/permission/service/__init__.py (100%) rename {kdb-bot => bot}/src/modules/permission/service/permission_service.py (80%) rename {kdb-bot => bot}/src/modules/short_role_name/__init__.py (100%) rename {kdb-bot => bot}/src/modules/short_role_name/events/__init__.py (100%) rename {kdb-bot => bot}/src/modules/short_role_name/events/short_role_name_on_member_update_event.py (80%) rename {kdb-bot => bot}/src/modules/short_role_name/service/__init__.py (100%) rename {kdb-bot => bot}/src/modules/short_role_name/service/short_role_name_service.py (89%) rename {kdb-bot => bot}/src/modules/short_role_name/short-role-name.json (100%) rename {kdb-bot => bot}/src/modules/short_role_name/short_role_name_check_command.py (82%) rename {kdb-bot => bot}/src/modules/short_role_name/short_role_name_module.py (71%) rename {kdb-bot => bot}/src/modules/short_role_name/short_role_name_seeder.py (100%) rename {kdb-bot => bot}/src/modules/special_offers/__init__.py (100%) rename {kdb-bot => bot}/src/modules/special_offers/special-offers.json (100%) rename {kdb-bot => bot}/src/modules/special_offers/special_offers_module.py (77%) rename {kdb-bot => bot}/src/modules/special_offers/steam_offer_watcher.py (81%) rename {kdb-bot => bot}/src/modules/technician/__init__.py (100%) rename {kdb-bot => bot}/src/modules/technician/api_key_seeder.py (92%) rename {kdb-bot => bot}/src/modules/technician/command/__init__.py (100%) rename {kdb-bot => bot}/src/modules/technician/command/api_key_group.py (84%) rename {kdb-bot => bot}/src/modules/technician/command/log_command.py (96%) rename {kdb-bot => bot}/src/modules/technician/command/restart_command.py (94%) rename {kdb-bot => bot}/src/modules/technician/command/shutdown_command.py (94%) rename {kdb-bot => bot}/src/modules/technician/command/sync_xp_command.py (78%) rename {kdb-bot => bot}/src/modules/technician/technician.json (100%) rename {kdb-bot => bot}/src/modules/technician/technician_module.py (85%) rename {kdb-bot => bot}/tools/checks/UserJoinedVoiceChannel.json (100%) rename {kdb-bot => bot}/tools/checks/__init__.py (100%) rename {kdb-bot => bot}/tools/checks/checks.json (100%) rename {kdb-bot => bot}/tools/checks/get_ontime_overlaps.py (100%) rename {kdb-bot => bot}/tools/get_version/__init__.py (100%) rename {kdb-bot => bot}/tools/get_version/application.py (100%) rename {kdb-bot => bot}/tools/get_version/get-version.json (100%) rename {kdb-bot => bot}/tools/get_version/main.py (100%) rename {kdb-bot => bot}/tools/get_version/startup.py (78%) rename {kdb-bot => bot}/tools/post_build/__init__.py (100%) rename {kdb-bot => bot}/tools/post_build/application.py (100%) rename {kdb-bot => bot}/tools/post_build/appsettings.json (100%) rename {kdb-bot => bot}/tools/post_build/main.py (100%) rename {kdb-bot => bot}/tools/post_build/post-build.json (100%) rename {kdb-bot => bot}/tools/post_build/post_build_settings.py (73%) rename {kdb-bot => bot}/tools/post_build/service/__init__.py (100%) rename {kdb-bot => bot}/tools/post_build/service/dependencies.py (93%) rename {kdb-bot => bot}/tools/post_build/service/remove_config.py (100%) rename {kdb-bot => bot}/tools/post_build/startup.py (82%) rename {kdb-bot => bot}/tools/set_version/__init__.py (100%) rename {kdb-bot => bot}/tools/set_version/application.py (74%) rename {kdb-bot => bot}/tools/set_version/git_service.py (100%) rename {kdb-bot => bot}/tools/set_version/main.py (100%) rename {kdb-bot => bot}/tools/set_version/set-version.json (100%) rename {kdb-bot => bot}/tools/set_version/startup.py (82%) rename {kdb-bot => bot}/tools/set_version/version_setter_service.py (76%) delete mode 100644 kdb-bot/LICENSE delete mode 100644 kdb-bot/README.md delete mode 100644 kdb-bot/cpl-workspace.json delete mode 160000 kdb-bot/docker delete mode 100644 kdb-bot/dockerfile delete mode 100644 kdb-bot/pyproject.toml delete mode 160000 kdb-bot/src/bot/config delete mode 160000 kdb-bot/src/bot_api/config rename {kdb-web => web}/.browserslistrc (100%) rename {kdb-web => web}/.editorconfig (100%) rename {kdb-web => web}/.gitignore (100%) rename {kdb-web => web}/.prettierrc (100%) rename {kdb-web => web}/README.md (100%) rename {kdb-web => web}/angular.json (100%) rename {kdb-web => web}/dockerfile (100%) rename {kdb-web => web}/karma.conf.js (100%) rename {kdb-web => web}/nginx.conf.template (100%) rename {kdb-web => web}/package-lock.json (100%) rename {kdb-web => web}/package.json (100%) rename {kdb-web => web}/src/app/app-routing.module.ts (100%) rename {kdb-web => web}/src/app/app.component.html (100%) rename {kdb-web => web}/src/app/app.component.scss (100%) rename {kdb-web => web}/src/app/app.component.spec.ts (100%) rename {kdb-web => web}/src/app/app.component.ts (100%) rename {kdb-web => web}/src/app/app.module.ts (100%) rename {kdb-web => web}/src/app/base/component-with-table.spec.ts (100%) rename {kdb-web => web}/src/app/base/component-with-table.ts (100%) rename {kdb-web => web}/src/app/components/error/not-found/not-found.component.html (100%) rename {kdb-web => web}/src/app/components/error/not-found/not-found.component.scss (100%) rename {kdb-web => web}/src/app/components/error/not-found/not-found.component.spec.ts (100%) rename {kdb-web => web}/src/app/components/error/not-found/not-found.component.ts (100%) rename {kdb-web => web}/src/app/components/footer/footer.component.html (100%) rename {kdb-web => web}/src/app/components/footer/footer.component.scss (100%) rename {kdb-web => web}/src/app/components/footer/footer.component.spec.ts (100%) rename {kdb-web => web}/src/app/components/footer/footer.component.ts (100%) rename {kdb-web => web}/src/app/components/header/header.component.html (100%) rename {kdb-web => web}/src/app/components/header/header.component.scss (100%) rename {kdb-web => web}/src/app/components/header/header.component.spec.ts (100%) rename {kdb-web => web}/src/app/components/header/header.component.ts (100%) rename {kdb-web => web}/src/app/components/sidebar/sidebar.component.html (100%) rename {kdb-web => web}/src/app/components/sidebar/sidebar.component.scss (100%) rename {kdb-web => web}/src/app/components/sidebar/sidebar.component.spec.ts (100%) rename {kdb-web => web}/src/app/components/sidebar/sidebar.component.ts (100%) rename {kdb-web => web}/src/app/components/spinner/spinner.component.html (100%) rename {kdb-web => web}/src/app/components/spinner/spinner.component.scss (100%) rename {kdb-web => web}/src/app/components/spinner/spinner.component.spec.ts (100%) rename {kdb-web => web}/src/app/components/spinner/spinner.component.ts (100%) rename {kdb-web => web}/src/app/models/auth/admin-update-user.dto.ts (100%) rename {kdb-web => web}/src/app/models/auth/auth-error-messages.enum.ts (100%) rename {kdb-web => web}/src/app/models/auth/auth-roles.enum.ts (100%) rename {kdb-web => web}/src/app/models/auth/auth-user-atr-errors.ts (100%) rename {kdb-web => web}/src/app/models/auth/auth-user.dto.ts (100%) rename {kdb-web => web}/src/app/models/auth/discord-auth-url.dto.ts (100%) rename {kdb-web => web}/src/app/models/auth/email-string.dto.ts (100%) rename {kdb-web => web}/src/app/models/auth/oauth.dto.ts (100%) rename {kdb-web => web}/src/app/models/auth/register-error-messages.enum.ts (100%) rename {kdb-web => web}/src/app/models/auth/reset-password.dto.ts (100%) rename {kdb-web => web}/src/app/models/auth/token.dto.ts (100%) rename {kdb-web => web}/src/app/models/auth/update-user.dto.ts (100%) rename {kdb-web => web}/src/app/models/config/api-version.ts (100%) rename {kdb-web => web}/src/app/models/config/app-settings.ts (100%) rename {kdb-web => web}/src/app/models/config/feature-flags.model.ts (100%) rename {kdb-web => web}/src/app/models/config/server-config.model.ts (100%) rename {kdb-web => web}/src/app/models/config/settings.dto.ts (100%) rename {kdb-web => web}/src/app/models/config/software-version.dto.ts (100%) rename {kdb-web => web}/src/app/models/config/software-version.ts (100%) rename {kdb-web => web}/src/app/models/config/technician-config.model.ts (100%) rename {kdb-web => web}/src/app/models/data/achievement.model.ts (100%) rename {kdb-web => web}/src/app/models/data/auto_role.model.ts (100%) rename {kdb-web => web}/src/app/models/data/client.model.ts (100%) rename {kdb-web => web}/src/app/models/data/data.model.ts (100%) rename {kdb-web => web}/src/app/models/data/discord.model.ts (100%) rename {kdb-web => web}/src/app/models/data/level.model.ts (100%) rename {kdb-web => web}/src/app/models/data/server.model.ts (100%) rename {kdb-web => web}/src/app/models/data/short_role_name.model.ts (100%) rename {kdb-web => web}/src/app/models/data/user.model.ts (100%) rename {kdb-web => web}/src/app/models/data/user_joined_game_server.model.ts (100%) rename {kdb-web => web}/src/app/models/data/user_joined_server.model.ts (100%) rename {kdb-web => web}/src/app/models/data/user_joined_voice_channel.model.ts (100%) rename {kdb-web => web}/src/app/models/data/user_warning.model.ts (100%) rename {kdb-web => web}/src/app/models/error/error-dto.ts (100%) rename {kdb-web => web}/src/app/models/error/service-error-code.enum.ts (100%) rename {kdb-web => web}/src/app/models/graphql/filter/page.model.ts (100%) rename {kdb-web => web}/src/app/models/graphql/filter/sort.model.ts (100%) rename {kdb-web => web}/src/app/models/graphql/mutations.model.ts (100%) rename {kdb-web => web}/src/app/models/graphql/queries.model.ts (100%) rename {kdb-web => web}/src/app/models/graphql/query.model.ts (100%) rename {kdb-web => web}/src/app/models/graphql/result.model.ts (100%) rename {kdb-web => web}/src/app/models/graphql/variables.model.ts (100%) rename {kdb-web => web}/src/app/models/selection/auth-user/auth-user-select-criterion.dto.ts (100%) rename {kdb-web => web}/src/app/models/selection/auth-user/get-filtered-auth-users-result.dto.ts (100%) rename {kdb-web => web}/src/app/models/selection/select-criterion.model.ts (100%) rename {kdb-web => web}/src/app/models/utils/confirmation-dialog.ts (100%) rename {kdb-web => web}/src/app/models/utils/toast-options.ts (100%) rename {kdb-web => web}/src/app/models/view/theme.ts (100%) rename {kdb-web => web}/src/app/models/view/themes.enum.ts (100%) rename {kdb-web => web}/src/app/modules/admin/auth-users/auth-user-routing.module.ts (100%) rename {kdb-web => web}/src/app/modules/admin/auth-users/auth-user.module.ts (100%) rename {kdb-web => web}/src/app/modules/admin/auth-users/components/auth-user/auth-user.component.html (100%) rename {kdb-web => web}/src/app/modules/admin/auth-users/components/auth-user/auth-user.component.scss (100%) rename {kdb-web => web}/src/app/modules/admin/auth-users/components/auth-user/auth-user.component.spec.ts (100%) rename {kdb-web => web}/src/app/modules/admin/auth-users/components/auth-user/auth-user.component.ts (100%) rename {kdb-web => web}/src/app/modules/admin/settings/components/settings/settings.component.html (100%) rename {kdb-web => web}/src/app/modules/admin/settings/components/settings/settings.component.scss (100%) rename {kdb-web => web}/src/app/modules/admin/settings/components/settings/settings.component.spec.ts (100%) rename {kdb-web => web}/src/app/modules/admin/settings/components/settings/settings.component.ts (100%) rename {kdb-web => web}/src/app/modules/admin/settings/settings-routing.module.ts (100%) rename {kdb-web => web}/src/app/modules/admin/settings/settings.module.ts (100%) rename {kdb-web => web}/src/app/modules/auth/auth-routing.module.ts (100%) rename {kdb-web => web}/src/app/modules/auth/auth.module.ts (100%) rename {kdb-web => web}/src/app/modules/auth/components/auth-footer/auth-footer.component.html (100%) rename {kdb-web => web}/src/app/modules/auth/components/auth-footer/auth-footer.component.scss (100%) rename {kdb-web => web}/src/app/modules/auth/components/auth-footer/auth-footer.component.spec.ts (100%) rename {kdb-web => web}/src/app/modules/auth/components/auth-footer/auth-footer.component.ts (100%) rename {kdb-web => web}/src/app/modules/auth/components/auth-header/auth-header.component.html (100%) rename {kdb-web => web}/src/app/modules/auth/components/auth-header/auth-header.component.scss (100%) rename {kdb-web => web}/src/app/modules/auth/components/auth-header/auth-header.component.spec.ts (100%) rename {kdb-web => web}/src/app/modules/auth/components/auth-header/auth-header.component.ts (100%) rename {kdb-web => web}/src/app/modules/auth/components/forget-password/forget-password.component.html (100%) rename {kdb-web => web}/src/app/modules/auth/components/forget-password/forget-password.component.scss (100%) rename {kdb-web => web}/src/app/modules/auth/components/forget-password/forget-password.component.spec.ts (100%) rename {kdb-web => web}/src/app/modules/auth/components/forget-password/forget-password.component.ts (100%) rename {kdb-web => web}/src/app/modules/auth/components/login/login.component.html (100%) rename {kdb-web => web}/src/app/modules/auth/components/login/login.component.scss (100%) rename {kdb-web => web}/src/app/modules/auth/components/login/login.component.spec.ts (100%) rename {kdb-web => web}/src/app/modules/auth/components/login/login.component.ts (100%) rename {kdb-web => web}/src/app/modules/auth/components/registration/registration.component.html (100%) rename {kdb-web => web}/src/app/modules/auth/components/registration/registration.component.scss (100%) rename {kdb-web => web}/src/app/modules/auth/components/registration/registration.component.spec.ts (100%) rename {kdb-web => web}/src/app/modules/auth/components/registration/registration.component.ts (100%) rename {kdb-web => web}/src/app/modules/shared/base/hideable-component.spec.ts (100%) rename {kdb-web => web}/src/app/modules/shared/base/hideable-component.ts (100%) rename {kdb-web => web}/src/app/modules/shared/base/multi-select-columns/multi-select-columns.component.html (100%) rename {kdb-web => web}/src/app/modules/shared/base/multi-select-columns/multi-select-columns.component.scss (100%) rename {kdb-web => web}/src/app/modules/shared/base/multi-select-columns/multi-select-columns.component.spec.ts (100%) rename {kdb-web => web}/src/app/modules/shared/base/multi-select-columns/multi-select-columns.component.ts (100%) rename {kdb-web => web}/src/app/modules/shared/components/config-list/config-list.component.html (100%) rename {kdb-web => web}/src/app/modules/shared/components/config-list/config-list.component.scss (100%) rename {kdb-web => web}/src/app/modules/shared/components/config-list/config-list.component.spec.ts (100%) rename {kdb-web => web}/src/app/modules/shared/components/config-list/config-list.component.ts (100%) rename {kdb-web => web}/src/app/modules/shared/components/feature-flag-list/feature-flag-list.component.html (100%) rename {kdb-web => web}/src/app/modules/shared/components/feature-flag-list/feature-flag-list.component.scss (100%) rename {kdb-web => web}/src/app/modules/shared/components/feature-flag-list/feature-flag-list.component.spec.ts (100%) rename {kdb-web => web}/src/app/modules/shared/components/feature-flag-list/feature-flag-list.component.ts (100%) rename {kdb-web => web}/src/app/modules/shared/components/hideable-column/hideable-column.component.html (100%) rename {kdb-web => web}/src/app/modules/shared/components/hideable-column/hideable-column.component.scss (100%) rename {kdb-web => web}/src/app/modules/shared/components/hideable-column/hideable-column.component.spec.ts (100%) rename {kdb-web => web}/src/app/modules/shared/components/hideable-column/hideable-column.component.ts (100%) rename {kdb-web => web}/src/app/modules/shared/components/hideable-header/hideable-header.component.html (100%) rename {kdb-web => web}/src/app/modules/shared/components/hideable-header/hideable-header.component.scss (100%) rename {kdb-web => web}/src/app/modules/shared/components/hideable-header/hideable-header.component.spec.ts (100%) rename {kdb-web => web}/src/app/modules/shared/components/hideable-header/hideable-header.component.ts (100%) rename {kdb-web => web}/src/app/modules/shared/components/history-btn/history-btn.component.html (100%) rename {kdb-web => web}/src/app/modules/shared/components/history-btn/history-btn.component.scss (100%) rename {kdb-web => web}/src/app/modules/shared/components/history-btn/history-btn.component.spec.ts (100%) rename {kdb-web => web}/src/app/modules/shared/components/history-btn/history-btn.component.ts (100%) rename {kdb-web => web}/src/app/modules/shared/guards/auth/auth.guard.spec.ts (100%) rename {kdb-web => web}/src/app/modules/shared/guards/auth/auth.guard.ts (100%) rename {kdb-web => web}/src/app/modules/shared/pipes/auth-role.pipe.ts (100%) rename {kdb-web => web}/src/app/modules/shared/pipes/bool.pipe.spec.ts (100%) rename {kdb-web => web}/src/app/modules/shared/pipes/bool.pipe.ts (100%) rename {kdb-web => web}/src/app/modules/shared/pipes/ip-address.pipe.ts (100%) rename {kdb-web => web}/src/app/modules/shared/shared.module.ts (100%) rename {kdb-web => web}/src/app/modules/view/change-password/change-password-routing.module.ts (100%) rename {kdb-web => web}/src/app/modules/view/change-password/change-password.module.ts (100%) rename {kdb-web => web}/src/app/modules/view/change-password/components/change-password/change-password.component.html (100%) rename {kdb-web => web}/src/app/modules/view/change-password/components/change-password/change-password.component.scss (100%) rename {kdb-web => web}/src/app/modules/view/change-password/components/change-password/change-password.component.spec.ts (100%) rename {kdb-web => web}/src/app/modules/view/change-password/components/change-password/change-password.component.ts (100%) rename {kdb-web => web}/src/app/modules/view/dashboard/components/dashboard/dashboard.component.html (100%) rename {kdb-web => web}/src/app/modules/view/dashboard/components/dashboard/dashboard.component.scss (100%) rename {kdb-web => web}/src/app/modules/view/dashboard/components/dashboard/dashboard.component.spec.ts (100%) rename {kdb-web => web}/src/app/modules/view/dashboard/components/dashboard/dashboard.component.ts (100%) rename {kdb-web => web}/src/app/modules/view/dashboard/dashboard-routing.module.ts (100%) rename {kdb-web => web}/src/app/modules/view/dashboard/dashboard.module.ts (100%) rename {kdb-web => web}/src/app/modules/view/server/achievements/achievements-routing.module.ts (100%) rename {kdb-web => web}/src/app/modules/view/server/achievements/achievements.module.ts (100%) rename {kdb-web => web}/src/app/modules/view/server/achievements/components/achievement/achievement.component.html (100%) rename {kdb-web => web}/src/app/modules/view/server/achievements/components/achievement/achievement.component.scss (100%) rename {kdb-web => web}/src/app/modules/view/server/achievements/components/achievement/achievement.component.spec.ts (100%) rename {kdb-web => web}/src/app/modules/view/server/achievements/components/achievement/achievement.component.ts (100%) rename {kdb-web => web}/src/app/modules/view/server/auto-role/auto-role-routing.module.ts (100%) rename {kdb-web => web}/src/app/modules/view/server/auto-role/auto-role.module.ts (100%) rename {kdb-web => web}/src/app/modules/view/server/auto-role/components/auto-roles-rules/auto-roles-rules.component.html (100%) rename {kdb-web => web}/src/app/modules/view/server/auto-role/components/auto-roles-rules/auto-roles-rules.component.scss (100%) rename {kdb-web => web}/src/app/modules/view/server/auto-role/components/auto-roles-rules/auto-roles-rules.component.spec.ts (100%) rename {kdb-web => web}/src/app/modules/view/server/auto-role/components/auto-roles-rules/auto-roles-rules.component.ts (100%) rename {kdb-web => web}/src/app/modules/view/server/auto-role/components/auto-roles/auto-roles.component.html (100%) rename {kdb-web => web}/src/app/modules/view/server/auto-role/components/auto-roles/auto-roles.component.scss (100%) rename {kdb-web => web}/src/app/modules/view/server/auto-role/components/auto-roles/auto-roles.component.spec.ts (100%) rename {kdb-web => web}/src/app/modules/view/server/auto-role/components/auto-roles/auto-roles.component.ts (100%) rename {kdb-web => web}/src/app/modules/view/server/config/components/config/config.component.html (100%) rename {kdb-web => web}/src/app/modules/view/server/config/components/config/config.component.scss (100%) rename {kdb-web => web}/src/app/modules/view/server/config/components/config/config.component.spec.ts (100%) rename {kdb-web => web}/src/app/modules/view/server/config/components/config/config.component.ts (100%) rename {kdb-web => web}/src/app/modules/view/server/config/config-routing.module.ts (100%) rename {kdb-web => web}/src/app/modules/view/server/config/config.module.ts (100%) rename {kdb-web => web}/src/app/modules/view/server/levels/components/levels/levels.component.html (100%) rename {kdb-web => web}/src/app/modules/view/server/levels/components/levels/levels.component.scss (100%) rename {kdb-web => web}/src/app/modules/view/server/levels/components/levels/levels.component.spec.ts (100%) rename {kdb-web => web}/src/app/modules/view/server/levels/components/levels/levels.component.ts (100%) rename {kdb-web => web}/src/app/modules/view/server/levels/levels-routing.module.ts (100%) rename {kdb-web => web}/src/app/modules/view/server/levels/levels.module.ts (100%) rename {kdb-web => web}/src/app/modules/view/server/members/members.component.html (100%) rename {kdb-web => web}/src/app/modules/view/server/members/members.component.scss (100%) rename {kdb-web => web}/src/app/modules/view/server/members/members.component.spec.ts (100%) rename {kdb-web => web}/src/app/modules/view/server/members/members.component.ts (100%) rename {kdb-web => web}/src/app/modules/view/server/profile/profile.component.html (100%) rename {kdb-web => web}/src/app/modules/view/server/profile/profile.component.scss (100%) rename {kdb-web => web}/src/app/modules/view/server/profile/profile.component.spec.ts (100%) rename {kdb-web => web}/src/app/modules/view/server/profile/profile.component.ts (100%) rename {kdb-web => web}/src/app/modules/view/server/server-dashboard/components/client/client.component.html (100%) rename {kdb-web => web}/src/app/modules/view/server/server-dashboard/components/client/client.component.scss (100%) rename {kdb-web => web}/src/app/modules/view/server/server-dashboard/components/client/client.component.spec.ts (100%) rename {kdb-web => web}/src/app/modules/view/server/server-dashboard/components/client/client.component.ts (100%) rename {kdb-web => web}/src/app/modules/view/server/server-dashboard/server-dashboard.component.html (100%) rename {kdb-web => web}/src/app/modules/view/server/server-dashboard/server-dashboard.component.scss (100%) rename {kdb-web => web}/src/app/modules/view/server/server-dashboard/server-dashboard.component.spec.ts (100%) rename {kdb-web => web}/src/app/modules/view/server/server-dashboard/server-dashboard.component.ts (100%) rename {kdb-web => web}/src/app/modules/view/server/server-routing.module.ts (100%) rename {kdb-web => web}/src/app/modules/view/server/server.module.ts (100%) rename {kdb-web => web}/src/app/modules/view/server/short-role-name/components/short-role-names/short-role-names.component.html (100%) rename {kdb-web => web}/src/app/modules/view/server/short-role-name/components/short-role-names/short-role-names.component.scss (100%) rename {kdb-web => web}/src/app/modules/view/server/short-role-name/components/short-role-names/short-role-names.component.spec.ts (100%) rename {kdb-web => web}/src/app/modules/view/server/short-role-name/components/short-role-names/short-role-names.component.ts (100%) rename {kdb-web => web}/src/app/modules/view/server/short-role-name/short-role-name-routing.module.ts (100%) rename {kdb-web => web}/src/app/modules/view/server/short-role-name/short-role-name.module.ts (100%) rename {kdb-web => web}/src/app/modules/view/user-settings/components/user-settings/user-settings.component.html (100%) rename {kdb-web => web}/src/app/modules/view/user-settings/components/user-settings/user-settings.component.scss (100%) rename {kdb-web => web}/src/app/modules/view/user-settings/components/user-settings/user-settings.component.spec.ts (100%) rename {kdb-web => web}/src/app/modules/view/user-settings/components/user-settings/user-settings.component.ts (100%) rename {kdb-web => web}/src/app/modules/view/user-settings/user-settings-routing.module.ts (100%) rename {kdb-web => web}/src/app/modules/view/user-settings/user-settings.module.ts (100%) rename {kdb-web => web}/src/app/services/auth/auth.service.spec.ts (100%) rename {kdb-web => web}/src/app/services/auth/auth.service.ts (100%) rename {kdb-web => web}/src/app/services/confirmation-dialog/confirmation-dialog.service.spec.ts (100%) rename {kdb-web => web}/src/app/services/confirmation-dialog/confirmation-dialog.service.ts (100%) rename {kdb-web => web}/src/app/services/data/data.service.spec.ts (100%) rename {kdb-web => web}/src/app/services/data/data.service.ts (100%) rename {kdb-web => web}/src/app/services/error-handler/error-handler.service.spec.ts (100%) rename {kdb-web => web}/src/app/services/error-handler/error-handler.service.ts (100%) rename {kdb-web => web}/src/app/services/gui/gui.service.spec.ts (100%) rename {kdb-web => web}/src/app/services/gui/gui.service.ts (100%) rename {kdb-web => web}/src/app/services/server.service.spec.ts (100%) rename {kdb-web => web}/src/app/services/server.service.ts (100%) rename {kdb-web => web}/src/app/services/settings/settings.service.spec.ts (100%) rename {kdb-web => web}/src/app/services/settings/settings.service.ts (100%) rename {kdb-web => web}/src/app/services/sidebar/sidebar.service.spec.ts (100%) rename {kdb-web => web}/src/app/services/sidebar/sidebar.service.ts (100%) rename {kdb-web => web}/src/app/services/socket/socket.service.spec.ts (100%) rename {kdb-web => web}/src/app/services/socket/socket.service.ts (100%) rename {kdb-web => web}/src/app/services/spinner/spinner.service.spec.ts (100%) rename {kdb-web => web}/src/app/services/spinner/spinner.service.ts (100%) rename {kdb-web => web}/src/app/services/theme/theme.service.spec.ts (100%) rename {kdb-web => web}/src/app/services/theme/theme.service.ts (100%) rename {kdb-web => web}/src/app/services/toast/toast.service.spec.ts (100%) rename {kdb-web => web}/src/app/services/toast/toast.service.ts (100%) rename {kdb-web => web}/src/assets/config.json (100%) rename {kdb-web => web}/src/assets/i18n/de.json (100%) rename {kdb-web => web}/src/assets/i18n/en.json (100%) rename {kdb-web => web}/src/assets/images/favicon.ico (100%) rename {kdb-web => web}/src/assets/version.json (100%) rename {kdb-web => web}/src/environments/environment.development.ts (100%) rename {kdb-web => web}/src/environments/environment.prod.ts (100%) rename {kdb-web => web}/src/environments/environment.staging.ts (100%) rename {kdb-web => web}/src/environments/environment.ts (100%) rename {kdb-web => web}/src/favicon.ico (100%) rename {kdb-web => web}/src/index.html (100%) rename {kdb-web => web}/src/main.ts (100%) rename {kdb-web => web}/src/polyfills.ts (100%) rename {kdb-web => web}/src/styles.scss (100%) rename {kdb-web => web}/src/styles/constants.scss (100%) rename {kdb-web => web}/src/styles/primeng-fixes.scss (100%) rename {kdb-web => web}/src/styles/themes/default-dark-theme.scss (100%) rename {kdb-web => web}/src/styles/themes/default-light-theme.scss (100%) rename {kdb-web => web}/src/styles/themes/sh-edraft-dark-theme.scss (100%) rename {kdb-web => web}/src/styles/themes/sh-edraft-light-theme.scss (100%) rename {kdb-web => web}/src/test.ts (100%) rename {kdb-web => web}/tsconfig.app.json (100%) rename {kdb-web => web}/tsconfig.json (100%) rename {kdb-web => web}/tsconfig.spec.json (100%) rename {kdb-web => web}/update-version.ts (100%) diff --git a/.gitmodules b/.gitmodules index ca793c6c..ac5bd60d 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,9 +1,9 @@ -[submodule "kdb-bot/src/bot/config"] - path = kdb-bot/src/bot/config - url = https://git.sh-edraft.de/sh-edraft.de/kd_discord_bot.config.git -[submodule "kdb-bot/src/bot_api/config"] - path = kdb-bot/src/bot_api/config - url = https://git.sh-edraft.de/sh-edraft.de/kd_discord_bot.api.config.git -[submodule "kdb-bot/docker"] - path = kdb-bot/docker - url = https://git.sh-edraft.de/sh-edraft.de/kd_discord_bot.docker.git +[submodule "shd-bot/src/bot/config"] + path = shd-bot/src/bot/config + url = https://git.sh-edraft.de/sh-edraft.de/sh_discord_bot.config.git +[submodule "shb-bot/src/bot_api/config"] + path = shb-bot/src/bot_api/config + url = https://git.sh-edraft.de/sh-edraft.de/sh_discord_bot.api.config.git +[submodule "shb-bot/bot/docker"] + path = shb-bot/bot/docker + url = https://git.sh-edraft.de/sh-edraft.de/sh_discord_bot.docker.git diff --git a/kdb-bot/.cpl/schematic_db_table.py b/bot/.cpl/schematic_db_table.py similarity index 100% rename from kdb-bot/.cpl/schematic_db_table.py rename to bot/.cpl/schematic_db_table.py diff --git a/kdb-bot/.cpl/schematic_migration.py b/bot/.cpl/schematic_migration.py similarity index 100% rename from kdb-bot/.cpl/schematic_migration.py rename to bot/.cpl/schematic_migration.py diff --git a/kdb-bot/.cpl/schematic_query.py b/bot/.cpl/schematic_query.py similarity index 100% rename from kdb-bot/.cpl/schematic_query.py rename to bot/.cpl/schematic_query.py diff --git a/kdb-bot/src/bot/__init__.py b/bot/src/bot/__init__.py similarity index 100% rename from kdb-bot/src/bot/__init__.py rename to bot/src/bot/__init__.py diff --git a/kdb-bot/src/bot/application.py b/bot/src/bot/application.py similarity index 87% rename from kdb-bot/src/bot/application.py rename to bot/src/bot/application.py index 6d1e4dd9..4d57ff59 100644 --- a/kdb-bot/src/bot/application.py +++ b/bot/src/bot/application.py @@ -23,17 +23,25 @@ class Application(DiscordBotApplicationABC): # cpl-core self._logger: LoggerABC = services.get_service(LoggerABC) - self._data_integrity: DataIntegrityService = services.get_service(DataIntegrityService) + self._data_integrity: DataIntegrityService = services.get_service( + DataIntegrityService + ) # cpl-discord self._bot: DiscordBotServiceABC = services.get_service(DiscordBotServiceABC) - self._bot_settings: DiscordBotSettings = config.get_configuration(DiscordBotSettings) + self._bot_settings: DiscordBotSettings = config.get_configuration( + DiscordBotSettings + ) # cpl-translation - self._translation: TranslationServiceABC = services.get_service(TranslationServiceABC) + self._translation: TranslationServiceABC = services.get_service( + TranslationServiceABC + ) self._t: TranslatePipe = services.get_service(TranslatePipe) # internal stuff self._tasks = services.get_services(TaskABC) - self._feature_flags: FeatureFlagsSettings = config.get_configuration(FeatureFlagsSettings) + self._feature_flags: FeatureFlagsSettings = config.get_configuration( + FeatureFlagsSettings + ) # api if self._feature_flags.get_flag(FeatureFlagsEnum.api_module): @@ -42,7 +50,9 @@ class Application(DiscordBotApplicationABC): self._is_stopping = False async def configure(self): - self._translation.load_by_settings(self._configuration.get_configuration(TranslationSettings)) + self._translation.load_by_settings( + self._configuration.get_configuration(TranslationSettings) + ) async def main(self): try: @@ -85,4 +95,8 @@ class Application(DiscordBotApplicationABC): Console.write_line() def is_restart(self): - return True if self._configuration.get_configuration("IS_RESTART") == "true" else False + return ( + True + if self._configuration.get_configuration("IS_RESTART") == "true" + else False + ) diff --git a/kdb-bot/src/bot/bot b/bot/src/bot/bot similarity index 100% rename from kdb-bot/src/bot/bot rename to bot/src/bot/bot diff --git a/kdb-bot/src/bot/bot.json b/bot/src/bot/bot.json similarity index 100% rename from kdb-bot/src/bot/bot.json rename to bot/src/bot/bot.json diff --git a/kdb-bot/src/bot/extension/__init__.py b/bot/src/bot/extension/__init__.py similarity index 100% rename from kdb-bot/src/bot/extension/__init__.py rename to bot/src/bot/extension/__init__.py diff --git a/kdb-bot/src/bot/extension/init_bot_extension.py b/bot/src/bot/extension/init_bot_extension.py similarity index 79% rename from kdb-bot/src/bot/extension/init_bot_extension.py rename to bot/src/bot/extension/init_bot_extension.py index 04a4fcf0..c0a2feef 100644 --- a/kdb-bot/src/bot/extension/init_bot_extension.py +++ b/bot/src/bot/extension/init_bot_extension.py @@ -13,4 +13,6 @@ class InitBotExtension(ApplicationExtensionABC): async def run(self, config: ConfigurationABC, services: ServiceProviderABC): settings = config.get_configuration(TechnicianConfig) - bot: DiscordBotServiceABC = services.get_service(DiscordBotServiceABC, max_messages=settings.cache_max_messages) + bot: DiscordBotServiceABC = services.get_service( + DiscordBotServiceABC, max_messages=settings.cache_max_messages + ) diff --git a/kdb-bot/src/bot/main.py b/bot/src/bot/main.py similarity index 100% rename from kdb-bot/src/bot/main.py rename to bot/src/bot/main.py diff --git a/kdb-bot/src/bot/module_list.py b/bot/src/bot/module_list.py similarity index 100% rename from kdb-bot/src/bot/module_list.py rename to bot/src/bot/module_list.py diff --git a/kdb-bot/src/bot/startup.py b/bot/src/bot/startup.py similarity index 95% rename from kdb-bot/src/bot/startup.py rename to bot/src/bot/startup.py index 0a5422d2..8e52249f 100644 --- a/kdb-bot/src/bot/startup.py +++ b/bot/src/bot/startup.py @@ -50,7 +50,9 @@ class Startup(StartupABC): services.add_singleton(CustomFileLoggerABC, ApiLogger) services.add_translation() - services.add_db_context(DBContext, self._config.get_configuration(DatabaseSettings)) + services.add_db_context( + DBContext, self._config.get_configuration(DatabaseSettings) + ) provider = services.build_service_provider() # instantiate custom logger diff --git a/kdb-bot/src/bot/startup_discord_extension.py b/bot/src/bot/startup_discord_extension.py similarity index 67% rename from kdb-bot/src/bot/startup_discord_extension.py rename to bot/src/bot/startup_discord_extension.py index 196017dc..73411881 100644 --- a/kdb-bot/src/bot/startup_discord_extension.py +++ b/bot/src/bot/startup_discord_extension.py @@ -9,9 +9,13 @@ class StartupDiscordExtension(StartupExtensionABC): def __init__(self): pass - def configure_configuration(self, config: ConfigurationABC, env: ApplicationEnvironmentABC): + def configure_configuration( + self, config: ConfigurationABC, env: ApplicationEnvironmentABC + ): pass - def configure_services(self, services: ServiceCollectionABC, env: ApplicationEnvironmentABC): + def configure_services( + self, services: ServiceCollectionABC, env: ApplicationEnvironmentABC + ): services.add_discord() dcc = get_discord_collection(services) diff --git a/kdb-bot/src/bot/startup_migration_extension.py b/bot/src/bot/startup_migration_extension.py similarity index 52% rename from kdb-bot/src/bot/startup_migration_extension.py rename to bot/src/bot/startup_migration_extension.py index bef5cd4d..a874e2f4 100644 --- a/kdb-bot/src/bot/startup_migration_extension.py +++ b/bot/src/bot/startup_migration_extension.py @@ -10,7 +10,9 @@ from bot_data.migration.api_migration import ApiMigration from bot_data.migration.auto_role_fix1_migration import AutoRoleFix1Migration from bot_data.migration.auto_role_migration import AutoRoleMigration from bot_data.migration.birthday_migration import BirthdayMigration -from bot_data.migration.config_feature_flags_migration import ConfigFeatureFlagsMigration +from bot_data.migration.config_feature_flags_migration import ( + ConfigFeatureFlagsMigration, +) from bot_data.migration.config_migration import ConfigMigration from bot_data.migration.db_history_migration import DBHistoryMigration from bot_data.migration.default_role_migration import DefaultRoleMigration @@ -20,10 +22,14 @@ from bot_data.migration.initial_migration import InitialMigration from bot_data.migration.level_migration import LevelMigration from bot_data.migration.remove_stats_migration import RemoveStatsMigration from bot_data.migration.short_role_name_migration import ShortRoleNameMigration -from bot_data.migration.short_role_name_only_highest_migration import ShortRoleNameOnlyHighestMigration +from bot_data.migration.short_role_name_only_highest_migration import ( + ShortRoleNameOnlyHighestMigration, +) from bot_data.migration.stats_migration import StatsMigration from bot_data.migration.steam_special_offer_migration import SteamSpecialOfferMigration -from bot_data.migration.user_joined_game_server_migration import UserJoinedGameServerMigration +from bot_data.migration.user_joined_game_server_migration import ( + UserJoinedGameServerMigration, +) from bot_data.migration.user_message_count_per_hour_migration import ( UserMessageCountPerHourMigration, ) @@ -35,30 +41,66 @@ class StartupMigrationExtension(StartupExtensionABC): def __init__(self): pass - def configure_configuration(self, config: ConfigurationABC, env: ApplicationEnvironmentABC): + def configure_configuration( + self, config: ConfigurationABC, env: ApplicationEnvironmentABC + ): pass - def configure_services(self, services: ServiceCollectionABC, env: ApplicationEnvironmentABC): + def configure_services( + self, services: ServiceCollectionABC, env: ApplicationEnvironmentABC + ): services.add_transient(MigrationService) services.add_transient(MigrationABC, InitialMigration) - services.add_transient(MigrationABC, AutoRoleMigration) # 03.10.2022 #54 - 0.2.2 + services.add_transient( + MigrationABC, AutoRoleMigration + ) # 03.10.2022 #54 - 0.2.2 services.add_transient(MigrationABC, ApiMigration) # 15.10.2022 #70 - 0.3.0 services.add_transient(MigrationABC, LevelMigration) # 06.11.2022 #25 - 0.3.0 services.add_transient(MigrationABC, StatsMigration) # 09.11.2022 #46 - 0.3.0 - services.add_transient(MigrationABC, AutoRoleFix1Migration) # 30.12.2022 #151 - 0.3.0 - services.add_transient(MigrationABC, UserMessageCountPerHourMigration) # 11.01.2023 #168 - 0.3.1 + services.add_transient( + MigrationABC, AutoRoleFix1Migration + ) # 30.12.2022 #151 - 0.3.0 + services.add_transient( + MigrationABC, UserMessageCountPerHourMigration + ) # 11.01.2023 #168 - 0.3.1 services.add_transient(MigrationABC, ApiKeyMigration) # 09.02.2023 #162 - 1.0.0 - services.add_transient(MigrationABC, UserJoinedGameServerMigration) # 12.02.2023 #181 - 1.0.0 - services.add_transient(MigrationABC, RemoveStatsMigration) # 19.02.2023 #190 - 1.0.0 - services.add_transient(MigrationABC, UserWarningMigration) # 21.02.2023 #35 - 1.0.0 - services.add_transient(MigrationABC, DBHistoryMigration) # 06.03.2023 #246 - 1.0.0 - services.add_transient(MigrationABC, AchievementsMigration) # 14.06.2023 #268 - 1.1.0 + services.add_transient( + MigrationABC, UserJoinedGameServerMigration + ) # 12.02.2023 #181 - 1.0.0 + services.add_transient( + MigrationABC, RemoveStatsMigration + ) # 19.02.2023 #190 - 1.0.0 + services.add_transient( + MigrationABC, UserWarningMigration + ) # 21.02.2023 #35 - 1.0.0 + services.add_transient( + MigrationABC, DBHistoryMigration + ) # 06.03.2023 #246 - 1.0.0 + services.add_transient( + MigrationABC, AchievementsMigration + ) # 14.06.2023 #268 - 1.1.0 services.add_transient(MigrationABC, ConfigMigration) # 19.07.2023 #127 - 1.1.0 - services.add_transient(MigrationABC, ConfigFeatureFlagsMigration) # 15.08.2023 #334 - 1.1.0 - services.add_transient(MigrationABC, DefaultRoleMigration) # 24.09.2023 #360 - 1.1.3 - services.add_transient(MigrationABC, ShortRoleNameMigration) # 28.09.2023 #378 - 1.1.7 - services.add_transient(MigrationABC, FixUpdatesMigration) # 28.09.2023 #378 - 1.1.7 - services.add_transient(MigrationABC, ShortRoleNameOnlyHighestMigration) # 02.10.2023 #391 - 1.1.9 - services.add_transient(MigrationABC, FixUserHistoryMigration) # 10.10.2023 #401 - 1.2.0 - services.add_transient(MigrationABC, BirthdayMigration) # 10.10.2023 #401 - 1.2.0 - services.add_transient(MigrationABC, SteamSpecialOfferMigration) # 10.10.2023 #188 - 1.2.0 + services.add_transient( + MigrationABC, ConfigFeatureFlagsMigration + ) # 15.08.2023 #334 - 1.1.0 + services.add_transient( + MigrationABC, DefaultRoleMigration + ) # 24.09.2023 #360 - 1.1.3 + services.add_transient( + MigrationABC, ShortRoleNameMigration + ) # 28.09.2023 #378 - 1.1.7 + services.add_transient( + MigrationABC, FixUpdatesMigration + ) # 28.09.2023 #378 - 1.1.7 + services.add_transient( + MigrationABC, ShortRoleNameOnlyHighestMigration + ) # 02.10.2023 #391 - 1.1.9 + services.add_transient( + MigrationABC, FixUserHistoryMigration + ) # 10.10.2023 #401 - 1.2.0 + services.add_transient( + MigrationABC, BirthdayMigration + ) # 10.10.2023 #401 - 1.2.0 + services.add_transient( + MigrationABC, SteamSpecialOfferMigration + ) # 10.10.2023 #188 - 1.2.0 diff --git a/kdb-bot/src/bot/startup_module_extension.py b/bot/src/bot/startup_module_extension.py similarity index 86% rename from kdb-bot/src/bot/startup_module_extension.py rename to bot/src/bot/startup_module_extension.py index 2d87319d..c3f1789e 100644 --- a/kdb-bot/src/bot/startup_module_extension.py +++ b/bot/src/bot/startup_module_extension.py @@ -18,11 +18,15 @@ class StartupModuleExtension(StartupExtensionABC): self._modules = ModuleList.get_modules() - def configure_configuration(self, config: ConfigurationABC, env: ApplicationEnvironmentABC): + def configure_configuration( + self, config: ConfigurationABC, env: ApplicationEnvironmentABC + ): self._config = config self._feature_flags = config.get_configuration(FeatureFlagsSettings) - def configure_services(self, services: ServiceCollectionABC, env: ApplicationEnvironmentABC): + def configure_services( + self, services: ServiceCollectionABC, env: ApplicationEnvironmentABC + ): provider = services.build_service_provider() dc_collection: DiscordCollectionABC = provider.get_service(DiscordCollectionABC) diff --git a/kdb-bot/src/bot/startup_settings_extension.py b/bot/src/bot/startup_settings_extension.py similarity index 64% rename from kdb-bot/src/bot/startup_settings_extension.py rename to bot/src/bot/startup_settings_extension.py index caf34f19..ad45ee9b 100644 --- a/kdb-bot/src/bot/startup_settings_extension.py +++ b/bot/src/bot/startup_settings_extension.py @@ -14,26 +14,38 @@ class StartupSettingsExtension(StartupExtensionABC): def __init__(self): self._start_time = datetime.now() - def configure_configuration(self, configuration: ConfigurationABC, environment: ApplicationEnvironmentABC): + def configure_configuration( + self, configuration: ConfigurationABC, environment: ApplicationEnvironmentABC + ): # this shit has to be done here because we need settings in subsequent startup extensions environment.set_working_directory(os.path.dirname(os.path.realpath(__file__))) configuration.add_environment_variables("KDB_") configuration.add_environment_variables("DISCORD_") configuration.add_json_file(f"config/appsettings.json", optional=False) - configuration.add_json_file(f"config/appsettings.{environment.environment_name}.json", optional=True) - configuration.add_json_file(f"config/appsettings.{environment.host_name}.json", optional=True) + configuration.add_json_file( + f"config/appsettings.{environment.environment_name}.json", optional=True + ) + configuration.add_json_file( + f"config/appsettings.{environment.host_name}.json", optional=True + ) # load feature-flags configuration.add_json_file(f"config/feature-flags.json", optional=False) - configuration.add_json_file(f"config/feature-flags.{environment.environment_name}.json", optional=True) - configuration.add_json_file(f"config/feature-flags.{environment.host_name}.json", optional=True) + configuration.add_json_file( + f"config/feature-flags.{environment.environment_name}.json", optional=True + ) + configuration.add_json_file( + f"config/feature-flags.{environment.host_name}.json", optional=True + ) configuration.add_configuration("Startup_StartTime", str(self._start_time)) self._configure_settings_with_sub_settings( configuration, BotLoggingSettings, lambda x: x.files, lambda x: x.key ) - def configure_services(self, services: ServiceCollectionABC, env: ApplicationEnvironmentABC): + def configure_services( + self, services: ServiceCollectionABC, env: ApplicationEnvironmentABC + ): pass @staticmethod @@ -45,4 +57,6 @@ class StartupSettingsExtension(StartupExtensionABC): return for sub_settings in list_atr(settings): - config.add_configuration(f"{type(sub_settings).__name__}_{atr(sub_settings)}", sub_settings) + config.add_configuration( + f"{type(sub_settings).__name__}_{atr(sub_settings)}", sub_settings + ) diff --git a/kdb-bot/src/bot/translation/de.json b/bot/src/bot/translation/de.json similarity index 100% rename from kdb-bot/src/bot/translation/de.json rename to bot/src/bot/translation/de.json diff --git a/kdb-bot/src/bot_api/__init__.py b/bot/src/bot_api/__init__.py similarity index 100% rename from kdb-bot/src/bot_api/__init__.py rename to bot/src/bot_api/__init__.py diff --git a/kdb-bot/src/bot_api/abc/__init__.py b/bot/src/bot_api/abc/__init__.py similarity index 100% rename from kdb-bot/src/bot_api/abc/__init__.py rename to bot/src/bot_api/abc/__init__.py diff --git a/kdb-bot/src/bot_api/abc/auth_service_abc.py b/bot/src/bot_api/abc/auth_service_abc.py similarity index 92% rename from kdb-bot/src/bot_api/abc/auth_service_abc.py rename to bot/src/bot_api/abc/auth_service_abc.py index 1ba5fbbb..812b3c30 100644 --- a/kdb-bot/src/bot_api/abc/auth_service_abc.py +++ b/bot/src/bot_api/abc/auth_service_abc.py @@ -40,11 +40,15 @@ class AuthServiceABC(ABC): pass @abstractmethod - async def get_filtered_auth_users_async(self, criteria: AuthUserSelectCriteria) -> AuthUserFilteredResultDTO: + async def get_filtered_auth_users_async( + self, criteria: AuthUserSelectCriteria + ) -> AuthUserFilteredResultDTO: pass @abstractmethod - async def get_auth_user_by_email_async(self, email: str, with_password: bool = False) -> AuthUserDTO: + async def get_auth_user_by_email_async( + self, email: str, with_password: bool = False + ) -> AuthUserDTO: pass @abstractmethod diff --git a/kdb-bot/src/bot_api/abc/dto_abc.py b/bot/src/bot_api/abc/dto_abc.py similarity index 100% rename from kdb-bot/src/bot_api/abc/dto_abc.py rename to bot/src/bot_api/abc/dto_abc.py diff --git a/kdb-bot/src/bot_api/abc/select_criteria_abc.py b/bot/src/bot_api/abc/select_criteria_abc.py similarity index 68% rename from kdb-bot/src/bot_api/abc/select_criteria_abc.py rename to bot/src/bot_api/abc/select_criteria_abc.py index 950b5203..2c54df69 100644 --- a/kdb-bot/src/bot_api/abc/select_criteria_abc.py +++ b/bot/src/bot_api/abc/select_criteria_abc.py @@ -3,7 +3,9 @@ from abc import ABC, abstractmethod class SelectCriteriaABC(ABC): @abstractmethod - def __init__(self, page_index: int, page_size: int, sort_direction: str, sort_column: str): + def __init__( + self, page_index: int, page_size: int, sort_direction: str, sort_column: str + ): self.page_index = page_index self.page_size = page_size self.sort_direction = sort_direction diff --git a/kdb-bot/src/bot_api/abc/transformer_abc.py b/bot/src/bot_api/abc/transformer_abc.py similarity index 100% rename from kdb-bot/src/bot_api/abc/transformer_abc.py rename to bot/src/bot_api/abc/transformer_abc.py diff --git a/kdb-bot/src/bot_api/api.py b/bot/src/bot_api/api.py similarity index 92% rename from kdb-bot/src/bot_api/api.py rename to bot/src/bot_api/api.py index dd086b2d..587f0503 100644 --- a/kdb-bot/src/bot_api/api.py +++ b/bot/src/bot_api/api.py @@ -57,7 +57,9 @@ class Api(Flask): # Added async_mode see link below # https://github.com/miguelgrinberg/Flask-SocketIO/discussions/1849 # https://stackoverflow.com/questions/39370848/flask-socket-io-sometimes-client-calls-freeze-the-server - self._socketio = SocketIO(self, cors_allowed_origins="*", path="/api/socket.io", async_mode="eventlet") + self._socketio = SocketIO( + self, cors_allowed_origins="*", path="/api/socket.io", async_mode="eventlet" + ) self._socketio.on_event("connect", self.on_connect) self._socketio.on_event("disconnect", self.on_disconnect) @@ -143,19 +145,26 @@ class Api(Flask): data = request.get_data() data = "" if len(data) == 0 else str(data.decode(encoding="utf-8")) - text = textwrap.dedent(f"Request: {request_id}:\n\tHeader:\n\t\t{headers}\n\tResponse: {data}") + text = textwrap.dedent( + f"Request: {request_id}:\n\tHeader:\n\t\t{headers}\n\tResponse: {data}" + ) self._logger.trace(__name__, text) return response def start(self): - self._logger.info(__name__, f"Starting API {self._api_settings.host}:{self._api_settings.port}") + self._logger.info( + __name__, + f"Starting API {self._api_settings.host}:{self._api_settings.port}", + ) self._register_routes() self.secret_key = CredentialManager.decrypt(self._auth_settings.secret_key) # from waitress import serve # https://docs.pylonsproject.org/projects/waitress/en/stable/arguments.html # serve(self, host=self._apt_settings.host, port=self._apt_settings.port, threads=10, connection_limit=1000, channel_timeout=10) - self._socket = eventlet.listen((self._api_settings.host, self._api_settings.port)) + self._socket = eventlet.listen( + (self._api_settings.host, self._api_settings.port) + ) wsgi.server(self._socket, self, log_output=False) def stop(self): diff --git a/kdb-bot/src/bot_api/api_module.py b/bot/src/bot_api/api_module.py similarity index 86% rename from kdb-bot/src/bot_api/api_module.py rename to bot/src/bot_api/api_module.py index b2695e12..13a28547 100644 --- a/kdb-bot/src/bot_api/api_module.py +++ b/bot/src/bot_api/api_module.py @@ -26,15 +26,21 @@ class ApiModule(ModuleABC): def __init__(self, dc: DiscordCollectionABC): ModuleABC.__init__(self, dc, FeatureFlagsEnum.api_module) - def configure_configuration(self, config: ConfigurationABC, env: ApplicationEnvironmentABC): + def configure_configuration( + self, config: ConfigurationABC, env: ApplicationEnvironmentABC + ): cwd = env.working_directory env.set_working_directory(os.path.dirname(os.path.realpath(__file__))) config.add_json_file(f"config/apisettings.json", optional=False) - config.add_json_file(f"config/apisettings.{env.environment_name}.json", optional=True) + config.add_json_file( + f"config/apisettings.{env.environment_name}.json", optional=True + ) config.add_json_file(f"config/apisettings.{env.host_name}.json", optional=True) env.set_working_directory(cwd) - def configure_services(self, services: ServiceCollectionABC, env: ApplicationEnvironmentABC): + def configure_services( + self, services: ServiceCollectionABC, env: ApplicationEnvironmentABC + ): services.add_singleton(EMailClientABC, EMailClient) services.add_singleton(ApiThread) diff --git a/kdb-bot/src/bot_api/api_thread.py b/bot/src/bot_api/api_thread.py similarity index 100% rename from kdb-bot/src/bot_api/api_thread.py rename to bot/src/bot_api/api_thread.py diff --git a/kdb-bot/src/bot_api/app_api_extension.py b/bot/src/bot_api/app_api_extension.py similarity index 93% rename from kdb-bot/src/bot_api/app_api_extension.py rename to bot/src/bot_api/app_api_extension.py index ea9fda56..da1ac033 100644 --- a/kdb-bot/src/bot_api/app_api_extension.py +++ b/bot/src/bot_api/app_api_extension.py @@ -12,7 +12,9 @@ class AppApiExtension(ApplicationExtensionABC): ApplicationExtensionABC.__init__(self) async def run(self, config: ConfigurationABC, services: ServiceProviderABC): - feature_flags: FeatureFlagsSettings = config.get_configuration(FeatureFlagsSettings) + feature_flags: FeatureFlagsSettings = config.get_configuration( + FeatureFlagsSettings + ) if not feature_flags.get_flag(FeatureFlagsEnum.api_module): return diff --git a/kdb-bot/src/bot_api/bot-api.json b/bot/src/bot_api/bot-api.json similarity index 100% rename from kdb-bot/src/bot_api/bot-api.json rename to bot/src/bot_api/bot-api.json diff --git a/kdb-bot/src/bot_api/configuration/__init__.py b/bot/src/bot_api/configuration/__init__.py similarity index 100% rename from kdb-bot/src/bot_api/configuration/__init__.py rename to bot/src/bot_api/configuration/__init__.py diff --git a/kdb-bot/src/bot_api/configuration/api_settings.py b/bot/src/bot_api/configuration/api_settings.py similarity index 100% rename from kdb-bot/src/bot_api/configuration/api_settings.py rename to bot/src/bot_api/configuration/api_settings.py diff --git a/kdb-bot/src/bot_api/configuration/authentication_settings.py b/bot/src/bot_api/configuration/authentication_settings.py similarity index 89% rename from kdb-bot/src/bot_api/configuration/authentication_settings.py rename to bot/src/bot_api/configuration/authentication_settings.py index b9c3fff2..3dfb2442 100644 --- a/kdb-bot/src/bot_api/configuration/authentication_settings.py +++ b/bot/src/bot_api/configuration/authentication_settings.py @@ -16,7 +16,9 @@ class AuthenticationSettings(ConfigurationModelABC): self._issuer = "" if issuer is None else issuer self._audience = "" if audience is None else audience self._token_expire_time = 0 if token_expire_time is None else token_expire_time - self._refresh_token_expire_time = 0 if refresh_token_expire_time is None else refresh_token_expire_time + self._refresh_token_expire_time = ( + 0 if refresh_token_expire_time is None else refresh_token_expire_time + ) @property def secret_key(self) -> str: diff --git a/kdb-bot/src/bot_api/configuration/discord_authentication_settings.py b/bot/src/bot_api/configuration/discord_authentication_settings.py similarity index 100% rename from kdb-bot/src/bot_api/configuration/discord_authentication_settings.py rename to bot/src/bot_api/configuration/discord_authentication_settings.py diff --git a/kdb-bot/src/bot_api/configuration/frontend_settings.py b/bot/src/bot_api/configuration/frontend_settings.py similarity index 100% rename from kdb-bot/src/bot_api/configuration/frontend_settings.py rename to bot/src/bot_api/configuration/frontend_settings.py diff --git a/kdb-bot/src/bot_api/controller/__init__.py b/bot/src/bot_api/controller/__init__.py similarity index 100% rename from kdb-bot/src/bot_api/controller/__init__.py rename to bot/src/bot_api/controller/__init__.py diff --git a/kdb-bot/src/bot_api/controller/auth_controller.py b/bot/src/bot_api/controller/auth_controller.py similarity index 83% rename from kdb-bot/src/bot_api/controller/auth_controller.py rename to bot/src/bot_api/controller/auth_controller.py index 983b5fb9..b5970ce4 100644 --- a/kdb-bot/src/bot_api/controller/auth_controller.py +++ b/bot/src/bot_api/controller/auth_controller.py @@ -70,7 +70,9 @@ class AuthController: @Route.post(f"{BasePath}/register") async def register(self): - dto: AuthUserDTO = JSONProcessor.process(AuthUserDTO, request.get_json(force=True, silent=True)) + dto: AuthUserDTO = JSONProcessor.process( + AuthUserDTO, request.get_json(force=True, silent=True) + ) self._auth_service.add_auth_user(dto) return "", 200 @@ -81,7 +83,9 @@ class AuthController: @Route.post(f"{BasePath}/login") async def login(self) -> Response: - dto: AuthUserDTO = JSONProcessor.process(AuthUserDTO, request.get_json(force=True, silent=True)) + dto: AuthUserDTO = JSONProcessor.process( + AuthUserDTO, request.get_json(force=True, silent=True) + ) result = await self._auth_service.login_async(dto) return jsonify(result.to_dict()) @@ -110,40 +114,52 @@ class AuthController: @Route.post(f"{BasePath}/reset-password") async def reset_password(self): - dto: ResetPasswordDTO = JSONProcessor.process(ResetPasswordDTO, request.get_json(force=True, silent=True)) + dto: ResetPasswordDTO = JSONProcessor.process( + ResetPasswordDTO, request.get_json(force=True, silent=True) + ) await self._auth_service.reset_password_async(dto) return "", 200 @Route.post(f"{BasePath}/update-user") @Route.authorize async def update_user(self): - dto: UpdateAuthUserDTO = JSONProcessor.process(UpdateAuthUserDTO, request.get_json(force=True, silent=True)) + dto: UpdateAuthUserDTO = JSONProcessor.process( + UpdateAuthUserDTO, request.get_json(force=True, silent=True) + ) await self._auth_service.update_user_async(dto) return "", 200 @Route.post(f"{BasePath}/update-user-as-admin") @Route.authorize(role=AuthRoleEnum.admin) async def update_user_as_admin(self): - dto: UpdateAuthUserDTO = JSONProcessor.process(UpdateAuthUserDTO, request.get_json(force=True, silent=True)) + dto: UpdateAuthUserDTO = JSONProcessor.process( + UpdateAuthUserDTO, request.get_json(force=True, silent=True) + ) await self._auth_service.update_user_as_admin_async(dto) return "", 200 @Route.post(f"{BasePath}/refresh") async def refresh(self) -> Response: - dto: TokenDTO = JSONProcessor.process(TokenDTO, request.get_json(force=True, silent=True)) + dto: TokenDTO = JSONProcessor.process( + TokenDTO, request.get_json(force=True, silent=True) + ) result = await self._auth_service.refresh_async(dto) return jsonify(result.to_dict()) @Route.post(f"{BasePath}/revoke") async def revoke(self): - dto: TokenDTO = JSONProcessor.process(TokenDTO, request.get_json(force=True, silent=True)) + dto: TokenDTO = JSONProcessor.process( + TokenDTO, request.get_json(force=True, silent=True) + ) await self._auth_service.revoke_async(dto) return "", 200 @Route.post(f"{BasePath}/delete-user") @Route.authorize(role=AuthRoleEnum.admin) async def delete_user(self): - dto: AuthUserDTO = JSONProcessor.process(AuthUserDTO, request.get_json(force=True, silent=True)) + dto: AuthUserDTO = JSONProcessor.process( + AuthUserDTO, request.get_json(force=True, silent=True) + ) await self._auth_service.delete_auth_user_async(dto) return "", 200 diff --git a/kdb-bot/src/bot_api/controller/auth_discord_controller.py b/bot/src/bot_api/controller/auth_discord_controller.py similarity index 100% rename from kdb-bot/src/bot_api/controller/auth_discord_controller.py rename to bot/src/bot_api/controller/auth_discord_controller.py diff --git a/kdb-bot/src/bot_api/controller/graphql_controller.py b/bot/src/bot_api/controller/graphql_controller.py similarity index 100% rename from kdb-bot/src/bot_api/controller/graphql_controller.py rename to bot/src/bot_api/controller/graphql_controller.py diff --git a/kdb-bot/src/bot_api/controller/gui_controller.py b/bot/src/bot_api/controller/gui_controller.py similarity index 100% rename from kdb-bot/src/bot_api/controller/gui_controller.py rename to bot/src/bot_api/controller/gui_controller.py diff --git a/kdb-bot/src/bot_api/event/__init__.py b/bot/src/bot_api/event/__init__.py similarity index 100% rename from kdb-bot/src/bot_api/event/__init__.py rename to bot/src/bot_api/event/__init__.py diff --git a/kdb-bot/src/bot_api/event/bot_api_on_ready_event.py b/bot/src/bot_api/event/bot_api_on_ready_event.py similarity index 100% rename from kdb-bot/src/bot_api/event/bot_api_on_ready_event.py rename to bot/src/bot_api/event/bot_api_on_ready_event.py diff --git a/kdb-bot/src/bot_api/exception/__init__.py b/bot/src/bot_api/exception/__init__.py similarity index 100% rename from kdb-bot/src/bot_api/exception/__init__.py rename to bot/src/bot_api/exception/__init__.py diff --git a/kdb-bot/src/bot_api/exception/service_error_code_enum.py b/bot/src/bot_api/exception/service_error_code_enum.py similarity index 100% rename from kdb-bot/src/bot_api/exception/service_error_code_enum.py rename to bot/src/bot_api/exception/service_error_code_enum.py diff --git a/kdb-bot/src/bot_api/exception/service_exception.py b/bot/src/bot_api/exception/service_exception.py similarity index 100% rename from kdb-bot/src/bot_api/exception/service_exception.py rename to bot/src/bot_api/exception/service_exception.py diff --git a/kdb-bot/src/bot_api/filter/__init__.py b/bot/src/bot_api/filter/__init__.py similarity index 100% rename from kdb-bot/src/bot_api/filter/__init__.py rename to bot/src/bot_api/filter/__init__.py diff --git a/kdb-bot/src/bot_api/filter/auth_user_select_criteria.py b/bot/src/bot_api/filter/auth_user_select_criteria.py similarity index 80% rename from kdb-bot/src/bot_api/filter/auth_user_select_criteria.py rename to bot/src/bot_api/filter/auth_user_select_criteria.py index eaa2ee7f..b19b8ead 100644 --- a/kdb-bot/src/bot_api/filter/auth_user_select_criteria.py +++ b/bot/src/bot_api/filter/auth_user_select_criteria.py @@ -13,7 +13,9 @@ class AuthUserSelectCriteria(SelectCriteriaABC): email: str, auth_role: int, ): - SelectCriteriaABC.__init__(self, page_index, page_size, sort_direction, sort_column) + SelectCriteriaABC.__init__( + self, page_index, page_size, sort_direction, sort_column + ) self.first_name = first_name self.last_name = last_name diff --git a/kdb-bot/src/bot_api/filter/discord/__init__.py b/bot/src/bot_api/filter/discord/__init__.py similarity index 100% rename from kdb-bot/src/bot_api/filter/discord/__init__.py rename to bot/src/bot_api/filter/discord/__init__.py diff --git a/kdb-bot/src/bot_api/filter/discord/server_select_criteria.py b/bot/src/bot_api/filter/discord/server_select_criteria.py similarity index 72% rename from kdb-bot/src/bot_api/filter/discord/server_select_criteria.py rename to bot/src/bot_api/filter/discord/server_select_criteria.py index 5f194809..73196b60 100644 --- a/kdb-bot/src/bot_api/filter/discord/server_select_criteria.py +++ b/bot/src/bot_api/filter/discord/server_select_criteria.py @@ -10,6 +10,8 @@ class ServerSelectCriteria(SelectCriteriaABC): sort_column: str, name: str, ): - SelectCriteriaABC.__init__(self, page_index, page_size, sort_direction, sort_column) + SelectCriteriaABC.__init__( + self, page_index, page_size, sort_direction, sort_column + ) self.name = name diff --git a/kdb-bot/src/bot_api/json_processor.py b/bot/src/bot_api/json_processor.py similarity index 100% rename from kdb-bot/src/bot_api/json_processor.py rename to bot/src/bot_api/json_processor.py diff --git a/kdb-bot/src/bot_api/logging/__init__.py b/bot/src/bot_api/logging/__init__.py similarity index 100% rename from kdb-bot/src/bot_api/logging/__init__.py rename to bot/src/bot_api/logging/__init__.py diff --git a/kdb-bot/src/bot_api/logging/api_logger.py b/bot/src/bot_api/logging/api_logger.py similarity index 100% rename from kdb-bot/src/bot_api/logging/api_logger.py rename to bot/src/bot_api/logging/api_logger.py diff --git a/kdb-bot/src/bot_api/model/__init__.py b/bot/src/bot_api/model/__init__.py similarity index 100% rename from kdb-bot/src/bot_api/model/__init__.py rename to bot/src/bot_api/model/__init__.py diff --git a/kdb-bot/src/bot_api/model/auth_user_dto.py b/bot/src/bot_api/model/auth_user_dto.py similarity index 100% rename from kdb-bot/src/bot_api/model/auth_user_dto.py rename to bot/src/bot_api/model/auth_user_dto.py diff --git a/kdb-bot/src/bot_api/model/auth_user_filtered_result_dto.py b/bot/src/bot_api/model/auth_user_filtered_result_dto.py similarity index 100% rename from kdb-bot/src/bot_api/model/auth_user_filtered_result_dto.py rename to bot/src/bot_api/model/auth_user_filtered_result_dto.py diff --git a/kdb-bot/src/bot_api/model/discord/__init__.py b/bot/src/bot_api/model/discord/__init__.py similarity index 100% rename from kdb-bot/src/bot_api/model/discord/__init__.py rename to bot/src/bot_api/model/discord/__init__.py diff --git a/kdb-bot/src/bot_api/model/discord/server_dto.py b/bot/src/bot_api/model/discord/server_dto.py similarity index 100% rename from kdb-bot/src/bot_api/model/discord/server_dto.py rename to bot/src/bot_api/model/discord/server_dto.py diff --git a/kdb-bot/src/bot_api/model/discord/server_filtered_result_dto.py b/bot/src/bot_api/model/discord/server_filtered_result_dto.py similarity index 100% rename from kdb-bot/src/bot_api/model/discord/server_filtered_result_dto.py rename to bot/src/bot_api/model/discord/server_filtered_result_dto.py diff --git a/kdb-bot/src/bot_api/model/email_string_dto.py b/bot/src/bot_api/model/email_string_dto.py similarity index 100% rename from kdb-bot/src/bot_api/model/email_string_dto.py rename to bot/src/bot_api/model/email_string_dto.py diff --git a/kdb-bot/src/bot_api/model/error_dto.py b/bot/src/bot_api/model/error_dto.py similarity index 87% rename from kdb-bot/src/bot_api/model/error_dto.py rename to bot/src/bot_api/model/error_dto.py index 867e581c..c864dece 100644 --- a/kdb-bot/src/bot_api/model/error_dto.py +++ b/bot/src/bot_api/model/error_dto.py @@ -11,7 +11,9 @@ class ErrorDTO(DtoABC): def __init__(self, error_code: Optional[ServiceErrorCode], message: str): DtoABC.__init__(self) - self._error_code = ServiceErrorCode.Unknown if error_code is None else error_code + self._error_code = ( + ServiceErrorCode.Unknown if error_code is None else error_code + ) self._message = message @property diff --git a/kdb-bot/src/bot_api/model/o_auth_dto.py b/bot/src/bot_api/model/o_auth_dto.py similarity index 100% rename from kdb-bot/src/bot_api/model/o_auth_dto.py rename to bot/src/bot_api/model/o_auth_dto.py diff --git a/kdb-bot/src/bot_api/model/reset_password_dto.py b/bot/src/bot_api/model/reset_password_dto.py similarity index 100% rename from kdb-bot/src/bot_api/model/reset_password_dto.py rename to bot/src/bot_api/model/reset_password_dto.py diff --git a/kdb-bot/src/bot_api/model/settings_dto.py b/bot/src/bot_api/model/settings_dto.py similarity index 100% rename from kdb-bot/src/bot_api/model/settings_dto.py rename to bot/src/bot_api/model/settings_dto.py diff --git a/kdb-bot/src/bot_api/model/token_dto.py b/bot/src/bot_api/model/token_dto.py similarity index 82% rename from kdb-bot/src/bot_api/model/token_dto.py rename to bot/src/bot_api/model/token_dto.py index 88ff8501..f8c98922 100644 --- a/kdb-bot/src/bot_api/model/token_dto.py +++ b/bot/src/bot_api/model/token_dto.py @@ -27,4 +27,8 @@ class TokenDTO(DtoABC): self._first_login = values["firstLogin"] def to_dict(self) -> dict: - return {"token": self._token, "refreshToken": self._refresh_token, "firstLogin": self._first_login} + return { + "token": self._token, + "refreshToken": self._refresh_token, + "firstLogin": self._first_login, + } diff --git a/kdb-bot/src/bot_api/model/update_auth_user_dto.py b/bot/src/bot_api/model/update_auth_user_dto.py similarity index 89% rename from kdb-bot/src/bot_api/model/update_auth_user_dto.py rename to bot/src/bot_api/model/update_auth_user_dto.py index 28e57768..d8361171 100644 --- a/kdb-bot/src/bot_api/model/update_auth_user_dto.py +++ b/bot/src/bot_api/model/update_auth_user_dto.py @@ -34,7 +34,9 @@ class UpdateAuthUserDTO(DtoABC): def from_dict(self, values: dict): self._auth_user = AuthUserDTO().from_dict(values["authUser"]) self._new_auth_user = AuthUserDTO().from_dict(values["newAuthUser"]) - self._change_password = False if "changePassword" not in values else bool(values["changePassword"]) + self._change_password = ( + False if "changePassword" not in values else bool(values["changePassword"]) + ) def to_dict(self) -> dict: return { diff --git a/kdb-bot/src/bot_api/model/user_dto.py b/bot/src/bot_api/model/user_dto.py similarity index 100% rename from kdb-bot/src/bot_api/model/user_dto.py rename to bot/src/bot_api/model/user_dto.py diff --git a/kdb-bot/src/bot_api/model/version_dto.py b/bot/src/bot_api/model/version_dto.py similarity index 100% rename from kdb-bot/src/bot_api/model/version_dto.py rename to bot/src/bot_api/model/version_dto.py diff --git a/kdb-bot/src/bot_api/route/__init__.py b/bot/src/bot_api/route/__init__.py similarity index 100% rename from kdb-bot/src/bot_api/route/__init__.py rename to bot/src/bot_api/route/__init__.py diff --git a/kdb-bot/src/bot_api/route/route.py b/bot/src/bot_api/route/route.py similarity index 84% rename from kdb-bot/src/bot_api/route/route.py rename to bot/src/bot_api/route/route.py index 74278f28..3b0fbc96 100644 --- a/kdb-bot/src/bot_api/route/route.py +++ b/bot/src/bot_api/route/route.py @@ -25,7 +25,12 @@ class Route: @classmethod @ServiceProviderABC.inject - def init_authorize(cls, env: ApplicationEnvironmentABC, auth_users: AuthUserRepositoryABC, auth: AuthServiceABC): + def init_authorize( + cls, + env: ApplicationEnvironmentABC, + auth_users: AuthUserRepositoryABC, + auth: AuthServiceABC, + ): cls._auth_users = auth_users cls._auth = auth cls._env = env.environment_name @@ -52,9 +57,17 @@ class Route: return user @classmethod - def authorize(cls, f: Callable = None, role: AuthRoleEnum = None, skip_in_dev=False, by_api_key=False): + def authorize( + cls, + f: Callable = None, + role: AuthRoleEnum = None, + skip_in_dev=False, + by_api_key=False, + ): if f is None: - return functools.partial(cls.authorize, role=role, skip_in_dev=skip_in_dev, by_api_key=by_api_key) + return functools.partial( + cls.authorize, role=role, skip_in_dev=skip_in_dev, by_api_key=by_api_key + ) @wraps(f) async def decorator(*args, **kwargs): @@ -65,7 +78,9 @@ class Route: api_key = None if "Authorization" in request.headers: if " " not in request.headers.get("Authorization"): - ex = ServiceException(ServiceErrorCode.Unauthorized, f"Token not set") + ex = ServiceException( + ServiceErrorCode.Unauthorized, f"Token not set" + ) error = ErrorDTO(ex.error_code, ex.message) return jsonify(error.to_dict()), 401 @@ -87,7 +102,9 @@ class Route: return jsonify(e), 500 if not valid: - ex = ServiceException(ServiceErrorCode.Unauthorized, f"API-Key invalid") + ex = ServiceException( + ServiceErrorCode.Unauthorized, f"API-Key invalid" + ) error = ErrorDTO(ex.error_code, ex.message) return jsonify(error.to_dict()), 401 @@ -99,7 +116,9 @@ class Route: return jsonify(error.to_dict()), 401 if cls._auth_users is None or cls._auth is None: - ex = ServiceException(ServiceErrorCode.Unauthorized, f"Authorize is not initialized") + ex = ServiceException( + ServiceErrorCode.Unauthorized, f"Authorize is not initialized" + ) error = ErrorDTO(ex.error_code, ex.message) return jsonify(error.to_dict()), 401 @@ -121,7 +140,9 @@ class Route: return jsonify(error.to_dict()), 401 if role is not None and user.auth_role.value < role.value: - ex = ServiceException(ServiceErrorCode.Unauthorized, f"Role {role} required") + ex = ServiceException( + ServiceErrorCode.Unauthorized, f"Role {role} required" + ) error = ErrorDTO(ex.error_code, ex.message) return jsonify(error.to_dict()), 403 diff --git a/kdb-bot/src/bot_api/service/__init__.py b/bot/src/bot_api/service/__init__.py similarity index 100% rename from kdb-bot/src/bot_api/service/__init__.py rename to bot/src/bot_api/service/__init__.py diff --git a/kdb-bot/src/bot_api/service/auth_service.py b/bot/src/bot_api/service/auth_service.py similarity index 82% rename from kdb-bot/src/bot_api/service/auth_service.py rename to bot/src/bot_api/service/auth_service.py index 94410b52..ec93775e 100644 --- a/kdb-bot/src/bot_api/service/auth_service.py +++ b/bot/src/bot_api/service/auth_service.py @@ -90,7 +90,9 @@ class AuthService(AuthServiceABC): def _get_api_key_str(self, api_key: ApiKey) -> str: return hashlib.sha256( - f"{api_key.identifier}:{api_key.key}+{self._auth_settings.secret_key}".encode("utf-8") + f"{api_key.identifier}:{api_key.key}+{self._auth_settings.secret_key}".encode( + "utf-8" + ) ).hexdigest() def generate_token(self, user: AuthUser) -> str: @@ -99,7 +101,8 @@ class AuthService(AuthServiceABC): "user_id": user.id, "email": user.email, "role": user.auth_role.value, - "exp": datetime.now(tz=timezone.utc) + timedelta(days=self._auth_settings.token_expire_time), + "exp": datetime.now(tz=timezone.utc) + + timedelta(days=self._auth_settings.token_expire_time), "iss": self._auth_settings.issuer, "aud": self._auth_settings.audience, }, @@ -155,7 +158,9 @@ class AuthService(AuthServiceABC): def _create_and_save_refresh_token(self, user: AuthUser) -> str: token = str(uuid.uuid4()) user.refresh_token = token - user.refresh_token_expire_time = datetime.now() + timedelta(days=self._auth_settings.refresh_token_expire_time) + user.refresh_token_expire_time = datetime.now() + timedelta( + days=self._auth_settings.refresh_token_expire_time + ) self._auth_users.update_auth_user(user) self._db.save_changes() return token @@ -188,8 +193,12 @@ class AuthService(AuthServiceABC): self._send_link_mail( user.email, - self._t.transform("api.auth.confirmation.subject").format(user.first_name, user.last_name), - self._t.transform("api.auth.confirmation.message").format(url, user.confirmation_id), + self._t.transform("api.auth.confirmation.subject").format( + user.first_name, user.last_name + ), + self._t.transform("api.auth.confirmation.message").format( + url, user.confirmation_id + ), ) def _send_forgot_password_id_to_user(self, user: AuthUser): @@ -199,28 +208,38 @@ class AuthService(AuthServiceABC): self._send_link_mail( user.email, - self._t.transform("api.auth.forgot_password.subject").format(user.first_name, user.last_name), - self._t.transform("api.auth.forgot_password.message").format(url, user.forgot_password_id), + self._t.transform("api.auth.forgot_password.subject").format( + user.first_name, user.last_name + ), + self._t.transform("api.auth.forgot_password.message").format( + url, user.forgot_password_id + ), ) async def get_all_auth_users_async(self) -> List[AuthUserDTO]: result = self._auth_users.get_all_auth_users().select(lambda x: AUT.to_dto(x)) return List(AuthUserDTO, result) - async def get_filtered_auth_users_async(self, criteria: AuthUserSelectCriteria) -> AuthUserFilteredResultDTO: + async def get_filtered_auth_users_async( + self, criteria: AuthUserSelectCriteria + ) -> AuthUserFilteredResultDTO: users = self._auth_users.get_filtered_auth_users(criteria) result = users.result.select(lambda x: AUT.to_dto(x)) return AuthUserFilteredResultDTO(List(AuthUserDTO, result), users.total_count) - async def get_auth_user_by_email_async(self, email: str, with_password: bool = False) -> AuthUserDTO: + async def get_auth_user_by_email_async( + self, email: str, with_password: bool = False + ) -> AuthUserDTO: try: # todo: check if logged in user is admin then send mail user = self._auth_users.get_auth_user_by_email(email) return AUT.to_dto(user, password=user.password if with_password else None) except Exception as e: self._logger.error(__name__, f"AuthUser not found", e) - raise ServiceException(ServiceErrorCode.InvalidData, f"User not found {email}") + raise ServiceException( + ServiceErrorCode.InvalidData, f"User not found {email}" + ) async def find_auth_user_by_email_async(self, email: str) -> Optional[AuthUser]: user = self._auth_users.find_auth_user_by_email(email) @@ -238,16 +257,22 @@ class AuthService(AuthServiceABC): user.password_salt = uuid.uuid4() user.password = self._hash_sha256(user_dto.password, user.password_salt) if not self._is_email_valid(user.email): - raise ServiceException(ServiceErrorCode.InvalidData, "Invalid E-Mail address") + raise ServiceException( + ServiceErrorCode.InvalidData, "Invalid E-Mail address" + ) try: user.confirmation_id = uuid.uuid4() self._auth_users.add_auth_user(user) self._send_confirmation_id_to_user(user) self._db.save_changes() - self._logger.info(__name__, f"Added auth user with E-Mail: {user_dto.email}") + self._logger.info( + __name__, f"Added auth user with E-Mail: {user_dto.email}" + ) except Exception as e: - self._logger.error(__name__, f"Cannot add user with E-Mail {user_dto.email}", e) + self._logger.error( + __name__, f"Cannot add user with E-Mail {user_dto.email}", e + ) raise ServiceException(ServiceErrorCode.UnableToAdd, "Invalid E-Mail") async def add_auth_user_by_oauth_async(self, dto: OAuthDTO): @@ -263,14 +288,20 @@ class AuthService(AuthServiceABC): db_user.first_name = dto.user.first_name db_user.last_name = dto.user.last_name db_user.password_salt = uuid.uuid4() - db_user.password = self._hash_sha256(dto.user.password, db_user.password_salt) + db_user.password = self._hash_sha256( + dto.user.password, db_user.password_salt + ) db_user.oauth_id = None db_user.confirmation_id = uuid.uuid4() self._send_confirmation_id_to_user(db_user) self._auth_users.update_auth_user(db_user) - self._logger.info(__name__, f"Added auth user with E-Mail: {dto.user.email}") + self._logger.info( + __name__, f"Added auth user with E-Mail: {dto.user.email}" + ) except Exception as e: - self._logger.error(__name__, f"Cannot add user with E-Mail {dto.user.email}", e) + self._logger.error( + __name__, f"Cannot add user with E-Mail {dto.user.email}", e + ) raise ServiceException(ServiceErrorCode.UnableToAdd, "Invalid E-Mail") self._db.save_changes() @@ -280,14 +311,16 @@ class AuthService(AuthServiceABC): raise ServiceException(ServiceErrorCode.InvalidData, f"User is empty") if update_user_dto.auth_user is None: - raise ServiceException(ServiceErrorCode.InvalidData, f"Existing user is empty") + raise ServiceException( + ServiceErrorCode.InvalidData, f"Existing user is empty" + ) if update_user_dto.new_auth_user is None: raise ServiceException(ServiceErrorCode.InvalidData, f"New user is empty") - if not self._is_email_valid(update_user_dto.auth_user.email) or not self._is_email_valid( - update_user_dto.new_auth_user.email - ): + if not self._is_email_valid( + update_user_dto.auth_user.email + ) or not self._is_email_valid(update_user_dto.new_auth_user.email): raise ServiceException(ServiceErrorCode.InvalidData, f"Invalid E-Mail") user = self._auth_users.find_auth_user_by_email(update_user_dto.auth_user.email) @@ -300,7 +333,8 @@ class AuthService(AuthServiceABC): # update first name if ( update_user_dto.new_auth_user.first_name is not None - and update_user_dto.auth_user.first_name != update_user_dto.new_auth_user.first_name + and update_user_dto.auth_user.first_name + != update_user_dto.new_auth_user.first_name ): user.first_name = update_user_dto.new_auth_user.first_name @@ -308,7 +342,8 @@ class AuthService(AuthServiceABC): if ( update_user_dto.new_auth_user.last_name is not None and update_user_dto.new_auth_user.last_name != "" - and update_user_dto.auth_user.last_name != update_user_dto.new_auth_user.last_name + and update_user_dto.auth_user.last_name + != update_user_dto.new_auth_user.last_name ): user.last_name = update_user_dto.new_auth_user.last_name @@ -318,22 +353,33 @@ class AuthService(AuthServiceABC): and update_user_dto.new_auth_user.email != "" and update_user_dto.auth_user.email != update_user_dto.new_auth_user.email ): - user_by_new_e_mail = self._auth_users.find_auth_user_by_email(update_user_dto.new_auth_user.email) + user_by_new_e_mail = self._auth_users.find_auth_user_by_email( + update_user_dto.new_auth_user.email + ) if user_by_new_e_mail is not None: - raise ServiceException(ServiceErrorCode.InvalidUser, "User already exists") + raise ServiceException( + ServiceErrorCode.InvalidUser, "User already exists" + ) user.email = update_user_dto.new_auth_user.email - update_user_dto.auth_user.password = self._hash_sha256(update_user_dto.auth_user.password, user.password_salt) + update_user_dto.auth_user.password = self._hash_sha256( + update_user_dto.auth_user.password, user.password_salt + ) if update_user_dto.auth_user.password != user.password: raise ServiceException(ServiceErrorCode.InvalidUser, "Wrong password") # update password if ( update_user_dto.new_auth_user.password is not None - and self._hash_sha256(update_user_dto.new_auth_user.password, user.password_salt) != user.password + and self._hash_sha256( + update_user_dto.new_auth_user.password, user.password_salt + ) + != user.password ): user.password_salt = uuid.uuid4() - user.password = self._hash_sha256(update_user_dto.new_auth_user.password, user.password_salt) + user.password = self._hash_sha256( + update_user_dto.new_auth_user.password, user.password_salt + ) self._auth_users.update_auth_user(user) self._db.save_changes() @@ -343,23 +389,31 @@ class AuthService(AuthServiceABC): raise ServiceException(ServiceErrorCode.InvalidData, f"User is empty") if update_user_dto.auth_user is None: - raise ServiceException(ServiceErrorCode.InvalidData, f"Existing user is empty") + raise ServiceException( + ServiceErrorCode.InvalidData, f"Existing user is empty" + ) if update_user_dto.new_auth_user is None: raise ServiceException(ServiceErrorCode.InvalidData, f"New user is empty") - if not self._is_email_valid(update_user_dto.auth_user.email) or not self._is_email_valid( - update_user_dto.new_auth_user.email - ): + if not self._is_email_valid( + update_user_dto.auth_user.email + ) or not self._is_email_valid(update_user_dto.new_auth_user.email): raise ServiceException(ServiceErrorCode.InvalidData, f"Invalid E-Mail") user = self._auth_users.find_auth_user_by_email(update_user_dto.auth_user.email) if user is None: raise ServiceException(ServiceErrorCode.InvalidUser, "User not found") - if user.confirmation_id is not None and update_user_dto.new_auth_user.is_confirmed: + if ( + user.confirmation_id is not None + and update_user_dto.new_auth_user.is_confirmed + ): user.confirmation_id = None - elif user.confirmation_id is None and not update_user_dto.new_auth_user.is_confirmed: + elif ( + user.confirmation_id is None + and not update_user_dto.new_auth_user.is_confirmed + ): user.confirmation_id = uuid.uuid4() # else # raise ServiceException(ServiceErrorCode.InvalidUser, 'E-Mail not confirmed') @@ -367,7 +421,8 @@ class AuthService(AuthServiceABC): # update first name if ( update_user_dto.new_auth_user.first_name is not None - and update_user_dto.auth_user.first_name != update_user_dto.new_auth_user.first_name + and update_user_dto.auth_user.first_name + != update_user_dto.new_auth_user.first_name ): user.first_name = update_user_dto.new_auth_user.first_name @@ -375,7 +430,8 @@ class AuthService(AuthServiceABC): if ( update_user_dto.new_auth_user.last_name is not None and update_user_dto.new_auth_user.last_name != "" - and update_user_dto.auth_user.last_name != update_user_dto.new_auth_user.last_name + and update_user_dto.auth_user.last_name + != update_user_dto.new_auth_user.last_name ): user.last_name = update_user_dto.new_auth_user.last_name @@ -385,19 +441,28 @@ class AuthService(AuthServiceABC): and update_user_dto.new_auth_user.email != "" and update_user_dto.auth_user.email != update_user_dto.new_auth_user.email ): - user_by_new_e_mail = self._auth_users.find_auth_user_by_email(update_user_dto.new_auth_user.email) + user_by_new_e_mail = self._auth_users.find_auth_user_by_email( + update_user_dto.new_auth_user.email + ) if user_by_new_e_mail is not None: - raise ServiceException(ServiceErrorCode.InvalidUser, "User already exists") + raise ServiceException( + ServiceErrorCode.InvalidUser, "User already exists" + ) user.email = update_user_dto.new_auth_user.email # update password if ( update_user_dto.new_auth_user.password is not None and update_user_dto.change_password - and user.password != self._hash_sha256(update_user_dto.new_auth_user.password, user.password_salt) + and user.password + != self._hash_sha256( + update_user_dto.new_auth_user.password, user.password_salt + ) ): user.password_salt = uuid.uuid4() - user.password = self._hash_sha256(update_user_dto.new_auth_user.password, user.password_salt) + user.password = self._hash_sha256( + update_user_dto.new_auth_user.password, user.password_salt + ) # update role if ( @@ -416,7 +481,9 @@ class AuthService(AuthServiceABC): self._db.save_changes() except Exception as e: self._logger.error(__name__, f"Cannot delete user", e) - raise ServiceException(ServiceErrorCode.UnableToDelete, f"Cannot delete user by mail {email}") + raise ServiceException( + ServiceErrorCode.UnableToDelete, f"Cannot delete user by mail {email}" + ) async def delete_auth_user_async(self, user_dto: AuthUser): try: @@ -500,7 +567,9 @@ class AuthService(AuthServiceABC): if user.id in user_ids: continue - self._auth_users.add_auth_user_user_rel(AuthUserUsersRelation(db_user, user)) + self._auth_users.add_auth_user_user_rel( + AuthUserUsersRelation(db_user, user) + ) if db_user.confirmation_id is not None and not added_user: raise ServiceException(ServiceErrorCode.Forbidden, "E-Mail not verified") @@ -530,13 +599,19 @@ class AuthService(AuthServiceABC): ): raise ServiceException(ServiceErrorCode.InvalidData, "Token expired") - return TokenDTO(self.generate_token(user), self._create_and_save_refresh_token(user)) + return TokenDTO( + self.generate_token(user), self._create_and_save_refresh_token(user) + ) except Exception as e: self._logger.error(__name__, f"Refreshing token failed", e) return TokenDTO("", "") async def revoke_async(self, token_dto: TokenDTO): - if token_dto is None or token_dto.token is None or token_dto.refresh_token is None: + if ( + token_dto is None + or token_dto.token is None + or token_dto.refresh_token is None + ): raise ServiceException(ServiceErrorCode.InvalidData, "Token not set") try: @@ -589,7 +664,9 @@ class AuthService(AuthServiceABC): ) if user.confirmation_id is not None: - raise ServiceException(ServiceErrorCode.InvalidUser, f"E-Mail not confirmed") + raise ServiceException( + ServiceErrorCode.InvalidUser, f"E-Mail not confirmed" + ) if user.password is None or rp_dto.password == "": raise ServiceException(ServiceErrorCode.InvalidData, f"Password not set") diff --git a/kdb-bot/src/bot_api/service/discord_service.py b/bot/src/bot_api/service/discord_service.py similarity index 83% rename from kdb-bot/src/bot_api/service/discord_service.py rename to bot/src/bot_api/service/discord_service.py index 386b3046..21e0df82 100644 --- a/kdb-bot/src/bot_api/service/discord_service.py +++ b/bot/src/bot_api/service/discord_service.py @@ -53,13 +53,17 @@ class DiscordService: if role != AuthRoleEnum.admin: auth_user = self._auth_users.find_auth_user_by_email(token["email"]) if auth_user is not None: - user_ids = auth_user.users.select(lambda x: x.server is not None and x.server.id) + user_ids = auth_user.users.select( + lambda x: x.server is not None and x.server.id + ) servers = servers.where(lambda x: x.id in user_ids) servers = List(ServerDTO, servers) return servers.select(self._to_dto).where(lambda x: x.name != "") - async def get_filtered_servers_async(self, criteria: ServerSelectCriteria) -> ServerFilteredResultDTO: + async def get_filtered_servers_async( + self, criteria: ServerSelectCriteria + ) -> ServerFilteredResultDTO: token = self._auth.get_decoded_token_from_request() if token is None or "email" not in token or "role" not in token: raise ServiceException(ServiceErrorCode.InvalidData, "Token invalid") @@ -70,15 +74,22 @@ class DiscordService: if role != AuthRoleEnum.admin: auth_user = self._auth_users.find_auth_user_by_email(token["email"]) if auth_user is not None: - user_ids = auth_user.users.select(lambda x: x.server is not None and x.server.id) - filtered_result.result = filtered_result.result.where(lambda x: x.id in user_ids) + user_ids = auth_user.users.select( + lambda x: x.server is not None and x.server.id + ) + filtered_result.result = filtered_result.result.where( + lambda x: x.id in user_ids + ) - servers: List = filtered_result.result.select(self._to_dto).where(lambda x: x.name != "") + servers: List = filtered_result.result.select(self._to_dto).where( + lambda x: x.name != "" + ) result = List(ServerDTO, servers) if criteria.name is not None and criteria.name != "": result = result.where( - lambda x: criteria.name.lower() in x.name.lower() or x.name.lower() == criteria.name.lower() + lambda x: criteria.name.lower() in x.name.lower() + or x.name.lower() == criteria.name.lower() ) return ServerFilteredResultDTO(List(ServerDTO, result), servers.count()) @@ -87,5 +98,7 @@ class DiscordService: server = self._servers.get_server_by_id(id) guild = self._bot.get_guild(server.discord_id) - server_dto = ServerTransformer.to_dto(server, guild.name, guild.member_count, guild.icon) + server_dto = ServerTransformer.to_dto( + server, guild.name, guild.member_count, guild.icon + ) return server_dto diff --git a/kdb-bot/src/bot_api/transformer/__init__.py b/bot/src/bot_api/transformer/__init__.py similarity index 100% rename from kdb-bot/src/bot_api/transformer/__init__.py rename to bot/src/bot_api/transformer/__init__.py diff --git a/kdb-bot/src/bot_api/transformer/auth_user_transformer.py b/bot/src/bot_api/transformer/auth_user_transformer.py similarity index 84% rename from kdb-bot/src/bot_api/transformer/auth_user_transformer.py rename to bot/src/bot_api/transformer/auth_user_transformer.py index 9e52fec3..83633520 100644 --- a/kdb-bot/src/bot_api/transformer/auth_user_transformer.py +++ b/bot/src/bot_api/transformer/auth_user_transformer.py @@ -27,27 +27,35 @@ class AuthUserTransformer(TransformerABC): None, None, datetime.now(), - AuthRoleEnum.normal if dto.auth_role is None else AuthRoleEnum(dto.auth_role), + AuthRoleEnum.normal + if dto.auth_role is None + else AuthRoleEnum(dto.auth_role), auth_user_id=0 if dto.id is None else dto.id, ) @staticmethod @ServiceProviderABC.inject - def _is_technician(user: User, bot: DiscordBotServiceABC, permissions: PermissionServiceABC): + def _is_technician( + user: User, bot: DiscordBotServiceABC, permissions: PermissionServiceABC + ): guild = bot.get_guild(user.server.discord_id) member = guild.get_member(user.discord_id) return permissions.is_member_technician(member) @staticmethod @ServiceProviderABC.inject - def _is_admin(user: User, bot: DiscordBotServiceABC, permissions: PermissionServiceABC): + def _is_admin( + user: User, bot: DiscordBotServiceABC, permissions: PermissionServiceABC + ): guild = bot.get_guild(user.server.discord_id) member = guild.get_member(user.discord_id) return permissions.is_member_admin(member) @staticmethod @ServiceProviderABC.inject - def _is_moderator(user: User, bot: DiscordBotServiceABC, permissions: PermissionServiceABC): + def _is_moderator( + user: User, bot: DiscordBotServiceABC, permissions: PermissionServiceABC + ): guild = bot.get_guild(user.server.discord_id) member = guild.get_member(user.discord_id) return permissions.is_member_moderator(member) diff --git a/kdb-bot/src/bot_api/transformer/server_transformer.py b/bot/src/bot_api/transformer/server_transformer.py similarity index 81% rename from kdb-bot/src/bot_api/transformer/server_transformer.py rename to bot/src/bot_api/transformer/server_transformer.py index bffba8e1..f4ca5d6f 100644 --- a/kdb-bot/src/bot_api/transformer/server_transformer.py +++ b/bot/src/bot_api/transformer/server_transformer.py @@ -13,7 +13,9 @@ class ServerTransformer(TransformerABC): return Server(dto.discord_id) @staticmethod - def to_dto(db: Server, name: str, member_count: int, icon_url: Optional[discord.Asset]) -> ServerDTO: + def to_dto( + db: Server, name: str, member_count: int, icon_url: Optional[discord.Asset] + ) -> ServerDTO: return ServerDTO( db.id, db.discord_id, diff --git a/kdb-bot/src/bot_core/__init__.py b/bot/src/bot_core/__init__.py similarity index 100% rename from kdb-bot/src/bot_core/__init__.py rename to bot/src/bot_core/__init__.py diff --git a/kdb-bot/src/bot_core/abc/__init__.py b/bot/src/bot_core/abc/__init__.py similarity index 100% rename from kdb-bot/src/bot_core/abc/__init__.py rename to bot/src/bot_core/abc/__init__.py diff --git a/kdb-bot/src/bot_core/abc/client_utils_abc.py b/bot/src/bot_core/abc/client_utils_abc.py similarity index 86% rename from kdb-bot/src/bot_core/abc/client_utils_abc.py rename to bot/src/bot_core/abc/client_utils_abc.py index 045228cb..9dd50401 100644 --- a/kdb-bot/src/bot_core/abc/client_utils_abc.py +++ b/bot/src/bot_core/abc/client_utils_abc.py @@ -45,7 +45,9 @@ class ClientUtilsABC(ABC): pass @abstractmethod - def get_auto_complete_list(self, _l: List, current: str, select: Callable = None) -> List: + def get_auto_complete_list( + self, _l: List, current: str, select: Callable = None + ) -> List: pass @abstractmethod @@ -64,7 +66,11 @@ class ClientUtilsABC(ABC): @abstractmethod async def react_to_message_by_auto_role_rule( - self, discord_channel_id: int, discord_message_id: int, rule: AutoRoleRule, guild: discord.Guild + self, + discord_channel_id: int, + discord_message_id: int, + rule: AutoRoleRule, + guild: discord.Guild, ): pass diff --git a/kdb-bot/src/bot_core/abc/custom_file_logger_abc.py b/bot/src/bot_core/abc/custom_file_logger_abc.py similarity index 92% rename from kdb-bot/src/bot_core/abc/custom_file_logger_abc.py rename to bot/src/bot_core/abc/custom_file_logger_abc.py index 2b2bbe0a..670b90e6 100644 --- a/kdb-bot/src/bot_core/abc/custom_file_logger_abc.py +++ b/bot/src/bot_core/abc/custom_file_logger_abc.py @@ -18,7 +18,9 @@ class CustomFileLoggerABC(Logger, ABC): env: ApplicationEnvironmentABC, ): self._key = key - self._settings: LoggingSettings = config.get_configuration(f"{FileLoggingSettings.__name__}_{key}") + self._settings: LoggingSettings = config.get_configuration( + f"{FileLoggingSettings.__name__}_{key}" + ) Logger.__init__(self, self._settings, time_format, env) self._begin_log() @@ -32,7 +34,9 @@ class CustomFileLoggerABC(Logger, ABC): self.info(__name__, f"Starting...") self._console = LoggingLevelEnum(console_level) - def _get_string(self, name_list_as_str: str, level: LoggingLevelEnum, message: str) -> str: + def _get_string( + self, name_list_as_str: str, level: LoggingLevelEnum, message: str + ) -> str: names = name_list_as_str.split(" ") log_level = level.name string = f"<{self._get_datetime_now()}> [ {log_level} ]" diff --git a/kdb-bot/src/bot_core/abc/message_service_abc.py b/bot/src/bot_core/abc/message_service_abc.py similarity index 92% rename from kdb-bot/src/bot_core/abc/message_service_abc.py rename to bot/src/bot_core/abc/message_service_abc.py index 3dada9a3..019c8b6a 100644 --- a/kdb-bot/src/bot_core/abc/message_service_abc.py +++ b/bot/src/bot_core/abc/message_service_abc.py @@ -13,7 +13,9 @@ class MessageServiceABC(ABC): pass @abstractmethod - async def delete_messages(self, messages: List[discord.Message], guild_id: int, without_tracking=False): + async def delete_messages( + self, messages: List[discord.Message], guild_id: int, without_tracking=False + ): pass @abstractmethod diff --git a/kdb-bot/src/bot_core/abc/module_abc.py b/bot/src/bot_core/abc/module_abc.py similarity index 100% rename from kdb-bot/src/bot_core/abc/module_abc.py rename to bot/src/bot_core/abc/module_abc.py diff --git a/kdb-bot/src/bot_core/abc/task_abc.py b/bot/src/bot_core/abc/task_abc.py similarity index 85% rename from kdb-bot/src/bot_core/abc/task_abc.py rename to bot/src/bot_core/abc/task_abc.py index d068fd37..bb684d8e 100644 --- a/kdb-bot/src/bot_core/abc/task_abc.py +++ b/bot/src/bot_core/abc/task_abc.py @@ -15,7 +15,9 @@ class TaskABC(commands.Cog): commands.Cog.__init__(self) @ServiceProviderABC.inject - async def _wait_until_ready(self, config: ConfigurationABC, logger: TaskLogger, bot: DiscordBotServiceABC): + async def _wait_until_ready( + self, config: ConfigurationABC, logger: TaskLogger, bot: DiscordBotServiceABC + ): logger.debug(__name__, f"Waiting before {type(self).__name__}") await bot.wait_until_ready() diff --git a/kdb-bot/src/bot_core/bot-core.json b/bot/src/bot_core/bot-core.json similarity index 100% rename from kdb-bot/src/bot_core/bot-core.json rename to bot/src/bot_core/bot-core.json diff --git a/kdb-bot/src/bot_core/configuration/__init__.py b/bot/src/bot_core/configuration/__init__.py similarity index 100% rename from kdb-bot/src/bot_core/configuration/__init__.py rename to bot/src/bot_core/configuration/__init__.py diff --git a/kdb-bot/src/bot_core/configuration/bot_logging_settings.py b/bot/src/bot_core/configuration/bot_logging_settings.py similarity index 100% rename from kdb-bot/src/bot_core/configuration/bot_logging_settings.py rename to bot/src/bot_core/configuration/bot_logging_settings.py diff --git a/kdb-bot/src/bot_core/configuration/feature_flags_enum.py b/bot/src/bot_core/configuration/feature_flags_enum.py similarity index 100% rename from kdb-bot/src/bot_core/configuration/feature_flags_enum.py rename to bot/src/bot_core/configuration/feature_flags_enum.py diff --git a/kdb-bot/src/bot_core/configuration/feature_flags_settings.py b/bot/src/bot_core/configuration/feature_flags_settings.py similarity index 100% rename from kdb-bot/src/bot_core/configuration/feature_flags_settings.py rename to bot/src/bot_core/configuration/feature_flags_settings.py diff --git a/kdb-bot/src/bot_core/configuration/file_logging_settings.py b/bot/src/bot_core/configuration/file_logging_settings.py similarity index 78% rename from kdb-bot/src/bot_core/configuration/file_logging_settings.py rename to bot/src/bot_core/configuration/file_logging_settings.py index 46028aa5..1e694363 100644 --- a/kdb-bot/src/bot_core/configuration/file_logging_settings.py +++ b/bot/src/bot_core/configuration/file_logging_settings.py @@ -10,7 +10,9 @@ class FileLoggingSettings(LoggingSettings): console_log_level: LoggingLevelEnum = None, file_log_level: LoggingLevelEnum = None, ): - LoggingSettings.__init__(self, path, filename, console_log_level, file_log_level) + LoggingSettings.__init__( + self, path, filename, console_log_level, file_log_level + ) self._key = key diff --git a/kdb-bot/src/bot_core/core_extension/__init__.py b/bot/src/bot_core/core_extension/__init__.py similarity index 100% rename from kdb-bot/src/bot_core/core_extension/__init__.py rename to bot/src/bot_core/core_extension/__init__.py diff --git a/kdb-bot/src/bot_core/core_extension/core_extension.py b/bot/src/bot_core/core_extension/core_extension.py similarity index 96% rename from kdb-bot/src/bot_core/core_extension/core_extension.py rename to bot/src/bot_core/core_extension/core_extension.py index de5a1781..ede39c5c 100644 --- a/kdb-bot/src/bot_core/core_extension/core_extension.py +++ b/bot/src/bot_core/core_extension/core_extension.py @@ -17,7 +17,9 @@ class CoreExtension(ApplicationExtensionABC): ApplicationExtensionABC.__init__(self) async def run(self, config: ConfigurationABC, services: ServiceProviderABC): - feature_flags: FeatureFlagsSettings = config.get_configuration(FeatureFlagsSettings) + feature_flags: FeatureFlagsSettings = config.get_configuration( + FeatureFlagsSettings + ) if not feature_flags.get_flag(FeatureFlagsEnum.core_module): return diff --git a/kdb-bot/src/bot_core/core_extension/core_extension_module.py b/bot/src/bot_core/core_extension/core_extension_module.py similarity index 67% rename from kdb-bot/src/bot_core/core_extension/core_extension_module.py rename to bot/src/bot_core/core_extension/core_extension_module.py index ef16529f..e780a721 100644 --- a/kdb-bot/src/bot_core/core_extension/core_extension_module.py +++ b/bot/src/bot_core/core_extension/core_extension_module.py @@ -15,8 +15,14 @@ class CoreExtensionModule(ModuleABC): def __init__(self, dc: DiscordCollectionABC): ModuleABC.__init__(self, dc, FeatureFlagsEnum.core_extension_module) - def configure_configuration(self, config: ConfigurationABC, env: ApplicationEnvironmentABC): + def configure_configuration( + self, config: ConfigurationABC, env: ApplicationEnvironmentABC + ): pass - def configure_services(self, services: ServiceCollectionABC, env: ApplicationEnvironmentABC): - services.add_transient(DiscordEventTypesEnum.on_ready.value, CoreExtensionOnReadyEvent) + def configure_services( + self, services: ServiceCollectionABC, env: ApplicationEnvironmentABC + ): + services.add_transient( + DiscordEventTypesEnum.on_ready.value, CoreExtensionOnReadyEvent + ) diff --git a/kdb-bot/src/bot_core/core_extension/core_extension_on_ready_event.py b/bot/src/bot_core/core_extension/core_extension_on_ready_event.py similarity index 100% rename from kdb-bot/src/bot_core/core_extension/core_extension_on_ready_event.py rename to bot/src/bot_core/core_extension/core_extension_on_ready_event.py diff --git a/kdb-bot/src/bot_core/core_module.py b/bot/src/bot_core/core_module.py similarity index 87% rename from kdb-bot/src/bot_core/core_module.py rename to bot/src/bot_core/core_module.py index 02611684..def17448 100644 --- a/kdb-bot/src/bot_core/core_module.py +++ b/bot/src/bot_core/core_module.py @@ -20,10 +20,14 @@ class CoreModule(ModuleABC): def __init__(self, dc: DiscordCollectionABC): ModuleABC.__init__(self, dc, FeatureFlagsEnum.core_module) - def configure_configuration(self, config: ConfigurationABC, env: ApplicationEnvironmentABC): + def configure_configuration( + self, config: ConfigurationABC, env: ApplicationEnvironmentABC + ): pass - def configure_services(self, services: ServiceCollectionABC, env: ApplicationEnvironmentABC): + def configure_services( + self, services: ServiceCollectionABC, env: ApplicationEnvironmentABC + ): services.add_transient(ConfigService) services.add_transient(MessageServiceABC, MessageService) services.add_transient(ClientUtilsABC, ClientUtilsService) diff --git a/kdb-bot/src/bot_core/events/__init__.py b/bot/src/bot_core/events/__init__.py similarity index 100% rename from kdb-bot/src/bot_core/events/__init__.py rename to bot/src/bot_core/events/__init__.py diff --git a/kdb-bot/src/bot_core/events/core_on_ready_event.py b/bot/src/bot_core/events/core_on_ready_event.py similarity index 100% rename from kdb-bot/src/bot_core/events/core_on_ready_event.py rename to bot/src/bot_core/events/core_on_ready_event.py diff --git a/kdb-bot/src/bot_core/exception/__init__.py b/bot/src/bot_core/exception/__init__.py similarity index 100% rename from kdb-bot/src/bot_core/exception/__init__.py rename to bot/src/bot_core/exception/__init__.py diff --git a/kdb-bot/src/bot_core/exception/check_error.py b/bot/src/bot_core/exception/check_error.py similarity index 100% rename from kdb-bot/src/bot_core/exception/check_error.py rename to bot/src/bot_core/exception/check_error.py diff --git a/kdb-bot/src/bot_core/helper/__init__.py b/bot/src/bot_core/helper/__init__.py similarity index 100% rename from kdb-bot/src/bot_core/helper/__init__.py rename to bot/src/bot_core/helper/__init__.py diff --git a/kdb-bot/src/bot_core/helper/command_checks.py b/bot/src/bot_core/helper/command_checks.py similarity index 85% rename from kdb-bot/src/bot_core/helper/command_checks.py rename to bot/src/bot_core/helper/command_checks.py index e2048409..b6e6672c 100644 --- a/kdb-bot/src/bot_core/helper/command_checks.py +++ b/bot/src/bot_core/helper/command_checks.py @@ -44,7 +44,9 @@ class CommandChecks: async def check_is_member_admin(ctx: Context): has_permission = cls._permissions.is_member_admin(ctx.author) if not has_permission: - await cls._message_service.send_ctx_msg(ctx, cls._t.transform("common.no_permission_message")) + await cls._message_service.send_ctx_msg( + ctx, cls._t.transform("common.no_permission_message") + ) raise CheckError(f"Member {ctx.author.name} is not admin") return has_permission @@ -56,7 +58,9 @@ class CommandChecks: async def check_is_member_technician(ctx: Context): has_permission = cls._permissions.is_member_technician(ctx.author) if not has_permission: - await cls._message_service.send_ctx_msg(ctx, cls._t.transform("common.no_permission_message")) + await cls._message_service.send_ctx_msg( + ctx, cls._t.transform("common.no_permission_message") + ) raise CheckError(f"Member {ctx.author.name} is not technician") return has_permission @@ -68,7 +72,9 @@ class CommandChecks: async def check_is_member_moderator(ctx: Context): has_permission = cls._permissions.is_member_moderator(ctx.author) if not has_permission: - await cls._message_service.send_ctx_msg(ctx, cls._t.transform("common.no_permission_message")) + await cls._message_service.send_ctx_msg( + ctx, cls._t.transform("common.no_permission_message") + ) raise CheckError(f"Member {ctx.author.name} is not moderator") return has_permission diff --git a/kdb-bot/src/bot_core/helper/event_checks.py b/bot/src/bot_core/helper/event_checks.py similarity index 100% rename from kdb-bot/src/bot_core/helper/event_checks.py rename to bot/src/bot_core/helper/event_checks.py diff --git a/kdb-bot/src/bot_core/helper/log_message_helper.py b/bot/src/bot_core/helper/log_message_helper.py similarity index 100% rename from kdb-bot/src/bot_core/helper/log_message_helper.py rename to bot/src/bot_core/helper/log_message_helper.py diff --git a/kdb-bot/src/bot_core/logging/__init__.py b/bot/src/bot_core/logging/__init__.py similarity index 100% rename from kdb-bot/src/bot_core/logging/__init__.py rename to bot/src/bot_core/logging/__init__.py diff --git a/kdb-bot/src/bot_core/logging/command_logger.py b/bot/src/bot_core/logging/command_logger.py similarity index 100% rename from kdb-bot/src/bot_core/logging/command_logger.py rename to bot/src/bot_core/logging/command_logger.py diff --git a/kdb-bot/src/bot_core/logging/database_logger.py b/bot/src/bot_core/logging/database_logger.py similarity index 100% rename from kdb-bot/src/bot_core/logging/database_logger.py rename to bot/src/bot_core/logging/database_logger.py diff --git a/kdb-bot/src/bot_core/logging/message_logger.py b/bot/src/bot_core/logging/message_logger.py similarity index 100% rename from kdb-bot/src/bot_core/logging/message_logger.py rename to bot/src/bot_core/logging/message_logger.py diff --git a/kdb-bot/src/bot_core/logging/task_logger.py b/bot/src/bot_core/logging/task_logger.py similarity index 100% rename from kdb-bot/src/bot_core/logging/task_logger.py rename to bot/src/bot_core/logging/task_logger.py diff --git a/kdb-bot/src/bot_core/pipes/__init__.py b/bot/src/bot_core/pipes/__init__.py similarity index 100% rename from kdb-bot/src/bot_core/pipes/__init__.py rename to bot/src/bot_core/pipes/__init__.py diff --git a/kdb-bot/src/bot_core/pipes/date_time_offset_pipe.py b/bot/src/bot_core/pipes/date_time_offset_pipe.py similarity index 100% rename from kdb-bot/src/bot_core/pipes/date_time_offset_pipe.py rename to bot/src/bot_core/pipes/date_time_offset_pipe.py diff --git a/kdb-bot/src/bot_core/service/__init__.py b/bot/src/bot_core/service/__init__.py similarity index 100% rename from kdb-bot/src/bot_core/service/__init__.py rename to bot/src/bot_core/service/__init__.py diff --git a/kdb-bot/src/bot_core/service/client_utils_service.py b/bot/src/bot_core/service/client_utils_service.py similarity index 87% rename from kdb-bot/src/bot_core/service/client_utils_service.py rename to bot/src/bot_core/service/client_utils_service.py index e5bd200a..b215386c 100644 --- a/kdb-bot/src/bot_core/service/client_utils_service.py +++ b/bot/src/bot_core/service/client_utils_service.py @@ -62,28 +62,36 @@ class ClientUtilsService(ClientUtilsABC): def received_command(self, guild_id: int): server = self._servers.get_server_by_discord_id(guild_id) - client = self._clients.find_client_by_discord_id_and_server_id(self._bot.user.id, server.id) + client = self._clients.find_client_by_discord_id_and_server_id( + self._bot.user.id, server.id + ) client.received_command_count += 1 self._clients.update_client(client) self._db.save_changes() def moved_user(self, guild_id: int): server = self._servers.get_server_by_discord_id(guild_id) - client = self._clients.find_client_by_discord_id_and_server_id(self._bot.user.id, server.id) + client = self._clients.find_client_by_discord_id_and_server_id( + self._bot.user.id, server.id + ) client.moved_users_count += 1 self._clients.update_client(client) self._db.save_changes() def moved_users(self, guild_id: int, count: int): server = self._servers.get_server_by_discord_id(guild_id) - client = self._clients.find_client_by_discord_id_and_server_id(self._bot.user.id, server.id) + client = self._clients.find_client_by_discord_id_and_server_id( + self._bot.user.id, server.id + ) client.moved_users_count += count self._clients.update_client(client) self._db.save_changes() def get_client(self, dc_ic: int, guild_id: int): server = self._servers.get_server_by_discord_id(guild_id) - client = self._clients.find_client_by_discord_id_and_server_id(self._bot.user.id, server.id) + client = self._clients.find_client_by_discord_id_and_server_id( + self._bot.user.id, server.id + ) return client async def check_if_bot_is_ready_yet(self) -> bool: @@ -121,7 +129,9 @@ class ClientUtilsService(ClientUtilsABC): await self._bot.change_presence(activity=discord.Game(name=name)) self._logger.info(__name__, f"Set presence {name}") - def get_auto_complete_list(self, _l: List, current: str, select: Callable = None) -> List: + def get_auto_complete_list( + self, _l: List, current: str, select: Callable = None + ) -> List: if current != "": if select is None: select = lambda x: x @@ -144,7 +154,9 @@ class ClientUtilsService(ClientUtilsABC): ) -> bool: umcph = None try: - umcph = self._umcphs.find_user_message_count_per_hour_by_user_id_and_date(user.id, created_at) + umcph = self._umcphs.find_user_message_count_per_hour_by_user_id_and_date( + user.id, created_at + ) if umcph is None: self._umcphs.add_user_message_count_per_hour( UserMessageCountPerHour( @@ -157,7 +169,11 @@ class ClientUtilsService(ClientUtilsABC): self._db.save_changes() - umcph = self._umcphs.get_user_message_count_per_hour_by_user_id_and_date(user.id, created_at) + umcph = ( + self._umcphs.get_user_message_count_per_hour_by_user_id_and_date( + user.id, created_at + ) + ) except Exception as e: self._logger.error( __name__, @@ -189,20 +205,30 @@ class ClientUtilsService(ClientUtilsABC): def get_ontime_for_user(self, user: User) -> float: return round( - self._user_joined_voice_channel.get_user_joined_voice_channels_by_user_id(user.id) + self._user_joined_voice_channel.get_user_joined_voice_channels_by_user_id( + user.id + ) .where(lambda x: x.leaved_on is not None and x.joined_on is not None) .sum(lambda join: (join.leaved_on - join.joined_on).total_seconds() / 3600), 2, ) async def react_to_message_by_auto_role_rule( - self, discord_channel_id: int, discord_message_id: int, rule: AutoRoleRule, guild: discord.Guild + self, + discord_channel_id: int, + discord_message_id: int, + rule: AutoRoleRule, + guild: discord.Guild, ): try: guild: Guild = self._bot.guilds.where(lambda g: g == guild).single() channel = guild.get_channel(discord_channel_id) message = await channel.fetch_message(discord_message_id) - emoji = List(discord.Emoji, guild.emojis).where(lambda x: x.name == rule.emoji_name).single() + emoji = ( + List(discord.Emoji, guild.emojis) + .where(lambda x: x.name == rule.emoji_name) + .single() + ) if emoji is None: self._logger.debug(__name__, f"Emoji {rule.emoji_name} not found") @@ -222,7 +248,9 @@ class ClientUtilsService(ClientUtilsABC): async def check_default_role(self, member: Union[discord.User, discord.Member]): try: server = self._servers.get_server_by_discord_id(member.guild.id) - settings: ServerConfig = self._config.get_configuration(f"ServerConfig_{server.discord_id}") + settings: ServerConfig = self._config.get_configuration( + f"ServerConfig_{server.discord_id}" + ) if settings.default_role_id is None: return @@ -234,4 +262,6 @@ class ClientUtilsService(ClientUtilsABC): await member.add_roles(default_role) except Exception as e: - self._logger.error(__name__, f"Cannot check for default role for member {member.id}", e) + self._logger.error( + __name__, f"Cannot check for default role for member {member.id}", e + ) diff --git a/kdb-bot/src/bot_core/service/config_service.py b/bot/src/bot_core/service/config_service.py similarity index 89% rename from kdb-bot/src/bot_core/service/config_service.py rename to bot/src/bot_core/service/config_service.py index 6aa29b83..657d972d 100644 --- a/kdb-bot/src/bot_core/service/config_service.py +++ b/bot/src/bot_core/service/config_service.py @@ -28,7 +28,10 @@ class ConfigService: def reload_technician_config(self): technician_config = self._technician_config_repo.get_technician_config() self._config.add_configuration(TechnicianConfig, technician_config) - self._config.add_configuration(FeatureFlagsSettings, FeatureFlagsSettings(**technician_config.feature_flags)) + self._config.add_configuration( + FeatureFlagsSettings, + FeatureFlagsSettings(**technician_config.feature_flags), + ) async def reload_server_config(self, server: Server): if not self._server_config_repo.does_server_config_exists(server.id): @@ -36,5 +39,6 @@ class ConfigService: server_config = self._server_config_repo.get_server_config_by_server(server.id) self._config.add_configuration( - f"{type(server_config).__name__}_{server_config.server.discord_id}", server_config + f"{type(server_config).__name__}_{server_config.server.discord_id}", + server_config, ) diff --git a/kdb-bot/src/bot_core/service/data_integrity_service.py b/bot/src/bot_core/service/data_integrity_service.py similarity index 77% rename from kdb-bot/src/bot_core/service/data_integrity_service.py rename to bot/src/bot_core/service/data_integrity_service.py index 9a2e613e..f7090636 100644 --- a/kdb-bot/src/bot_core/service/data_integrity_service.py +++ b/bot/src/bot_core/service/data_integrity_service.py @@ -11,7 +11,9 @@ from bot_core.logging.database_logger import DatabaseLogger from bot_core.pipes.date_time_offset_pipe import DateTimeOffsetPipe from bot_data.abc.client_repository_abc import ClientRepositoryABC from bot_data.abc.known_user_repository_abc import KnownUserRepositoryABC -from bot_data.abc.user_joined_game_server_repository_abc import UserJoinedGameServerRepositoryABC +from bot_data.abc.user_joined_game_server_repository_abc import ( + UserJoinedGameServerRepositoryABC, +) from bot_data.abc.user_joined_server_repository_abc import UserJoinedServerRepositoryABC from bot_data.abc.user_joined_voice_channel_repository_abc import ( UserJoinedVoiceChannelRepositoryABC, @@ -65,12 +67,16 @@ class DataIntegrityService: self._is_for_shutdown = False def _check_known_users(self): - self._logger.debug(__name__, f"Start checking KnownUsers table, {len(self._bot.users)}") + self._logger.debug( + __name__, f"Start checking KnownUsers table, {len(self._bot.users)}" + ) for u in self._bot.users: u: discord.User = u try: if u.bot: - self._logger.trace(__name__, f"User {u.id} is ignored, because its a bot") + self._logger.trace( + __name__, f"User {u.id} is ignored, because its a bot" + ) continue user = self._known_users.find_user_by_discord_id(u.id) @@ -123,7 +129,9 @@ class DataIntegrityService: try: server: Server = self._servers.find_server_by_discord_id(g.id) if server is None: - self._logger.fatal(__name__, f"Server not found in database: {g.id}") + self._logger.fatal( + __name__, f"Server not found in database: {g.id}" + ) client = self._clients.find_client_by_server_id(server.id) if client is not None: @@ -134,7 +142,9 @@ class DataIntegrityService: f"Client for server {g.id} not found in database: {self._bot.user.id}", ) self._logger.debug(__name__, f"Add client: {self._bot.user.id}") - self._clients.add_client(Client(self._bot.user.id, 0, 0, 0, 0, 0, server)) + self._clients.add_client( + Client(self._bot.user.id, 0, 0, 0, 0, 0, server) + ) self._db_context.save_changes() client = self._clients.find_client_by_server_id(server.id) @@ -160,15 +170,21 @@ class DataIntegrityService: try: server = self._servers.find_server_by_discord_id(g.id) if server is None: - self._logger.fatal(__name__, f"Server not found in database: {g.id}") + self._logger.fatal( + __name__, f"Server not found in database: {g.id}" + ) for u in g.members: u: Union[discord.Member, discord.User] = u if u.bot: - self._logger.trace(__name__, f"User {u.id} is ignored, because its a bot") + self._logger.trace( + __name__, f"User {u.id} is ignored, because its a bot" + ) continue - user = self._users.find_user_by_discord_id_and_server_id(u.id, server.id) + user = self._users.find_user_by_discord_id_and_server_id( + u.id, server.id + ) if user is not None: continue @@ -192,20 +208,30 @@ class DataIntegrityService: server = self._servers.find_server_by_discord_id(guild.id) if server is None: - self._logger.fatal(__name__, f"Server not found in database: {guild.id}") + self._logger.fatal( + __name__, f"Server not found in database: {guild.id}" + ) try: for u in guild.members: u: discord.User = u if u.bot: - self._logger.trace(__name__, f"User {u.id} is ignored, because its a bot") + self._logger.trace( + __name__, f"User {u.id} is ignored, because its a bot" + ) continue - user = self._users.find_user_by_discord_id_and_server_id(u.id, server.id) + user = self._users.find_user_by_discord_id_and_server_id( + u.id, server.id + ) if user is None: - self._logger.fatal(__name__, f"User not found in database: {u.id}") + self._logger.fatal( + __name__, f"User not found in database: {u.id}" + ) - join = self._user_joins.find_active_user_joined_server_by_user_id(user.id) + join = self._user_joins.find_active_user_joined_server_by_user_id( + user.id + ) if join is not None: continue @@ -255,24 +281,36 @@ class DataIntegrityService: self._logger.debug(__name__, f"Start checking UserJoinedVoiceChannel table") for guild in self._bot.guilds: guild: discord.Guild = guild - settings: ServerConfig = self._config.get_configuration(f"ServerConfig_{guild.id}") + settings: ServerConfig = self._config.get_configuration( + f"ServerConfig_{guild.id}" + ) server = self._servers.find_server_by_discord_id(guild.id) if server is None: - self._logger.fatal(__name__, f"Server not found in database: {guild.id}") + self._logger.fatal( + __name__, f"Server not found in database: {guild.id}" + ) try: # close open voice states for member in guild.members: if member.bot: - self._logger.trace(__name__, f"User {member.id} is ignored, because its a bot") + self._logger.trace( + __name__, f"User {member.id} is ignored, because its a bot" + ) continue - user = self._users.find_user_by_discord_id_and_server_id(member.id, server.id) + user = self._users.find_user_by_discord_id_and_server_id( + member.id, server.id + ) if user is None: - self._logger.fatal(__name__, f"User not found in database: {member.id}") + self._logger.fatal( + __name__, f"User not found in database: {member.id}" + ) - joins = self._user_joins_vc.find_active_user_joined_voice_channels_by_user_id(user.id) + joins = self._user_joins_vc.find_active_user_joined_voice_channels_by_user_id( + user.id + ) if joins is None or len(joins) == 0: continue @@ -286,7 +324,9 @@ class DataIntegrityService: if ( (join.leaved_on - join.joined_on).total_seconds() / 60 / 60 ) > settings.max_voice_state_hours: - join.leaved_on = join.joined_on + timedelta(hours=settings.max_voice_state_hours) + join.leaved_on = join.joined_on + timedelta( + hours=settings.max_voice_state_hours + ) self._user_joins_vc.update_user_joined_voice_channel(join) @@ -301,17 +341,28 @@ class DataIntegrityService: # add open voice states for member in guild.members: if member.bot: - self._logger.trace(__name__, f"User {member.id} is ignored, because its a bot") + self._logger.trace( + __name__, f"User {member.id} is ignored, because its a bot" + ) continue - if member.voice is None or member.voice.channel.id in settings.afk_channel_ids: + if ( + member.voice is None + or member.voice.channel.id in settings.afk_channel_ids + ): continue - user = self._users.find_user_by_discord_id_and_server_id(member.id, server.id) + user = self._users.find_user_by_discord_id_and_server_id( + member.id, server.id + ) if user is None: - self._logger.fatal(__name__, f"User not found in database: {member.id}") + self._logger.fatal( + __name__, f"User not found in database: {member.id}" + ) - join = UserJoinedVoiceChannel(user, member.voice.channel.id, datetime.now()) + join = UserJoinedVoiceChannel( + user, member.voice.channel.id, datetime.now() + ) self._user_joins_vc.add_user_joined_voice_channel(join) self._db_context.save_changes() @@ -325,19 +376,29 @@ class DataIntegrityService: server = self._servers.find_server_by_discord_id(guild.id) if server is None: - self._logger.fatal(__name__, f"Server not found in database: {guild.id}") + self._logger.fatal( + __name__, f"Server not found in database: {guild.id}" + ) try: for member in guild.members: if member.bot: - self._logger.trace(__name__, f"User {member.id} is ignored, because its a bot") + self._logger.trace( + __name__, f"User {member.id} is ignored, because its a bot" + ) continue - user = self._users.find_user_by_discord_id_and_server_id(member.id, server.id) + user = self._users.find_user_by_discord_id_and_server_id( + member.id, server.id + ) if user is None: - self._logger.fatal(__name__, f"User not found in database: {member.id}") + self._logger.fatal( + __name__, f"User not found in database: {member.id}" + ) - joins = self._user_joined_gs.find_active_user_joined_game_servers_by_user_id(user.id) + joins = self._user_joined_gs.find_active_user_joined_game_servers_by_user_id( + user.id + ) if joins is None or len(joins) == 0: continue @@ -347,12 +408,16 @@ class DataIntegrityService: f"Active UserJoinedGameServer found in database: {guild.id}:{member.id}@{join.joined_on}", ) join.leaved_on = datetime.now() - settings: ServerConfig = self._config.get_configuration(f"ServerConfig_{guild.id}") + settings: ServerConfig = self._config.get_configuration( + f"ServerConfig_{guild.id}" + ) if ( (join.leaved_on - join.joined_on).total_seconds() / 60 / 60 ) > settings.max_voice_state_hours: - join.leaved_on = join.joined_on + timedelta(hours=settings.max_voice_state_hours) + join.leaved_on = join.joined_on + timedelta( + hours=settings.max_voice_state_hours + ) self._user_joined_gs.update_user_joined_game_server(join) if self._is_for_shutdown: @@ -369,16 +434,24 @@ class DataIntegrityService: for guild in self._bot.guilds: server = self._servers.find_server_by_discord_id(guild.id) if server is None: - self._logger.fatal(__name__, f"Server not found in database: {guild.id}") + self._logger.fatal( + __name__, f"Server not found in database: {guild.id}" + ) for member in guild.members: if member.bot: - self._logger.trace(__name__, f"User {member.id} is ignored, because its a bot") + self._logger.trace( + __name__, f"User {member.id} is ignored, because its a bot" + ) continue - user = self._users.find_user_by_discord_id_and_server_id(member.id, server.id) + user = self._users.find_user_by_discord_id_and_server_id( + member.id, server.id + ) if user is None: - self._logger.fatal(__name__, f"User not found in database: {member.id}") + self._logger.fatal( + __name__, f"User not found in database: {member.id}" + ) await self._achievements.validate_achievements_for_user(user) diff --git a/kdb-bot/src/bot_core/service/message_service.py b/bot/src/bot_core/service/message_service.py similarity index 70% rename from kdb-bot/src/bot_core/service/message_service.py rename to bot/src/bot_core/service/message_service.py index 9140742f..060d5495 100644 --- a/kdb-bot/src/bot_core/service/message_service.py +++ b/bot/src/bot_core/service/message_service.py @@ -31,15 +31,23 @@ class MessageService(MessageServiceABC): self._clients = clients self._db = db - async def delete_messages(self, messages: List[discord.Message], guild_id: int, without_tracking=False): + async def delete_messages( + self, messages: List[discord.Message], guild_id: int, without_tracking=False + ): self._logger.debug(__name__, f"Try to delete {messages.count()} messages") - server_st: ServerConfig = self._config.get_configuration(f"ServerConfig_{guild_id}") + server_st: ServerConfig = self._config.get_configuration( + f"ServerConfig_{guild_id}" + ) await asyncio.sleep(server_st.message_delete_timer) for message in messages: - await self.delete_message(message, mass_delete=True, without_tracking=without_tracking) + await self.delete_message( + message, mass_delete=True, without_tracking=without_tracking + ) self._logger.debug(__name__, "Deleting messages finished") - async def delete_message(self, message: discord.Message, mass_delete=False, without_tracking=False): + async def delete_message( + self, message: discord.Message, mass_delete=False, without_tracking=False + ): guild_id = ( message.guild.id if message.guild is not None @@ -50,7 +58,9 @@ class MessageService(MessageServiceABC): else None ) - server_st: ServerConfig = self._config.get_configuration(f"ServerConfig_{guild_id}") + server_st: ServerConfig = self._config.get_configuration( + f"ServerConfig_{guild_id}" + ) if not mass_delete: await asyncio.sleep(server_st.message_delete_timer) self._logger.debug( @@ -64,7 +74,9 @@ class MessageService(MessageServiceABC): self._logger.error(__name__, f"Deleting message failed", e) else: if not without_tracking: - self._clients.append_deleted_message_count(self._bot.user.id, guild_id, 1) + self._clients.append_deleted_message_count( + self._bot.user.id, guild_id, 1 + ) self._db.save_changes() self._logger.info(__name__, f"Deleted message {message}") @@ -76,7 +88,9 @@ class MessageService(MessageServiceABC): wait_before_delete: int = None, without_tracking=False, ): - self._logger.debug(__name__, f"Try to send message\n\t{message}\n\tto: {channel}") + self._logger.debug( + __name__, f"Try to send message\n\t{message}\n\tto: {channel}" + ) msg = None try: if isinstance(message, discord.Embed): @@ -86,11 +100,15 @@ class MessageService(MessageServiceABC): else: msg = await channel.send(message) except Exception as e: - self._logger.error(__name__, f"Send message to channel {channel.id} failed", e) + self._logger.error( + __name__, f"Send message to channel {channel.id} failed", e + ) else: self._logger.info(__name__, f"Sent message to channel {channel.id}") if not without_tracking: - self._clients.append_sent_message_count(self._bot.user.id, channel.guild.id, 1) + self._clients.append_sent_message_count( + self._bot.user.id, channel.guild.id, 1 + ) self._db.save_changes() if wait_before_delete is not None: @@ -107,17 +125,23 @@ class MessageService(MessageServiceABC): receiver: Union[discord.User, discord.Member], without_tracking=False, ): - self._logger.debug(__name__, f"Try to send message\n\t{message}\n\tto: {receiver}") + self._logger.debug( + __name__, f"Try to send message\n\t{message}\n\tto: {receiver}" + ) try: if isinstance(message, discord.Embed): msg = await receiver.send(embed=message) else: msg = await receiver.send(message) except Exception as e: - self._logger.error(__name__, f"Send message to user {receiver.id} failed", e) + self._logger.error( + __name__, f"Send message to user {receiver.id} failed", e + ) else: if not without_tracking: - self._clients.append_sent_message_count(self._bot.user.id, receiver.guild.id, 1) + self._clients.append_sent_message_count( + self._bot.user.id, receiver.guild.id, 1 + ) self._db.save_changes() self._logger.info(__name__, f"Sent message to user {receiver.id}") @@ -136,7 +160,9 @@ class MessageService(MessageServiceABC): self._logger.debug(__name__, f"Message: {message}") return None - self._logger.debug(__name__, f"Try to send message\t\t{message}\n\tto: {ctx.channel}") + self._logger.debug( + __name__, f"Try to send message\t\t{message}\n\tto: {ctx.channel}" + ) msg = None try: if isinstance(message, discord.Embed): @@ -144,11 +170,15 @@ class MessageService(MessageServiceABC): else: msg = await ctx.send(message, file=file, ephemeral=not is_public) except Exception as e: - self._logger.error(__name__, f"Send message to channel {ctx.channel.id} failed", e) + self._logger.error( + __name__, f"Send message to channel {ctx.channel.id} failed", e + ) else: self._logger.info(__name__, f"Sent message to channel {ctx.channel.id}") if not without_tracking and ctx.guild is not None: - self._clients.append_sent_message_count(self._bot.user.id, ctx.guild.id, 1) + self._clients.append_sent_message_count( + self._bot.user.id, ctx.guild.id, 1 + ) self._db.save_changes() if wait_before_delete is not None: @@ -177,18 +207,30 @@ class MessageService(MessageServiceABC): self._logger.debug(__name__, f"Message: {message}") return - self._logger.debug(__name__, f"Try to send message\t\t{message}\n\tto: {interaction.channel}") + self._logger.debug( + __name__, f"Try to send message\t\t{message}\n\tto: {interaction.channel}" + ) try: if isinstance(message, discord.Embed): - await interaction.response.send_message(embed=message, ephemeral=not is_public, **kwargs) + await interaction.response.send_message( + embed=message, ephemeral=not is_public, **kwargs + ) else: - await interaction.response.send_message(message, ephemeral=not is_public, **kwargs) + await interaction.response.send_message( + message, ephemeral=not is_public, **kwargs + ) except Exception as e: - self._logger.error(__name__, f"Send message to channel {interaction.channel.id} failed", e) + self._logger.error( + __name__, f"Send message to channel {interaction.channel.id} failed", e + ) else: - self._logger.info(__name__, f"Sent message to channel {interaction.channel.id}") + self._logger.info( + __name__, f"Sent message to channel {interaction.channel.id}" + ) if not without_tracking and interaction.guild is not None: - self._clients.append_sent_message_count(self._bot.user.id, interaction.guild.id, 1) + self._clients.append_sent_message_count( + self._bot.user.id, interaction.guild.id, 1 + ) self._db.save_changes() if wait_before_delete is not None: @@ -197,4 +239,6 @@ class MessageService(MessageServiceABC): if is_persistent: return - await self.delete_message(await interaction.original_response(), without_tracking) + await self.delete_message( + await interaction.original_response(), without_tracking + ) diff --git a/kdb-bot/src/bot_data/__init__.py b/bot/src/bot_data/__init__.py similarity index 100% rename from kdb-bot/src/bot_data/__init__.py rename to bot/src/bot_data/__init__.py diff --git a/kdb-bot/src/bot_data/abc/__init__.py b/bot/src/bot_data/abc/__init__.py similarity index 100% rename from kdb-bot/src/bot_data/abc/__init__.py rename to bot/src/bot_data/abc/__init__.py diff --git a/kdb-bot/src/bot_data/abc/achievement_repository_abc.py b/bot/src/bot_data/abc/achievement_repository_abc.py similarity index 91% rename from kdb-bot/src/bot_data/abc/achievement_repository_abc.py rename to bot/src/bot_data/abc/achievement_repository_abc.py index ff3014fe..e1cc6c4e 100644 --- a/kdb-bot/src/bot_data/abc/achievement_repository_abc.py +++ b/bot/src/bot_data/abc/achievement_repository_abc.py @@ -28,7 +28,9 @@ class AchievementRepositoryABC(ABC): pass @abstractmethod - def get_user_got_achievements_by_achievement_id(self, achievement_id: int) -> List[Achievement]: + def get_user_got_achievements_by_achievement_id( + self, achievement_id: int + ) -> List[Achievement]: pass @abstractmethod diff --git a/kdb-bot/src/bot_data/abc/api_key_repository_abc.py b/bot/src/bot_data/abc/api_key_repository_abc.py similarity index 100% rename from kdb-bot/src/bot_data/abc/api_key_repository_abc.py rename to bot/src/bot_data/abc/api_key_repository_abc.py diff --git a/kdb-bot/src/bot_data/abc/auth_user_repository_abc.py b/bot/src/bot_data/abc/auth_user_repository_abc.py similarity index 94% rename from kdb-bot/src/bot_data/abc/auth_user_repository_abc.py rename to bot/src/bot_data/abc/auth_user_repository_abc.py index 9d9b06ec..0dc7eeaf 100644 --- a/kdb-bot/src/bot_data/abc/auth_user_repository_abc.py +++ b/bot/src/bot_data/abc/auth_user_repository_abc.py @@ -23,7 +23,9 @@ class AuthUserRepositoryABC(ABC): pass @abstractmethod - def get_filtered_auth_users(self, criteria: AuthUserSelectCriteria) -> FilteredResult: + def get_filtered_auth_users( + self, criteria: AuthUserSelectCriteria + ) -> FilteredResult: pass @abstractmethod diff --git a/kdb-bot/src/bot_data/abc/auto_role_repository_abc.py b/bot/src/bot_data/abc/auto_role_repository_abc.py similarity index 100% rename from kdb-bot/src/bot_data/abc/auto_role_repository_abc.py rename to bot/src/bot_data/abc/auto_role_repository_abc.py diff --git a/kdb-bot/src/bot_data/abc/client_repository_abc.py b/bot/src/bot_data/abc/client_repository_abc.py similarity index 93% rename from kdb-bot/src/bot_data/abc/client_repository_abc.py rename to bot/src/bot_data/abc/client_repository_abc.py index 3b9f9132..40cf8033 100644 --- a/kdb-bot/src/bot_data/abc/client_repository_abc.py +++ b/bot/src/bot_data/abc/client_repository_abc.py @@ -36,7 +36,9 @@ class ClientRepositoryABC(ABC): pass @abstractmethod - def find_client_by_discord_id_and_server_id(self, discord_id: int, server_id: int) -> Optional[Client]: + def find_client_by_discord_id_and_server_id( + self, discord_id: int, server_id: int + ) -> Optional[Client]: pass @abstractmethod diff --git a/kdb-bot/src/bot_data/abc/data_seeder_abc.py b/bot/src/bot_data/abc/data_seeder_abc.py similarity index 100% rename from kdb-bot/src/bot_data/abc/data_seeder_abc.py rename to bot/src/bot_data/abc/data_seeder_abc.py diff --git a/kdb-bot/src/bot_data/abc/game_server_repository_abc.py b/bot/src/bot_data/abc/game_server_repository_abc.py similarity index 100% rename from kdb-bot/src/bot_data/abc/game_server_repository_abc.py rename to bot/src/bot_data/abc/game_server_repository_abc.py diff --git a/kdb-bot/src/bot_data/abc/history_table_abc.py b/bot/src/bot_data/abc/history_table_abc.py similarity index 100% rename from kdb-bot/src/bot_data/abc/history_table_abc.py rename to bot/src/bot_data/abc/history_table_abc.py diff --git a/kdb-bot/src/bot_data/abc/known_user_repository_abc.py b/bot/src/bot_data/abc/known_user_repository_abc.py similarity index 100% rename from kdb-bot/src/bot_data/abc/known_user_repository_abc.py rename to bot/src/bot_data/abc/known_user_repository_abc.py diff --git a/kdb-bot/src/bot_data/abc/level_repository_abc.py b/bot/src/bot_data/abc/level_repository_abc.py similarity index 100% rename from kdb-bot/src/bot_data/abc/level_repository_abc.py rename to bot/src/bot_data/abc/level_repository_abc.py diff --git a/kdb-bot/src/bot_data/abc/migration_abc.py b/bot/src/bot_data/abc/migration_abc.py similarity index 100% rename from kdb-bot/src/bot_data/abc/migration_abc.py rename to bot/src/bot_data/abc/migration_abc.py diff --git a/kdb-bot/src/bot_data/abc/server_config_repository_abc.py b/bot/src/bot_data/abc/server_config_repository_abc.py similarity index 64% rename from kdb-bot/src/bot_data/abc/server_config_repository_abc.py rename to bot/src/bot_data/abc/server_config_repository_abc.py index f66fdc89..6a5cd127 100644 --- a/kdb-bot/src/bot_data/abc/server_config_repository_abc.py +++ b/bot/src/bot_data/abc/server_config_repository_abc.py @@ -35,25 +35,37 @@ class ServerConfigRepositoryABC(ABC): pass @abstractmethod - def add_server_team_role_id_config(self, server_team_role_id: ServerTeamRoleIdsConfig): + def add_server_team_role_id_config( + self, server_team_role_id: ServerTeamRoleIdsConfig + ): pass @abstractmethod - def update_server_team_role_id_config(self, server_team_role_id: ServerTeamRoleIdsConfig): + def update_server_team_role_id_config( + self, server_team_role_id: ServerTeamRoleIdsConfig + ): pass @abstractmethod - def delete_server_team_role_id_config(self, server_team_role_id: ServerTeamRoleIdsConfig): + def delete_server_team_role_id_config( + self, server_team_role_id: ServerTeamRoleIdsConfig + ): pass @abstractmethod - def add_server_afk_channel_config(self, server_afk_channel: ServerAFKChannelIdsConfig): + def add_server_afk_channel_config( + self, server_afk_channel: ServerAFKChannelIdsConfig + ): pass @abstractmethod - def update_server_afk_channel_config(self, server_afk_channel: ServerAFKChannelIdsConfig): + def update_server_afk_channel_config( + self, server_afk_channel: ServerAFKChannelIdsConfig + ): pass @abstractmethod - def delete_server_afk_channel_config(self, server_afk_channel: ServerAFKChannelIdsConfig): + def delete_server_afk_channel_config( + self, server_afk_channel: ServerAFKChannelIdsConfig + ): pass diff --git a/kdb-bot/src/bot_data/abc/server_repository_abc.py b/bot/src/bot_data/abc/server_repository_abc.py similarity index 100% rename from kdb-bot/src/bot_data/abc/server_repository_abc.py rename to bot/src/bot_data/abc/server_repository_abc.py diff --git a/kdb-bot/src/bot_data/abc/short_role_name_repository_abc.py b/bot/src/bot_data/abc/short_role_name_repository_abc.py similarity index 100% rename from kdb-bot/src/bot_data/abc/short_role_name_repository_abc.py rename to bot/src/bot_data/abc/short_role_name_repository_abc.py diff --git a/kdb-bot/src/bot_data/abc/steam_special_offer_repository_abc.py b/bot/src/bot_data/abc/steam_special_offer_repository_abc.py similarity index 100% rename from kdb-bot/src/bot_data/abc/steam_special_offer_repository_abc.py rename to bot/src/bot_data/abc/steam_special_offer_repository_abc.py diff --git a/kdb-bot/src/bot_data/abc/table_with_id_abc.py b/bot/src/bot_data/abc/table_with_id_abc.py similarity index 100% rename from kdb-bot/src/bot_data/abc/table_with_id_abc.py rename to bot/src/bot_data/abc/table_with_id_abc.py diff --git a/kdb-bot/src/bot_data/abc/technician_config_repository_abc.py b/bot/src/bot_data/abc/technician_config_repository_abc.py similarity index 79% rename from kdb-bot/src/bot_data/abc/technician_config_repository_abc.py rename to bot/src/bot_data/abc/technician_config_repository_abc.py index 25c88d96..364af9b6 100644 --- a/kdb-bot/src/bot_data/abc/technician_config_repository_abc.py +++ b/bot/src/bot_data/abc/technician_config_repository_abc.py @@ -43,13 +43,19 @@ class TechnicianConfigRepositoryABC(ABC): pass @abstractmethod - def add_technician_ping_url_config(self, technician_ping_url: TechnicianPingUrlConfig): + def add_technician_ping_url_config( + self, technician_ping_url: TechnicianPingUrlConfig + ): pass @abstractmethod - def update_technician_ping_url_config(self, technician_ping_url: TechnicianPingUrlConfig): + def update_technician_ping_url_config( + self, technician_ping_url: TechnicianPingUrlConfig + ): pass @abstractmethod - def delete_technician_ping_url_config(self, technician_ping_url: TechnicianPingUrlConfig): + def delete_technician_ping_url_config( + self, technician_ping_url: TechnicianPingUrlConfig + ): pass diff --git a/kdb-bot/src/bot_data/abc/user_game_ident_repository_abc.py b/bot/src/bot_data/abc/user_game_ident_repository_abc.py similarity index 100% rename from kdb-bot/src/bot_data/abc/user_game_ident_repository_abc.py rename to bot/src/bot_data/abc/user_game_ident_repository_abc.py diff --git a/kdb-bot/src/bot_data/abc/user_joined_game_server_repository_abc.py b/bot/src/bot_data/abc/user_joined_game_server_repository_abc.py similarity index 51% rename from kdb-bot/src/bot_data/abc/user_joined_game_server_repository_abc.py rename to bot/src/bot_data/abc/user_joined_game_server_repository_abc.py index 97a0358b..c6c3cfcf 100644 --- a/kdb-bot/src/bot_data/abc/user_joined_game_server_repository_abc.py +++ b/bot/src/bot_data/abc/user_joined_game_server_repository_abc.py @@ -20,31 +20,45 @@ class UserJoinedGameServerRepositoryABC(ABC): pass @abstractmethod - def get_user_joined_game_servers_by_user_id(self, user_id: int) -> List[UserJoinedGameServer]: + def get_user_joined_game_servers_by_user_id( + self, user_id: int + ) -> List[UserJoinedGameServer]: pass @abstractmethod - def get_active_user_joined_game_server_by_user_id(self, user_id: int) -> UserJoinedGameServer: + def get_active_user_joined_game_server_by_user_id( + self, user_id: int + ) -> UserJoinedGameServer: pass @abstractmethod - def find_active_user_joined_game_server_by_user_id(self, user_id: int) -> Optional[UserJoinedGameServer]: + def find_active_user_joined_game_server_by_user_id( + self, user_id: int + ) -> Optional[UserJoinedGameServer]: pass @abstractmethod - def find_active_user_joined_game_servers_by_user_id(self, user_id: int) -> List[Optional[UserJoinedGameServer]]: + def find_active_user_joined_game_servers_by_user_id( + self, user_id: int + ) -> List[Optional[UserJoinedGameServer]]: pass @abstractmethod - def add_user_joined_game_server(self, user_joined_game_server: UserJoinedGameServer): + def add_user_joined_game_server( + self, user_joined_game_server: UserJoinedGameServer + ): pass @abstractmethod - def update_user_joined_game_server(self, user_joined_game_server: UserJoinedGameServer): + def update_user_joined_game_server( + self, user_joined_game_server: UserJoinedGameServer + ): pass @abstractmethod - def delete_user_joined_game_server(self, user_joined_game_server: UserJoinedGameServer): + def delete_user_joined_game_server( + self, user_joined_game_server: UserJoinedGameServer + ): pass @abstractmethod diff --git a/kdb-bot/src/bot_data/abc/user_joined_server_repository_abc.py b/bot/src/bot_data/abc/user_joined_server_repository_abc.py similarity index 76% rename from kdb-bot/src/bot_data/abc/user_joined_server_repository_abc.py rename to bot/src/bot_data/abc/user_joined_server_repository_abc.py index cbc3a718..d317b7b2 100644 --- a/kdb-bot/src/bot_data/abc/user_joined_server_repository_abc.py +++ b/bot/src/bot_data/abc/user_joined_server_repository_abc.py @@ -24,15 +24,21 @@ class UserJoinedServerRepositoryABC(ABC): pass @abstractmethod - def get_user_joined_servers_by_user_id(self, user_id: int) -> list[UserJoinedServer]: + def get_user_joined_servers_by_user_id( + self, user_id: int + ) -> list[UserJoinedServer]: pass @abstractmethod - def get_active_user_joined_server_by_user_id(self, user_id: int) -> UserJoinedServer: + def get_active_user_joined_server_by_user_id( + self, user_id: int + ) -> UserJoinedServer: pass @abstractmethod - def find_active_user_joined_server_by_user_id(self, user_id: int) -> Optional[UserJoinedServer]: + def find_active_user_joined_server_by_user_id( + self, user_id: int + ) -> Optional[UserJoinedServer]: pass @abstractmethod diff --git a/kdb-bot/src/bot_data/abc/user_joined_voice_channel_repository_abc.py b/bot/src/bot_data/abc/user_joined_voice_channel_repository_abc.py similarity index 50% rename from kdb-bot/src/bot_data/abc/user_joined_voice_channel_repository_abc.py rename to bot/src/bot_data/abc/user_joined_voice_channel_repository_abc.py index 7ce7e01a..793cfe33 100644 --- a/kdb-bot/src/bot_data/abc/user_joined_voice_channel_repository_abc.py +++ b/bot/src/bot_data/abc/user_joined_voice_channel_repository_abc.py @@ -19,31 +19,45 @@ class UserJoinedVoiceChannelRepositoryABC(ABC): pass @abstractmethod - def get_user_joined_voice_channels_by_user_id(self, user_id: int) -> List[UserJoinedVoiceChannel]: + def get_user_joined_voice_channels_by_user_id( + self, user_id: int + ) -> List[UserJoinedVoiceChannel]: pass @abstractmethod - def get_active_user_joined_voice_channel_by_user_id(self, user_id: int) -> UserJoinedVoiceChannel: + def get_active_user_joined_voice_channel_by_user_id( + self, user_id: int + ) -> UserJoinedVoiceChannel: pass @abstractmethod - def find_active_user_joined_voice_channel_by_user_id(self, user_id: int) -> Optional[UserJoinedVoiceChannel]: + def find_active_user_joined_voice_channel_by_user_id( + self, user_id: int + ) -> Optional[UserJoinedVoiceChannel]: pass @abstractmethod - def find_active_user_joined_voice_channels_by_user_id(self, user_id: int) -> List[Optional[UserJoinedVoiceChannel]]: + def find_active_user_joined_voice_channels_by_user_id( + self, user_id: int + ) -> List[Optional[UserJoinedVoiceChannel]]: pass @abstractmethod - def add_user_joined_voice_channel(self, user_joined_voice_channel: UserJoinedVoiceChannel): + def add_user_joined_voice_channel( + self, user_joined_voice_channel: UserJoinedVoiceChannel + ): pass @abstractmethod - def update_user_joined_voice_channel(self, user_joined_voice_channel: UserJoinedVoiceChannel): + def update_user_joined_voice_channel( + self, user_joined_voice_channel: UserJoinedVoiceChannel + ): pass @abstractmethod - def delete_user_joined_voice_channel(self, user_joined_voice_channel: UserJoinedVoiceChannel): + def delete_user_joined_voice_channel( + self, user_joined_voice_channel: UserJoinedVoiceChannel + ): pass @abstractmethod diff --git a/kdb-bot/src/bot_data/abc/user_message_count_per_hour_repository_abc.py b/bot/src/bot_data/abc/user_message_count_per_hour_repository_abc.py similarity index 91% rename from kdb-bot/src/bot_data/abc/user_message_count_per_hour_repository_abc.py rename to bot/src/bot_data/abc/user_message_count_per_hour_repository_abc.py index 59108387..778177fa 100644 --- a/kdb-bot/src/bot_data/abc/user_message_count_per_hour_repository_abc.py +++ b/bot/src/bot_data/abc/user_message_count_per_hour_repository_abc.py @@ -17,7 +17,9 @@ class UserMessageCountPerHourRepositoryABC(ABC): pass @abstractmethod - def find_user_message_count_per_hour_by_user_id(self, user_id: int) -> Optional[UserMessageCountPerHour]: + def find_user_message_count_per_hour_by_user_id( + self, user_id: int + ) -> Optional[UserMessageCountPerHour]: pass @abstractmethod diff --git a/kdb-bot/src/bot_data/abc/user_repository_abc.py b/bot/src/bot_data/abc/user_repository_abc.py similarity index 81% rename from kdb-bot/src/bot_data/abc/user_repository_abc.py rename to bot/src/bot_data/abc/user_repository_abc.py index 0e3ced21..1605e24d 100644 --- a/kdb-bot/src/bot_data/abc/user_repository_abc.py +++ b/bot/src/bot_data/abc/user_repository_abc.py @@ -32,11 +32,15 @@ class UserRepositoryABC(ABC): pass @abstractmethod - def get_user_by_discord_id_and_server_id(self, discord_id: int, server_id: int) -> User: + def get_user_by_discord_id_and_server_id( + self, discord_id: int, server_id: int + ) -> User: pass @abstractmethod - def find_user_by_discord_id_and_server_id(self, discord_id: int, server_id: int) -> Optional[User]: + def find_user_by_discord_id_and_server_id( + self, discord_id: int, server_id: int + ) -> Optional[User]: pass @abstractmethod diff --git a/kdb-bot/src/bot_data/abc/user_warnings_repository_abc.py b/bot/src/bot_data/abc/user_warnings_repository_abc.py similarity index 100% rename from kdb-bot/src/bot_data/abc/user_warnings_repository_abc.py rename to bot/src/bot_data/abc/user_warnings_repository_abc.py diff --git a/kdb-bot/src/bot_data/bot-data.json b/bot/src/bot_data/bot-data.json similarity index 100% rename from kdb-bot/src/bot_data/bot-data.json rename to bot/src/bot_data/bot-data.json diff --git a/kdb-bot/src/bot_data/data_module.py b/bot/src/bot_data/data_module.py similarity index 74% rename from kdb-bot/src/bot_data/data_module.py rename to bot/src/bot_data/data_module.py index 378216ed..ad38d4f6 100644 --- a/kdb-bot/src/bot_data/data_module.py +++ b/bot/src/bot_data/data_module.py @@ -17,10 +17,14 @@ from bot_data.abc.level_repository_abc import LevelRepositoryABC from bot_data.abc.server_config_repository_abc import ServerConfigRepositoryABC from bot_data.abc.server_repository_abc import ServerRepositoryABC from bot_data.abc.short_role_name_repository_abc import ShortRoleNameRepositoryABC -from bot_data.abc.steam_special_offer_repository_abc import SteamSpecialOfferRepositoryABC +from bot_data.abc.steam_special_offer_repository_abc import ( + SteamSpecialOfferRepositoryABC, +) from bot_data.abc.technician_config_repository_abc import TechnicianConfigRepositoryABC from bot_data.abc.user_game_ident_repository_abc import UserGameIdentRepositoryABC -from bot_data.abc.user_joined_game_server_repository_abc import UserJoinedGameServerRepositoryABC +from bot_data.abc.user_joined_game_server_repository_abc import ( + UserJoinedGameServerRepositoryABC, +) from bot_data.abc.user_joined_server_repository_abc import UserJoinedServerRepositoryABC from bot_data.abc.user_joined_voice_channel_repository_abc import ( UserJoinedVoiceChannelRepositoryABC, @@ -30,7 +34,9 @@ from bot_data.abc.user_message_count_per_hour_repository_abc import ( ) from bot_data.abc.user_repository_abc import UserRepositoryABC from bot_data.abc.user_warnings_repository_abc import UserWarningsRepositoryABC -from bot_data.service.achievements_repository_service import AchievementRepositoryService +from bot_data.service.achievements_repository_service import ( + AchievementRepositoryService, +) from bot_data.service.api_key_repository_service import ApiKeyRepositoryService from bot_data.service.auth_user_repository_service import AuthUserRepositoryService from bot_data.service.auto_role_repository_service import AutoRoleRepositoryService @@ -40,15 +46,27 @@ from bot_data.service.game_server_repository_service import GameServerRepository from bot_data.service.known_user_repository_service import KnownUserRepositoryService from bot_data.service.level_repository_service import LevelRepositoryService from bot_data.service.seeder_service import SeederService -from bot_data.service.server_config_repository_service import ServerConfigRepositoryService +from bot_data.service.server_config_repository_service import ( + ServerConfigRepositoryService, +) from bot_data.service.server_config_seeder import ServerConfigSeeder from bot_data.service.server_repository_service import ServerRepositoryService -from bot_data.service.short_role_name_repository_service import ShortRoleNameRepositoryService -from bot_data.service.steam_special_offer_repository_service import SteamSpecialOfferRepositoryService -from bot_data.service.technician_config_repository_service import TechnicianConfigRepositoryService +from bot_data.service.short_role_name_repository_service import ( + ShortRoleNameRepositoryService, +) +from bot_data.service.steam_special_offer_repository_service import ( + SteamSpecialOfferRepositoryService, +) +from bot_data.service.technician_config_repository_service import ( + TechnicianConfigRepositoryService, +) from bot_data.service.technician_config_seeder import TechnicianConfigSeeder -from bot_data.service.user_game_ident_repository_service import UserGameIdentRepositoryService -from bot_data.service.user_joined_game_server_repository_service import UserJoinedGameServerRepositoryService +from bot_data.service.user_game_ident_repository_service import ( + UserGameIdentRepositoryService, +) +from bot_data.service.user_joined_game_server_repository_service import ( + UserJoinedGameServerRepositoryService, +) from bot_data.service.user_joined_server_repository_service import ( UserJoinedServerRepositoryService, ) @@ -59,17 +77,23 @@ from bot_data.service.user_message_count_per_hour_repository_service import ( UserMessageCountPerHourRepositoryService, ) from bot_data.service.user_repository_service import UserRepositoryService -from bot_data.service.user_warnings_repository_service import UserWarningsRepositoryService +from bot_data.service.user_warnings_repository_service import ( + UserWarningsRepositoryService, +) class DataModule(ModuleABC): def __init__(self, dc: DiscordCollectionABC): ModuleABC.__init__(self, dc, FeatureFlagsEnum.data_module) - def configure_configuration(self, config: ConfigurationABC, env: ApplicationEnvironmentABC): + def configure_configuration( + self, config: ConfigurationABC, env: ApplicationEnvironmentABC + ): pass - def configure_services(self, services: ServiceCollectionABC, env: ApplicationEnvironmentABC): + def configure_services( + self, services: ServiceCollectionABC, env: ApplicationEnvironmentABC + ): services.add_singleton(CacheService) services.add_transient(ApiKeyRepositoryABC, ApiKeyRepositoryService) @@ -78,9 +102,15 @@ class DataModule(ModuleABC): services.add_transient(UserRepositoryABC, UserRepositoryService) services.add_transient(ClientRepositoryABC, ClientRepositoryService) services.add_transient(KnownUserRepositoryABC, KnownUserRepositoryService) - services.add_transient(UserJoinedServerRepositoryABC, UserJoinedServerRepositoryService) - services.add_transient(UserJoinedVoiceChannelRepositoryABC, UserJoinedVoiceChannelRepositoryService) - services.add_transient(UserJoinedGameServerRepositoryABC, UserJoinedGameServerRepositoryService) + services.add_transient( + UserJoinedServerRepositoryABC, UserJoinedServerRepositoryService + ) + services.add_transient( + UserJoinedVoiceChannelRepositoryABC, UserJoinedVoiceChannelRepositoryService + ) + services.add_transient( + UserJoinedGameServerRepositoryABC, UserJoinedGameServerRepositoryService + ) services.add_transient(AutoRoleRepositoryABC, AutoRoleRepositoryService) services.add_transient(LevelRepositoryABC, LevelRepositoryService) services.add_transient(UserWarningsRepositoryABC, UserWarningsRepositoryService) @@ -89,12 +119,20 @@ class DataModule(ModuleABC): UserMessageCountPerHourRepositoryService, ) services.add_transient(GameServerRepositoryABC, GameServerRepositoryService) - services.add_transient(UserGameIdentRepositoryABC, UserGameIdentRepositoryService) + services.add_transient( + UserGameIdentRepositoryABC, UserGameIdentRepositoryService + ) services.add_transient(AchievementRepositoryABC, AchievementRepositoryService) - services.add_transient(TechnicianConfigRepositoryABC, TechnicianConfigRepositoryService) + services.add_transient( + TechnicianConfigRepositoryABC, TechnicianConfigRepositoryService + ) services.add_transient(ServerConfigRepositoryABC, ServerConfigRepositoryService) - services.add_transient(ShortRoleNameRepositoryABC, ShortRoleNameRepositoryService) - services.add_transient(SteamSpecialOfferRepositoryABC, SteamSpecialOfferRepositoryService) + services.add_transient( + ShortRoleNameRepositoryABC, ShortRoleNameRepositoryService + ) + services.add_transient( + SteamSpecialOfferRepositoryABC, SteamSpecialOfferRepositoryService + ) services.add_transient(SeederService) services.add_transient(DataSeederABC, TechnicianConfigSeeder) diff --git a/kdb-bot/src/bot_data/db_context.py b/bot/src/bot_data/db_context.py similarity index 100% rename from kdb-bot/src/bot_data/db_context.py rename to bot/src/bot_data/db_context.py diff --git a/kdb-bot/src/bot_data/filtered_result.py b/bot/src/bot_data/filtered_result.py similarity index 100% rename from kdb-bot/src/bot_data/filtered_result.py rename to bot/src/bot_data/filtered_result.py diff --git a/kdb-bot/src/bot_data/migration/__init__.py b/bot/src/bot_data/migration/__init__.py similarity index 100% rename from kdb-bot/src/bot_data/migration/__init__.py rename to bot/src/bot_data/migration/__init__.py diff --git a/kdb-bot/src/bot_data/migration/achievements_migration.py b/bot/src/bot_data/migration/achievements_migration.py similarity index 84% rename from kdb-bot/src/bot_data/migration/achievements_migration.py rename to bot/src/bot_data/migration/achievements_migration.py index f3a454d3..b58299c2 100644 --- a/kdb-bot/src/bot_data/migration/achievements_migration.py +++ b/bot/src/bot_data/migration/achievements_migration.py @@ -74,12 +74,30 @@ class AchievementsMigration(MigrationABC): # A join table history between users and achievements is not necessary. - self._cursor.execute(str(f"""ALTER TABLE Users ADD MessageCount BIGINT NOT NULL DEFAULT 0 AFTER XP;""")) - self._cursor.execute(str(f"""ALTER TABLE Users ADD ReactionCount BIGINT NOT NULL DEFAULT 0 AFTER XP;""")) - self._cursor.execute(str(f"""ALTER TABLE UsersHistory ADD MessageCount BIGINT NOT NULL DEFAULT 0 AFTER XP;""")) - self._cursor.execute(str(f"""ALTER TABLE UsersHistory ADD ReactionCount BIGINT NOT NULL DEFAULT 0 AFTER XP;""")) + self._cursor.execute( + str( + f"""ALTER TABLE Users ADD MessageCount BIGINT NOT NULL DEFAULT 0 AFTER XP;""" + ) + ) + self._cursor.execute( + str( + f"""ALTER TABLE Users ADD ReactionCount BIGINT NOT NULL DEFAULT 0 AFTER XP;""" + ) + ) + self._cursor.execute( + str( + f"""ALTER TABLE UsersHistory ADD MessageCount BIGINT NOT NULL DEFAULT 0 AFTER XP;""" + ) + ) + self._cursor.execute( + str( + f"""ALTER TABLE UsersHistory ADD ReactionCount BIGINT NOT NULL DEFAULT 0 AFTER XP;""" + ) + ) - self._cursor.execute(str(f"""DROP TRIGGER IF EXISTS `TR_AchievementsUpdate`;""")) + self._cursor.execute( + str(f"""DROP TRIGGER IF EXISTS `TR_AchievementsUpdate`;""") + ) self._cursor.execute( str( f""" @@ -99,7 +117,9 @@ class AchievementsMigration(MigrationABC): ) ) - self._cursor.execute(str(f"""DROP TRIGGER IF EXISTS `TR_AchievementsDelete`;""")) + self._cursor.execute( + str(f"""DROP TRIGGER IF EXISTS `TR_AchievementsDelete`;""") + ) self._cursor.execute( str( diff --git a/kdb-bot/src/bot_data/migration/api_key_migration.py b/bot/src/bot_data/migration/api_key_migration.py similarity index 100% rename from kdb-bot/src/bot_data/migration/api_key_migration.py rename to bot/src/bot_data/migration/api_key_migration.py diff --git a/kdb-bot/src/bot_data/migration/api_migration.py b/bot/src/bot_data/migration/api_migration.py similarity index 100% rename from kdb-bot/src/bot_data/migration/api_migration.py rename to bot/src/bot_data/migration/api_migration.py diff --git a/kdb-bot/src/bot_data/migration/auto_role_fix1_migration.py b/bot/src/bot_data/migration/auto_role_fix1_migration.py similarity index 100% rename from kdb-bot/src/bot_data/migration/auto_role_fix1_migration.py rename to bot/src/bot_data/migration/auto_role_fix1_migration.py diff --git a/kdb-bot/src/bot_data/migration/auto_role_migration.py b/bot/src/bot_data/migration/auto_role_migration.py similarity index 100% rename from kdb-bot/src/bot_data/migration/auto_role_migration.py rename to bot/src/bot_data/migration/auto_role_migration.py diff --git a/kdb-bot/src/bot_data/migration/birthday_migration.py b/bot/src/bot_data/migration/birthday_migration.py similarity index 100% rename from kdb-bot/src/bot_data/migration/birthday_migration.py rename to bot/src/bot_data/migration/birthday_migration.py diff --git a/kdb-bot/src/bot_data/migration/config_feature_flags_migration.py b/bot/src/bot_data/migration/config_feature_flags_migration.py similarity index 74% rename from kdb-bot/src/bot_data/migration/config_feature_flags_migration.py rename to bot/src/bot_data/migration/config_feature_flags_migration.py index f9046565..a4654bb1 100644 --- a/kdb-bot/src/bot_data/migration/config_feature_flags_migration.py +++ b/bot/src/bot_data/migration/config_feature_flags_migration.py @@ -16,11 +16,15 @@ class ConfigFeatureFlagsMigration(MigrationABC): self._logger.debug(__name__, "Running upgrade") self._cursor.execute( - str("""ALTER TABLE CFG_Technician ADD FeatureFlags JSON NULL DEFAULT ('{}') AFTER CacheMaxMessages;""") + str( + """ALTER TABLE CFG_Technician ADD FeatureFlags JSON NULL DEFAULT ('{}') AFTER CacheMaxMessages;""" + ) ) self._cursor.execute( - str("""ALTER TABLE CFG_Server ADD FeatureFlags JSON NULL DEFAULT ('{}') AFTER LoginMessageChannelId;""") + str( + """ALTER TABLE CFG_Server ADD FeatureFlags JSON NULL DEFAULT ('{}') AFTER LoginMessageChannelId;""" + ) ) def downgrade(self): diff --git a/kdb-bot/src/bot_data/migration/config_migration.py b/bot/src/bot_data/migration/config_migration.py similarity index 100% rename from kdb-bot/src/bot_data/migration/config_migration.py rename to bot/src/bot_data/migration/config_migration.py diff --git a/kdb-bot/src/bot_data/migration/db_history_migration.py b/bot/src/bot_data/migration/db_history_migration.py similarity index 100% rename from kdb-bot/src/bot_data/migration/db_history_migration.py rename to bot/src/bot_data/migration/db_history_migration.py diff --git a/kdb-bot/src/bot_data/migration/db_history_scripts/api_keys.sql b/bot/src/bot_data/migration/db_history_scripts/api_keys.sql similarity index 100% rename from kdb-bot/src/bot_data/migration/db_history_scripts/api_keys.sql rename to bot/src/bot_data/migration/db_history_scripts/api_keys.sql diff --git a/kdb-bot/src/bot_data/migration/db_history_scripts/auth_user_users_relation.sql b/bot/src/bot_data/migration/db_history_scripts/auth_user_users_relation.sql similarity index 100% rename from kdb-bot/src/bot_data/migration/db_history_scripts/auth_user_users_relation.sql rename to bot/src/bot_data/migration/db_history_scripts/auth_user_users_relation.sql diff --git a/kdb-bot/src/bot_data/migration/db_history_scripts/auth_users.sql b/bot/src/bot_data/migration/db_history_scripts/auth_users.sql similarity index 100% rename from kdb-bot/src/bot_data/migration/db_history_scripts/auth_users.sql rename to bot/src/bot_data/migration/db_history_scripts/auth_users.sql diff --git a/kdb-bot/src/bot_data/migration/db_history_scripts/auto_role_rules.sql b/bot/src/bot_data/migration/db_history_scripts/auto_role_rules.sql similarity index 100% rename from kdb-bot/src/bot_data/migration/db_history_scripts/auto_role_rules.sql rename to bot/src/bot_data/migration/db_history_scripts/auto_role_rules.sql diff --git a/kdb-bot/src/bot_data/migration/db_history_scripts/auto_roles.sql b/bot/src/bot_data/migration/db_history_scripts/auto_roles.sql similarity index 100% rename from kdb-bot/src/bot_data/migration/db_history_scripts/auto_roles.sql rename to bot/src/bot_data/migration/db_history_scripts/auto_roles.sql diff --git a/kdb-bot/src/bot_data/migration/db_history_scripts/clients.sql b/bot/src/bot_data/migration/db_history_scripts/clients.sql similarity index 100% rename from kdb-bot/src/bot_data/migration/db_history_scripts/clients.sql rename to bot/src/bot_data/migration/db_history_scripts/clients.sql diff --git a/kdb-bot/src/bot_data/migration/db_history_scripts/config/server.sql b/bot/src/bot_data/migration/db_history_scripts/config/server.sql similarity index 100% rename from kdb-bot/src/bot_data/migration/db_history_scripts/config/server.sql rename to bot/src/bot_data/migration/db_history_scripts/config/server.sql diff --git a/kdb-bot/src/bot_data/migration/db_history_scripts/config/server_afk_channels.sql b/bot/src/bot_data/migration/db_history_scripts/config/server_afk_channels.sql similarity index 100% rename from kdb-bot/src/bot_data/migration/db_history_scripts/config/server_afk_channels.sql rename to bot/src/bot_data/migration/db_history_scripts/config/server_afk_channels.sql diff --git a/kdb-bot/src/bot_data/migration/db_history_scripts/config/server_team_roles.sql b/bot/src/bot_data/migration/db_history_scripts/config/server_team_roles.sql similarity index 100% rename from kdb-bot/src/bot_data/migration/db_history_scripts/config/server_team_roles.sql rename to bot/src/bot_data/migration/db_history_scripts/config/server_team_roles.sql diff --git a/kdb-bot/src/bot_data/migration/db_history_scripts/config/technician.sql b/bot/src/bot_data/migration/db_history_scripts/config/technician.sql similarity index 100% rename from kdb-bot/src/bot_data/migration/db_history_scripts/config/technician.sql rename to bot/src/bot_data/migration/db_history_scripts/config/technician.sql diff --git a/kdb-bot/src/bot_data/migration/db_history_scripts/config/technician_ids.sql b/bot/src/bot_data/migration/db_history_scripts/config/technician_ids.sql similarity index 100% rename from kdb-bot/src/bot_data/migration/db_history_scripts/config/technician_ids.sql rename to bot/src/bot_data/migration/db_history_scripts/config/technician_ids.sql diff --git a/kdb-bot/src/bot_data/migration/db_history_scripts/config/technician_ping_urls.sql b/bot/src/bot_data/migration/db_history_scripts/config/technician_ping_urls.sql similarity index 100% rename from kdb-bot/src/bot_data/migration/db_history_scripts/config/technician_ping_urls.sql rename to bot/src/bot_data/migration/db_history_scripts/config/technician_ping_urls.sql diff --git a/kdb-bot/src/bot_data/migration/db_history_scripts/game_servers.sql b/bot/src/bot_data/migration/db_history_scripts/game_servers.sql similarity index 100% rename from kdb-bot/src/bot_data/migration/db_history_scripts/game_servers.sql rename to bot/src/bot_data/migration/db_history_scripts/game_servers.sql diff --git a/kdb-bot/src/bot_data/migration/db_history_scripts/known_users.sql b/bot/src/bot_data/migration/db_history_scripts/known_users.sql similarity index 100% rename from kdb-bot/src/bot_data/migration/db_history_scripts/known_users.sql rename to bot/src/bot_data/migration/db_history_scripts/known_users.sql diff --git a/kdb-bot/src/bot_data/migration/db_history_scripts/levels.sql b/bot/src/bot_data/migration/db_history_scripts/levels.sql similarity index 100% rename from kdb-bot/src/bot_data/migration/db_history_scripts/levels.sql rename to bot/src/bot_data/migration/db_history_scripts/levels.sql diff --git a/kdb-bot/src/bot_data/migration/db_history_scripts/servers.sql b/bot/src/bot_data/migration/db_history_scripts/servers.sql similarity index 100% rename from kdb-bot/src/bot_data/migration/db_history_scripts/servers.sql rename to bot/src/bot_data/migration/db_history_scripts/servers.sql diff --git a/kdb-bot/src/bot_data/migration/db_history_scripts/short_rule_names.sql b/bot/src/bot_data/migration/db_history_scripts/short_rule_names.sql similarity index 100% rename from kdb-bot/src/bot_data/migration/db_history_scripts/short_rule_names.sql rename to bot/src/bot_data/migration/db_history_scripts/short_rule_names.sql diff --git a/kdb-bot/src/bot_data/migration/db_history_scripts/user_game_idents.sql b/bot/src/bot_data/migration/db_history_scripts/user_game_idents.sql similarity index 100% rename from kdb-bot/src/bot_data/migration/db_history_scripts/user_game_idents.sql rename to bot/src/bot_data/migration/db_history_scripts/user_game_idents.sql diff --git a/kdb-bot/src/bot_data/migration/db_history_scripts/user_joined_game_servers.sql b/bot/src/bot_data/migration/db_history_scripts/user_joined_game_servers.sql similarity index 100% rename from kdb-bot/src/bot_data/migration/db_history_scripts/user_joined_game_servers.sql rename to bot/src/bot_data/migration/db_history_scripts/user_joined_game_servers.sql diff --git a/kdb-bot/src/bot_data/migration/db_history_scripts/user_joined_servers.sql b/bot/src/bot_data/migration/db_history_scripts/user_joined_servers.sql similarity index 100% rename from kdb-bot/src/bot_data/migration/db_history_scripts/user_joined_servers.sql rename to bot/src/bot_data/migration/db_history_scripts/user_joined_servers.sql diff --git a/kdb-bot/src/bot_data/migration/db_history_scripts/user_joined_voice_channel.sql b/bot/src/bot_data/migration/db_history_scripts/user_joined_voice_channel.sql similarity index 100% rename from kdb-bot/src/bot_data/migration/db_history_scripts/user_joined_voice_channel.sql rename to bot/src/bot_data/migration/db_history_scripts/user_joined_voice_channel.sql diff --git a/kdb-bot/src/bot_data/migration/db_history_scripts/user_message_count_per_hour.sql b/bot/src/bot_data/migration/db_history_scripts/user_message_count_per_hour.sql similarity index 100% rename from kdb-bot/src/bot_data/migration/db_history_scripts/user_message_count_per_hour.sql rename to bot/src/bot_data/migration/db_history_scripts/user_message_count_per_hour.sql diff --git a/kdb-bot/src/bot_data/migration/db_history_scripts/user_warnings.sql b/bot/src/bot_data/migration/db_history_scripts/user_warnings.sql similarity index 100% rename from kdb-bot/src/bot_data/migration/db_history_scripts/user_warnings.sql rename to bot/src/bot_data/migration/db_history_scripts/user_warnings.sql diff --git a/kdb-bot/src/bot_data/migration/db_history_scripts/users.sql b/bot/src/bot_data/migration/db_history_scripts/users.sql similarity index 100% rename from kdb-bot/src/bot_data/migration/db_history_scripts/users.sql rename to bot/src/bot_data/migration/db_history_scripts/users.sql diff --git a/kdb-bot/src/bot_data/migration/default_role_migration.py b/bot/src/bot_data/migration/default_role_migration.py similarity index 100% rename from kdb-bot/src/bot_data/migration/default_role_migration.py rename to bot/src/bot_data/migration/default_role_migration.py diff --git a/kdb-bot/src/bot_data/migration/fix_updates_migration.py b/bot/src/bot_data/migration/fix_updates_migration.py similarity index 93% rename from kdb-bot/src/bot_data/migration/fix_updates_migration.py rename to bot/src/bot_data/migration/fix_updates_migration.py index f4d5e020..9f2420e3 100644 --- a/kdb-bot/src/bot_data/migration/fix_updates_migration.py +++ b/bot/src/bot_data/migration/fix_updates_migration.py @@ -47,5 +47,7 @@ class FixUpdatesMigration(MigrationABC): """ ) ) - self._cursor.execute("ALTER TABLE CFG_TechnicianHistory DROP COLUMN FeatureFlags;") + self._cursor.execute( + "ALTER TABLE CFG_TechnicianHistory DROP COLUMN FeatureFlags;" + ) self._cursor.execute("ALTER TABLE CFG_ServerHistory DROP COLUMN FeatureFlags;") diff --git a/kdb-bot/src/bot_data/migration/fix_user_history_migration.py b/bot/src/bot_data/migration/fix_user_history_migration.py similarity index 100% rename from kdb-bot/src/bot_data/migration/fix_user_history_migration.py rename to bot/src/bot_data/migration/fix_user_history_migration.py diff --git a/kdb-bot/src/bot_data/migration/initial_migration.py b/bot/src/bot_data/migration/initial_migration.py similarity index 100% rename from kdb-bot/src/bot_data/migration/initial_migration.py rename to bot/src/bot_data/migration/initial_migration.py diff --git a/kdb-bot/src/bot_data/migration/level_migration.py b/bot/src/bot_data/migration/level_migration.py similarity index 100% rename from kdb-bot/src/bot_data/migration/level_migration.py rename to bot/src/bot_data/migration/level_migration.py diff --git a/kdb-bot/src/bot_data/migration/remove_stats_migration.py b/bot/src/bot_data/migration/remove_stats_migration.py similarity index 100% rename from kdb-bot/src/bot_data/migration/remove_stats_migration.py rename to bot/src/bot_data/migration/remove_stats_migration.py diff --git a/kdb-bot/src/bot_data/migration/short_role_name_migration.py b/bot/src/bot_data/migration/short_role_name_migration.py similarity index 100% rename from kdb-bot/src/bot_data/migration/short_role_name_migration.py rename to bot/src/bot_data/migration/short_role_name_migration.py diff --git a/kdb-bot/src/bot_data/migration/short_role_name_only_highest_migration.py b/bot/src/bot_data/migration/short_role_name_only_highest_migration.py similarity index 100% rename from kdb-bot/src/bot_data/migration/short_role_name_only_highest_migration.py rename to bot/src/bot_data/migration/short_role_name_only_highest_migration.py diff --git a/kdb-bot/src/bot_data/migration/stats_migration.py b/bot/src/bot_data/migration/stats_migration.py similarity index 100% rename from kdb-bot/src/bot_data/migration/stats_migration.py rename to bot/src/bot_data/migration/stats_migration.py diff --git a/kdb-bot/src/bot_data/migration/steam_special_offer_migration.py b/bot/src/bot_data/migration/steam_special_offer_migration.py similarity index 100% rename from kdb-bot/src/bot_data/migration/steam_special_offer_migration.py rename to bot/src/bot_data/migration/steam_special_offer_migration.py diff --git a/kdb-bot/src/bot_data/migration/user_joined_game_server_migration.py b/bot/src/bot_data/migration/user_joined_game_server_migration.py similarity index 100% rename from kdb-bot/src/bot_data/migration/user_joined_game_server_migration.py rename to bot/src/bot_data/migration/user_joined_game_server_migration.py diff --git a/kdb-bot/src/bot_data/migration/user_message_count_per_hour_migration.py b/bot/src/bot_data/migration/user_message_count_per_hour_migration.py similarity index 100% rename from kdb-bot/src/bot_data/migration/user_message_count_per_hour_migration.py rename to bot/src/bot_data/migration/user_message_count_per_hour_migration.py diff --git a/kdb-bot/src/bot_data/migration/user_warning_migration.py b/bot/src/bot_data/migration/user_warning_migration.py similarity index 100% rename from kdb-bot/src/bot_data/migration/user_warning_migration.py rename to bot/src/bot_data/migration/user_warning_migration.py diff --git a/kdb-bot/src/bot_data/model/__init__.py b/bot/src/bot_data/model/__init__.py similarity index 100% rename from kdb-bot/src/bot_data/model/__init__.py rename to bot/src/bot_data/model/__init__.py diff --git a/kdb-bot/src/bot_data/model/achievement.py b/bot/src/bot_data/model/achievement.py similarity index 97% rename from kdb-bot/src/bot_data/model/achievement.py rename to bot/src/bot_data/model/achievement.py index ebce645d..97a3e059 100644 --- a/kdb-bot/src/bot_data/model/achievement.py +++ b/bot/src/bot_data/model/achievement.py @@ -34,7 +34,9 @@ class Achievement(TableABC): TableABC.__init__(self) self._created_at = created_at if created_at is not None else self._created_at - self._modified_at = modified_at if modified_at is not None else self._modified_at + self._modified_at = ( + modified_at if modified_at is not None else self._modified_at + ) @ServiceProviderABC.inject def _is_operator_valid(self, operator, service: ServiceProviderABC) -> bool: diff --git a/kdb-bot/src/bot_data/model/achievement_history.py b/bot/src/bot_data/model/achievement_history.py similarity index 100% rename from kdb-bot/src/bot_data/model/achievement_history.py rename to bot/src/bot_data/model/achievement_history.py diff --git a/kdb-bot/src/bot_data/model/api_key.py b/bot/src/bot_data/model/api_key.py similarity index 95% rename from kdb-bot/src/bot_data/model/api_key.py rename to bot/src/bot_data/model/api_key.py index d63c4d1b..20abc12d 100644 --- a/kdb-bot/src/bot_data/model/api_key.py +++ b/bot/src/bot_data/model/api_key.py @@ -23,7 +23,9 @@ class ApiKey(TableABC): TableABC.__init__(self) self._created_at = created_at if created_at is not None else self._created_at - self._modified_at = modified_at if modified_at is not None else self._modified_at + self._modified_at = ( + modified_at if modified_at is not None else self._modified_at + ) @property def id(self) -> int: diff --git a/kdb-bot/src/bot_data/model/auth_role_enum.py b/bot/src/bot_data/model/auth_role_enum.py similarity index 100% rename from kdb-bot/src/bot_data/model/auth_role_enum.py rename to bot/src/bot_data/model/auth_role_enum.py diff --git a/kdb-bot/src/bot_data/model/auth_user.py b/bot/src/bot_data/model/auth_user.py similarity index 98% rename from kdb-bot/src/bot_data/model/auth_user.py rename to bot/src/bot_data/model/auth_user.py index 47bdf41a..cdc6d8a2 100644 --- a/kdb-bot/src/bot_data/model/auth_user.py +++ b/bot/src/bot_data/model/auth_user.py @@ -49,7 +49,9 @@ class AuthUser(TableABC): TableABC.__init__(self) self._created_at = created_at if created_at is not None else self._created_at - self._modified_at = modified_at if modified_at is not None else self._modified_at + self._modified_at = ( + modified_at if modified_at is not None else self._modified_at + ) @property def id(self) -> int: diff --git a/kdb-bot/src/bot_data/model/auth_user_users_relation.py b/bot/src/bot_data/model/auth_user_users_relation.py similarity index 95% rename from kdb-bot/src/bot_data/model/auth_user_users_relation.py rename to bot/src/bot_data/model/auth_user_users_relation.py index 23b9ceab..25e66301 100644 --- a/kdb-bot/src/bot_data/model/auth_user_users_relation.py +++ b/bot/src/bot_data/model/auth_user_users_relation.py @@ -19,7 +19,9 @@ class AuthUserUsersRelation(TableABC): TableABC.__init__(self) self._created_at = created_at if created_at is not None else self._created_at - self._modified_at = modified_at if modified_at is not None else self._modified_at + self._modified_at = ( + modified_at if modified_at is not None else self._modified_at + ) @property def auth_user(self) -> AuthUser: diff --git a/kdb-bot/src/bot_data/model/auto_role.py b/bot/src/bot_data/model/auto_role.py similarity index 96% rename from kdb-bot/src/bot_data/model/auto_role.py rename to bot/src/bot_data/model/auto_role.py index a1ff7934..e8b446c7 100644 --- a/kdb-bot/src/bot_data/model/auto_role.py +++ b/bot/src/bot_data/model/auto_role.py @@ -25,7 +25,9 @@ class AutoRole(TableABC): TableABC.__init__(self) self._created_at = created_at if created_at is not None else self._created_at - self._modified_at = modified_at if modified_at is not None else self._modified_at + self._modified_at = ( + modified_at if modified_at is not None else self._modified_at + ) @property def id(self) -> int: diff --git a/kdb-bot/src/bot_data/model/auto_role_history.py b/bot/src/bot_data/model/auto_role_history.py similarity index 100% rename from kdb-bot/src/bot_data/model/auto_role_history.py rename to bot/src/bot_data/model/auto_role_history.py diff --git a/kdb-bot/src/bot_data/model/auto_role_rule.py b/bot/src/bot_data/model/auto_role_rule.py similarity index 96% rename from kdb-bot/src/bot_data/model/auto_role_rule.py rename to bot/src/bot_data/model/auto_role_rule.py index 8729b6ec..f90fd86f 100644 --- a/kdb-bot/src/bot_data/model/auto_role_rule.py +++ b/bot/src/bot_data/model/auto_role_rule.py @@ -24,7 +24,9 @@ class AutoRoleRule(TableABC): TableABC.__init__(self) self._created_at = created_at if created_at is not None else self._created_at - self._modified_at = modified_at if modified_at is not None else self._modified_at + self._modified_at = ( + modified_at if modified_at is not None else self._modified_at + ) @property def id(self) -> int: diff --git a/kdb-bot/src/bot_data/model/auto_role_rule_history.py b/bot/src/bot_data/model/auto_role_rule_history.py similarity index 100% rename from kdb-bot/src/bot_data/model/auto_role_rule_history.py rename to bot/src/bot_data/model/auto_role_rule_history.py diff --git a/kdb-bot/src/bot_data/model/client.py b/bot/src/bot_data/model/client.py similarity index 97% rename from kdb-bot/src/bot_data/model/client.py rename to bot/src/bot_data/model/client.py index b6c163c9..e8c56adf 100644 --- a/kdb-bot/src/bot_data/model/client.py +++ b/bot/src/bot_data/model/client.py @@ -32,7 +32,9 @@ class Client(TableABC): TableABC.__init__(self) self._created_at = created_at if created_at is not None else self._created_at - self._modified_at = modified_at if modified_at is not None else self._modified_at + self._modified_at = ( + modified_at if modified_at is not None else self._modified_at + ) @property def id(self) -> int: diff --git a/kdb-bot/src/bot_data/model/client_history.py b/bot/src/bot_data/model/client_history.py similarity index 100% rename from kdb-bot/src/bot_data/model/client_history.py rename to bot/src/bot_data/model/client_history.py diff --git a/kdb-bot/src/bot_data/model/game_server.py b/bot/src/bot_data/model/game_server.py similarity index 96% rename from kdb-bot/src/bot_data/model/game_server.py rename to bot/src/bot_data/model/game_server.py index eeea20d8..8cc510af 100644 --- a/kdb-bot/src/bot_data/model/game_server.py +++ b/bot/src/bot_data/model/game_server.py @@ -23,7 +23,9 @@ class GameServer(TableABC): TableABC.__init__(self) self._created_at = created_at if created_at is not None else self._created_at - self._modified_at = modified_at if modified_at is not None else self._modified_at + self._modified_at = ( + modified_at if modified_at is not None else self._modified_at + ) @property def id(self) -> int: diff --git a/kdb-bot/src/bot_data/model/known_user.py b/bot/src/bot_data/model/known_user.py similarity index 93% rename from kdb-bot/src/bot_data/model/known_user.py rename to bot/src/bot_data/model/known_user.py index 37d375f0..e07bcf83 100644 --- a/kdb-bot/src/bot_data/model/known_user.py +++ b/bot/src/bot_data/model/known_user.py @@ -16,7 +16,9 @@ class KnownUser(TableABC): TableABC.__init__(self) self._created_at = created_at if created_at is not None else self._created_at - self._modified_at = modified_at if modified_at is not None else self._modified_at + self._modified_at = ( + modified_at if modified_at is not None else self._modified_at + ) @property def id(self) -> int: diff --git a/kdb-bot/src/bot_data/model/known_user_history.py b/bot/src/bot_data/model/known_user_history.py similarity index 100% rename from kdb-bot/src/bot_data/model/known_user_history.py rename to bot/src/bot_data/model/known_user_history.py diff --git a/kdb-bot/src/bot_data/model/level.py b/bot/src/bot_data/model/level.py similarity index 96% rename from kdb-bot/src/bot_data/model/level.py rename to bot/src/bot_data/model/level.py index a20d268b..bdad1826 100644 --- a/kdb-bot/src/bot_data/model/level.py +++ b/bot/src/bot_data/model/level.py @@ -27,7 +27,9 @@ class Level(TableABC): TableABC.__init__(self) self._created_at = created_at if created_at is not None else self._created_at - self._modified_at = modified_at if modified_at is not None else self._modified_at + self._modified_at = ( + modified_at if modified_at is not None else self._modified_at + ) @property def id(self) -> int: diff --git a/kdb-bot/src/bot_data/model/level_history.py b/bot/src/bot_data/model/level_history.py similarity index 100% rename from kdb-bot/src/bot_data/model/level_history.py rename to bot/src/bot_data/model/level_history.py diff --git a/kdb-bot/src/bot_data/model/migration_history.py b/bot/src/bot_data/model/migration_history.py similarity index 100% rename from kdb-bot/src/bot_data/model/migration_history.py rename to bot/src/bot_data/model/migration_history.py diff --git a/kdb-bot/src/bot_data/model/server.py b/bot/src/bot_data/model/server.py similarity index 95% rename from kdb-bot/src/bot_data/model/server.py rename to bot/src/bot_data/model/server.py index d86c6e97..5ae54ca7 100644 --- a/kdb-bot/src/bot_data/model/server.py +++ b/bot/src/bot_data/model/server.py @@ -18,7 +18,9 @@ class Server(TableABC): TableABC.__init__(self) self._created_at = created_at if created_at is not None else self._created_at - self._modified_at = modified_at if modified_at is not None else self._modified_at + self._modified_at = ( + modified_at if modified_at is not None else self._modified_at + ) @property def id(self) -> int: diff --git a/kdb-bot/src/bot_data/model/server_afk_channel_ids_config.py b/bot/src/bot_data/model/server_afk_channel_ids_config.py similarity index 94% rename from kdb-bot/src/bot_data/model/server_afk_channel_ids_config.py rename to bot/src/bot_data/model/server_afk_channel_ids_config.py index 9b182426..2c9042d9 100644 --- a/kdb-bot/src/bot_data/model/server_afk_channel_ids_config.py +++ b/bot/src/bot_data/model/server_afk_channel_ids_config.py @@ -18,7 +18,9 @@ class ServerAFKChannelIdsConfig(TableABC): TableABC.__init__(self) self._created_at = created_at if created_at is not None else self._created_at - self._modified_at = modified_at if modified_at is not None else self._modified_at + self._modified_at = ( + modified_at if modified_at is not None else self._modified_at + ) @property def channel_id(self) -> int: diff --git a/kdb-bot/src/bot_data/model/server_config.py b/bot/src/bot_data/model/server_config.py similarity index 98% rename from kdb-bot/src/bot_data/model/server_config.py rename to bot/src/bot_data/model/server_config.py index cf220355..3453de2f 100644 --- a/kdb-bot/src/bot_data/model/server_config.py +++ b/bot/src/bot_data/model/server_config.py @@ -56,7 +56,9 @@ class ServerConfig(TableABC, ConfigurationModelABC): self._team_channel_id = team_channel_id self._login_message_channel_id = login_message_channel_id self._default_role_id = default_role_id - self._short_role_name_only_set_highest_role = short_role_name_only_set_highest_role + self._short_role_name_only_set_highest_role = ( + short_role_name_only_set_highest_role + ) self._game_offer_notification_chat_id = game_offer_notification_chat_id self._feature_flags = feature_flags @@ -66,7 +68,9 @@ class ServerConfig(TableABC, ConfigurationModelABC): TableABC.__init__(self) self._created_at = created_at if created_at is not None else self._created_at - self._modified_at = modified_at if modified_at is not None else self._modified_at + self._modified_at = ( + modified_at if modified_at is not None else self._modified_at + ) @staticmethod def new(guild: Guild, server: Server) -> "ServerConfig": diff --git a/kdb-bot/src/bot_data/model/server_config_history.py b/bot/src/bot_data/model/server_config_history.py similarity index 96% rename from kdb-bot/src/bot_data/model/server_config_history.py rename to bot/src/bot_data/model/server_config_history.py index 6364f2eb..009491bd 100644 --- a/kdb-bot/src/bot_data/model/server_config_history.py +++ b/bot/src/bot_data/model/server_config_history.py @@ -43,7 +43,9 @@ class ServerConfigHistory(HistoryTableABC): self._team_channel_id = team_channel_id self._login_message_channel_id = login_message_channel_id self._default_role_id = default_role_id - self._short_role_name_only_set_highest_role = short_role_name_only_set_highest_role + self._short_role_name_only_set_highest_role = ( + short_role_name_only_set_highest_role + ) self._feature_flags = feature_flags self._server_id = server_id diff --git a/kdb-bot/src/bot_data/model/server_history.py b/bot/src/bot_data/model/server_history.py similarity index 100% rename from kdb-bot/src/bot_data/model/server_history.py rename to bot/src/bot_data/model/server_history.py diff --git a/kdb-bot/src/bot_data/model/server_team_role_ids_config.py b/bot/src/bot_data/model/server_team_role_ids_config.py similarity index 95% rename from kdb-bot/src/bot_data/model/server_team_role_ids_config.py rename to bot/src/bot_data/model/server_team_role_ids_config.py index dfd870dd..7be73531 100644 --- a/kdb-bot/src/bot_data/model/server_team_role_ids_config.py +++ b/bot/src/bot_data/model/server_team_role_ids_config.py @@ -22,7 +22,9 @@ class ServerTeamRoleIdsConfig(TableABC): TableABC.__init__(self) self._created_at = created_at if created_at is not None else self._created_at - self._modified_at = modified_at if modified_at is not None else self._modified_at + self._modified_at = ( + modified_at if modified_at is not None else self._modified_at + ) @property def id(self) -> int: diff --git a/kdb-bot/src/bot_data/model/short_role_name.py b/bot/src/bot_data/model/short_role_name.py similarity index 96% rename from kdb-bot/src/bot_data/model/short_role_name.py rename to bot/src/bot_data/model/short_role_name.py index 4ddef4f1..d03b6ddc 100644 --- a/kdb-bot/src/bot_data/model/short_role_name.py +++ b/bot/src/bot_data/model/short_role_name.py @@ -27,7 +27,9 @@ class ShortRoleName(TableABC): TableABC.__init__(self) self._created_at = created_at if created_at is not None else self._created_at - self._modified_at = modified_at if modified_at is not None else self._modified_at + self._modified_at = ( + modified_at if modified_at is not None else self._modified_at + ) @property def id(self) -> int: diff --git a/kdb-bot/src/bot_data/model/short_role_name_history.py b/bot/src/bot_data/model/short_role_name_history.py similarity index 100% rename from kdb-bot/src/bot_data/model/short_role_name_history.py rename to bot/src/bot_data/model/short_role_name_history.py diff --git a/kdb-bot/src/bot_data/model/short_role_name_position_enum.py b/bot/src/bot_data/model/short_role_name_position_enum.py similarity index 100% rename from kdb-bot/src/bot_data/model/short_role_name_position_enum.py rename to bot/src/bot_data/model/short_role_name_position_enum.py diff --git a/kdb-bot/src/bot_data/model/steam_special_offer.py b/bot/src/bot_data/model/steam_special_offer.py similarity index 96% rename from kdb-bot/src/bot_data/model/steam_special_offer.py rename to bot/src/bot_data/model/steam_special_offer.py index 76301dc4..0b7e6927 100644 --- a/kdb-bot/src/bot_data/model/steam_special_offer.py +++ b/bot/src/bot_data/model/steam_special_offer.py @@ -22,7 +22,9 @@ class SteamSpecialOffer(TableABC): TableABC.__init__(self) self._created_at = created_at if created_at is not None else self._created_at - self._modified_at = modified_at if modified_at is not None else self._modified_at + self._modified_at = ( + modified_at if modified_at is not None else self._modified_at + ) @property def id(self) -> int: diff --git a/kdb-bot/src/bot_data/model/team_member_type_enum.py b/bot/src/bot_data/model/team_member_type_enum.py similarity index 100% rename from kdb-bot/src/bot_data/model/team_member_type_enum.py rename to bot/src/bot_data/model/team_member_type_enum.py diff --git a/kdb-bot/src/bot_data/model/technician_config.py b/bot/src/bot_data/model/technician_config.py similarity index 97% rename from kdb-bot/src/bot_data/model/technician_config.py rename to bot/src/bot_data/model/technician_config.py index 1390f4b8..9aab8628 100644 --- a/kdb-bot/src/bot_data/model/technician_config.py +++ b/bot/src/bot_data/model/technician_config.py @@ -33,7 +33,9 @@ class TechnicianConfig(TableABC, ConfigurationModelABC): TableABC.__init__(self) self._created_at = created_at if created_at is not None else self._created_at - self._modified_at = modified_at if modified_at is not None else self._modified_at + self._modified_at = ( + modified_at if modified_at is not None else self._modified_at + ) @property def id(self) -> int: diff --git a/kdb-bot/src/bot_data/model/technician_config_history.py b/bot/src/bot_data/model/technician_config_history.py similarity index 100% rename from kdb-bot/src/bot_data/model/technician_config_history.py rename to bot/src/bot_data/model/technician_config_history.py diff --git a/kdb-bot/src/bot_data/model/technician_id_config.py b/bot/src/bot_data/model/technician_id_config.py similarity index 94% rename from kdb-bot/src/bot_data/model/technician_id_config.py rename to bot/src/bot_data/model/technician_id_config.py index 6ba5f581..7db76b4b 100644 --- a/kdb-bot/src/bot_data/model/technician_id_config.py +++ b/bot/src/bot_data/model/technician_id_config.py @@ -16,7 +16,9 @@ class TechnicianIdConfig(TableABC): TableABC.__init__(self) self._created_at = created_at if created_at is not None else self._created_at - self._modified_at = modified_at if modified_at is not None else self._modified_at + self._modified_at = ( + modified_at if modified_at is not None else self._modified_at + ) @property def id(self) -> int: diff --git a/kdb-bot/src/bot_data/model/technician_id_config_history.py b/bot/src/bot_data/model/technician_id_config_history.py similarity index 100% rename from kdb-bot/src/bot_data/model/technician_id_config_history.py rename to bot/src/bot_data/model/technician_id_config_history.py diff --git a/kdb-bot/src/bot_data/model/technician_ping_url_config.py b/bot/src/bot_data/model/technician_ping_url_config.py similarity index 94% rename from kdb-bot/src/bot_data/model/technician_ping_url_config.py rename to bot/src/bot_data/model/technician_ping_url_config.py index 31983624..bcc63b97 100644 --- a/kdb-bot/src/bot_data/model/technician_ping_url_config.py +++ b/bot/src/bot_data/model/technician_ping_url_config.py @@ -16,7 +16,9 @@ class TechnicianPingUrlConfig(TableABC): TableABC.__init__(self) self._created_at = created_at if created_at is not None else self._created_at - self._modified_at = modified_at if modified_at is not None else self._modified_at + self._modified_at = ( + modified_at if modified_at is not None else self._modified_at + ) @property def id(self) -> int: diff --git a/kdb-bot/src/bot_data/model/technician_ping_url_config_history.py b/bot/src/bot_data/model/technician_ping_url_config_history.py similarity index 100% rename from kdb-bot/src/bot_data/model/technician_ping_url_config_history.py rename to bot/src/bot_data/model/technician_ping_url_config_history.py diff --git a/kdb-bot/src/bot_data/model/user.py b/bot/src/bot_data/model/user.py similarity index 94% rename from kdb-bot/src/bot_data/model/user.py rename to bot/src/bot_data/model/user.py index 310ecc08..d1e7d514 100644 --- a/kdb-bot/src/bot_data/model/user.py +++ b/bot/src/bot_data/model/user.py @@ -33,7 +33,9 @@ class User(TableABC): TableABC.__init__(self) self._created_at = created_at if created_at is not None else self._created_at - self._modified_at = modified_at if modified_at is not None else self._modified_at + self._modified_at = ( + modified_at if modified_at is not None else self._modified_at + ) @property def id(self) -> int: @@ -115,9 +117,13 @@ class User(TableABC): self, services: ServiceProviderABC, ) -> bool: - from bot_data.abc.user_joined_server_repository_abc import UserJoinedServerRepositoryABC + from bot_data.abc.user_joined_server_repository_abc import ( + UserJoinedServerRepositoryABC, + ) - ujs: UserJoinedServerRepositoryABC = services.get_service(UserJoinedServerRepositoryABC) + ujs: UserJoinedServerRepositoryABC = services.get_service( + UserJoinedServerRepositoryABC + ) return ujs.find_active_user_joined_server_by_user_id(self.id) is None @property @@ -126,9 +132,13 @@ class User(TableABC): self, services: ServiceProviderABC, ) -> List["UserGameIdent"]: - from bot_data.abc.user_game_ident_repository_abc import UserGameIdentRepositoryABC + from bot_data.abc.user_game_ident_repository_abc import ( + UserGameIdentRepositoryABC, + ) - game_idents_repo: UserGameIdentRepositoryABC = services.get_service(UserGameIdentRepositoryABC) + game_idents_repo: UserGameIdentRepositoryABC = services.get_service( + UserGameIdentRepositoryABC + ) return game_idents_repo.get_user_game_idents_by_user_id(self.id) @staticmethod diff --git a/kdb-bot/src/bot_data/model/user_game_ident.py b/bot/src/bot_data/model/user_game_ident.py similarity index 96% rename from kdb-bot/src/bot_data/model/user_game_ident.py rename to bot/src/bot_data/model/user_game_ident.py index 79468d13..11d88a66 100644 --- a/kdb-bot/src/bot_data/model/user_game_ident.py +++ b/bot/src/bot_data/model/user_game_ident.py @@ -23,7 +23,9 @@ class UserGameIdent(TableABC): TableABC.__init__(self) self._created_at = created_at if created_at is not None else self._created_at - self._modified_at = modified_at if modified_at is not None else self._modified_at + self._modified_at = ( + modified_at if modified_at is not None else self._modified_at + ) @property def id(self) -> int: diff --git a/kdb-bot/src/bot_data/model/user_got_achievement.py b/bot/src/bot_data/model/user_got_achievement.py similarity index 95% rename from kdb-bot/src/bot_data/model/user_got_achievement.py rename to bot/src/bot_data/model/user_got_achievement.py index d2c37cf5..373bfe05 100644 --- a/kdb-bot/src/bot_data/model/user_got_achievement.py +++ b/bot/src/bot_data/model/user_got_achievement.py @@ -22,7 +22,9 @@ class UserGotAchievement(TableABC): TableABC.__init__(self) self._created_at = created_at if created_at is not None else self._created_at - self._modified_at = modified_at if modified_at is not None else self._modified_at + self._modified_at = ( + modified_at if modified_at is not None else self._modified_at + ) @property def id(self) -> int: diff --git a/kdb-bot/src/bot_data/model/user_history.py b/bot/src/bot_data/model/user_history.py similarity index 89% rename from kdb-bot/src/bot_data/model/user_history.py rename to bot/src/bot_data/model/user_history.py index 2bf39954..461550fe 100644 --- a/kdb-bot/src/bot_data/model/user_history.py +++ b/bot/src/bot_data/model/user_history.py @@ -60,9 +60,13 @@ class UserHistory(HistoryTableABC): self, services: ServiceProviderABC, ) -> bool: - from bot_data.abc.user_joined_server_repository_abc import UserJoinedServerRepositoryABC + from bot_data.abc.user_joined_server_repository_abc import ( + UserJoinedServerRepositoryABC, + ) - ujs: UserJoinedServerRepositoryABC = services.get_service(UserJoinedServerRepositoryABC) + ujs: UserJoinedServerRepositoryABC = services.get_service( + UserJoinedServerRepositoryABC + ) return ujs.find_active_user_joined_server_by_user_id(self.id) is None @property @@ -71,7 +75,11 @@ class UserHistory(HistoryTableABC): self, services: ServiceProviderABC, ) -> List["UserGameIdent"]: - from bot_data.abc.user_game_ident_repository_abc import UserGameIdentRepositoryABC + from bot_data.abc.user_game_ident_repository_abc import ( + UserGameIdentRepositoryABC, + ) - game_idents_repo: UserGameIdentRepositoryABC = services.get_service(UserGameIdentRepositoryABC) + game_idents_repo: UserGameIdentRepositoryABC = services.get_service( + UserGameIdentRepositoryABC + ) return game_idents_repo.get_user_game_idents_by_user_id(self.id) diff --git a/kdb-bot/src/bot_data/model/user_joined_game_server.py b/bot/src/bot_data/model/user_joined_game_server.py similarity index 96% rename from kdb-bot/src/bot_data/model/user_joined_game_server.py rename to bot/src/bot_data/model/user_joined_game_server.py index cf60229d..8cfaae11 100644 --- a/kdb-bot/src/bot_data/model/user_joined_game_server.py +++ b/bot/src/bot_data/model/user_joined_game_server.py @@ -25,7 +25,9 @@ class UserJoinedGameServer(TableABC): TableABC.__init__(self) self._created_at = created_at if created_at is not None else self._created_at - self._modified_at = modified_at if modified_at is not None else self._modified_at + self._modified_at = ( + modified_at if modified_at is not None else self._modified_at + ) @property def id(self) -> int: diff --git a/kdb-bot/src/bot_data/model/user_joined_game_server_history.py b/bot/src/bot_data/model/user_joined_game_server_history.py similarity index 100% rename from kdb-bot/src/bot_data/model/user_joined_game_server_history.py rename to bot/src/bot_data/model/user_joined_game_server_history.py diff --git a/kdb-bot/src/bot_data/model/user_joined_server.py b/bot/src/bot_data/model/user_joined_server.py similarity index 96% rename from kdb-bot/src/bot_data/model/user_joined_server.py rename to bot/src/bot_data/model/user_joined_server.py index e55cb60d..25cf2b27 100644 --- a/kdb-bot/src/bot_data/model/user_joined_server.py +++ b/bot/src/bot_data/model/user_joined_server.py @@ -22,7 +22,9 @@ class UserJoinedServer(TableABC): TableABC.__init__(self) self._created_at = created_at if created_at is not None else self._created_at - self._modified_at = modified_at if modified_at is not None else self._modified_at + self._modified_at = ( + modified_at if modified_at is not None else self._modified_at + ) @property def id(self) -> int: diff --git a/kdb-bot/src/bot_data/model/user_joined_server_history.py b/bot/src/bot_data/model/user_joined_server_history.py similarity index 100% rename from kdb-bot/src/bot_data/model/user_joined_server_history.py rename to bot/src/bot_data/model/user_joined_server_history.py diff --git a/kdb-bot/src/bot_data/model/user_joined_voice_channel.py b/bot/src/bot_data/model/user_joined_voice_channel.py similarity index 97% rename from kdb-bot/src/bot_data/model/user_joined_voice_channel.py rename to bot/src/bot_data/model/user_joined_voice_channel.py index 3b938452..5764b5e8 100644 --- a/kdb-bot/src/bot_data/model/user_joined_voice_channel.py +++ b/bot/src/bot_data/model/user_joined_voice_channel.py @@ -26,7 +26,9 @@ class UserJoinedVoiceChannel(TableABC): TableABC.__init__(self) self._created_at = created_at if created_at is not None else self._created_at - self._modified_at = modified_at if modified_at is not None else self._modified_at + self._modified_at = ( + modified_at if modified_at is not None else self._modified_at + ) @property def id(self) -> int: diff --git a/kdb-bot/src/bot_data/model/user_joined_voice_channel_history.py b/bot/src/bot_data/model/user_joined_voice_channel_history.py similarity index 100% rename from kdb-bot/src/bot_data/model/user_joined_voice_channel_history.py rename to bot/src/bot_data/model/user_joined_voice_channel_history.py diff --git a/kdb-bot/src/bot_data/model/user_message_count_per_hour.py b/bot/src/bot_data/model/user_message_count_per_hour.py similarity index 96% rename from kdb-bot/src/bot_data/model/user_message_count_per_hour.py rename to bot/src/bot_data/model/user_message_count_per_hour.py index 7815ffa4..be0fdddc 100644 --- a/kdb-bot/src/bot_data/model/user_message_count_per_hour.py +++ b/bot/src/bot_data/model/user_message_count_per_hour.py @@ -24,7 +24,9 @@ class UserMessageCountPerHour(TableABC): TableABC.__init__(self) self._created_at = created_at if created_at is not None else self._created_at - self._modified_at = modified_at if modified_at is not None else self._modified_at + self._modified_at = ( + modified_at if modified_at is not None else self._modified_at + ) @property def id(self) -> int: diff --git a/kdb-bot/src/bot_data/model/user_role_enum.py b/bot/src/bot_data/model/user_role_enum.py similarity index 100% rename from kdb-bot/src/bot_data/model/user_role_enum.py rename to bot/src/bot_data/model/user_role_enum.py diff --git a/kdb-bot/src/bot_data/model/user_warnings.py b/bot/src/bot_data/model/user_warnings.py similarity index 95% rename from kdb-bot/src/bot_data/model/user_warnings.py rename to bot/src/bot_data/model/user_warnings.py index 99610a5f..bd1e290c 100644 --- a/kdb-bot/src/bot_data/model/user_warnings.py +++ b/bot/src/bot_data/model/user_warnings.py @@ -24,7 +24,9 @@ class UserWarnings(TableABC): TableABC.__init__(self) self._created_at = created_at if created_at is not None else self._created_at - self._modified_at = modified_at if modified_at is not None else self._modified_at + self._modified_at = ( + modified_at if modified_at is not None else self._modified_at + ) @property def id(self) -> int: diff --git a/kdb-bot/src/bot_data/model/user_warnings_history.py b/bot/src/bot_data/model/user_warnings_history.py similarity index 100% rename from kdb-bot/src/bot_data/model/user_warnings_history.py rename to bot/src/bot_data/model/user_warnings_history.py diff --git a/kdb-bot/src/bot_data/service/__init__.py b/bot/src/bot_data/service/__init__.py similarity index 100% rename from kdb-bot/src/bot_data/service/__init__.py rename to bot/src/bot_data/service/__init__.py diff --git a/kdb-bot/src/bot_data/service/achievements_repository_service.py b/bot/src/bot_data/service/achievements_repository_service.py similarity index 76% rename from kdb-bot/src/bot_data/service/achievements_repository_service.py rename to bot/src/bot_data/service/achievements_repository_service.py index b848fb5a..004a4a53 100644 --- a/kdb-bot/src/bot_data/service/achievements_repository_service.py +++ b/bot/src/bot_data/service/achievements_repository_service.py @@ -49,7 +49,9 @@ class AchievementRepositoryService(AchievementRepositoryABC): def get_achievements(self) -> List[Achievement]: achievements = List(Achievement) - self._logger.trace(__name__, f"Send SQL command: {Achievement.get_select_all_string()}") + self._logger.trace( + __name__, f"Send SQL command: {Achievement.get_select_all_string()}" + ) results = self._context.select(Achievement.get_select_all_string()) for result in results: self._logger.trace(__name__, f"Get user with id {result[0]}") @@ -58,15 +60,22 @@ class AchievementRepositoryService(AchievementRepositoryABC): return achievements def get_achievement_by_id(self, id: int) -> Achievement: - self._logger.trace(__name__, f"Send SQL command: {Achievement.get_select_by_id_string(id)}") + self._logger.trace( + __name__, f"Send SQL command: {Achievement.get_select_by_id_string(id)}" + ) result = self._context.select(Achievement.get_select_by_id_string(id))[0] return self._from_result(result) def get_achievements_by_server_id(self, server_id: int) -> List[Achievement]: achievements = List(Achievement) - self._logger.trace(__name__, f"Send SQL command: {Achievement.get_select_by_server_id_string(server_id)}") - results = self._context.select(Achievement.get_select_by_server_id_string(server_id)) + self._logger.trace( + __name__, + f"Send SQL command: {Achievement.get_select_by_server_id_string(server_id)}", + ) + results = self._context.select( + Achievement.get_select_by_server_id_string(server_id) + ) for result in results: self._logger.trace(__name__, f"Get user with id {result[0]}") achievements.append(self._from_result(result)) @@ -76,26 +85,38 @@ class AchievementRepositoryService(AchievementRepositoryABC): def get_achievements_by_user_id(self, user_id: int) -> List[Achievement]: achievements = List(Achievement) achievements_joins = List(UserGotAchievement) - self._logger.trace(__name__, f"Send SQL command: {UserGotAchievement.get_select_by_user_id_string(user_id)}") - results = self._context.select(UserGotAchievement.get_select_by_user_id_string(user_id)) + self._logger.trace( + __name__, + f"Send SQL command: {UserGotAchievement.get_select_by_user_id_string(user_id)}", + ) + results = self._context.select( + UserGotAchievement.get_select_by_user_id_string(user_id) + ) for result in results: self._logger.trace(__name__, f"Got UserGotAchievement with id {result[0]}") achievements_joins.append(self._join_from_result(result)) for achievements_join in achievements_joins: - results = self._context.select(Achievement.get_select_by_id_string(achievements_join.achievement.id)) + results = self._context.select( + Achievement.get_select_by_id_string(achievements_join.achievement.id) + ) for result in results: self._logger.trace(__name__, f"Got Achievement with id {result[0]}") achievements.append(self._from_result(result)) return achievements - def get_user_got_achievements_by_achievement_id(self, achievement_id: int) -> List[Achievement]: + def get_user_got_achievements_by_achievement_id( + self, achievement_id: int + ) -> List[Achievement]: achievements_joins = List(UserGotAchievement) self._logger.trace( - __name__, f"Send SQL command: {UserGotAchievement.get_select_by_achievement_id_string(achievement_id)}" + __name__, + f"Send SQL command: {UserGotAchievement.get_select_by_achievement_id_string(achievement_id)}", + ) + results = self._context.select( + UserGotAchievement.get_select_by_achievement_id_string(achievement_id) ) - results = self._context.select(UserGotAchievement.get_select_by_achievement_id_string(achievement_id)) for result in results: self._logger.trace(__name__, f"Got UserGotAchievement with id {result[0]}") achievements_joins.append(self._join_from_result(result)) diff --git a/kdb-bot/src/bot_data/service/api_key_repository_service.py b/bot/src/bot_data/service/api_key_repository_service.py similarity index 77% rename from kdb-bot/src/bot_data/service/api_key_repository_service.py rename to bot/src/bot_data/service/api_key_repository_service.py index d4f57dfc..dfa6f72e 100644 --- a/kdb-bot/src/bot_data/service/api_key_repository_service.py +++ b/bot/src/bot_data/service/api_key_repository_service.py @@ -45,7 +45,9 @@ class ApiKeyRepositoryService(ApiKeyRepositoryABC): def get_api_keys(self) -> List[ApiKey]: api_keys = List(ApiKey) - self._logger.trace(__name__, f"Send SQL command: {ApiKey.get_select_all_string()}") + self._logger.trace( + __name__, f"Send SQL command: {ApiKey.get_select_all_string()}" + ) results = self._context.select(ApiKey.get_select_all_string()) for result in results: api_keys.append(self._api_key_from_result(result)) @@ -53,16 +55,26 @@ class ApiKeyRepositoryService(ApiKeyRepositoryABC): return api_keys def get_api_key(self, identifier: str, key: str) -> ApiKey: - self._logger.trace(__name__, f"Send SQL command: {ApiKey.get_select_string(identifier, key)}") - return self._api_key_from_result(self._context.select(ApiKey.get_select_string(identifier, key))[0]) + self._logger.trace( + __name__, f"Send SQL command: {ApiKey.get_select_string(identifier, key)}" + ) + return self._api_key_from_result( + self._context.select(ApiKey.get_select_string(identifier, key))[0] + ) def get_api_key_by_id(self, id: int) -> ApiKey: self._logger.trace(__name__, f"Send SQL command: {ApiKey.get_select_by_id(id)}") - return self._api_key_from_result(self._context.select(ApiKey.get_select_by_id(id))[0]) + return self._api_key_from_result( + self._context.select(ApiKey.get_select_by_id(id))[0] + ) def get_api_key_by_key(self, key: str) -> ApiKey: - self._logger.trace(__name__, f"Send SQL command: {ApiKey.get_select_by_key(key)}") - return self._api_key_from_result(self._context.select(ApiKey.get_select_by_key(key))[0]) + self._logger.trace( + __name__, f"Send SQL command: {ApiKey.get_select_by_key(key)}" + ) + return self._api_key_from_result( + self._context.select(ApiKey.get_select_by_key(key))[0] + ) def add_api_key(self, api_key: ApiKey): self._logger.trace(__name__, f"Send SQL command: {api_key.insert_string}") diff --git a/kdb-bot/src/bot_data/service/auth_user_repository_service.py b/bot/src/bot_data/service/auth_user_repository_service.py similarity index 84% rename from kdb-bot/src/bot_data/service/auth_user_repository_service.py rename to bot/src/bot_data/service/auth_user_repository_service.py index 00afe7ae..1b959068 100644 --- a/kdb-bot/src/bot_data/service/auth_user_repository_service.py +++ b/bot/src/bot_data/service/auth_user_repository_service.py @@ -74,7 +74,9 @@ class AuthUserRepositoryService(AuthUserRepositoryABC): def get_all_auth_users(self) -> List[AuthUser]: users = List(AuthUser) - self._logger.trace(__name__, f"Send SQL command: {AuthUser.get_select_all_string()}") + self._logger.trace( + __name__, f"Send SQL command: {AuthUser.get_select_all_string()}" + ) results = self._context.select(AuthUser.get_select_all_string()) for result in results: self._logger.trace(__name__, f"Get auth user with id {result[0]}") @@ -82,22 +84,36 @@ class AuthUserRepositoryService(AuthUserRepositoryABC): return users - def get_filtered_auth_users(self, criteria: AuthUserSelectCriteria) -> FilteredResult: + def get_filtered_auth_users( + self, criteria: AuthUserSelectCriteria + ) -> FilteredResult: users = self.get_all_auth_users() - self._logger.trace(__name__, f"Send SQL command: {AuthUser.get_select_all_string()}") + self._logger.trace( + __name__, f"Send SQL command: {AuthUser.get_select_all_string()}" + ) query = users if criteria.first_name is not None and criteria.first_name != "": - query = query.where(lambda x: criteria.first_name in x.first_name or x.first_name == criteria.first_name) + query = query.where( + lambda x: criteria.first_name in x.first_name + or x.first_name == criteria.first_name + ) if criteria.last_name is not None and criteria.last_name != "": - query = query.where(lambda x: criteria.last_name in x.last_name or x.last_name == criteria.last_name) + query = query.where( + lambda x: criteria.last_name in x.last_name + or x.last_name == criteria.last_name + ) if criteria.email is not None and criteria.email != "": - query = query.where(lambda x: criteria.email in x.email or x.email == criteria.email) + query = query.where( + lambda x: criteria.email in x.email or x.email == criteria.email + ) if criteria.auth_role is not None: - query = query.where(lambda x: x.auth_role == AuthRoleEnum(criteria.auth_role)) + query = query.where( + lambda x: x.auth_role == AuthRoleEnum(criteria.auth_role) + ) # sort if ( @@ -128,12 +144,16 @@ class AuthUserRepositoryService(AuthUserRepositoryABC): return result def get_auth_user_by_email(self, email: str) -> AuthUser: - self._logger.trace(__name__, f"Send SQL command: {AuthUser.get_select_by_email_string(email)}") + self._logger.trace( + __name__, f"Send SQL command: {AuthUser.get_select_by_email_string(email)}" + ) result = self._context.select(AuthUser.get_select_by_email_string(email))[0] return self._user_from_result(result) def find_auth_user_by_email(self, email: str) -> Optional[AuthUser]: - self._logger.trace(__name__, f"Send SQL command: {AuthUser.get_select_by_email_string(email)}") + self._logger.trace( + __name__, f"Send SQL command: {AuthUser.get_select_by_email_string(email)}" + ) result = self._context.select(AuthUser.get_select_by_email_string(email)) if result is None or len(result) == 0: return None @@ -160,7 +180,9 @@ class AuthUserRepositoryService(AuthUserRepositoryABC): __name__, f"Send SQL command: {AuthUser.get_select_by_forgot_password_id_string(id)}", ) - result = self._context.select(AuthUser.get_select_by_forgot_password_id_string(id)) + result = self._context.select( + AuthUser.get_select_by_forgot_password_id_string(id) + ) if result is None or len(result) == 0: return None diff --git a/kdb-bot/src/bot_data/service/auto_role_repository_service.py b/bot/src/bot_data/service/auto_role_repository_service.py similarity index 59% rename from kdb-bot/src/bot_data/service/auto_role_repository_service.py rename to bot/src/bot_data/service/auto_role_repository_service.py index d1599341..e739962a 100644 --- a/kdb-bot/src/bot_data/service/auto_role_repository_service.py +++ b/bot/src/bot_data/service/auto_role_repository_service.py @@ -11,7 +11,12 @@ from bot_data.model.auto_role_rule import AutoRoleRule class AutoRoleRepositoryService(AutoRoleRepositoryABC): - def __init__(self, logger: DatabaseLogger, db_context: DatabaseContextABC, servers: ServerRepositoryABC): + def __init__( + self, + logger: DatabaseLogger, + db_context: DatabaseContextABC, + servers: ServerRepositoryABC, + ): self._logger = logger self._context = db_context self._servers = servers @@ -20,26 +25,42 @@ class AutoRoleRepositoryService(AutoRoleRepositoryABC): def get_auto_roles(self) -> List[AutoRole]: auto_roles = List(AutoRole) - self._logger.trace(__name__, f"Send SQL command: {AutoRole.get_select_all_string()}") + self._logger.trace( + __name__, f"Send SQL command: {AutoRole.get_select_all_string()}" + ) results = self._context.select(AutoRole.get_select_all_string()) for result in results: auto_roles.append( AutoRole( - self._servers.get_server_by_id(result[1]), result[2], result[3], result[4], result[5], id=result[0] + self._servers.get_server_by_id(result[1]), + result[2], + result[3], + result[4], + result[5], + id=result[0], ) ) return auto_roles def get_auto_role_by_id(self, id: int) -> AutoRole: - self._logger.trace(__name__, f"Send SQL command: {AutoRole.get_select_by_id_string(id)}") + self._logger.trace( + __name__, f"Send SQL command: {AutoRole.get_select_by_id_string(id)}" + ) result = self._context.select(AutoRole.get_select_by_id_string(id))[0] return AutoRole( - self._servers.get_server_by_id(result[1]), result[2], result[3], result[4], result[5], id=result[0] + self._servers.get_server_by_id(result[1]), + result[2], + result[3], + result[4], + result[5], + id=result[0], ) def find_auto_role_by_id(self, id: int) -> Optional[AutoRole]: - self._logger.trace(__name__, f"Send SQL command: {AutoRole.get_select_by_id_string(id)}") + self._logger.trace( + __name__, f"Send SQL command: {AutoRole.get_select_by_id_string(id)}" + ) result = self._context.select(AutoRole.get_select_by_id_string(id)) if result is None or len(result) == 0: return None @@ -47,17 +68,29 @@ class AutoRoleRepositoryService(AutoRoleRepositoryABC): result = result[0] return AutoRole( - self._servers.get_server_by_id(result[1]), result[2], result[3], result[4], result[5], id=result[0] + self._servers.get_server_by_id(result[1]), + result[2], + result[3], + result[4], + result[5], + id=result[0], ) def get_auto_roles_by_server_id(self, id: int) -> List[AutoRole]: - self._logger.trace(__name__, f"Send SQL command: {AutoRole.get_select_by_server_id_string(id)}") + self._logger.trace( + __name__, f"Send SQL command: {AutoRole.get_select_by_server_id_string(id)}" + ) auto_roles = List(AutoRole) results = self._context.select(AutoRole.get_select_by_server_id_string(id)) for result in results: auto_roles.append( AutoRole( - self._servers.get_server_by_id(result[1]), result[2], result[3], result[4], result[5], id=result[0] + self._servers.get_server_by_id(result[1]), + result[2], + result[3], + result[4], + result[5], + id=result[0], ) ) @@ -70,7 +103,12 @@ class AutoRoleRepositoryService(AutoRoleRepositoryABC): ) result = self._context.select(AutoRole.get_select_by_message_id_string(id))[0] return AutoRole( - self._servers.get_server_by_id(result[1]), result[2], result[3], result[4], result[5], id=result[0] + self._servers.get_server_by_id(result[1]), + result[2], + result[3], + result[4], + result[5], + id=result[0], ) def find_auto_role_by_message_id(self, id: int) -> Optional[AutoRole]: @@ -85,7 +123,12 @@ class AutoRoleRepositoryService(AutoRoleRepositoryABC): result = result[0] return AutoRole( - self._servers.get_server_by_id(result[1]), result[2], result[3], result[4], result[5], id=result[0] + self._servers.get_server_by_id(result[1]), + result[2], + result[3], + result[4], + result[5], + id=result[0], ) def add_auto_role(self, auto_role: AutoRole): @@ -102,22 +145,36 @@ class AutoRoleRepositoryService(AutoRoleRepositoryABC): def get_auto_role_rules(self) -> List[AutoRoleRule]: auto_role_rules = List(AutoRoleRule) - self._logger.trace(__name__, f"Send SQL command: {AutoRoleRule.get_select_all_string()}") + self._logger.trace( + __name__, f"Send SQL command: {AutoRoleRule.get_select_all_string()}" + ) results = self._context.select(AutoRoleRule.get_select_all_string()) for result in results: auto_role_rules.append( AutoRoleRule( - self.get_auto_role_by_id(result[1]), result[2], result[3], result[4], result[5], id=result[0] + self.get_auto_role_by_id(result[1]), + result[2], + result[3], + result[4], + result[5], + id=result[0], ) ) return auto_role_rules def get_auto_role_rule_by_id(self, id: int) -> AutoRoleRule: - self._logger.trace(__name__, f"Send SQL command: {AutoRoleRule.get_select_by_id_string(id)}") + self._logger.trace( + __name__, f"Send SQL command: {AutoRoleRule.get_select_by_id_string(id)}" + ) result = self._context.select(AutoRoleRule.get_select_by_id_string(id))[0] return AutoRoleRule( - self.get_auto_role_by_id(result[1]), result[2], result[3], result[4], result[5], id=result[0] + self.get_auto_role_by_id(result[1]), + result[2], + result[3], + result[4], + result[5], + id=result[0], ) def get_auto_role_rules_by_auto_role_id(self, id: int) -> List[AutoRoleRule]: @@ -126,24 +183,37 @@ class AutoRoleRepositoryService(AutoRoleRepositoryABC): __name__, f"Send SQL command: {AutoRoleRule.get_select_by_auto_role_id_string(id)}", ) - results = self._context.select(AutoRoleRule.get_select_by_auto_role_id_string(id)) + results = self._context.select( + AutoRoleRule.get_select_by_auto_role_id_string(id) + ) for result in results: auto_role_rules.append( AutoRoleRule( - self.get_auto_role_by_id(result[1]), result[2], result[3], result[4], result[5], id=result[0] + self.get_auto_role_by_id(result[1]), + result[2], + result[3], + result[4], + result[5], + id=result[0], ) ) return auto_role_rules def add_auto_role_rule(self, auto_role_rule: AutoRoleRule): - self._logger.trace(__name__, f"Send SQL command: {auto_role_rule.insert_string}") + self._logger.trace( + __name__, f"Send SQL command: {auto_role_rule.insert_string}" + ) self._context.cursor.execute(auto_role_rule.insert_string) def update_auto_role_rule(self, auto_role_rule: AutoRoleRule): - self._logger.trace(__name__, f"Send SQL command: {auto_role_rule.udpate_string}") + self._logger.trace( + __name__, f"Send SQL command: {auto_role_rule.udpate_string}" + ) self._context.cursor.execute(auto_role_rule.udpate_string) def delete_auto_role_rule(self, auto_role_rule: AutoRoleRule): - self._logger.trace(__name__, f"Send SQL command: {auto_role_rule.delete_string}") + self._logger.trace( + __name__, f"Send SQL command: {auto_role_rule.delete_string}" + ) self._context.cursor.execute(auto_role_rule.delete_string) diff --git a/kdb-bot/src/bot_data/service/cache_service.py b/bot/src/bot_data/service/cache_service.py similarity index 100% rename from kdb-bot/src/bot_data/service/cache_service.py rename to bot/src/bot_data/service/cache_service.py diff --git a/kdb-bot/src/bot_data/service/client_repository_service.py b/bot/src/bot_data/service/client_repository_service.py similarity index 89% rename from kdb-bot/src/bot_data/service/client_repository_service.py rename to bot/src/bot_data/service/client_repository_service.py index 587569a0..ce92d9ad 100644 --- a/kdb-bot/src/bot_data/service/client_repository_service.py +++ b/bot/src/bot_data/service/client_repository_service.py @@ -25,7 +25,9 @@ class ClientRepositoryService(ClientRepositoryABC): def get_clients(self) -> List[Client]: clients = List(Client) - self._logger.trace(__name__, f"Send SQL command: {Client.get_select_all_string()}") + self._logger.trace( + __name__, f"Send SQL command: {Client.get_select_all_string()}" + ) results = self._context.select(Client.get_select_all_string()) for result in results: self._logger.trace(__name__, f"Get client with id {result[0]}") @@ -47,7 +49,9 @@ class ClientRepositoryService(ClientRepositoryABC): return clients def get_client_by_id(self, client_id: int) -> Client: - self._logger.trace(__name__, f"Send SQL command: {Client.get_select_by_id_string(client_id)}") + self._logger.trace( + __name__, f"Send SQL command: {Client.get_select_by_id_string(client_id)}" + ) result = self._context.select(Client.get_select_by_id_string(client_id)) return Client( result[1], @@ -64,7 +68,10 @@ class ClientRepositoryService(ClientRepositoryABC): def get_clients_by_server_id(self, server_id: int) -> List[Client]: clients = List(Client) - self._logger.trace(__name__, f"Send SQL command: {Client.get_select_by_server_id_string(server_id)}") + self._logger.trace( + __name__, + f"Send SQL command: {Client.get_select_by_server_id_string(server_id)}", + ) results = self._context.select(Client.get_select_by_server_id_string(server_id)) for result in results: clients.append( @@ -89,7 +96,9 @@ class ClientRepositoryService(ClientRepositoryABC): __name__, f"Send SQL command: {Client.get_select_by_discord_id_string(discord_id)}", ) - result = self._context.select(Client.get_select_by_discord_id_string(discord_id))[0] + result = self._context.select( + Client.get_select_by_discord_id_string(discord_id) + )[0] return Client( result[1], result[2], @@ -108,7 +117,9 @@ class ClientRepositoryService(ClientRepositoryABC): __name__, f"Send SQL command: {Client.get_select_by_discord_id_string(discord_id)}", ) - result = self._context.select(Client.get_select_by_discord_id_string(discord_id)) + result = self._context.select( + Client.get_select_by_discord_id_string(discord_id) + ) if result is None or len(result) == 0: return None @@ -151,12 +162,16 @@ class ClientRepositoryService(ClientRepositoryABC): id=result[0], ) - def find_client_by_discord_id_and_server_id(self, discord_id: int, server_id: int) -> Optional[Client]: + def find_client_by_discord_id_and_server_id( + self, discord_id: int, server_id: int + ) -> Optional[Client]: self._logger.trace( __name__, f"Send SQL command: {Client.get_select_by_discord_id_and_server_id_string(discord_id, server_id)}", ) - result = self._context.select(Client.get_select_by_discord_id_and_server_id_string(discord_id, server_id)) + result = self._context.select( + Client.get_select_by_discord_id_and_server_id_string(discord_id, server_id) + ) if result is None or len(result) == 0: return None diff --git a/kdb-bot/src/bot_data/service/game_server_repository_service.py b/bot/src/bot_data/service/game_server_repository_service.py similarity index 93% rename from kdb-bot/src/bot_data/service/game_server_repository_service.py rename to bot/src/bot_data/service/game_server_repository_service.py index 1bdd0aeb..0a87b95e 100644 --- a/kdb-bot/src/bot_data/service/game_server_repository_service.py +++ b/bot/src/bot_data/service/game_server_repository_service.py @@ -42,7 +42,9 @@ class GameServerRepositoryService(GameServerRepositoryABC): ) results = self._context.select(GameServer.get_select_all_string()) for result in results: - self._logger.trace(__name__, f"Get user-joined-game-server with id {result[0]}") + self._logger.trace( + __name__, f"Get user-joined-game-server with id {result[0]}" + ) game_servers.append(self._from_result(result)) return game_servers @@ -55,7 +57,9 @@ class GameServerRepositoryService(GameServerRepositoryABC): ) results = self._context.select(GameServer.get_select_by_server_id_string(id)) for result in results: - self._logger.trace(__name__, f"Get user-joined-game-server with id {result[0]}") + self._logger.trace( + __name__, f"Get user-joined-game-server with id {result[0]}" + ) game_servers.append(self._from_result(result)) return game_servers diff --git a/kdb-bot/src/bot_data/service/known_user_repository_service.py b/bot/src/bot_data/service/known_user_repository_service.py similarity index 83% rename from kdb-bot/src/bot_data/service/known_user_repository_service.py rename to bot/src/bot_data/service/known_user_repository_service.py index b7dc57e2..5ef2d7c5 100644 --- a/kdb-bot/src/bot_data/service/known_user_repository_service.py +++ b/bot/src/bot_data/service/known_user_repository_service.py @@ -25,7 +25,9 @@ class KnownUserRepositoryService(KnownUserRepositoryABC): def get_users(self) -> List[KnownUser]: users = List(KnownUser) - self._logger.trace(__name__, f"Send SQL command: {KnownUser.get_select_all_string()}") + self._logger.trace( + __name__, f"Send SQL command: {KnownUser.get_select_all_string()}" + ) results = self._context.select(KnownUser.get_select_all_string()) for result in results: self._logger.trace(__name__, f"Get known_user with id {result[0]}") @@ -34,7 +36,9 @@ class KnownUserRepositoryService(KnownUserRepositoryABC): return users def get_user_by_id(self, id: int) -> KnownUser: - self._logger.trace(__name__, f"Send SQL command: {KnownUser.get_select_by_id_string(id)}") + self._logger.trace( + __name__, f"Send SQL command: {KnownUser.get_select_by_id_string(id)}" + ) result = self._context.select(KnownUser.get_select_by_id_string(id)) return KnownUser(result[1], result[2], result[3], id=result[0]) @@ -43,7 +47,9 @@ class KnownUserRepositoryService(KnownUserRepositoryABC): __name__, f"Send SQL command: {KnownUser.get_select_by_discord_id_string(discord_id)}", ) - result = self._context.select(KnownUser.get_select_by_discord_id_string(discord_id))[0] + result = self._context.select( + KnownUser.get_select_by_discord_id_string(discord_id) + )[0] return KnownUser(result[1], result[2], result[3], id=result[0]) def find_user_by_discord_id(self, discord_id: int) -> Optional[KnownUser]: @@ -51,7 +57,9 @@ class KnownUserRepositoryService(KnownUserRepositoryABC): __name__, f"Send SQL command: {KnownUser.get_select_by_discord_id_string(discord_id)}", ) - result = self._context.select(KnownUser.get_select_by_discord_id_string(discord_id)) + result = self._context.select( + KnownUser.get_select_by_discord_id_string(discord_id) + ) if result is None or len(result) == 0: return None diff --git a/kdb-bot/src/bot_data/service/level_repository_service.py b/bot/src/bot_data/service/level_repository_service.py similarity index 91% rename from kdb-bot/src/bot_data/service/level_repository_service.py rename to bot/src/bot_data/service/level_repository_service.py index c713c0da..e7828104 100644 --- a/kdb-bot/src/bot_data/service/level_repository_service.py +++ b/bot/src/bot_data/service/level_repository_service.py @@ -42,7 +42,9 @@ class LevelRepositoryService(LevelRepositoryABC): def get_levels(self) -> List[Level]: levels = List(Level) - self._logger.trace(__name__, f"Send SQL command: {Level.get_select_all_string()}") + self._logger.trace( + __name__, f"Send SQL command: {Level.get_select_all_string()}" + ) results = self._context.select(Level.get_select_all_string()) for result in results: self._logger.trace(__name__, f"Get level with id {result[0]}") @@ -51,13 +53,17 @@ class LevelRepositoryService(LevelRepositoryABC): return levels def get_level_by_id(self, id: int) -> Level: - self._logger.trace(__name__, f"Send SQL command: {Level.get_select_by_id_string(id)}") + self._logger.trace( + __name__, f"Send SQL command: {Level.get_select_by_id_string(id)}" + ) result = self._context.select(Level.get_select_by_id_string(id))[0] return self._level_from_result(result) def find_level_by_id(self, id: int) -> Optional[Level]: - self._logger.trace(__name__, f"Send SQL command: {Level.get_select_by_id_string(id)}") + self._logger.trace( + __name__, f"Send SQL command: {Level.get_select_by_id_string(id)}" + ) result = self._context.select(Level.get_select_by_id_string(id)) if result is None or len(result) == 0: return None diff --git a/kdb-bot/src/bot_data/service/migration_service.py b/bot/src/bot_data/service/migration_service.py similarity index 78% rename from kdb-bot/src/bot_data/service/migration_service.py rename to bot/src/bot_data/service/migration_service.py index dc6436a7..cf6303e9 100644 --- a/kdb-bot/src/bot_data/service/migration_service.py +++ b/bot/src/bot_data/service/migration_service.py @@ -21,7 +21,9 @@ class MigrationService: self._cursor = db.cursor self._migrations: List[MigrationABC] = ( - List(type, MigrationABC.__subclasses__()).order_by(lambda x: x.name).order_by(lambda x: x.prio) + List(type, MigrationABC.__subclasses__()) + .order_by(lambda x: x.name) + .order_by(lambda x: x.prio) ) def migrate(self): @@ -38,15 +40,21 @@ class MigrationService: __name__, f"Running SQL Command: {MigrationHistory.get_select_by_id_string(migration_id)}", ) - migration_from_db = self._db.select(MigrationHistory.get_select_by_id_string(migration_id)) + migration_from_db = self._db.select( + MigrationHistory.get_select_by_id_string(migration_id) + ) if migration_from_db is not None and len(migration_from_db) > 0: continue self._logger.debug(__name__, f"Running Migration {migration_id}") - migration_as_service: MigrationABC = self._services.get_service(migration) + migration_as_service: MigrationABC = self._services.get_service( + migration + ) migration_as_service.upgrade() self._cursor.execute(MigrationHistory(migration_id).insert_string) self._db.save_changes() except Exception as e: - self._logger.error(__name__, f"Cannot get migration with id {migration}", e) + self._logger.error( + __name__, f"Cannot get migration with id {migration}", e + ) diff --git a/kdb-bot/src/bot_data/service/seeder_service.py b/bot/src/bot_data/service/seeder_service.py similarity index 100% rename from kdb-bot/src/bot_data/service/seeder_service.py rename to bot/src/bot_data/service/seeder_service.py diff --git a/kdb-bot/src/bot_data/service/server_config_repository_service.py b/bot/src/bot_data/service/server_config_repository_service.py similarity index 54% rename from kdb-bot/src/bot_data/service/server_config_repository_service.py rename to bot/src/bot_data/service/server_config_repository_service.py index 302a5752..9ff8bf10 100644 --- a/kdb-bot/src/bot_data/service/server_config_repository_service.py +++ b/bot/src/bot_data/service/server_config_repository_service.py @@ -13,7 +13,12 @@ from bot_data.model.team_member_type_enum import TeamMemberTypeEnum class ServerConfigRepositoryService(ServerConfigRepositoryABC): - def __init__(self, logger: DatabaseLogger, db_context: DatabaseContextABC, servers: ServerRepositoryABC): + def __init__( + self, + logger: DatabaseLogger, + db_context: DatabaseContextABC, + servers: ServerRepositoryABC, + ): ServerConfigRepositoryABC.__init__(self) self._logger = logger @@ -23,14 +28,24 @@ class ServerConfigRepositoryService(ServerConfigRepositoryABC): def _get_team_role_ids(self, server_id: int) -> List[ServerTeamRoleIdsConfig]: ids = List(ServerTeamRoleIdsConfig) self._logger.trace( - __name__, f"Send SQL command: {ServerTeamRoleIdsConfig.get_select_by_server_id_string(server_id)}" + __name__, + f"Send SQL command: {ServerTeamRoleIdsConfig.get_select_by_server_id_string(server_id)}", + ) + results = self._context.select( + ServerTeamRoleIdsConfig.get_select_by_server_id_string(server_id) ) - results = self._context.select(ServerTeamRoleIdsConfig.get_select_by_server_id_string(server_id)) for result in results: - self._logger.trace(__name__, f"Got ServerTeamRoleIdsConfig with id {result[0]}") + self._logger.trace( + __name__, f"Got ServerTeamRoleIdsConfig with id {result[0]}" + ) ids.append( ServerTeamRoleIdsConfig( - result[1], TeamMemberTypeEnum(result[2]), result[3], result[4], result[5], id=result[0] + result[1], + TeamMemberTypeEnum(result[2]), + result[3], + result[4], + result[5], + id=result[0], ) ) @@ -42,9 +57,13 @@ class ServerConfigRepositoryService(ServerConfigRepositoryABC): __name__, f"Send SQL command: {ServerAFKChannelIdsConfig.get_select_by_server_id_string(server_id)}", ) - results = self._context.select(ServerAFKChannelIdsConfig.get_select_by_server_id_string(server_id)) + results = self._context.select( + ServerAFKChannelIdsConfig.get_select_by_server_id_string(server_id) + ) for result in results: - self._logger.trace(__name__, f"Got ServerAFKChannelIdsConfig with id {result[0]}") + self._logger.trace( + __name__, f"Got ServerAFKChannelIdsConfig with id {result[0]}" + ) urls.append(result[1]) return urls @@ -78,20 +97,35 @@ class ServerConfigRepositoryService(ServerConfigRepositoryABC): ) def does_server_config_exists(self, server_id: int) -> bool: - self._logger.trace(__name__, f"Send SQL command: {ServerConfig.get_select_by_server_id_string(server_id)}") - result = self._context.select(ServerConfig.get_select_by_server_id_string(server_id)) + self._logger.trace( + __name__, + f"Send SQL command: {ServerConfig.get_select_by_server_id_string(server_id)}", + ) + result = self._context.select( + ServerConfig.get_select_by_server_id_string(server_id) + ) return len(result) > 0 def get_server_config_by_server(self, server_id: int) -> ServerConfig: - self._logger.trace(__name__, f"Send SQL command: {ServerConfig.get_select_by_server_id_string(server_id)}") - result = self._context.select(ServerConfig.get_select_by_server_id_string(server_id))[0] + self._logger.trace( + __name__, + f"Send SQL command: {ServerConfig.get_select_by_server_id_string(server_id)}", + ) + result = self._context.select( + ServerConfig.get_select_by_server_id_string(server_id) + )[0] return self._from_result(result) def get_server_config_by_id(self, config_id: int) -> ServerConfig: - self._logger.trace(__name__, f"Send SQL command: {ServerConfig.get_select_by_id_string(config_id)}") - result = self._context.select(ServerConfig.get_select_by_id_string(config_id))[0] + self._logger.trace( + __name__, + f"Send SQL command: {ServerConfig.get_select_by_id_string(config_id)}", + ) + result = self._context.select(ServerConfig.get_select_by_id_string(config_id))[ + 0 + ] return self._from_result(result) @@ -107,26 +141,50 @@ class ServerConfigRepositoryService(ServerConfigRepositoryABC): self._logger.trace(__name__, f"Send SQL command: {server_config.delete_string}") self._context.cursor.execute(server_config.delete_string) - def add_server_team_role_id_config(self, server_team_role_id: ServerTeamRoleIdsConfig): - self._logger.trace(__name__, f"Send SQL command: {server_team_role_id.insert_string}") + def add_server_team_role_id_config( + self, server_team_role_id: ServerTeamRoleIdsConfig + ): + self._logger.trace( + __name__, f"Send SQL command: {server_team_role_id.insert_string}" + ) self._context.cursor.execute(server_team_role_id.insert_string) - def update_server_team_role_id_config(self, server_team_role_id: ServerTeamRoleIdsConfig): - self._logger.trace(__name__, f"Send SQL command: {server_team_role_id.udpate_string}") + def update_server_team_role_id_config( + self, server_team_role_id: ServerTeamRoleIdsConfig + ): + self._logger.trace( + __name__, f"Send SQL command: {server_team_role_id.udpate_string}" + ) self._context.cursor.execute(server_team_role_id.udpate_string) - def delete_server_team_role_id_config(self, server_team_role_id: ServerTeamRoleIdsConfig): - self._logger.trace(__name__, f"Send SQL command: {server_team_role_id.delete_string}") + def delete_server_team_role_id_config( + self, server_team_role_id: ServerTeamRoleIdsConfig + ): + self._logger.trace( + __name__, f"Send SQL command: {server_team_role_id.delete_string}" + ) self._context.cursor.execute(server_team_role_id.delete_string) - def add_server_afk_channel_config(self, server_afk_channel: ServerAFKChannelIdsConfig): - self._logger.trace(__name__, f"Send SQL command: {server_afk_channel.insert_string}") + def add_server_afk_channel_config( + self, server_afk_channel: ServerAFKChannelIdsConfig + ): + self._logger.trace( + __name__, f"Send SQL command: {server_afk_channel.insert_string}" + ) self._context.cursor.execute(server_afk_channel.insert_string) - def update_server_afk_channel_config(self, server_afk_channel: ServerAFKChannelIdsConfig): - self._logger.trace(__name__, f"Send SQL command: {server_afk_channel.udpate_string}") + def update_server_afk_channel_config( + self, server_afk_channel: ServerAFKChannelIdsConfig + ): + self._logger.trace( + __name__, f"Send SQL command: {server_afk_channel.udpate_string}" + ) self._context.cursor.execute(server_afk_channel.udpate_string) - def delete_server_afk_channel_config(self, server_afk_channel: ServerAFKChannelIdsConfig): - self._logger.trace(__name__, f"Send SQL command: {server_afk_channel.delete_string}") + def delete_server_afk_channel_config( + self, server_afk_channel: ServerAFKChannelIdsConfig + ): + self._logger.trace( + __name__, f"Send SQL command: {server_afk_channel.delete_string}" + ) self._context.cursor.execute(server_afk_channel.delete_string) diff --git a/kdb-bot/src/bot_data/service/server_config_seeder.py b/bot/src/bot_data/service/server_config_seeder.py similarity index 100% rename from kdb-bot/src/bot_data/service/server_config_seeder.py rename to bot/src/bot_data/service/server_config_seeder.py diff --git a/kdb-bot/src/bot_data/service/server_repository_service.py b/bot/src/bot_data/service/server_repository_service.py similarity index 74% rename from kdb-bot/src/bot_data/service/server_repository_service.py rename to bot/src/bot_data/service/server_repository_service.py index 924cc036..43f54c3d 100644 --- a/kdb-bot/src/bot_data/service/server_repository_service.py +++ b/bot/src/bot_data/service/server_repository_service.py @@ -12,7 +12,12 @@ from bot_data.service.cache_service import CacheService class ServerRepositoryService(ServerRepositoryABC): - def __init__(self, logger: DatabaseLogger, db_context: DatabaseContextABC, cache: CacheService): + def __init__( + self, + logger: DatabaseLogger, + db_context: DatabaseContextABC, + cache: CacheService, + ): self._logger = logger self._context = db_context self._cache = cache @@ -21,7 +26,9 @@ class ServerRepositoryService(ServerRepositoryABC): def get_servers(self) -> List[Server]: servers = List(Server) - self._logger.trace(__name__, f"Send SQL command: {Server.get_select_all_string()}") + self._logger.trace( + __name__, f"Send SQL command: {Server.get_select_all_string()}" + ) results = self._context.select(Server.get_select_all_string()) for result in results: servers.append(Server(result[1], result[2], result[3], id=result[0])) @@ -31,7 +38,9 @@ class ServerRepositoryService(ServerRepositoryABC): def get_filtered_servers(self, criteria: ServerSelectCriteria) -> FilteredResult: servers = self.get_servers() - self._logger.trace(__name__, f"Send SQL command: {Server.get_select_all_string()}") + self._logger.trace( + __name__, f"Send SQL command: {Server.get_select_all_string()}" + ) query = servers # sort @@ -43,7 +52,9 @@ class ServerRepositoryService(ServerRepositoryABC): ): crit_sort_direction = criteria.sort_direction.lower() if crit_sort_direction == "desc" or crit_sort_direction == "descending": - query = query.order_by_descending(lambda x: getattr(x, criteria.sort_column)) + query = query.order_by_descending( + lambda x: getattr(x, criteria.sort_column) + ) else: query = query.order_by(lambda x: getattr(x, criteria.sort_column)) @@ -55,19 +66,25 @@ class ServerRepositoryService(ServerRepositoryABC): return result def get_server_by_id(self, server_id: int) -> Server: - cs = self._cache.cached_server.where(lambda x: x.id == server_id).single_or_default() + cs = self._cache.cached_server.where( + lambda x: x.id == server_id + ).single_or_default() if cs is not None: return cs - self._logger.trace(__name__, f"Send SQL command: {Server.get_select_by_id_string(server_id)}") + self._logger.trace( + __name__, f"Send SQL command: {Server.get_select_by_id_string(server_id)}" + ) result = self._context.select(Server.get_select_by_id_string(server_id))[0] server = Server(result[1], result[2], result[3], id=result[0]) self._cache.add_server(server) return server def get_server_by_discord_id(self, discord_id: int) -> Server: - cs = self._cache.cached_server.where(lambda x: x.discord_id == discord_id).single_or_default() + cs = self._cache.cached_server.where( + lambda x: x.discord_id == discord_id + ).single_or_default() if cs is not None: return cs @@ -75,11 +92,15 @@ class ServerRepositoryService(ServerRepositoryABC): __name__, f"Send SQL command: {Server.get_select_by_discord_id_string(discord_id)}", ) - result = self._context.select(Server.get_select_by_discord_id_string(discord_id))[0] + result = self._context.select( + Server.get_select_by_discord_id_string(discord_id) + )[0] return Server(result[1], result[2], result[3], id=result[0]) def find_server_by_discord_id(self, discord_id: int) -> Optional[Server]: - cs = self._cache.cached_server.where(lambda x: x.discord_id == discord_id).single_or_default() + cs = self._cache.cached_server.where( + lambda x: x.discord_id == discord_id + ).single_or_default() if cs is not None: return cs @@ -87,7 +108,9 @@ class ServerRepositoryService(ServerRepositoryABC): __name__, f"Send SQL command: {Server.get_select_by_discord_id_string(discord_id)}", ) - result = self._context.select(Server.get_select_by_discord_id_string(discord_id)) + result = self._context.select( + Server.get_select_by_discord_id_string(discord_id) + ) if result is None or len(result) == 0: return None diff --git a/kdb-bot/src/bot_data/service/short_role_name_repository_service.py b/bot/src/bot_data/service/short_role_name_repository_service.py similarity index 76% rename from kdb-bot/src/bot_data/service/short_role_name_repository_service.py rename to bot/src/bot_data/service/short_role_name_repository_service.py index fa65077e..5b6a929e 100644 --- a/kdb-bot/src/bot_data/service/short_role_name_repository_service.py +++ b/bot/src/bot_data/service/short_role_name_repository_service.py @@ -35,7 +35,9 @@ class ShortRoleNameRepositoryService(ShortRoleNameRepositoryABC): return ShortRoleName( self._get_value_from_result(sql_result[1]), # name int(self._get_value_from_result(sql_result[2])), # role_id - ShortRoleNamePositionEnum(self._get_value_from_result(sql_result[3])), # position + ShortRoleNamePositionEnum( + self._get_value_from_result(sql_result[3]) + ), # position self._servers.get_server_by_id(sql_result[4]), # server self._get_value_from_result(sql_result[5]), # created_at self._get_value_from_result(sql_result[6]), # modified_at @@ -44,7 +46,9 @@ class ShortRoleNameRepositoryService(ShortRoleNameRepositoryABC): def get_short_role_names(self) -> List[ShortRoleName]: short_role_names = List(ShortRoleName) - self._logger.trace(__name__, f"Send SQL command: {ShortRoleName.get_select_all_string()}") + self._logger.trace( + __name__, f"Send SQL command: {ShortRoleName.get_select_all_string()}" + ) results = self._context.select(ShortRoleName.get_select_all_string()) for result in results: self._logger.trace(__name__, f"Get short_role_name with id {result[0]}") @@ -53,15 +57,22 @@ class ShortRoleNameRepositoryService(ShortRoleNameRepositoryABC): return short_role_names def get_short_role_name_by_id(self, id: int) -> ShortRoleName: - self._logger.trace(__name__, f"Send SQL command: {ShortRoleName.get_select_by_id_string(id)}") + self._logger.trace( + __name__, f"Send SQL command: {ShortRoleName.get_select_by_id_string(id)}" + ) result = self._context.select(ShortRoleName.get_select_by_id_string(id))[0] return self._short_role_name_from_result(result) def find_short_role_names_by_role_id(self, role_id: int) -> List[ShortRoleName]: short_role_names = List(ShortRoleName) - self._logger.trace(__name__, f"Send SQL command: {ShortRoleName.get_select_by_role_id_string(role_id)}") - results = self._context.select(ShortRoleName.get_select_by_role_id_string(role_id)) + self._logger.trace( + __name__, + f"Send SQL command: {ShortRoleName.get_select_by_role_id_string(role_id)}", + ) + results = self._context.select( + ShortRoleName.get_select_by_role_id_string(role_id) + ) for result in results: self._logger.trace(__name__, f"Get short_role_name with id {result[0]}") short_role_names.append(self._short_role_name_from_result(result)) @@ -74,7 +85,9 @@ class ShortRoleNameRepositoryService(ShortRoleNameRepositoryABC): __name__, f"Send SQL command: {ShortRoleName.get_select_by_server_id_string(server_id)}", ) - results = self._context.select(ShortRoleName.get_select_by_server_id_string(server_id)) + results = self._context.select( + ShortRoleName.get_select_by_server_id_string(server_id) + ) for result in results: self._logger.trace(__name__, f"Get short_role_name with id {result[0]}") @@ -83,13 +96,19 @@ class ShortRoleNameRepositoryService(ShortRoleNameRepositoryABC): return short_role_names def add_short_role_name(self, short_role_name: ShortRoleName): - self._logger.trace(__name__, f"Send SQL command: {short_role_name.insert_string}") + self._logger.trace( + __name__, f"Send SQL command: {short_role_name.insert_string}" + ) self._context.cursor.execute(short_role_name.insert_string) def update_short_role_name(self, short_role_name: ShortRoleName): - self._logger.trace(__name__, f"Send SQL command: {short_role_name.udpate_string}") + self._logger.trace( + __name__, f"Send SQL command: {short_role_name.udpate_string}" + ) self._context.cursor.execute(short_role_name.udpate_string) def delete_short_role_name(self, short_role_name: ShortRoleName): - self._logger.trace(__name__, f"Send SQL command: {short_role_name.delete_string}") + self._logger.trace( + __name__, f"Send SQL command: {short_role_name.delete_string}" + ) self._context.cursor.execute(short_role_name.delete_string) diff --git a/kdb-bot/src/bot_data/service/steam_special_offer_repository_service.py b/bot/src/bot_data/service/steam_special_offer_repository_service.py similarity index 74% rename from kdb-bot/src/bot_data/service/steam_special_offer_repository_service.py rename to bot/src/bot_data/service/steam_special_offer_repository_service.py index 94ee702d..256f01b2 100644 --- a/kdb-bot/src/bot_data/service/steam_special_offer_repository_service.py +++ b/bot/src/bot_data/service/steam_special_offer_repository_service.py @@ -5,7 +5,9 @@ from cpl_query.extension import List from bot_core.logging.database_logger import DatabaseLogger from bot_data.abc.server_repository_abc import ServerRepositoryABC -from bot_data.abc.steam_special_offer_repository_abc import SteamSpecialOfferRepositoryABC +from bot_data.abc.steam_special_offer_repository_abc import ( + SteamSpecialOfferRepositoryABC, +) from bot_data.model.steam_special_offer import SteamSpecialOffer @@ -41,7 +43,9 @@ class SteamSpecialOfferRepositoryService(SteamSpecialOfferRepositoryABC): def get_steam_special_offers(self) -> List[SteamSpecialOffer]: steam_special_offers = List(SteamSpecialOffer) - self._logger.trace(__name__, f"Send SQL command: {SteamSpecialOffer.get_select_all_string()}") + self._logger.trace( + __name__, f"Send SQL command: {SteamSpecialOffer.get_select_all_string()}" + ) results = self._context.select(SteamSpecialOffer.get_select_all_string()) for result in results: self._logger.trace(__name__, f"Get steam_special_offer with id {result[0]}") @@ -50,19 +54,30 @@ class SteamSpecialOfferRepositoryService(SteamSpecialOfferRepositoryABC): return steam_special_offers def get_steam_special_offer_by_name(self, name: str) -> SteamSpecialOffer: - self._logger.trace(__name__, f"Send SQL command: {SteamSpecialOffer.get_select_by_name_string(name)}") - result = self._context.select(SteamSpecialOffer.get_select_by_name_string(name))[0] + self._logger.trace( + __name__, + f"Send SQL command: {SteamSpecialOffer.get_select_by_name_string(name)}", + ) + result = self._context.select( + SteamSpecialOffer.get_select_by_name_string(name) + )[0] return self._steam_special_offer_from_result(result) def add_steam_special_offer(self, steam_special_offer: SteamSpecialOffer): - self._logger.trace(__name__, f"Send SQL command: {steam_special_offer.insert_string}") + self._logger.trace( + __name__, f"Send SQL command: {steam_special_offer.insert_string}" + ) self._context.cursor.execute(steam_special_offer.insert_string) def update_steam_special_offer(self, steam_special_offer: SteamSpecialOffer): - self._logger.trace(__name__, f"Send SQL command: {steam_special_offer.udpate_string}") + self._logger.trace( + __name__, f"Send SQL command: {steam_special_offer.udpate_string}" + ) self._context.cursor.execute(steam_special_offer.udpate_string) def delete_steam_special_offer(self, steam_special_offer: SteamSpecialOffer): - self._logger.trace(__name__, f"Send SQL command: {steam_special_offer.delete_string}") + self._logger.trace( + __name__, f"Send SQL command: {steam_special_offer.delete_string}" + ) self._context.cursor.execute(steam_special_offer.delete_string) diff --git a/kdb-bot/src/bot_data/service/technician_config_repository_service.py b/bot/src/bot_data/service/technician_config_repository_service.py similarity index 69% rename from kdb-bot/src/bot_data/service/technician_config_repository_service.py rename to bot/src/bot_data/service/technician_config_repository_service.py index fe32eded..3d31b415 100644 --- a/kdb-bot/src/bot_data/service/technician_config_repository_service.py +++ b/bot/src/bot_data/service/technician_config_repository_service.py @@ -19,7 +19,9 @@ class TechnicianConfigRepositoryService(TechnicianConfigRepositoryABC): def _get_technician_ids(self) -> List[int]: ids = List(int) - self._logger.trace(__name__, f"Send SQL command: {TechnicianIdConfig.get_select_all_string()}") + self._logger.trace( + __name__, f"Send SQL command: {TechnicianIdConfig.get_select_all_string()}" + ) results = self._context.select(TechnicianIdConfig.get_select_all_string()) for result in results: self._logger.trace(__name__, f"Got TechnicianId with id {result[0]}") @@ -29,7 +31,10 @@ class TechnicianConfigRepositoryService(TechnicianConfigRepositoryABC): def _get_technician_ping_urls(self) -> List[str]: urls = List(str) - self._logger.trace(__name__, f"Send SQL command: {TechnicianPingUrlConfig.get_select_all_string()}") + self._logger.trace( + __name__, + f"Send SQL command: {TechnicianPingUrlConfig.get_select_all_string()}", + ) results = self._context.select(TechnicianPingUrlConfig.get_select_all_string()) for result in results: self._logger.trace(__name__, f"Got TechnicianPingUrl with id {result[0]}") @@ -52,27 +57,37 @@ class TechnicianConfigRepositoryService(TechnicianConfigRepositoryABC): ) def does_technician_config_exists(self) -> bool: - self._logger.trace(__name__, f"Send SQL command: {TechnicianConfig.get_select_all_string()}") + self._logger.trace( + __name__, f"Send SQL command: {TechnicianConfig.get_select_all_string()}" + ) result = self._context.select(TechnicianConfig.get_select_all_string()) return len(result) > 0 def get_technician_config(self) -> TechnicianConfig: - self._logger.trace(__name__, f"Send SQL command: {TechnicianConfig.get_select_all_string()}") + self._logger.trace( + __name__, f"Send SQL command: {TechnicianConfig.get_select_all_string()}" + ) result = self._context.select(TechnicianConfig.get_select_all_string())[0] return self._from_result(result) def add_technician_config(self, technician_config: TechnicianConfig): - self._logger.trace(__name__, f"Send SQL command: {technician_config.insert_string}") + self._logger.trace( + __name__, f"Send SQL command: {technician_config.insert_string}" + ) self._context.cursor.execute(technician_config.insert_string) def update_technician_config(self, technician_config: TechnicianConfig): - self._logger.trace(__name__, f"Send SQL command: {technician_config.udpate_string}") + self._logger.trace( + __name__, f"Send SQL command: {technician_config.udpate_string}" + ) self._context.cursor.execute(technician_config.udpate_string) def delete_technician_config(self, technician_config: TechnicianConfig): - self._logger.trace(__name__, f"Send SQL command: {technician_config.delete_string}") + self._logger.trace( + __name__, f"Send SQL command: {technician_config.delete_string}" + ) self._context.cursor.execute(technician_config.delete_string) def add_technician_id_config(self, technician_id: TechnicianIdConfig): @@ -87,14 +102,26 @@ class TechnicianConfigRepositoryService(TechnicianConfigRepositoryABC): self._logger.trace(__name__, f"Send SQL command: {technician_id.delete_string}") self._context.cursor.execute(technician_id.delete_string) - def add_technician_ping_url_config(self, technician_ping_url: TechnicianPingUrlConfig): - self._logger.trace(__name__, f"Send SQL command: {technician_ping_url.insert_string}") + def add_technician_ping_url_config( + self, technician_ping_url: TechnicianPingUrlConfig + ): + self._logger.trace( + __name__, f"Send SQL command: {technician_ping_url.insert_string}" + ) self._context.cursor.execute(technician_ping_url.insert_string) - def update_technician_ping_url_config(self, technician_ping_url: TechnicianPingUrlConfig): - self._logger.trace(__name__, f"Send SQL command: {technician_ping_url.udpate_string}") + def update_technician_ping_url_config( + self, technician_ping_url: TechnicianPingUrlConfig + ): + self._logger.trace( + __name__, f"Send SQL command: {technician_ping_url.udpate_string}" + ) self._context.cursor.execute(technician_ping_url.udpate_string) - def delete_technician_ping_url_config(self, technician_ping_url: TechnicianPingUrlConfig): - self._logger.trace(__name__, f"Send SQL command: {technician_ping_url.delete_string}") + def delete_technician_ping_url_config( + self, technician_ping_url: TechnicianPingUrlConfig + ): + self._logger.trace( + __name__, f"Send SQL command: {technician_ping_url.delete_string}" + ) self._context.cursor.execute(technician_ping_url.delete_string) diff --git a/kdb-bot/src/bot_data/service/technician_config_seeder.py b/bot/src/bot_data/service/technician_config_seeder.py similarity index 85% rename from kdb-bot/src/bot_data/service/technician_config_seeder.py rename to bot/src/bot_data/service/technician_config_seeder.py index 209b3e02..09dfd3bc 100644 --- a/kdb-bot/src/bot_data/service/technician_config_seeder.py +++ b/bot/src/bot_data/service/technician_config_seeder.py @@ -34,15 +34,22 @@ class TechnicianConfigSeeder(DataSeederABC): 1000000, {}, List(int, [240160344557879316]), - List(str, ["www.google.com", "www.sh-edraft.de", "www.keksdose-gaming.de"]), + List( + str, + ["www.google.com", "www.sh-edraft.de", "www.keksdose-gaming.de"], + ), ) self._technician_config.add_technician_config(config) for technician in config.technician_ids: - self._technician_config.add_technician_id_config(TechnicianIdConfig(technician)) + self._technician_config.add_technician_id_config( + TechnicianIdConfig(technician) + ) for url in config.ping_urls: - self._technician_config.add_technician_ping_url_config(TechnicianPingUrlConfig(url)) + self._technician_config.add_technician_ping_url_config( + TechnicianPingUrlConfig(url) + ) self._db.save_changes() self._logger.debug(__name__, "Seeded technician config") diff --git a/kdb-bot/src/bot_data/service/user_game_ident_repository_service.py b/bot/src/bot_data/service/user_game_ident_repository_service.py similarity index 85% rename from kdb-bot/src/bot_data/service/user_game_ident_repository_service.py rename to bot/src/bot_data/service/user_game_ident_repository_service.py index d0dfc38b..0039d85e 100644 --- a/kdb-bot/src/bot_data/service/user_game_ident_repository_service.py +++ b/bot/src/bot_data/service/user_game_ident_repository_service.py @@ -51,13 +51,17 @@ class UserGameIdentRepositoryService(UserGameIdentRepositoryABC): return joins - def get_user_game_idents_by_game_server_id(self, game_server_id: int) -> List[UserGameIdent]: + def get_user_game_idents_by_game_server_id( + self, game_server_id: int + ) -> List[UserGameIdent]: joins = List(UserGameIdent) self._logger.trace( __name__, f"Send SQL command: {UserGameIdent.get_select_by_game_server_id_string(game_server_id)}", ) - results = self._context.select(UserGameIdent.get_select_by_game_server_id_string(game_server_id)) + results = self._context.select( + UserGameIdent.get_select_by_game_server_id_string(game_server_id) + ) for result in results: self._logger.trace(__name__, f"Get UserGameIdent with id {result[0]}") joins.append(self._from_result(result)) @@ -77,7 +81,9 @@ class UserGameIdentRepositoryService(UserGameIdentRepositoryABC): __name__, f"Send SQL command: {UserGameIdent.get_select_by_ident_string(ident)}", ) - result = self._context.select(UserGameIdent.get_select_by_ident_string(ident))[0] + result = self._context.select(UserGameIdent.get_select_by_ident_string(ident))[ + 0 + ] return self._from_result(result) def find_user_game_ident_by_ident(self, ident: str) -> Optional[UserGameIdent]: @@ -98,22 +104,30 @@ class UserGameIdentRepositoryService(UserGameIdentRepositoryABC): __name__, f"Send SQL command: {UserGameIdent.get_select_by_user_id_string(user_id)}", ) - results = self._context.select(UserGameIdent.get_select_by_user_id_string(user_id)) + results = self._context.select( + UserGameIdent.get_select_by_user_id_string(user_id) + ) for result in results: joins.append(self._from_result(result)) return joins def add_user_game_ident(self, user_game_ident: UserGameIdent): - self._logger.trace(__name__, f"Send SQL command: {user_game_ident.insert_string}") + self._logger.trace( + __name__, f"Send SQL command: {user_game_ident.insert_string}" + ) self._context.cursor.execute(user_game_ident.insert_string) def update_user_game_ident(self, user_game_ident: UserGameIdent): - self._logger.trace(__name__, f"Send SQL command: {user_game_ident.udpate_string}") + self._logger.trace( + __name__, f"Send SQL command: {user_game_ident.udpate_string}" + ) self._context.cursor.execute(user_game_ident.udpate_string) def delete_user_game_ident(self, user_game_ident: UserGameIdent): - self._logger.trace(__name__, f"Send SQL command: {user_game_ident.delete_string}") + self._logger.trace( + __name__, f"Send SQL command: {user_game_ident.delete_string}" + ) self._context.cursor.execute(user_game_ident.delete_string) def delete_user_game_ident_by_user_id(self, user_id: int): diff --git a/kdb-bot/src/bot_data/service/user_joined_game_server_repository_service.py b/bot/src/bot_data/service/user_joined_game_server_repository_service.py similarity index 65% rename from kdb-bot/src/bot_data/service/user_joined_game_server_repository_service.py rename to bot/src/bot_data/service/user_joined_game_server_repository_service.py index e9ded8ba..5f1a3627 100644 --- a/kdb-bot/src/bot_data/service/user_joined_game_server_repository_service.py +++ b/bot/src/bot_data/service/user_joined_game_server_repository_service.py @@ -46,7 +46,9 @@ class UserJoinedGameServerRepositoryService(UserJoinedGameServerRepositoryABC): ) results = self._context.select(UserJoinedGameServer.get_select_all_string()) for result in results: - self._logger.trace(__name__, f"Get user-joined-game-server with id {result[0]}") + self._logger.trace( + __name__, f"Get user-joined-game-server with id {result[0]}" + ) joins.append(self._from_result(result)) return joins @@ -56,35 +58,49 @@ class UserJoinedGameServerRepositoryService(UserJoinedGameServerRepositoryABC): __name__, f"Send SQL command: {UserJoinedGameServer.get_select_by_id_string(id)}", ) - result = self._context.select(UserJoinedGameServer.get_select_by_id_string(id))[0] + result = self._context.select(UserJoinedGameServer.get_select_by_id_string(id))[ + 0 + ] return self._from_result(result) - def get_user_joined_game_servers_by_user_id(self, user_id: int) -> List[UserJoinedGameServer]: + def get_user_joined_game_servers_by_user_id( + self, user_id: int + ) -> List[UserJoinedGameServer]: joins = List(UserJoinedGameServer) self._logger.trace( __name__, f"Send SQL command: {UserJoinedGameServer.get_select_by_user_id_string(user_id)}", ) - results = self._context.select(UserJoinedGameServer.get_select_by_user_id_string(user_id)) + results = self._context.select( + UserJoinedGameServer.get_select_by_user_id_string(user_id) + ) for result in results: joins.append(self._from_result(result)) return joins - def get_active_user_joined_game_server_by_user_id(self, user_id: int) -> UserJoinedGameServer: + def get_active_user_joined_game_server_by_user_id( + self, user_id: int + ) -> UserJoinedGameServer: self._logger.trace( __name__, f"Send SQL command: {UserJoinedGameServer.get_select_by_user_id_string(user_id)}", ) - result = self._context.select(UserJoinedGameServer.get_select_active_by_user_id_string(user_id))[0] + result = self._context.select( + UserJoinedGameServer.get_select_active_by_user_id_string(user_id) + )[0] return self._from_result(result) - def find_active_user_joined_game_server_by_user_id(self, user_id: int) -> Optional[UserJoinedGameServer]: + def find_active_user_joined_game_server_by_user_id( + self, user_id: int + ) -> Optional[UserJoinedGameServer]: self._logger.trace( __name__, f"Send SQL command: {UserJoinedGameServer.get_select_by_user_id_string(user_id)}", ) - result = self._context.select(UserJoinedGameServer.get_select_active_by_user_id_string(user_id)) + result = self._context.select( + UserJoinedGameServer.get_select_active_by_user_id_string(user_id) + ) if result is None or len(result) == 0: return None @@ -92,29 +108,45 @@ class UserJoinedGameServerRepositoryService(UserJoinedGameServerRepositoryABC): return self._from_result(result) - def find_active_user_joined_game_servers_by_user_id(self, user_id: int) -> List[Optional[UserJoinedGameServer]]: + def find_active_user_joined_game_servers_by_user_id( + self, user_id: int + ) -> List[Optional[UserJoinedGameServer]]: self._logger.trace( __name__, f"Send SQL command: {UserJoinedGameServer.get_select_active_by_user_id_string(user_id)}", ) result = List(UserJoinedGameServer) - db_results = self._context.select(UserJoinedGameServer.get_select_active_by_user_id_string(user_id)) + db_results = self._context.select( + UserJoinedGameServer.get_select_active_by_user_id_string(user_id) + ) for db_result in db_results: result.append(self._from_result(db_result)) return result - def add_user_joined_game_server(self, user_joined_game_server: UserJoinedGameServer): - self._logger.trace(__name__, f"Send SQL command: {user_joined_game_server.insert_string}") + def add_user_joined_game_server( + self, user_joined_game_server: UserJoinedGameServer + ): + self._logger.trace( + __name__, f"Send SQL command: {user_joined_game_server.insert_string}" + ) self._context.cursor.execute(user_joined_game_server.insert_string) - def update_user_joined_game_server(self, user_joined_game_server: UserJoinedGameServer): - self._logger.trace(__name__, f"Send SQL command: {user_joined_game_server.udpate_string}") + def update_user_joined_game_server( + self, user_joined_game_server: UserJoinedGameServer + ): + self._logger.trace( + __name__, f"Send SQL command: {user_joined_game_server.udpate_string}" + ) self._context.cursor.execute(user_joined_game_server.udpate_string) - def delete_user_joined_game_server(self, user_joined_game_server: UserJoinedGameServer): - self._logger.trace(__name__, f"Send SQL command: {user_joined_game_server.delete_string}") + def delete_user_joined_game_server( + self, user_joined_game_server: UserJoinedGameServer + ): + self._logger.trace( + __name__, f"Send SQL command: {user_joined_game_server.delete_string}" + ) self._context.cursor.execute(user_joined_game_server.delete_string) def delete_user_joined_game_server_by_user_id(self, user_id: int): @@ -122,4 +154,6 @@ class UserJoinedGameServerRepositoryService(UserJoinedGameServerRepositoryABC): __name__, f"Send SQL command: {UserJoinedGameServer.delete_by_user_id_string}", ) - self._context.cursor.execute(UserJoinedGameServer.delete_by_user_id_string(user_id)) + self._context.cursor.execute( + UserJoinedGameServer.delete_by_user_id_string(user_id) + ) diff --git a/kdb-bot/src/bot_data/service/user_joined_server_repository_service.py b/bot/src/bot_data/service/user_joined_server_repository_service.py similarity index 78% rename from kdb-bot/src/bot_data/service/user_joined_server_repository_service.py rename to bot/src/bot_data/service/user_joined_server_repository_service.py index abd0a17b..02d8f948 100644 --- a/kdb-bot/src/bot_data/service/user_joined_server_repository_service.py +++ b/bot/src/bot_data/service/user_joined_server_repository_service.py @@ -25,7 +25,9 @@ class UserJoinedServerRepositoryService(UserJoinedServerRepositoryABC): def get_user_joined_servers(self) -> List[UserJoinedServer]: joins = List(UserJoinedServer) - self._logger.trace(__name__, f"Send SQL command: {UserJoinedServer.get_select_all_string()}") + self._logger.trace( + __name__, f"Send SQL command: {UserJoinedServer.get_select_all_string()}" + ) results = self._context.select(UserJoinedServer.get_select_all_string()) for result in results: self._logger.trace(__name__, f"Get user-joined-server with id {result[0]}") @@ -72,13 +74,17 @@ class UserJoinedServerRepositoryService(UserJoinedServerRepositoryABC): id=result[0], ) - def get_user_joined_servers_by_user_id(self, user_id: int) -> List[UserJoinedServer]: + def get_user_joined_servers_by_user_id( + self, user_id: int + ) -> List[UserJoinedServer]: joins = List(UserJoinedServer) self._logger.trace( __name__, f"Send SQL command: {UserJoinedServer.get_select_by_user_id_string(user_id)}", ) - results = self._context.select(UserJoinedServer.get_select_by_user_id_string(user_id)) + results = self._context.select( + UserJoinedServer.get_select_by_user_id_string(user_id) + ) for result in results: joins.append( UserJoinedServer( @@ -93,12 +99,16 @@ class UserJoinedServerRepositoryService(UserJoinedServerRepositoryABC): return joins - def get_active_user_joined_server_by_user_id(self, user_id: int) -> UserJoinedServer: + def get_active_user_joined_server_by_user_id( + self, user_id: int + ) -> UserJoinedServer: self._logger.trace( __name__, f"Send SQL command: {UserJoinedServer.get_select_by_user_id_string(user_id)}", ) - result = self._context.select(UserJoinedServer.get_select_active_by_user_id_string(user_id))[0] + result = self._context.select( + UserJoinedServer.get_select_active_by_user_id_string(user_id) + )[0] return UserJoinedServer( self._users.get_user_by_id(result[1]), result[2], @@ -108,12 +118,16 @@ class UserJoinedServerRepositoryService(UserJoinedServerRepositoryABC): id=result[0], ) - def find_active_user_joined_server_by_user_id(self, user_id: int) -> Optional[UserJoinedServer]: + def find_active_user_joined_server_by_user_id( + self, user_id: int + ) -> Optional[UserJoinedServer]: self._logger.trace( __name__, f"Send SQL command: {UserJoinedServer.get_select_by_user_id_string(user_id)}", ) - result = self._context.select(UserJoinedServer.get_select_active_by_user_id_string(user_id)) + result = self._context.select( + UserJoinedServer.get_select_active_by_user_id_string(user_id) + ) if result is None or len(result) == 0: return None @@ -129,13 +143,19 @@ class UserJoinedServerRepositoryService(UserJoinedServerRepositoryABC): ) def add_user_joined_server(self, user_joined_server: UserJoinedServer): - self._logger.trace(__name__, f"Send SQL command: {user_joined_server.insert_string}") + self._logger.trace( + __name__, f"Send SQL command: {user_joined_server.insert_string}" + ) self._context.cursor.execute(user_joined_server.insert_string) def update_user_joined_server(self, user_joined_server: UserJoinedServer): - self._logger.trace(__name__, f"Send SQL command: {user_joined_server.udpate_string}") + self._logger.trace( + __name__, f"Send SQL command: {user_joined_server.udpate_string}" + ) self._context.cursor.execute(user_joined_server.udpate_string) def delete_user_joined_server(self, user_joined_server: UserJoinedServer): - self._logger.trace(__name__, f"Send SQL command: {user_joined_server.delete_string}") + self._logger.trace( + __name__, f"Send SQL command: {user_joined_server.delete_string}" + ) self._context.cursor.execute(user_joined_server.delete_string) diff --git a/kdb-bot/src/bot_data/service/user_joined_voice_channel_repository_service.py b/bot/src/bot_data/service/user_joined_voice_channel_repository_service.py similarity index 68% rename from kdb-bot/src/bot_data/service/user_joined_voice_channel_repository_service.py rename to bot/src/bot_data/service/user_joined_voice_channel_repository_service.py index c441d26a..f01216ac 100644 --- a/kdb-bot/src/bot_data/service/user_joined_voice_channel_repository_service.py +++ b/bot/src/bot_data/service/user_joined_voice_channel_repository_service.py @@ -33,7 +33,9 @@ class UserJoinedVoiceChannelRepositoryService(UserJoinedVoiceChannelRepositoryAB ) results = self._context.select(UserJoinedVoiceChannel.get_select_all_string()) for result in results: - self._logger.trace(__name__, f"Get user-joined-voice-channel with id {result[0]}") + self._logger.trace( + __name__, f"Get user-joined-voice-channel with id {result[0]}" + ) joins.append( UserJoinedVoiceChannel( self._users.get_user_by_id(result[1]), @@ -52,7 +54,9 @@ class UserJoinedVoiceChannelRepositoryService(UserJoinedVoiceChannelRepositoryAB __name__, f"Send SQL command: {UserJoinedVoiceChannel.get_select_by_id_string(id)}", ) - result = self._context.select(UserJoinedVoiceChannel.get_select_by_id_string(id))[0] + result = self._context.select( + UserJoinedVoiceChannel.get_select_by_id_string(id) + )[0] return UserJoinedVoiceChannel( self._users.get_user_by_id(result[1]), result[2], @@ -62,13 +66,17 @@ class UserJoinedVoiceChannelRepositoryService(UserJoinedVoiceChannelRepositoryAB id=result[0], ) - def get_user_joined_voice_channels_by_user_id(self, user_id: int) -> List[UserJoinedVoiceChannel]: + def get_user_joined_voice_channels_by_user_id( + self, user_id: int + ) -> List[UserJoinedVoiceChannel]: joins = List(UserJoinedVoiceChannel) self._logger.trace( __name__, f"Send SQL command: {UserJoinedVoiceChannel.get_select_by_user_id_string(user_id)}", ) - results = self._context.select(UserJoinedVoiceChannel.get_select_by_user_id_string(user_id)) + results = self._context.select( + UserJoinedVoiceChannel.get_select_by_user_id_string(user_id) + ) for result in results: joins.append( UserJoinedVoiceChannel( @@ -83,12 +91,16 @@ class UserJoinedVoiceChannelRepositoryService(UserJoinedVoiceChannelRepositoryAB return joins - def get_active_user_joined_voice_channel_by_user_id(self, user_id: int) -> UserJoinedVoiceChannel: + def get_active_user_joined_voice_channel_by_user_id( + self, user_id: int + ) -> UserJoinedVoiceChannel: self._logger.trace( __name__, f"Send SQL command: {UserJoinedVoiceChannel.get_select_by_user_id_string(user_id)}", ) - result = self._context.select(UserJoinedVoiceChannel.get_select_active_by_user_id_string(user_id))[0] + result = self._context.select( + UserJoinedVoiceChannel.get_select_active_by_user_id_string(user_id) + )[0] return UserJoinedVoiceChannel( self._users.get_user_by_id(result[1]), result[2], @@ -98,12 +110,16 @@ class UserJoinedVoiceChannelRepositoryService(UserJoinedVoiceChannelRepositoryAB id=result[0], ) - def find_active_user_joined_voice_channel_by_user_id(self, user_id: int) -> Optional[UserJoinedVoiceChannel]: + def find_active_user_joined_voice_channel_by_user_id( + self, user_id: int + ) -> Optional[UserJoinedVoiceChannel]: self._logger.trace( __name__, f"Send SQL command: {UserJoinedVoiceChannel.get_select_by_user_id_string(user_id)}", ) - result = self._context.select(UserJoinedVoiceChannel.get_select_active_by_user_id_string(user_id)) + result = self._context.select( + UserJoinedVoiceChannel.get_select_active_by_user_id_string(user_id) + ) if result is None or len(result) == 0: return None @@ -118,13 +134,17 @@ class UserJoinedVoiceChannelRepositoryService(UserJoinedVoiceChannelRepositoryAB id=result[0], ) - def find_active_user_joined_voice_channels_by_user_id(self, user_id: int) -> List[Optional[UserJoinedVoiceChannel]]: + def find_active_user_joined_voice_channels_by_user_id( + self, user_id: int + ) -> List[Optional[UserJoinedVoiceChannel]]: self._logger.trace( __name__, f"Send SQL command: {UserJoinedVoiceChannel.get_select_active_by_user_id_string(user_id)}", ) result = List(UserJoinedVoiceChannel) - db_results = self._context.select(UserJoinedVoiceChannel.get_select_active_by_user_id_string(user_id)) + db_results = self._context.select( + UserJoinedVoiceChannel.get_select_active_by_user_id_string(user_id) + ) for db_result in db_results: result.append( @@ -140,16 +160,28 @@ class UserJoinedVoiceChannelRepositoryService(UserJoinedVoiceChannelRepositoryAB return result - def add_user_joined_voice_channel(self, user_joined_voice_channel: UserJoinedVoiceChannel): - self._logger.trace(__name__, f"Send SQL command: {user_joined_voice_channel.insert_string}") + def add_user_joined_voice_channel( + self, user_joined_voice_channel: UserJoinedVoiceChannel + ): + self._logger.trace( + __name__, f"Send SQL command: {user_joined_voice_channel.insert_string}" + ) self._context.cursor.execute(user_joined_voice_channel.insert_string) - def update_user_joined_voice_channel(self, user_joined_voice_channel: UserJoinedVoiceChannel): - self._logger.trace(__name__, f"Send SQL command: {user_joined_voice_channel.udpate_string}") + def update_user_joined_voice_channel( + self, user_joined_voice_channel: UserJoinedVoiceChannel + ): + self._logger.trace( + __name__, f"Send SQL command: {user_joined_voice_channel.udpate_string}" + ) self._context.cursor.execute(user_joined_voice_channel.udpate_string) - def delete_user_joined_voice_channel(self, user_joined_voice_channel: UserJoinedVoiceChannel): - self._logger.trace(__name__, f"Send SQL command: {user_joined_voice_channel.delete_string}") + def delete_user_joined_voice_channel( + self, user_joined_voice_channel: UserJoinedVoiceChannel + ): + self._logger.trace( + __name__, f"Send SQL command: {user_joined_voice_channel.delete_string}" + ) self._context.cursor.execute(user_joined_voice_channel.delete_string) def delete_user_joined_voice_channel_by_user_id(self, user_id: int): @@ -157,4 +189,6 @@ class UserJoinedVoiceChannelRepositoryService(UserJoinedVoiceChannelRepositoryAB __name__, f"Send SQL command: {UserJoinedVoiceChannel.delete_by_user_id_string}", ) - self._context.cursor.execute(UserJoinedVoiceChannel.delete_by_user_id_string(user_id)) + self._context.cursor.execute( + UserJoinedVoiceChannel.delete_by_user_id_string(user_id) + ) diff --git a/kdb-bot/src/bot_data/service/user_message_count_per_hour_repository_service.py b/bot/src/bot_data/service/user_message_count_per_hour_repository_service.py similarity index 89% rename from kdb-bot/src/bot_data/service/user_message_count_per_hour_repository_service.py rename to bot/src/bot_data/service/user_message_count_per_hour_repository_service.py index e63db818..2ccb57e6 100644 --- a/kdb-bot/src/bot_data/service/user_message_count_per_hour_repository_service.py +++ b/bot/src/bot_data/service/user_message_count_per_hour_repository_service.py @@ -51,12 +51,16 @@ class UserMessageCountPerHourRepositoryService(UserMessageCountPerHourRepository ) results = self._context.select(UserMessageCountPerHour.get_select_all_string()) for result in results: - self._logger.trace(__name__, f"Get user message count per hour with id {result[0]}") + self._logger.trace( + __name__, f"Get user message count per hour with id {result[0]}" + ) umcphs.append(self._from_result(result)) return umcphs - def find_user_message_count_per_hour_by_user_id(self, user_id: int) -> List[Optional[UserMessageCountPerHour]]: + def find_user_message_count_per_hour_by_user_id( + self, user_id: int + ) -> List[Optional[UserMessageCountPerHour]]: umcphs = List(UserMessageCountPerHour) sql = UserMessageCountPerHour.get_select_by_user_id_string(user_id) self._logger.trace(__name__, f"Send SQL command: {sql}") @@ -65,7 +69,9 @@ class UserMessageCountPerHourRepositoryService(UserMessageCountPerHourRepository return umcphs for result in results: - self._logger.trace(__name__, f"Get user message count per hour with id {result[0]}") + self._logger.trace( + __name__, f"Get user message count per hour with id {result[0]}" + ) umcphs.append(self._from_result(result)) return umcphs @@ -73,7 +79,9 @@ class UserMessageCountPerHourRepositoryService(UserMessageCountPerHourRepository def get_user_message_count_per_hour_by_user_id_and_date( self, user_id: int, date: datetime ) -> UserMessageCountPerHour: - sql = UserMessageCountPerHour.get_select_by_user_id_and_date_string(user_id, date) + sql = UserMessageCountPerHour.get_select_by_user_id_and_date_string( + user_id, date + ) self._logger.trace(__name__, f"Send SQL command: {sql}") result = self._context.select(sql)[0] return self._from_result(result) @@ -81,7 +89,9 @@ class UserMessageCountPerHourRepositoryService(UserMessageCountPerHourRepository def find_user_message_count_per_hour_by_user_id_and_date( self, user_id: int, date: datetime ) -> Optional[UserMessageCountPerHour]: - sql = UserMessageCountPerHour.get_select_by_user_id_and_date_string(user_id, date) + sql = UserMessageCountPerHour.get_select_by_user_id_and_date_string( + user_id, date + ) self._logger.trace(__name__, f"Send SQL command: {sql}") result = self._context.select(sql) if result is None or len(result) == 0: diff --git a/kdb-bot/src/bot_data/service/user_repository_service.py b/bot/src/bot_data/service/user_repository_service.py similarity index 81% rename from kdb-bot/src/bot_data/service/user_repository_service.py rename to bot/src/bot_data/service/user_repository_service.py index 940156a8..b39cd560 100644 --- a/kdb-bot/src/bot_data/service/user_repository_service.py +++ b/bot/src/bot_data/service/user_repository_service.py @@ -39,7 +39,9 @@ class UserRepositoryService(UserRepositoryABC): def get_users(self) -> List[User]: users = List(User) - self._logger.trace(__name__, f"Send SQL command: {User.get_select_all_string()}") + self._logger.trace( + __name__, f"Send SQL command: {User.get_select_all_string()}" + ) results = self._context.select(User.get_select_all_string()) for result in results: self._logger.trace(__name__, f"Get user with id {result[0]}") @@ -48,13 +50,17 @@ class UserRepositoryService(UserRepositoryABC): return users def get_user_by_id(self, id: int) -> User: - self._logger.trace(__name__, f"Send SQL command: {User.get_select_by_id_string(id)}") + self._logger.trace( + __name__, f"Send SQL command: {User.get_select_by_id_string(id)}" + ) result = self._context.select(User.get_select_by_id_string(id))[0] return self._from_result(result) def find_user_by_id(self, id: int) -> Optional[User]: - self._logger.trace(__name__, f"Send SQL command: {User.get_select_by_id_string(id)}") + self._logger.trace( + __name__, f"Send SQL command: {User.get_select_by_id_string(id)}" + ) result = self._context.select(User.get_select_by_id_string(id)) if result is None or len(result) == 0: return None @@ -87,21 +93,29 @@ class UserRepositoryService(UserRepositoryABC): return users - def get_user_by_discord_id_and_server_id(self, discord_id: int, server_id: int) -> User: + def get_user_by_discord_id_and_server_id( + self, discord_id: int, server_id: int + ) -> User: self._logger.trace( __name__, f"Send SQL command: {User.get_select_by_discord_id_and_server_id_string(discord_id, server_id)}", ) - result = self._context.select(User.get_select_by_discord_id_and_server_id_string(discord_id, server_id))[0] + result = self._context.select( + User.get_select_by_discord_id_and_server_id_string(discord_id, server_id) + )[0] return self._from_result(result) - def find_user_by_discord_id_and_server_id(self, discord_id: int, server_id: int) -> Optional[User]: + def find_user_by_discord_id_and_server_id( + self, discord_id: int, server_id: int + ) -> Optional[User]: self._logger.trace( __name__, f"Send SQL command: {User.get_select_by_discord_id_and_server_id_string(discord_id, server_id)}", ) - result = self._context.select(User.get_select_by_discord_id_and_server_id_string(discord_id, server_id)) + result = self._context.select( + User.get_select_by_discord_id_and_server_id_string(discord_id, server_id) + ) if result is None or len(result) == 0: return None diff --git a/kdb-bot/src/bot_data/service/user_warnings_repository_service.py b/bot/src/bot_data/service/user_warnings_repository_service.py similarity index 85% rename from kdb-bot/src/bot_data/service/user_warnings_repository_service.py rename to bot/src/bot_data/service/user_warnings_repository_service.py index 34cded9b..fade2db6 100644 --- a/kdb-bot/src/bot_data/service/user_warnings_repository_service.py +++ b/bot/src/bot_data/service/user_warnings_repository_service.py @@ -47,7 +47,9 @@ class UserWarningsRepositoryService(UserWarningsRepositoryABC): def get_user_warnings(self) -> List[UserWarnings]: warnings = List(UserWarnings) - self._logger.trace(__name__, f"Send SQL command: {UserWarnings.get_select_all_string()}") + self._logger.trace( + __name__, f"Send SQL command: {UserWarnings.get_select_all_string()}" + ) results = self._context.select(UserWarnings.get_select_all_string()) for result in results: warnings.append(self._from_result(result)) @@ -55,14 +57,21 @@ class UserWarningsRepositoryService(UserWarningsRepositoryABC): return warnings def get_user_warnings_by_id(self, id: int) -> UserWarnings: - self._logger.trace(__name__, f"Send SQL command: {UserWarnings.get_select_by_id_string(id)}") + self._logger.trace( + __name__, f"Send SQL command: {UserWarnings.get_select_by_id_string(id)}" + ) result = self._context.select(UserWarnings.get_select_by_id_string(id))[0] return self._from_result(result) def get_user_warnings_by_user_id(self, user_id: int) -> List[UserWarnings]: warnings = List(UserWarnings) - self._logger.trace(__name__, f"Send SQL command: {UserWarnings.get_select_by_user_id_string(user_id)}") - results = self._context.select(UserWarnings.get_select_by_user_id_string(user_id)) + self._logger.trace( + __name__, + f"Send SQL command: {UserWarnings.get_select_by_user_id_string(user_id)}", + ) + results = self._context.select( + UserWarnings.get_select_by_user_id_string(user_id) + ) for result in results: warnings.append(self._from_result(result)) diff --git a/kdb-bot/src/bot_graphql/__init__.py b/bot/src/bot_graphql/__init__.py similarity index 100% rename from kdb-bot/src/bot_graphql/__init__.py rename to bot/src/bot_graphql/__init__.py diff --git a/kdb-bot/src/bot_graphql/abc/__init__.py b/bot/src/bot_graphql/abc/__init__.py similarity index 100% rename from kdb-bot/src/bot_graphql/abc/__init__.py rename to bot/src/bot_graphql/abc/__init__.py diff --git a/kdb-bot/src/bot_graphql/abc/data_query_abc.py b/bot/src/bot_graphql/abc/data_query_abc.py similarity index 100% rename from kdb-bot/src/bot_graphql/abc/data_query_abc.py rename to bot/src/bot_graphql/abc/data_query_abc.py diff --git a/kdb-bot/src/bot_graphql/abc/data_query_with_history_abc.py b/bot/src/bot_graphql/abc/data_query_with_history_abc.py similarity index 100% rename from kdb-bot/src/bot_graphql/abc/data_query_with_history_abc.py rename to bot/src/bot_graphql/abc/data_query_with_history_abc.py diff --git a/kdb-bot/src/bot_graphql/abc/filter_abc.py b/bot/src/bot_graphql/abc/filter_abc.py similarity index 83% rename from kdb-bot/src/bot_graphql/abc/filter_abc.py rename to bot/src/bot_graphql/abc/filter_abc.py index e0d5ff8d..aec7b1a9 100644 --- a/kdb-bot/src/bot_graphql/abc/filter_abc.py +++ b/bot/src/bot_graphql/abc/filter_abc.py @@ -24,7 +24,11 @@ class FilterABC(ABC): sig = signature(f) for param in sig.parameters.items(): parameter = param[1] - if parameter.name == "self" or parameter.name == "cls" or parameter.annotation == Parameter.empty: + if ( + parameter.name == "self" + or parameter.name == "cls" + or parameter.annotation == Parameter.empty + ): continue if issubclass(parameter.annotation, FilterABC): @@ -34,7 +38,9 @@ class FilterABC(ABC): @staticmethod @ServiceProviderABC.inject - def get_collection_filter(filter_type: type, values: dict, services: ServiceProviderABC): + def get_collection_filter( + filter_type: type, values: dict, services: ServiceProviderABC + ): filter: FilterABC = services.get_service(filter_type) filter.from_dict(values) return filter diff --git a/kdb-bot/src/bot_graphql/abc/history_query_abc.py b/bot/src/bot_graphql/abc/history_query_abc.py similarity index 100% rename from kdb-bot/src/bot_graphql/abc/history_query_abc.py rename to bot/src/bot_graphql/abc/history_query_abc.py diff --git a/kdb-bot/src/bot_graphql/abc/query_abc.py b/bot/src/bot_graphql/abc/query_abc.py similarity index 86% rename from kdb-bot/src/bot_graphql/abc/query_abc.py rename to bot/src/bot_graphql/abc/query_abc.py index 1a566a94..535bbc59 100644 --- a/kdb-bot/src/bot_graphql/abc/query_abc.py +++ b/bot/src/bot_graphql/abc/query_abc.py @@ -38,10 +38,14 @@ class QueryABC(ObjectType): def __init__(self, name: str): ObjectType.__init__(self, name) - def add_collection(self, name: str, get_collection: Callable, filter_type: type = None): + def add_collection( + self, name: str, get_collection: Callable, filter_type: type = None + ): def wrapper(*args, **kwargs): if filter_type is not None and "filter" in kwargs: - kwargs["filter"] = FilterABC.get_collection_filter(filter_type, kwargs["filter"]) + kwargs["filter"] = FilterABC.get_collection_filter( + filter_type, kwargs["filter"] + ) else: kwargs["filter"] = None @@ -94,7 +98,10 @@ class QueryABC(ObjectType): u: User = u guild = bot.get_guild(u.server.discord_id) member = guild.get_member(u.discord_id) - if permissions.is_member_moderator(member) and u.server.id == element.server.id: + if ( + permissions.is_member_moderator(member) + and u.server.id == element.server.id + ): access = True break @@ -104,7 +111,10 @@ class QueryABC(ObjectType): u: User = u guild = bot.get_guild(u.server.discord_id) member = guild.get_member(u.discord_id) - if permissions.is_member_moderator(member) and u.server.id == element.server.id: + if ( + permissions.is_member_moderator(member) + and u.server.id == element.server.id + ): access = True break @@ -114,7 +124,10 @@ class QueryABC(ObjectType): u: User = u guild = bot.get_guild(u.server.discord_id) member = guild.get_member(u.discord_id) - if permissions.is_member_moderator(member) and u.server.id == element.auto_role.server.id: + if ( + permissions.is_member_moderator(member) + and u.server.id == element.auto_role.server.id + ): access = True break @@ -199,11 +212,18 @@ class QueryABC(ObjectType): u: User = u guild = bot.get_guild(u.server.discord_id) member = guild.get_member(u.discord_id) - if permissions.is_member_moderator(member) and u.server.id == element.server.id: + if ( + permissions.is_member_moderator(member) + and u.server.id == element.server.id + ): access = True break - elif type(element) == dict and "key" in element and element["key"] in [e.value for e in FeatureFlagsEnum]: + elif ( + type(element) == dict + and "key" in element + and element["key"] in [e.value for e in FeatureFlagsEnum] + ): for u in user.users: u: User = u guild = bot.get_guild(u.server.discord_id) @@ -215,7 +235,9 @@ class QueryABC(ObjectType): return access @ServiceProviderABC.inject - def _can_user_mutate_data(self, server: Server, permission: UserRoleEnum, services: ServiceProviderABC): + def _can_user_mutate_data( + self, server: Server, permission: UserRoleEnum, services: ServiceProviderABC + ): permissions: PermissionService = services.get_service(PermissionService) bot: DiscordBotServiceABC = services.get_service(DiscordBotServiceABC) @@ -224,7 +246,9 @@ class QueryABC(ObjectType): return member = bot.get_guild(server.discord_id).get_member( - auth_user.users.where(lambda x: x.server.id == server.id).single().discord_id + auth_user.users.where(lambda x: x.server.id == server.id) + .single() + .discord_id ) check_perm = lambda x: True @@ -237,11 +261,20 @@ class QueryABC(ObjectType): check_perm = lambda x: permissions.is_member_technician(x) if not check_perm(member): - ex = ServiceException(ServiceErrorCode.Forbidden, f"User not allowed to mutate data") + ex = ServiceException( + ServiceErrorCode.Forbidden, f"User not allowed to mutate data" + ) raise ex # @FilterABC.resolve_filter_annotation - def _resolve_collection(self, collection: List, *_, filter: FilterABC = None, page: Page = None, sort: Sort = None): + def _resolve_collection( + self, + collection: List, + *_, + filter: FilterABC = None, + page: Page = None, + sort: Sort = None, + ): if filter is not None: collection = filter.filter(collection) diff --git a/kdb-bot/src/bot_graphql/bot-graphql.json b/bot/src/bot_graphql/bot-graphql.json similarity index 100% rename from kdb-bot/src/bot_graphql/bot-graphql.json rename to bot/src/bot_graphql/bot-graphql.json diff --git a/kdb-bot/src/bot_graphql/filter/__init__.py b/bot/src/bot_graphql/filter/__init__.py similarity index 100% rename from kdb-bot/src/bot_graphql/filter/__init__.py rename to bot/src/bot_graphql/filter/__init__.py diff --git a/kdb-bot/src/bot_graphql/filter/achievement_filter.py b/bot/src/bot_graphql/filter/achievement_filter.py similarity index 84% rename from kdb-bot/src/bot_graphql/filter/achievement_filter.py rename to bot/src/bot_graphql/filter/achievement_filter.py index b95e00c0..1e1afd11 100644 --- a/kdb-bot/src/bot_graphql/filter/achievement_filter.py +++ b/bot/src/bot_graphql/filter/achievement_filter.py @@ -55,10 +55,16 @@ class AchievementFilter(FilterABC): query = query.where(lambda x: x.name == self._name or self._name in x.name) if self._description is not None: - query = query.where(lambda x: x.description == self._description or self._description in x.description) + query = query.where( + lambda x: x.description == self._description + or self._description in x.description + ) if self._attribute is not None: - query = query.where(lambda x: x.attribute == self._attribute or self._attribute in x.attribute) + query = query.where( + lambda x: x.attribute == self._attribute + or self._attribute in x.attribute + ) if self._operator is not None: query = query.where(lambda x: x.operator == self._operator) @@ -67,7 +73,9 @@ class AchievementFilter(FilterABC): query = query.where(lambda x: x.value == self._value) if self._server is not None: - servers = self._server.filter(query.select(lambda x: x.server)).select(lambda x: x.id) + servers = self._server.filter(query.select(lambda x: x.server)).select( + lambda x: x.id + ) query = query.where(lambda x: x.server.id in servers) return query diff --git a/kdb-bot/src/bot_graphql/filter/auto_role_filter.py b/bot/src/bot_graphql/filter/auto_role_filter.py similarity index 87% rename from kdb-bot/src/bot_graphql/filter/auto_role_filter.py rename to bot/src/bot_graphql/filter/auto_role_filter.py index 6f17dd59..caa976d5 100644 --- a/kdb-bot/src/bot_graphql/filter/auto_role_filter.py +++ b/bot/src/bot_graphql/filter/auto_role_filter.py @@ -46,21 +46,26 @@ class AutoRoleFilter(FilterABC): if self._channel_id is not None: query = query.where( - lambda x: x.discord_channel_id == self._channel_id or str(self._channel_id) in str(x.discord_channel_id) + lambda x: x.discord_channel_id == self._channel_id + or str(self._channel_id) in str(x.discord_channel_id) ) if self._channel_name is not None: query = query.where( - lambda x: x.discord_channel_name == self._channel_name or self._channel_name in x.discord_channel_name + lambda x: x.discord_channel_name == self._channel_name + or self._channel_name in x.discord_channel_name ) if self._message_id is not None: query = query.where( - lambda x: x.discord_message_id == self._message_id or str(self._message_id) in str(x.discord_message_id) + lambda x: x.discord_message_id == self._message_id + or str(self._message_id) in str(x.discord_message_id) ) if self._server is not None: - servers = self._server.filter(query.select(lambda x: x.server)).select(lambda x: x.id) + servers = self._server.filter(query.select(lambda x: x.server)).select( + lambda x: x.id + ) query = query.where(lambda x: x.server.id in servers) return query diff --git a/kdb-bot/src/bot_graphql/filter/auto_role_rule_filter.py b/bot/src/bot_graphql/filter/auto_role_rule_filter.py similarity index 93% rename from kdb-bot/src/bot_graphql/filter/auto_role_rule_filter.py rename to bot/src/bot_graphql/filter/auto_role_rule_filter.py index b9571d8f..6d661147 100644 --- a/kdb-bot/src/bot_graphql/filter/auto_role_rule_filter.py +++ b/bot/src/bot_graphql/filter/auto_role_rule_filter.py @@ -57,7 +57,9 @@ class AutoRoleRuleFilter(FilterABC): query = query.where(get_role_name) if self._auto_role is not None: - auto_roles = self._auto_role.filter(query.select(lambda x: x.game_server)).select(lambda x: x.id) + auto_roles = self._auto_role.filter( + query.select(lambda x: x.game_server) + ).select(lambda x: x.id) query = query.where(lambda x: x.game_server.id in auto_roles) return query diff --git a/kdb-bot/src/bot_graphql/filter/client_filter.py b/bot/src/bot_graphql/filter/client_filter.py similarity index 84% rename from kdb-bot/src/bot_graphql/filter/client_filter.py rename to bot/src/bot_graphql/filter/client_filter.py index 29563600..8f46fca2 100644 --- a/kdb-bot/src/bot_graphql/filter/client_filter.py +++ b/bot/src/bot_graphql/filter/client_filter.py @@ -38,10 +38,15 @@ class ClientFilter(FilterABC): query = query.where(lambda x: x.id == self._discord_id) if self._name is not None: - query = query.where(lambda x: self._name.lower() == x.name.lower() or self._name.lower() in x.name.lower()) + query = query.where( + lambda x: self._name.lower() == x.name.lower() + or self._name.lower() in x.name.lower() + ) if self._server is not None: - servers = self._server.filter(query.select(lambda x: x.server)).select(lambda x: x.id) + servers = self._server.filter(query.select(lambda x: x.server)).select( + lambda x: x.id + ) query = query.where(lambda x: x.server.id in servers) return query diff --git a/kdb-bot/src/bot_graphql/filter/level_filter.py b/bot/src/bot_graphql/filter/level_filter.py similarity index 84% rename from kdb-bot/src/bot_graphql/filter/level_filter.py rename to bot/src/bot_graphql/filter/level_filter.py index 2ded4ad8..ebd8de39 100644 --- a/kdb-bot/src/bot_graphql/filter/level_filter.py +++ b/bot/src/bot_graphql/filter/level_filter.py @@ -33,10 +33,15 @@ class LevelFilter(FilterABC): query = query.where(lambda x: x.id == self._id) if self._name is not None: - query = query.where(lambda x: self._name.lower() == x.name.lower() or self._name.lower() in x.name.lower()) + query = query.where( + lambda x: self._name.lower() == x.name.lower() + or self._name.lower() in x.name.lower() + ) if self._server is not None: - servers = self._server.filter(query.select(lambda x: x.server)).select(lambda x: x.id) + servers = self._server.filter(query.select(lambda x: x.server)).select( + lambda x: x.id + ) query = query.where(lambda x: x.server.id in servers) return query diff --git a/kdb-bot/src/bot_graphql/filter/page.py b/bot/src/bot_graphql/filter/page.py similarity index 100% rename from kdb-bot/src/bot_graphql/filter/page.py rename to bot/src/bot_graphql/filter/page.py diff --git a/kdb-bot/src/bot_graphql/filter/server_filter.py b/bot/src/bot_graphql/filter/server_filter.py similarity index 83% rename from kdb-bot/src/bot_graphql/filter/server_filter.py rename to bot/src/bot_graphql/filter/server_filter.py index e090323e..f6384146 100644 --- a/kdb-bot/src/bot_graphql/filter/server_filter.py +++ b/bot/src/bot_graphql/filter/server_filter.py @@ -32,7 +32,8 @@ class ServerFilter(FilterABC): if self._discord_id is not None: query = query.where( - lambda x: x.discord_id == self._discord_id or str(self._discord_id) in str(x.discord_id) + lambda x: x.discord_id == self._discord_id + or str(self._discord_id) in str(x.discord_id) ) if self._name is not None: @@ -40,7 +41,8 @@ class ServerFilter(FilterABC): def where_guild(x: Guild): guild = bot.get_guild(x.discord_id) return guild is not None and ( - self._name.lower() == guild.name.lower() or self._name.lower() in guild.name.lower() + self._name.lower() == guild.name.lower() + or self._name.lower() in guild.name.lower() ) query = query.where(where_guild) diff --git a/kdb-bot/src/bot_graphql/filter/short_role_name_filter.py b/bot/src/bot_graphql/filter/short_role_name_filter.py similarity index 91% rename from kdb-bot/src/bot_graphql/filter/short_role_name_filter.py rename to bot/src/bot_graphql/filter/short_role_name_filter.py index 426e3630..2fb3b2be 100644 --- a/kdb-bot/src/bot_graphql/filter/short_role_name_filter.py +++ b/bot/src/bot_graphql/filter/short_role_name_filter.py @@ -46,7 +46,10 @@ class ShortRoleNameFilter(FilterABC): query = query.where(lambda x: x.id == self._id) if self._short_name is not None: - query = query.where(lambda x: x.short_name == self._short_name or self._short_name in x.short_name) + query = query.where( + lambda x: x.short_name == self._short_name + or self._short_name in x.short_name + ) if self._role_id is not None: query = query.where(lambda x: x.role_id == self._role_id) @@ -64,7 +67,9 @@ class ShortRoleNameFilter(FilterABC): query = query.where(lambda x: x.position.value == self._position.value) if self._server is not None: - servers = self._server.filter(query.select(lambda x: x.server)).select(lambda x: x.id) + servers = self._server.filter(query.select(lambda x: x.server)).select( + lambda x: x.id + ) query = query.where(lambda x: x.server.id in servers) return query diff --git a/kdb-bot/src/bot_graphql/filter/sort.py b/bot/src/bot_graphql/filter/sort.py similarity index 100% rename from kdb-bot/src/bot_graphql/filter/sort.py rename to bot/src/bot_graphql/filter/sort.py diff --git a/kdb-bot/src/bot_graphql/filter/user_filter.py b/bot/src/bot_graphql/filter/user_filter.py similarity index 80% rename from kdb-bot/src/bot_graphql/filter/user_filter.py rename to bot/src/bot_graphql/filter/user_filter.py index 53c130d5..7a50f6d2 100644 --- a/kdb-bot/src/bot_graphql/filter/user_filter.py +++ b/bot/src/bot_graphql/filter/user_filter.py @@ -73,7 +73,8 @@ class UserFilter(FilterABC): if self._discord_id is not None: query = query.where( - lambda x: x.discord_id == self._discord_id or str(self._discord_id) in str(x.discord_id) + lambda x: x.discord_id == self._discord_id + or str(self._discord_id) in str(x.discord_id) ) if self._name is not None: @@ -81,7 +82,9 @@ class UserFilter(FilterABC): def _get_member(user: User): guild = self._bot.get_guild(user.server.discord_id) member = guild.get_member(user.discord_id) - return member is not None and (member.name == self._name or self._name in member.name) + return member is not None and ( + member.name == self._name or self._name in member.name + ) query = query.where(_get_member) @@ -89,20 +92,30 @@ class UserFilter(FilterABC): query = query.where(lambda x: x.xp == self._xp) if self._ontime is not None: - query = query.where(lambda x: self._client_utils.get_ontime_for_user(x) == self._ontime) + query = query.where( + lambda x: self._client_utils.get_ontime_for_user(x) == self._ontime + ) if self._level is not None: - levels = self._level.filter(query.select(lambda x: self._levels.get_level(x))).select(lambda x: x.id) + levels = self._level.filter( + query.select(lambda x: self._levels.get_level(x)) + ).select(lambda x: x.id) query = query.where(lambda x: self._levels.get_level(x).id in levels) if self._server is not None: - servers = self._server.filter(query.select(lambda x: x.server)).select(lambda x: x.id) + servers = self._server.filter(query.select(lambda x: x.server)).select( + lambda x: x.id + ) query = query.where(lambda x: x.server.id in servers) if self._left_server is not None: def _has_user_left_server(user: User): - active_join = self._user_joined_servers.find_active_user_joined_server_by_user_id(user.id) + active_join = ( + self._user_joined_servers.find_active_user_joined_server_by_user_id( + user.id + ) + ) return (active_join is None) == self._left_server query = query.where(_has_user_left_server) diff --git a/kdb-bot/src/bot_graphql/filter/user_joined_game_server_filter.py b/bot/src/bot_graphql/filter/user_joined_game_server_filter.py similarity index 96% rename from kdb-bot/src/bot_graphql/filter/user_joined_game_server_filter.py rename to bot/src/bot_graphql/filter/user_joined_game_server_filter.py index 1d266a70..84297e50 100644 --- a/kdb-bot/src/bot_graphql/filter/user_joined_game_server_filter.py +++ b/bot/src/bot_graphql/filter/user_joined_game_server_filter.py @@ -42,7 +42,9 @@ class UserJoinedGameServerFilter(FilterABC): query = query.where(lambda x: x.game_server == self._game_server) if self._user is not None: - users = self._user.filter(query.select(lambda x: x.user)).select(lambda x: x.id) + users = self._user.filter(query.select(lambda x: x.user)).select( + lambda x: x.id + ) query = query.where(lambda x: x.user.id in users) return query diff --git a/kdb-bot/src/bot_graphql/filter/user_joined_server_filter.py b/bot/src/bot_graphql/filter/user_joined_server_filter.py similarity index 80% rename from kdb-bot/src/bot_graphql/filter/user_joined_server_filter.py rename to bot/src/bot_graphql/filter/user_joined_server_filter.py index 3aac7e25..dd760752 100644 --- a/kdb-bot/src/bot_graphql/filter/user_joined_server_filter.py +++ b/bot/src/bot_graphql/filter/user_joined_server_filter.py @@ -43,13 +43,21 @@ class UserJoinedServerFilter(FilterABC): query = query.where(lambda x: x.id == self._id) if self._user is not None: - users = self._user.filter(query.select(lambda x: x.user)).select(lambda x: x.id) + users = self._user.filter(query.select(lambda x: x.user)).select( + lambda x: x.id + ) query = query.where(lambda x: x.user.id in users) if self._joined_on is not None: - query = query.where(lambda x: x.joined_on == self._joined_on or self._joined_on in x.joined_on) + query = query.where( + lambda x: x.joined_on == self._joined_on + or self._joined_on in x.joined_on + ) if self._leaved_on is not None: - query = query.where(lambda x: x.leaved_on == self._leaved_on or self._leaved_on in x.leaved_on) + query = query.where( + lambda x: x.leaved_on == self._leaved_on + or self._leaved_on in x.leaved_on + ) return query diff --git a/kdb-bot/src/bot_graphql/filter/user_joined_voice_channel_filter.py b/bot/src/bot_graphql/filter/user_joined_voice_channel_filter.py similarity index 82% rename from kdb-bot/src/bot_graphql/filter/user_joined_voice_channel_filter.py rename to bot/src/bot_graphql/filter/user_joined_voice_channel_filter.py index 51ba446a..681cf038 100644 --- a/kdb-bot/src/bot_graphql/filter/user_joined_voice_channel_filter.py +++ b/bot/src/bot_graphql/filter/user_joined_voice_channel_filter.py @@ -46,7 +46,9 @@ class UserJoinedVoiceChannelFilter(FilterABC): if "leavedOn" in values: self._leaved_on = values["leavedOn"] - def filter(self, query: List[UserJoinedVoiceChannel]) -> List[UserJoinedVoiceChannel]: + def filter( + self, query: List[UserJoinedVoiceChannel] + ) -> List[UserJoinedVoiceChannel]: if self._id is not None: query = query.where(lambda x: x.id == self._id) @@ -62,13 +64,21 @@ class UserJoinedVoiceChannelFilter(FilterABC): query = query.where(get_channel_name) if self._user is not None: - users = self._user.filter(query.select(lambda x: x.user)).select(lambda x: x.id) + users = self._user.filter(query.select(lambda x: x.user)).select( + lambda x: x.id + ) query = query.where(lambda x: x.user.id in users) if self._joined_on is not None: - query = query.where(lambda x: x.joined_on == self._joined_on or self._joined_on in x.joined_on) + query = query.where( + lambda x: x.joined_on == self._joined_on + or self._joined_on in x.joined_on + ) if self._leaved_on is not None: - query = query.where(lambda x: x.leaved_on == self._leaved_on or self._leaved_on in x.leaved_on) + query = query.where( + lambda x: x.leaved_on == self._leaved_on + or self._leaved_on in x.leaved_on + ) return query diff --git a/kdb-bot/src/bot_graphql/filter/user_warning_filter.py b/bot/src/bot_graphql/filter/user_warning_filter.py similarity index 85% rename from kdb-bot/src/bot_graphql/filter/user_warning_filter.py rename to bot/src/bot_graphql/filter/user_warning_filter.py index 2c716c9e..c2d70df1 100644 --- a/kdb-bot/src/bot_graphql/filter/user_warning_filter.py +++ b/bot/src/bot_graphql/filter/user_warning_filter.py @@ -43,14 +43,21 @@ class UserWarningFilter(FilterABC): query = query.where(lambda x: x.id == self._id) if self._user is not None: - users = self._user.filter(query.select(lambda x: x.user)).select(lambda x: x.id) + users = self._user.filter(query.select(lambda x: x.user)).select( + lambda x: x.id + ) query = query.where(lambda x: x.id in users) if self._description is not None: - query = query.where(lambda x: x.description == self._description or self._description in x.description) + query = query.where( + lambda x: x.description == self._description + or self._description in x.description + ) if self._author is not None: - users = self._author.filter(query.select(lambda x: x.author)).select(lambda x: x.id) + users = self._author.filter(query.select(lambda x: x.author)).select( + lambda x: x.id + ) query = query.where(lambda x: x.id in users) return query diff --git a/kdb-bot/src/bot_graphql/graphql/achievement.gql b/bot/src/bot_graphql/graphql/achievement.gql similarity index 100% rename from kdb-bot/src/bot_graphql/graphql/achievement.gql rename to bot/src/bot_graphql/graphql/achievement.gql diff --git a/kdb-bot/src/bot_graphql/graphql/autoRole.gql b/bot/src/bot_graphql/graphql/autoRole.gql similarity index 100% rename from kdb-bot/src/bot_graphql/graphql/autoRole.gql rename to bot/src/bot_graphql/graphql/autoRole.gql diff --git a/kdb-bot/src/bot_graphql/graphql/autoRoleRule.gql b/bot/src/bot_graphql/graphql/autoRoleRule.gql similarity index 100% rename from kdb-bot/src/bot_graphql/graphql/autoRoleRule.gql rename to bot/src/bot_graphql/graphql/autoRoleRule.gql diff --git a/kdb-bot/src/bot_graphql/graphql/base.gql b/bot/src/bot_graphql/graphql/base.gql similarity index 100% rename from kdb-bot/src/bot_graphql/graphql/base.gql rename to bot/src/bot_graphql/graphql/base.gql diff --git a/kdb-bot/src/bot_graphql/graphql/client.gql b/bot/src/bot_graphql/graphql/client.gql similarity index 100% rename from kdb-bot/src/bot_graphql/graphql/client.gql rename to bot/src/bot_graphql/graphql/client.gql diff --git a/kdb-bot/src/bot_graphql/graphql/discord.gql b/bot/src/bot_graphql/graphql/discord.gql similarity index 100% rename from kdb-bot/src/bot_graphql/graphql/discord.gql rename to bot/src/bot_graphql/graphql/discord.gql diff --git a/kdb-bot/src/bot_graphql/graphql/featureFlags.gql b/bot/src/bot_graphql/graphql/featureFlags.gql similarity index 100% rename from kdb-bot/src/bot_graphql/graphql/featureFlags.gql rename to bot/src/bot_graphql/graphql/featureFlags.gql diff --git a/kdb-bot/src/bot_graphql/graphql/knownUser.gql b/bot/src/bot_graphql/graphql/knownUser.gql similarity index 100% rename from kdb-bot/src/bot_graphql/graphql/knownUser.gql rename to bot/src/bot_graphql/graphql/knownUser.gql diff --git a/kdb-bot/src/bot_graphql/graphql/level.gql b/bot/src/bot_graphql/graphql/level.gql similarity index 100% rename from kdb-bot/src/bot_graphql/graphql/level.gql rename to bot/src/bot_graphql/graphql/level.gql diff --git a/kdb-bot/src/bot_graphql/graphql/mutation.gql b/bot/src/bot_graphql/graphql/mutation.gql similarity index 100% rename from kdb-bot/src/bot_graphql/graphql/mutation.gql rename to bot/src/bot_graphql/graphql/mutation.gql diff --git a/kdb-bot/src/bot_graphql/graphql/query.gql b/bot/src/bot_graphql/graphql/query.gql similarity index 100% rename from kdb-bot/src/bot_graphql/graphql/query.gql rename to bot/src/bot_graphql/graphql/query.gql diff --git a/kdb-bot/src/bot_graphql/graphql/server.gql b/bot/src/bot_graphql/graphql/server.gql similarity index 100% rename from kdb-bot/src/bot_graphql/graphql/server.gql rename to bot/src/bot_graphql/graphql/server.gql diff --git a/kdb-bot/src/bot_graphql/graphql/serverConfig.gql b/bot/src/bot_graphql/graphql/serverConfig.gql similarity index 100% rename from kdb-bot/src/bot_graphql/graphql/serverConfig.gql rename to bot/src/bot_graphql/graphql/serverConfig.gql diff --git a/kdb-bot/src/bot_graphql/graphql/shortRoleName.gql b/bot/src/bot_graphql/graphql/shortRoleName.gql similarity index 100% rename from kdb-bot/src/bot_graphql/graphql/shortRoleName.gql rename to bot/src/bot_graphql/graphql/shortRoleName.gql diff --git a/kdb-bot/src/bot_graphql/graphql/technicianConfig.gql b/bot/src/bot_graphql/graphql/technicianConfig.gql similarity index 100% rename from kdb-bot/src/bot_graphql/graphql/technicianConfig.gql rename to bot/src/bot_graphql/graphql/technicianConfig.gql diff --git a/kdb-bot/src/bot_graphql/graphql/user.gql b/bot/src/bot_graphql/graphql/user.gql similarity index 100% rename from kdb-bot/src/bot_graphql/graphql/user.gql rename to bot/src/bot_graphql/graphql/user.gql diff --git a/kdb-bot/src/bot_graphql/graphql/userJoinedGameServer.gql b/bot/src/bot_graphql/graphql/userJoinedGameServer.gql similarity index 100% rename from kdb-bot/src/bot_graphql/graphql/userJoinedGameServer.gql rename to bot/src/bot_graphql/graphql/userJoinedGameServer.gql diff --git a/kdb-bot/src/bot_graphql/graphql/userJoinedServer.gql b/bot/src/bot_graphql/graphql/userJoinedServer.gql similarity index 100% rename from kdb-bot/src/bot_graphql/graphql/userJoinedServer.gql rename to bot/src/bot_graphql/graphql/userJoinedServer.gql diff --git a/kdb-bot/src/bot_graphql/graphql/userJoinedVoiceChannel.gql b/bot/src/bot_graphql/graphql/userJoinedVoiceChannel.gql similarity index 100% rename from kdb-bot/src/bot_graphql/graphql/userJoinedVoiceChannel.gql rename to bot/src/bot_graphql/graphql/userJoinedVoiceChannel.gql diff --git a/kdb-bot/src/bot_graphql/graphql/userWarning.gql b/bot/src/bot_graphql/graphql/userWarning.gql similarity index 100% rename from kdb-bot/src/bot_graphql/graphql/userWarning.gql rename to bot/src/bot_graphql/graphql/userWarning.gql diff --git a/kdb-bot/src/bot_graphql/graphql_module.py b/bot/src/bot_graphql/graphql_module.py similarity index 93% rename from kdb-bot/src/bot_graphql/graphql_module.py rename to bot/src/bot_graphql/graphql_module.py index 07d028c0..822556a4 100644 --- a/kdb-bot/src/bot_graphql/graphql_module.py +++ b/bot/src/bot_graphql/graphql_module.py @@ -17,7 +17,9 @@ from bot_graphql.filter.short_role_name_filter import ShortRoleNameFilter from bot_graphql.filter.user_filter import UserFilter from bot_graphql.filter.user_joined_game_server_filter import UserJoinedGameServerFilter from bot_graphql.filter.user_joined_server_filter import UserJoinedServerFilter -from bot_graphql.filter.user_joined_voice_channel_filter import UserJoinedVoiceChannelFilter +from bot_graphql.filter.user_joined_voice_channel_filter import ( + UserJoinedVoiceChannelFilter, +) from bot_graphql.filter.user_warning_filter import UserWarningFilter from bot_graphql.graphql_service import GraphQLService from bot_graphql.mutation import Mutation @@ -28,7 +30,9 @@ from bot_graphql.mutations.level_mutation import LevelMutation from bot_graphql.mutations.server_config_mutation import ServerConfigMutation from bot_graphql.mutations.short_role_name_mutation import ShortRoleNameMutation from bot_graphql.mutations.technician_config_mutation import TechnicianConfigMutation -from bot_graphql.mutations.user_joined_game_server_mutation import UserJoinedGameServerMutation +from bot_graphql.mutations.user_joined_game_server_mutation import ( + UserJoinedGameServerMutation, +) from bot_graphql.mutations.user_mutation import UserMutation from bot_graphql.queries.achievement_attribute_query import AchievementAttributeQuery from bot_graphql.queries.achievement_history_query import AchievementHistoryQuery @@ -55,17 +59,31 @@ from bot_graphql.queries.server_history_query import ServerHistoryQuery from bot_graphql.queries.server_query import ServerQuery from bot_graphql.queries.short_role_name_history_query import ShortRoleNameHistoryQuery from bot_graphql.queries.short_role_name_query import ShortRoleNameQuery -from bot_graphql.queries.technician_config_history_query import TechnicianConfigHistoryQuery +from bot_graphql.queries.technician_config_history_query import ( + TechnicianConfigHistoryQuery, +) from bot_graphql.queries.technician_config_query import TechnicianConfigQuery -from bot_graphql.queries.technician_id_config_history_query import TechnicianIdConfigHistoryQuery -from bot_graphql.queries.technician_ping_url_config_history_query import TechnicianPingUrlConfigHistoryQuery +from bot_graphql.queries.technician_id_config_history_query import ( + TechnicianIdConfigHistoryQuery, +) +from bot_graphql.queries.technician_ping_url_config_history_query import ( + TechnicianPingUrlConfigHistoryQuery, +) from bot_graphql.queries.user_history_query import UserHistoryQuery -from bot_graphql.queries.user_joined_game_server_history_query import UserJoinedGameServerHistoryQuery +from bot_graphql.queries.user_joined_game_server_history_query import ( + UserJoinedGameServerHistoryQuery, +) from bot_graphql.queries.user_joined_game_server_query import UserJoinedGameServerQuery -from bot_graphql.queries.user_joined_server_history_query import UserJoinedServerHistoryQuery +from bot_graphql.queries.user_joined_server_history_query import ( + UserJoinedServerHistoryQuery, +) from bot_graphql.queries.user_joined_server_query import UserJoinedServerQuery -from bot_graphql.queries.user_joined_voice_channel_history_query import UserJoinedVoiceChannelHistoryQuery -from bot_graphql.queries.user_joined_voice_channel_query import UserJoinedVoiceChannelQuery +from bot_graphql.queries.user_joined_voice_channel_history_query import ( + UserJoinedVoiceChannelHistoryQuery, +) +from bot_graphql.queries.user_joined_voice_channel_query import ( + UserJoinedVoiceChannelQuery, +) from bot_graphql.queries.user_query import UserQuery from bot_graphql.queries.user_warning_history_query import UserWarningHistoryQuery from bot_graphql.queries.user_warning_query import UserWarningQuery @@ -77,10 +95,14 @@ class GraphQLModule(ModuleABC): def __init__(self, dc: DiscordCollectionABC): ModuleABC.__init__(self, dc, FeatureFlagsEnum.data_module) - def configure_configuration(self, config: ConfigurationABC, env: ApplicationEnvironmentABC): + def configure_configuration( + self, config: ConfigurationABC, env: ApplicationEnvironmentABC + ): pass - def configure_services(self, services: ServiceCollectionABC, env: ApplicationEnvironmentABC): + def configure_services( + self, services: ServiceCollectionABC, env: ApplicationEnvironmentABC + ): services.add_singleton(Schema) services.add_singleton(GraphQLService) services.add_singleton(Query) diff --git a/kdb-bot/src/bot_graphql/graphql_service.py b/bot/src/bot_graphql/graphql_service.py similarity index 100% rename from kdb-bot/src/bot_graphql/graphql_service.py rename to bot/src/bot_graphql/graphql_service.py diff --git a/kdb-bot/src/bot_graphql/model/__init__.py b/bot/src/bot_graphql/model/__init__.py similarity index 100% rename from kdb-bot/src/bot_graphql/model/__init__.py rename to bot/src/bot_graphql/model/__init__.py diff --git a/kdb-bot/src/bot_graphql/model/discord.py b/bot/src/bot_graphql/model/discord.py similarity index 100% rename from kdb-bot/src/bot_graphql/model/discord.py rename to bot/src/bot_graphql/model/discord.py diff --git a/kdb-bot/src/bot_graphql/mutation.py b/bot/src/bot_graphql/mutation.py similarity index 97% rename from kdb-bot/src/bot_graphql/mutation.py rename to bot/src/bot_graphql/mutation.py index 3dc7d599..39e38cc5 100644 --- a/kdb-bot/src/bot_graphql/mutation.py +++ b/bot/src/bot_graphql/mutation.py @@ -7,7 +7,9 @@ from bot_graphql.mutations.level_mutation import LevelMutation from bot_graphql.mutations.server_config_mutation import ServerConfigMutation from bot_graphql.mutations.short_role_name_mutation import ShortRoleNameMutation from bot_graphql.mutations.technician_config_mutation import TechnicianConfigMutation -from bot_graphql.mutations.user_joined_game_server_mutation import UserJoinedGameServerMutation +from bot_graphql.mutations.user_joined_game_server_mutation import ( + UserJoinedGameServerMutation, +) from bot_graphql.mutations.user_mutation import UserMutation diff --git a/kdb-bot/src/bot_graphql/mutations/__init__.py b/bot/src/bot_graphql/mutations/__init__.py similarity index 100% rename from kdb-bot/src/bot_graphql/mutations/__init__.py rename to bot/src/bot_graphql/mutations/__init__.py diff --git a/kdb-bot/src/bot_graphql/mutations/achievement_mutation.py b/bot/src/bot_graphql/mutations/achievement_mutation.py similarity index 85% rename from kdb-bot/src/bot_graphql/mutations/achievement_mutation.py rename to bot/src/bot_graphql/mutations/achievement_mutation.py index 40975a38..2731df20 100644 --- a/kdb-bot/src/bot_graphql/mutations/achievement_mutation.py +++ b/bot/src/bot_graphql/mutations/achievement_mutation.py @@ -55,16 +55,26 @@ class AchievementMutation(QueryABC): and a.server.id == server.id ) - return self._achievements.get_achievements_by_server_id(achievement.server.id).where(get_new_achievement).last() + return ( + self._achievements.get_achievements_by_server_id(achievement.server.id) + .where(get_new_achievement) + .last() + ) def resolve_update_achievement(self, *_, input: dict): achievement = self._achievements.get_achievement_by_id(input["id"]) self._can_user_mutate_data(achievement.server, UserRoleEnum.moderator) achievement.name = input["name"] if "name" in input else achievement.name - achievement.description = input["description"] if "description" in input else achievement.description - achievement.attribute = input["attribute"] if "attribute" in input else achievement.attribute - achievement.operator = input["operator"] if "operator" in input else achievement.operator + achievement.description = ( + input["description"] if "description" in input else achievement.description + ) + achievement.attribute = ( + input["attribute"] if "attribute" in input else achievement.attribute + ) + achievement.operator = ( + input["operator"] if "operator" in input else achievement.operator + ) achievement.value = input["value"] if "value" in input else achievement.value self._achievements.update_achievement(achievement) diff --git a/kdb-bot/src/bot_graphql/mutations/auto_role_mutation.py b/bot/src/bot_graphql/mutations/auto_role_mutation.py similarity index 77% rename from kdb-bot/src/bot_graphql/mutations/auto_role_mutation.py rename to bot/src/bot_graphql/mutations/auto_role_mutation.py index d936fc6e..e4dec683 100644 --- a/kdb-bot/src/bot_graphql/mutations/auto_role_mutation.py +++ b/bot/src/bot_graphql/mutations/auto_role_mutation.py @@ -25,7 +25,11 @@ class AutoRoleMutation(QueryABC): self.set_field("deleteAutoRole", self.resolve_delete_auto_role) def resolve_create_auto_role(self, *_, input: dict): - auto_role = AutoRole(self._servers.get_server_by_id(input["serverId"]), input["channelId"], input["messageId"]) + auto_role = AutoRole( + self._servers.get_server_by_id(input["serverId"]), + input["channelId"], + input["messageId"], + ) self._can_user_mutate_data(auto_role.server, UserRoleEnum.moderator) self._auto_roles.add_auto_role(auto_role) @@ -38,14 +42,22 @@ class AutoRoleMutation(QueryABC): and x.discord_message_id == int(input["messageId"]) ) - return self._auto_roles.get_auto_roles_by_server_id(auto_role.server.id).where(get_new).last() + return ( + self._auto_roles.get_auto_roles_by_server_id(auto_role.server.id) + .where(get_new) + .last() + ) def resolve_update_auto_role(self, *_, input: dict): auto_role = self._auto_roles.get_auto_role_by_id(input["id"]) self._can_user_mutate_data(auto_role.server, UserRoleEnum.moderator) - auto_role.discord_channel_id = input["channelId"] if "channelId" in input else auto_role.discord_channel_id - auto_role.discord_message_id = input["messageId"] if "messageId" in input else auto_role.discord_message_id + auto_role.discord_channel_id = ( + input["channelId"] if "channelId" in input else auto_role.discord_channel_id + ) + auto_role.discord_message_id = ( + input["messageId"] if "messageId" in input else auto_role.discord_message_id + ) self._auto_roles.update_auto_role(auto_role) self._db.save_changes() diff --git a/kdb-bot/src/bot_graphql/mutations/auto_role_rule_mutation.py b/bot/src/bot_graphql/mutations/auto_role_rule_mutation.py similarity index 77% rename from kdb-bot/src/bot_graphql/mutations/auto_role_rule_mutation.py rename to bot/src/bot_graphql/mutations/auto_role_rule_mutation.py index 56681df9..0b880c0b 100644 --- a/kdb-bot/src/bot_graphql/mutations/auto_role_rule_mutation.py +++ b/bot/src/bot_graphql/mutations/auto_role_rule_mutation.py @@ -32,9 +32,13 @@ class AutoRoleRuleMutation(QueryABC): def resolve_create_auto_role_rule(self, *_, input: dict): auto_role_rule = AutoRoleRule( - self._auto_roles.get_auto_role_by_id(input["autoRoleId"]), input["emojiName"], input["roleId"] + self._auto_roles.get_auto_role_by_id(input["autoRoleId"]), + input["emojiName"], + input["roleId"], + ) + self._can_user_mutate_data( + auto_role_rule.auto_role.server, UserRoleEnum.moderator ) - self._can_user_mutate_data(auto_role_rule.auto_role.server, UserRoleEnum.moderator) self._auto_roles.add_auto_role_rule(auto_role_rule) self._db.save_changes() @@ -54,14 +58,26 @@ class AutoRoleRuleMutation(QueryABC): self._bot.get_guild(auto_role_rule.auto_role.server.discord_id), ) ) - return self._auto_roles.get_auto_role_rules_by_auto_role_id(auto_role_rule.auto_role.id).where(get_new).last() + return ( + self._auto_roles.get_auto_role_rules_by_auto_role_id( + auto_role_rule.auto_role.id + ) + .where(get_new) + .last() + ) def resolve_update_auto_role_rule(self, *_, input: dict): auto_role_rule = self._auto_roles.get_auto_role_rule_by_id(input["id"]) - self._can_user_mutate_data(auto_role_rule.auto_role.server, UserRoleEnum.moderator) + self._can_user_mutate_data( + auto_role_rule.auto_role.server, UserRoleEnum.moderator + ) - auto_role_rule.emoji_name = input["emojiName"] if "emojiName" in input else auto_role_rule.emoji_name - auto_role_rule.role_id = input["roleId"] if "roleId" in input else auto_role_rule.role_id + auto_role_rule.emoji_name = ( + input["emojiName"] if "emojiName" in input else auto_role_rule.emoji_name + ) + auto_role_rule.role_id = ( + input["roleId"] if "roleId" in input else auto_role_rule.role_id + ) self._auto_roles.update_auto_role_rule(auto_role_rule) self._db.save_changes() @@ -79,7 +95,9 @@ class AutoRoleRuleMutation(QueryABC): def resolve_delete_auto_role_rule(self, *_, id: int): auto_role_rule = self._auto_roles.get_auto_role_rule_by_id(id) - self._can_user_mutate_data(auto_role_rule.auto_role.server, UserRoleEnum.moderator) + self._can_user_mutate_data( + auto_role_rule.auto_role.server, UserRoleEnum.moderator + ) self._auto_roles.delete_auto_role_rule(auto_role_rule) self._db.save_changes() diff --git a/kdb-bot/src/bot_graphql/mutations/level_mutation.py b/bot/src/bot_graphql/mutations/level_mutation.py similarity index 91% rename from kdb-bot/src/bot_graphql/mutations/level_mutation.py rename to bot/src/bot_graphql/mutations/level_mutation.py index 215538b7..179cc786 100644 --- a/kdb-bot/src/bot_graphql/mutations/level_mutation.py +++ b/bot/src/bot_graphql/mutations/level_mutation.py @@ -54,7 +54,11 @@ class LevelMutation(QueryABC): ) self._bot.loop.create_task(self._level_seeder.seed()) - return self._levels.get_levels_by_server_id(level.server.id).where(get_new_level).last() + return ( + self._levels.get_levels_by_server_id(level.server.id) + .where(get_new_level) + .last() + ) def resolve_update_level(self, *_, input: dict): level = self._levels.get_level_by_id(input["id"]) @@ -63,7 +67,9 @@ class LevelMutation(QueryABC): level.name = input["name"] if "name" in input else level.name level.color = input["color"] if "color" in input else level.color level.min_xp = input["minXp"] if "minXp" in input else level.min_xp - level.permissions = input["permissions"] if "permissions" in input else level.permissions + level.permissions = ( + input["permissions"] if "permissions" in input else level.permissions + ) self._levels.update_level(level) self._db.save_changes() diff --git a/kdb-bot/src/bot_graphql/mutations/server_config_mutation.py b/bot/src/bot_graphql/mutations/server_config_mutation.py similarity index 67% rename from kdb-bot/src/bot_graphql/mutations/server_config_mutation.py rename to bot/src/bot_graphql/mutations/server_config_mutation.py index 1f179d4a..0f7df29b 100644 --- a/kdb-bot/src/bot_graphql/mutations/server_config_mutation.py +++ b/bot/src/bot_graphql/mutations/server_config_mutation.py @@ -41,28 +41,44 @@ class ServerConfigMutation(QueryABC): raise ValueError("Id not set") server_config = self._server_configs.get_server_config_by_id(int(input["id"])) - self._can_user_mutate_data(Route.get_user().users[0].server, UserRoleEnum.technician) + self._can_user_mutate_data( + Route.get_user().users[0].server, UserRoleEnum.technician + ) server_config.message_delete_timer = ( - input["messageDeleteTimer"] if "messageDeleteTimer" in input else server_config.message_delete_timer + input["messageDeleteTimer"] + if "messageDeleteTimer" in input + else server_config.message_delete_timer ) server_config.notification_chat_id = ( - input["notificationChatId"] if "notificationChatId" in input else server_config.notification_chat_id + input["notificationChatId"] + if "notificationChatId" in input + else server_config.notification_chat_id ) server_config.max_voice_state_hours = ( - input["maxVoiceStateHours"] if "maxVoiceStateHours" in input else server_config.max_voice_state_hours + input["maxVoiceStateHours"] + if "maxVoiceStateHours" in input + else server_config.max_voice_state_hours ) server_config.xp_per_message = ( - input["xpPerMessage"] if "xpPerMessage" in input else server_config.xp_per_message + input["xpPerMessage"] + if "xpPerMessage" in input + else server_config.xp_per_message ) server_config.xp_per_reaction = ( - input["xpPerReaction"] if "xpPerReaction" in input else server_config.xp_per_reaction + input["xpPerReaction"] + if "xpPerReaction" in input + else server_config.xp_per_reaction ) server_config.max_message_xp_per_hour = ( - input["maxMessageXpPerHour"] if "maxMessageXpPerHour" in input else server_config.max_message_xp_per_hour + input["maxMessageXpPerHour"] + if "maxMessageXpPerHour" in input + else server_config.max_message_xp_per_hour ) server_config.xp_per_ontime_hour = ( - input["xpPerOntimeHour"] if "xpPerOntimeHour" in input else server_config.xp_per_ontime_hour + input["xpPerOntimeHour"] + if "xpPerOntimeHour" in input + else server_config.xp_per_ontime_hour ) server_config.xp_per_event_participation = ( input["xpPerEventParticipation"] @@ -70,19 +86,29 @@ class ServerConfigMutation(QueryABC): else server_config.xp_per_event_participation ) server_config.xp_per_achievement = ( - input["xpPerAchievement"] if "xpPerAchievement" in input else server_config.xp_per_achievement + input["xpPerAchievement"] + if "xpPerAchievement" in input + else server_config.xp_per_achievement ) server_config.xp_for_birthday = ( - input["xpForBirthday"] if "xpForBirthday" in input else server_config.xp_for_birthday + input["xpForBirthday"] + if "xpForBirthday" in input + else server_config.xp_for_birthday ) server_config.afk_command_channel_id = ( - input["afkCommandChannelId"] if "afkCommandChannelId" in input else server_config.afk_command_channel_id + input["afkCommandChannelId"] + if "afkCommandChannelId" in input + else server_config.afk_command_channel_id ) server_config.help_voice_channel_id = ( - input["helpVoiceChannelId"] if "helpVoiceChannelId" in input else server_config.help_voice_channel_id + input["helpVoiceChannelId"] + if "helpVoiceChannelId" in input + else server_config.help_voice_channel_id ) server_config.team_channel_id = ( - input["teamChannelId"] if "teamChannelId" in input else server_config.team_channel_id + input["teamChannelId"] + if "teamChannelId" in input + else server_config.team_channel_id ) server_config.login_message_channel_id = ( input["loginMessageChannelId"] @@ -90,7 +116,9 @@ class ServerConfigMutation(QueryABC): else server_config.login_message_channel_id ) server_config.default_role_id = ( - input["defaultRoleId"] if "defaultRoleId" in input else server_config.default_role_id + input["defaultRoleId"] + if "defaultRoleId" in input + else server_config.default_role_id ) server_config.short_role_name_only_set_highest_role = ( input["shortRoleNameOnlySetHighestRole"] @@ -103,7 +131,12 @@ class ServerConfigMutation(QueryABC): else server_config.game_offer_notification_chat_id ) server_config.feature_flags = ( - dict(zip([x["key"] for x in input["featureFlags"]], [x["value"] for x in input["featureFlags"]])) + dict( + zip( + [x["key"] for x in input["featureFlags"]], + [x["value"] for x in input["featureFlags"]], + ) + ) if "featureFlags" in input else server_config.feature_flags ) @@ -117,25 +150,33 @@ class ServerConfigMutation(QueryABC): if "moderatorRoleIds" in input: team_role_ids.extend( [ - ServerTeamRoleIdsConfig(x, TeamMemberTypeEnum.moderator, server_config.server.id) + ServerTeamRoleIdsConfig( + x, TeamMemberTypeEnum.moderator, server_config.server.id + ) for x in input["moderatorRoleIds"] ] ) else: team_role_ids.extend( - server_config.team_role_ids.where(lambda x: x.team_member_type == TeamMemberTypeEnum.moderator) + server_config.team_role_ids.where( + lambda x: x.team_member_type == TeamMemberTypeEnum.moderator + ) ) if "adminRoleIds" in input: team_role_ids.extend( [ - ServerTeamRoleIdsConfig(x, TeamMemberTypeEnum.admin, server_config.server.id) + ServerTeamRoleIdsConfig( + x, TeamMemberTypeEnum.admin, server_config.server.id + ) for x in input["adminRoleIds"] ] ) else: team_role_ids.extend( - server_config.team_role_ids.where(lambda x: x.team_member_type == TeamMemberTypeEnum.admin) + server_config.team_role_ids.where( + lambda x: x.team_member_type == TeamMemberTypeEnum.admin + ) ) self._server_configs.update_server_config(server_config) @@ -147,11 +188,15 @@ class ServerConfigMutation(QueryABC): self._update_team_role_ids(server_config) self._db.save_changes() - self._bot.loop.create_task(self._config_service.reload_server_config(server_config.server)) + self._bot.loop.create_task( + self._config_service.reload_server_config(server_config.server) + ) return server_config def _update_afk_channel_ids(self, new_config: ServerConfig): - old_config = self._server_configs.get_server_config_by_server(new_config.server.id) + old_config = self._server_configs.get_server_config_by_server( + new_config.server.id + ) for channel_id in old_config.afk_channel_ids: if channel_id in new_config.afk_channel_ids: continue @@ -169,9 +214,13 @@ class ServerConfigMutation(QueryABC): ) def _update_team_role_ids(self, new_config: ServerConfig): - old_config = self._server_configs.get_server_config_by_server(new_config.server.id) + old_config = self._server_configs.get_server_config_by_server( + new_config.server.id + ) for role_id in old_config.team_role_ids: - if role_id.role_id in new_config.team_role_ids.select(lambda x: int(x.role_id)): + if role_id.role_id in new_config.team_role_ids.select( + lambda x: int(x.role_id) + ): continue self._server_configs.delete_server_team_role_id_config(role_id) @@ -183,7 +232,9 @@ class ServerConfigMutation(QueryABC): raise ValueError(f"Invalid roleId") for role_id in new_config.team_role_ids: - if role_id.role_id in old_config.team_role_ids.select(lambda x: str(x.role_id)): + if role_id.role_id in old_config.team_role_ids.select( + lambda x: str(x.role_id) + ): continue self._server_configs.add_server_team_role_id_config(role_id) diff --git a/kdb-bot/src/bot_graphql/mutations/short_role_name_mutation.py b/bot/src/bot_graphql/mutations/short_role_name_mutation.py similarity index 86% rename from kdb-bot/src/bot_graphql/mutations/short_role_name_mutation.py rename to bot/src/bot_graphql/mutations/short_role_name_mutation.py index 3044af99..d3b8c910 100644 --- a/kdb-bot/src/bot_graphql/mutations/short_role_name_mutation.py +++ b/bot/src/bot_graphql/mutations/short_role_name_mutation.py @@ -41,7 +41,9 @@ class ShortRoleNameMutation(QueryABC): server, ) - result = self._short_role_names.find_short_role_names_by_role_id(short_role_name.role_id) + result = self._short_role_names.find_short_role_names_by_role_id( + short_role_name.role_id + ) if result.count() > 0: raise ValueError("Short name for role already exists") @@ -56,7 +58,9 @@ class ShortRoleNameMutation(QueryABC): ) return ( - self._short_role_names.get_short_role_names_by_server_id(short_role_name.server.id) + self._short_role_names.get_short_role_names_by_server_id( + short_role_name.server.id + ) .where(get_new_short_role_name) .last() ) @@ -65,9 +69,15 @@ class ShortRoleNameMutation(QueryABC): short_role_name = self._short_role_names.get_short_role_name_by_id(input["id"]) self._can_user_mutate_data(short_role_name.server, UserRoleEnum.moderator) - short_role_name.short_name = input["shortName"] if "shortName" in input else short_role_name.short_name - short_role_name.role_id = input["roleId"] if "roleId" in input else short_role_name.role_id - short_role_name.position = input["position"] if "position" in input else short_role_name.position + short_role_name.short_name = ( + input["shortName"] if "shortName" in input else short_role_name.short_name + ) + short_role_name.role_id = ( + input["roleId"] if "roleId" in input else short_role_name.role_id + ) + short_role_name.position = ( + input["position"] if "position" in input else short_role_name.position + ) self._short_role_names.update_short_role_name(short_role_name) self._db.save_changes() diff --git a/kdb-bot/src/bot_graphql/mutations/technician_config_mutation.py b/bot/src/bot_graphql/mutations/technician_config_mutation.py similarity index 79% rename from kdb-bot/src/bot_graphql/mutations/technician_config_mutation.py rename to bot/src/bot_graphql/mutations/technician_config_mutation.py index 434856ee..09ba300b 100644 --- a/kdb-bot/src/bot_graphql/mutations/technician_config_mutation.py +++ b/bot/src/bot_graphql/mutations/technician_config_mutation.py @@ -43,7 +43,9 @@ class TechnicianConfigMutation(QueryABC): self._bot.loop.create_task(self._tech_seeder.seed()) technician_config = self._technician_configs.get_technician_config() - self._can_user_mutate_data(Route.get_user().users[0].server, UserRoleEnum.technician) + self._can_user_mutate_data( + Route.get_user().users[0].server, UserRoleEnum.technician + ) technician_config.help_command_reference_url = ( input["helpCommandReferenceUrl"] @@ -51,17 +53,28 @@ class TechnicianConfigMutation(QueryABC): else technician_config.help_command_reference_url ) technician_config.wait_for_restart = ( - input["waitForRestart"] if "waitForRestart" in input else technician_config.wait_for_restart + input["waitForRestart"] + if "waitForRestart" in input + else technician_config.wait_for_restart ) technician_config.wait_for_shutdown = ( - input["waitForShutdown"] if "waitForShutdown" in input else technician_config.wait_for_shutdown + input["waitForShutdown"] + if "waitForShutdown" in input + else technician_config.wait_for_shutdown ) technician_config.cache_max_messages = ( - input["cacheMaxMessages"] if "cacheMaxMessages" in input else technician_config.cache_max_messages + input["cacheMaxMessages"] + if "cacheMaxMessages" in input + else technician_config.cache_max_messages ) old_feature_flags = technician_config.feature_flags technician_config.feature_flags = ( - dict(zip([x["key"] for x in input["featureFlags"]], [x["value"] for x in input["featureFlags"]])) + dict( + zip( + [x["key"] for x in input["featureFlags"]], + [x["value"] for x in input["featureFlags"]], + ) + ) if "featureFlags" in input else technician_config.feature_flags ) @@ -70,7 +83,9 @@ class TechnicianConfigMutation(QueryABC): technician_config.feature_flags[old_flag] = False technician_config.ping_urls = ( - List(str, input["pingURLs"]) if "pingURLs" in input else technician_config.ping_urls + List(str, input["pingURLs"]) + if "pingURLs" in input + else technician_config.ping_urls ) technician_config.technician_ids = ( List(int).extend([int(x) for x in input["technicianIds"]]) @@ -95,13 +110,17 @@ class TechnicianConfigMutation(QueryABC): if url in new_config.ping_urls: continue - self._technician_configs.delete_technician_ping_url_config(TechnicianPingUrlConfig(url)) + self._technician_configs.delete_technician_ping_url_config( + TechnicianPingUrlConfig(url) + ) for url in new_config.ping_urls: if url in old_config.ping_urls: continue - self._technician_configs.add_technician_ping_url_config(TechnicianPingUrlConfig(url)) + self._technician_configs.add_technician_ping_url_config( + TechnicianPingUrlConfig(url) + ) def _update_technician_ids(self, new_config: TechnicianConfig): old_config = self._technician_configs.get_technician_config() @@ -109,7 +128,9 @@ class TechnicianConfigMutation(QueryABC): if technician_id in new_config.technician_ids: continue - self._technician_configs.delete_technician_id_config(TechnicianIdConfig(technician_id)) + self._technician_configs.delete_technician_id_config( + TechnicianIdConfig(technician_id) + ) for technician_id in new_config.technician_ids: user = self._bot.get_user(technician_id) @@ -120,4 +141,6 @@ class TechnicianConfigMutation(QueryABC): if technician_id in old_config.technician_ids: continue - self._technician_configs.add_technician_id_config(TechnicianIdConfig(technician_id)) + self._technician_configs.add_technician_id_config( + TechnicianIdConfig(technician_id) + ) diff --git a/kdb-bot/src/bot_graphql/mutations/user_joined_game_server_mutation.py b/bot/src/bot_graphql/mutations/user_joined_game_server_mutation.py similarity index 86% rename from kdb-bot/src/bot_graphql/mutations/user_joined_game_server_mutation.py rename to bot/src/bot_graphql/mutations/user_joined_game_server_mutation.py index 9225299d..d5885fd6 100644 --- a/kdb-bot/src/bot_graphql/mutations/user_joined_game_server_mutation.py +++ b/bot/src/bot_graphql/mutations/user_joined_game_server_mutation.py @@ -15,7 +15,9 @@ from bot_data.abc.api_key_repository_abc import ApiKeyRepositoryABC from bot_data.abc.game_server_repository_abc import GameServerRepositoryABC from bot_data.abc.server_repository_abc import ServerRepositoryABC from bot_data.abc.user_game_ident_repository_abc import UserGameIdentRepositoryABC -from bot_data.abc.user_joined_game_server_repository_abc import UserJoinedGameServerRepositoryABC +from bot_data.abc.user_joined_game_server_repository_abc import ( + UserJoinedGameServerRepositoryABC, +) from bot_data.abc.user_repository_abc import UserRepositoryABC from bot_data.model.api_key import ApiKey from bot_data.model.server_config import ServerConfig @@ -61,7 +63,9 @@ class UserJoinedGameServerMutation(QueryABC): def _get_api_key_str(self, api_key: ApiKey) -> str: return hashlib.sha256( - f"{api_key.identifier}:{api_key.key}+{self._auth_settings.secret_key}".encode("utf-8") + f"{api_key.identifier}:{api_key.key}+{self._auth_settings.secret_key}".encode( + "utf-8" + ) ).hexdigest() def _get_api_key(self) -> Optional[ApiKey]: @@ -80,13 +84,19 @@ class UserJoinedGameServerMutation(QueryABC): game_ident = self._user_game_idents.get_user_game_ident_by_ident(input["ident"]) user = game_ident.user - settings: ServerConfig = self._config.get_configuration(f"ServerConfig_{user.server.discord_id}") - if not FeatureFlagsSettings.get_flag_from_dict(settings.feature_flags, FeatureFlagsEnum.game_server): + settings: ServerConfig = self._config.get_configuration( + f"ServerConfig_{user.server.discord_id}" + ) + if not FeatureFlagsSettings.get_flag_from_dict( + settings.feature_flags, FeatureFlagsEnum.game_server + ): raise Exception("Feature not activated") self._can_user_mutate_data(user.server, UserRoleEnum.admin) - active = self._user_joined_game_servers.find_active_user_joined_game_server_by_user_id(user.id) + active = self._user_joined_game_servers.find_active_user_joined_game_server_by_user_id( + user.id + ) if active is not None: self._logger.debug( __name__, @@ -98,26 +108,38 @@ class UserJoinedGameServerMutation(QueryABC): self._user_joined_game_servers.add_user_joined_game_server(new) self._db.save_changes() - return self._user_joined_game_servers.get_active_user_joined_game_server_by_user_id(user.id) + return self._user_joined_game_servers.get_active_user_joined_game_server_by_user_id( + user.id + ) def resolve_user_left(self, *_, input: dict): - game_ident = self._user_game_idents.find_user_game_ident_by_ident(input["ident"]) + game_ident = self._user_game_idents.find_user_game_ident_by_ident( + input["ident"] + ) if game_ident is None: return user = game_ident.user - settings: ServerConfig = self._config.get_configuration(f"ServerConfig_{user.server.discord_id}") - if not FeatureFlagsSettings.get_flag_from_dict(settings.feature_flags, FeatureFlagsEnum.game_server): + settings: ServerConfig = self._config.get_configuration( + f"ServerConfig_{user.server.discord_id}" + ) + if not FeatureFlagsSettings.get_flag_from_dict( + settings.feature_flags, FeatureFlagsEnum.game_server + ): raise Exception("Feature not activated") self._can_user_mutate_data(user.server, UserRoleEnum.admin) - active = self._user_joined_game_servers.find_active_user_joined_game_server_by_user_id(user.id) + active = self._user_joined_game_servers.find_active_user_joined_game_server_by_user_id( + user.id + ) if active is None: return active.leaved_on = datetime.now() - settings: ServerConfig = self._config.get_configuration(f"ServerConfig_{user.server.discord_id}") + settings: ServerConfig = self._config.get_configuration( + f"ServerConfig_{user.server.discord_id}" + ) ontime = round((active.leaved_on - active.joined_on).total_seconds() / 3600, 2) old_xp = user.xp diff --git a/kdb-bot/src/bot_graphql/mutations/user_mutation.py b/bot/src/bot_graphql/mutations/user_mutation.py similarity index 80% rename from kdb-bot/src/bot_graphql/mutations/user_mutation.py rename to bot/src/bot_graphql/mutations/user_mutation.py index 9ec5f4cc..778db4f4 100644 --- a/kdb-bot/src/bot_graphql/mutations/user_mutation.py +++ b/bot/src/bot_graphql/mutations/user_mutation.py @@ -48,7 +48,9 @@ class UserMutation(QueryABC): auth_user = Route.get_user() member = self._bot.get_guild(user.server.discord_id).get_member( - auth_user.users.where(lambda x: x.server.id == user.server.id).single().discord_id + auth_user.users.where(lambda x: x.server.id == user.server.id) + .single() + .discord_id ) if member.id != user.discord_id: self._can_user_mutate_data(user.server, UserRoleEnum.moderator) @@ -62,9 +64,19 @@ class UserMutation(QueryABC): if "userWarnings" in input: self._update_user_warning(user, input["userWarnings"]) - user.xp = new_xp if new_xp is not None else input["xp"] if "xp" in input else user.xp + user.xp = ( + new_xp + if new_xp is not None + else input["xp"] + if "xp" in input + else user.xp + ) - user.birthday = datetime.strptime(input["birthday"], "%d.%m.%Y") if "birthday" in input else user.birthday + user.birthday = ( + datetime.strptime(input["birthday"], "%d.%m.%Y") + if "birthday" in input + else user.birthday + ) self._users.update_user(user) self._db.save_changes() @@ -76,15 +88,23 @@ class UserMutation(QueryABC): def _update_user_warning(self, user: User, new_warnings: dict): old_warnings = self._user_warnings.get_user_warnings_by_user_id(user.id) for warning in old_warnings: - if warning.id in [int(x["id"]) if "id" in x else None for x in new_warnings]: + if warning.id in [ + int(x["id"]) if "id" in x else None for x in new_warnings + ]: continue self._user_warning_service.remove_warnings(warning.id) for warning in new_warnings: - if "id" in warning and int(warning["id"]) in old_warnings.select(lambda x: x.id): + if "id" in warning and int(warning["id"]) in old_warnings.select( + lambda x: x.id + ): continue - member = self._bot.get_guild(user.server.discord_id).get_member(user.discord_id) + member = self._bot.get_guild(user.server.discord_id).get_member( + user.discord_id + ) author = self._users.get_user_by_id(int(warning["author"])) - self._user_warning_service.add_warnings(member, warning["description"], author.discord_id) + self._user_warning_service.add_warnings( + member, warning["description"], author.discord_id + ) diff --git a/kdb-bot/src/bot_graphql/queries/__init__.py b/bot/src/bot_graphql/queries/__init__.py similarity index 100% rename from kdb-bot/src/bot_graphql/queries/__init__.py rename to bot/src/bot_graphql/queries/__init__.py diff --git a/kdb-bot/src/bot_graphql/queries/achievement_attribute_query.py b/bot/src/bot_graphql/queries/achievement_attribute_query.py similarity index 100% rename from kdb-bot/src/bot_graphql/queries/achievement_attribute_query.py rename to bot/src/bot_graphql/queries/achievement_attribute_query.py diff --git a/kdb-bot/src/bot_graphql/queries/achievement_history_query.py b/bot/src/bot_graphql/queries/achievement_history_query.py similarity index 100% rename from kdb-bot/src/bot_graphql/queries/achievement_history_query.py rename to bot/src/bot_graphql/queries/achievement_history_query.py diff --git a/kdb-bot/src/bot_graphql/queries/achievement_query.py b/bot/src/bot_graphql/queries/achievement_query.py similarity index 84% rename from kdb-bot/src/bot_graphql/queries/achievement_query.py rename to bot/src/bot_graphql/queries/achievement_query.py index ab72fde0..f12e8657 100644 --- a/kdb-bot/src/bot_graphql/queries/achievement_query.py +++ b/bot/src/bot_graphql/queries/achievement_query.py @@ -9,7 +9,9 @@ class AchievementQuery(DataQueryWithHistoryABC): self, db: DatabaseContextABC, ): - DataQueryWithHistoryABC.__init__(self, "Achievement", "AchievementsHistory", AchievementHistory, db) + DataQueryWithHistoryABC.__init__( + self, "Achievement", "AchievementsHistory", AchievementHistory, db + ) self.set_field("id", lambda x, *_: x.id) self.set_field("name", lambda x, *_: x.name) diff --git a/kdb-bot/src/bot_graphql/queries/auto_role_history_query.py b/bot/src/bot_graphql/queries/auto_role_history_query.py similarity index 100% rename from kdb-bot/src/bot_graphql/queries/auto_role_history_query.py rename to bot/src/bot_graphql/queries/auto_role_history_query.py diff --git a/kdb-bot/src/bot_graphql/queries/auto_role_query.py b/bot/src/bot_graphql/queries/auto_role_query.py similarity index 91% rename from kdb-bot/src/bot_graphql/queries/auto_role_query.py rename to bot/src/bot_graphql/queries/auto_role_query.py index aaf694b7..ea6b9d7c 100644 --- a/kdb-bot/src/bot_graphql/queries/auto_role_query.py +++ b/bot/src/bot_graphql/queries/auto_role_query.py @@ -18,7 +18,9 @@ class AutoRoleQuery(DataQueryWithHistoryABC): servers: ServerRepositoryABC, db: DatabaseContextABC, ): - DataQueryWithHistoryABC.__init__(self, "AutoRole", "AutoRolesHistory", AutoRoleHistory, db) + DataQueryWithHistoryABC.__init__( + self, "AutoRole", "AutoRolesHistory", AutoRoleHistory, db + ) self._bot = bot self._auto_role_rules = auto_role_rules @@ -31,7 +33,9 @@ class AutoRoleQuery(DataQueryWithHistoryABC): self.set_field("server", self.resolve_server) self.add_collection( "autoRoleRule", - lambda x, *_: self._auto_role_rules.get_auto_role_rules_by_auto_role_id(x.id), + lambda x, *_: self._auto_role_rules.get_auto_role_rules_by_auto_role_id( + x.id + ), AutoRoleFilter, ) diff --git a/kdb-bot/src/bot_graphql/queries/auto_role_rule_history_query.py b/bot/src/bot_graphql/queries/auto_role_rule_history_query.py similarity index 100% rename from kdb-bot/src/bot_graphql/queries/auto_role_rule_history_query.py rename to bot/src/bot_graphql/queries/auto_role_rule_history_query.py diff --git a/kdb-bot/src/bot_graphql/queries/auto_role_rule_query.py b/bot/src/bot_graphql/queries/auto_role_rule_query.py similarity index 81% rename from kdb-bot/src/bot_graphql/queries/auto_role_rule_query.py rename to bot/src/bot_graphql/queries/auto_role_rule_query.py index e847a605..e08dc4f1 100644 --- a/kdb-bot/src/bot_graphql/queries/auto_role_rule_query.py +++ b/bot/src/bot_graphql/queries/auto_role_rule_query.py @@ -8,8 +8,15 @@ from bot_graphql.abc.data_query_with_history_abc import DataQueryWithHistoryABC class AutoRoleRuleQuery(DataQueryWithHistoryABC): - def __init__(self, bot: DiscordBotServiceABC, auto_roles: AutoRoleRepositoryABC, db: DatabaseContextABC): - DataQueryWithHistoryABC.__init__(self, "AutoRoleRule", "AutoRoleRulesHistory", AutoRoleRuleHistory, db) + def __init__( + self, + bot: DiscordBotServiceABC, + auto_roles: AutoRoleRepositoryABC, + db: DatabaseContextABC, + ): + DataQueryWithHistoryABC.__init__( + self, "AutoRoleRule", "AutoRoleRulesHistory", AutoRoleRuleHistory, db + ) self._bot = bot self._auto_roles = auto_roles diff --git a/kdb-bot/src/bot_graphql/queries/client_history_query.py b/bot/src/bot_graphql/queries/client_history_query.py similarity index 100% rename from kdb-bot/src/bot_graphql/queries/client_history_query.py rename to bot/src/bot_graphql/queries/client_history_query.py diff --git a/kdb-bot/src/bot_graphql/queries/client_query.py b/bot/src/bot_graphql/queries/client_query.py similarity index 94% rename from kdb-bot/src/bot_graphql/queries/client_query.py rename to bot/src/bot_graphql/queries/client_query.py index 6e69a369..af462202 100644 --- a/kdb-bot/src/bot_graphql/queries/client_query.py +++ b/bot/src/bot_graphql/queries/client_query.py @@ -8,7 +8,9 @@ from bot_graphql.abc.data_query_with_history_abc import DataQueryWithHistoryABC class ClientQuery(DataQueryWithHistoryABC): def __init__(self, bot: DiscordBotServiceABC, db: DatabaseContextABC): - DataQueryWithHistoryABC.__init__(self, "Client", "ClientsHistory", ClientHistory, db) + DataQueryWithHistoryABC.__init__( + self, "Client", "ClientsHistory", ClientHistory, db + ) self._bot = bot diff --git a/kdb-bot/src/bot_graphql/queries/discord/__init__.py b/bot/src/bot_graphql/queries/discord/__init__.py similarity index 100% rename from kdb-bot/src/bot_graphql/queries/discord/__init__.py rename to bot/src/bot_graphql/queries/discord/__init__.py diff --git a/kdb-bot/src/bot_graphql/queries/discord/channel_query.py b/bot/src/bot_graphql/queries/discord/channel_query.py similarity index 100% rename from kdb-bot/src/bot_graphql/queries/discord/channel_query.py rename to bot/src/bot_graphql/queries/discord/channel_query.py diff --git a/kdb-bot/src/bot_graphql/queries/discord/discord_query.py b/bot/src/bot_graphql/queries/discord/discord_query.py similarity index 100% rename from kdb-bot/src/bot_graphql/queries/discord/discord_query.py rename to bot/src/bot_graphql/queries/discord/discord_query.py diff --git a/kdb-bot/src/bot_graphql/queries/discord/discord_user_query.py b/bot/src/bot_graphql/queries/discord/discord_user_query.py similarity index 100% rename from kdb-bot/src/bot_graphql/queries/discord/discord_user_query.py rename to bot/src/bot_graphql/queries/discord/discord_user_query.py diff --git a/kdb-bot/src/bot_graphql/queries/discord/emoji_query.py b/bot/src/bot_graphql/queries/discord/emoji_query.py similarity index 100% rename from kdb-bot/src/bot_graphql/queries/discord/emoji_query.py rename to bot/src/bot_graphql/queries/discord/emoji_query.py diff --git a/kdb-bot/src/bot_graphql/queries/discord/guild_query.py b/bot/src/bot_graphql/queries/discord/guild_query.py similarity index 88% rename from kdb-bot/src/bot_graphql/queries/discord/guild_query.py rename to bot/src/bot_graphql/queries/discord/guild_query.py index 98f581f3..5393c530 100644 --- a/kdb-bot/src/bot_graphql/queries/discord/guild_query.py +++ b/bot/src/bot_graphql/queries/discord/guild_query.py @@ -20,7 +20,10 @@ class GuildQuery(QueryABC): self.set_field("channels", self._resolve_channels) self.set_field("roles", lambda g, *_: g.roles.order_by(lambda x: x.position)) self.set_field( - "emojis", lambda g, *_: List(discord.Emoji, g.emojis).order_by_descending(lambda x: x.created_at) + "emojis", + lambda g, *_: List(discord.Emoji, g.emojis).order_by_descending( + lambda x: x.created_at + ), ) def _resolve_channels(self, g: Guild, *_, filter=None): diff --git a/kdb-bot/src/bot_graphql/queries/discord/role_query.py b/bot/src/bot_graphql/queries/discord/role_query.py similarity index 100% rename from kdb-bot/src/bot_graphql/queries/discord/role_query.py rename to bot/src/bot_graphql/queries/discord/role_query.py diff --git a/kdb-bot/src/bot_graphql/queries/game_server_query.py b/bot/src/bot_graphql/queries/game_server_query.py similarity index 100% rename from kdb-bot/src/bot_graphql/queries/game_server_query.py rename to bot/src/bot_graphql/queries/game_server_query.py diff --git a/kdb-bot/src/bot_graphql/queries/known_user_history_query.py b/bot/src/bot_graphql/queries/known_user_history_query.py similarity index 100% rename from kdb-bot/src/bot_graphql/queries/known_user_history_query.py rename to bot/src/bot_graphql/queries/known_user_history_query.py diff --git a/kdb-bot/src/bot_graphql/queries/known_user_query.py b/bot/src/bot_graphql/queries/known_user_query.py similarity index 83% rename from kdb-bot/src/bot_graphql/queries/known_user_query.py rename to bot/src/bot_graphql/queries/known_user_query.py index d3435735..c6079b56 100644 --- a/kdb-bot/src/bot_graphql/queries/known_user_query.py +++ b/bot/src/bot_graphql/queries/known_user_query.py @@ -7,7 +7,9 @@ from bot_graphql.abc.data_query_with_history_abc import DataQueryWithHistoryABC class KnownUserQuery(DataQueryWithHistoryABC): def __init__(self, db: DatabaseContextABC): - DataQueryWithHistoryABC.__init__(self, "KnownUser", "KnownUsersHistory", KnownUserHistory, db) + DataQueryWithHistoryABC.__init__( + self, "KnownUser", "KnownUsersHistory", KnownUserHistory, db + ) self.set_field("id", self.resolve_id) self.set_field("discordId", self.resolve_discord_id) diff --git a/kdb-bot/src/bot_graphql/queries/level_history_query.py b/bot/src/bot_graphql/queries/level_history_query.py similarity index 100% rename from kdb-bot/src/bot_graphql/queries/level_history_query.py rename to bot/src/bot_graphql/queries/level_history_query.py diff --git a/kdb-bot/src/bot_graphql/queries/level_query.py b/bot/src/bot_graphql/queries/level_query.py similarity index 91% rename from kdb-bot/src/bot_graphql/queries/level_query.py rename to bot/src/bot_graphql/queries/level_query.py index 5f726c5b..7eef1b3f 100644 --- a/kdb-bot/src/bot_graphql/queries/level_query.py +++ b/bot/src/bot_graphql/queries/level_query.py @@ -7,7 +7,9 @@ from bot_graphql.abc.data_query_with_history_abc import DataQueryWithHistoryABC class LevelQuery(DataQueryWithHistoryABC): def __init__(self, db: DatabaseContextABC): - DataQueryWithHistoryABC.__init__(self, "Level", "LevelsHistory", LevelHistory, db) + DataQueryWithHistoryABC.__init__( + self, "Level", "LevelsHistory", LevelHistory, db + ) self.set_field("id", self.resolve_id) self.set_field("name", self.resolve_name) diff --git a/kdb-bot/src/bot_graphql/queries/server_config_query.py b/bot/src/bot_graphql/queries/server_config_query.py similarity index 53% rename from kdb-bot/src/bot_graphql/queries/server_config_query.py rename to bot/src/bot_graphql/queries/server_config_query.py index 080fd874..9c28b560 100644 --- a/kdb-bot/src/bot_graphql/queries/server_config_query.py +++ b/bot/src/bot_graphql/queries/server_config_query.py @@ -8,31 +8,60 @@ from bot_graphql.abc.data_query_with_history_abc import DataQueryWithHistoryABC class ServerConfigQuery(DataQueryWithHistoryABC): def __init__(self, db: DatabaseContextABC): - DataQueryWithHistoryABC.__init__(self, "ServerConfig", "CFG_ServerHistory", ServerConfigHistory, db) + DataQueryWithHistoryABC.__init__( + self, "ServerConfig", "CFG_ServerHistory", ServerConfigHistory, db + ) self.set_field("id", lambda config, *_: config.id) - self.set_field("messageDeleteTimer", lambda config, *_: config.message_delete_timer) - self.set_field("notificationChatId", lambda config, *_: config.notification_chat_id) - self.set_field("maxVoiceStateHours", lambda config, *_: config.max_voice_state_hours) + self.set_field( + "messageDeleteTimer", lambda config, *_: config.message_delete_timer + ) + self.set_field( + "notificationChatId", lambda config, *_: config.notification_chat_id + ) + self.set_field( + "maxVoiceStateHours", lambda config, *_: config.max_voice_state_hours + ) self.set_field("xpPerMessage", lambda config, *_: config.xp_per_message) self.set_field("xpPerReaction", lambda config, *_: config.xp_per_reaction) - self.set_field("maxMessageXpPerHour", lambda config, *_: config.max_message_xp_per_hour) + self.set_field( + "maxMessageXpPerHour", lambda config, *_: config.max_message_xp_per_hour + ) self.set_field("xpPerOntimeHour", lambda config, *_: config.xp_per_ontime_hour) - self.set_field("xpPerEventParticipation", lambda config, *_: config.xp_per_event_participation) + self.set_field( + "xpPerEventParticipation", + lambda config, *_: config.xp_per_event_participation, + ) self.set_field("xpPerAchievement", lambda config, *_: config.xp_per_achievement) self.set_field("xpForBirthday", lambda config, *_: config.xp_for_birthday) - self.set_field("afkCommandChannelId", lambda config, *_: config.afk_command_channel_id) - self.set_field("helpVoiceChannelId", lambda config, *_: config.help_voice_channel_id) + self.set_field( + "afkCommandChannelId", lambda config, *_: config.afk_command_channel_id + ) + self.set_field( + "helpVoiceChannelId", lambda config, *_: config.help_voice_channel_id + ) self.set_field("teamChannelId", lambda config, *_: config.team_channel_id) - self.set_field("loginMessageChannelId", lambda config, *_: config.login_message_channel_id) + self.set_field( + "loginMessageChannelId", lambda config, *_: config.login_message_channel_id + ) self.set_field("defaultRoleId", lambda config, *_: config.default_role_id) self.set_field( - "shortRoleNameOnlySetHighestRole", lambda config, *_: config.short_role_name_only_set_highest_role + "shortRoleNameOnlySetHighestRole", + lambda config, *_: config.short_role_name_only_set_highest_role, + ) + self.set_field( + "gameOfferNotificationChatId", + lambda config, *_: config.game_offer_notification_chat_id, ) - self.set_field("gameOfferNotificationChatId", lambda config, *_: config.game_offer_notification_chat_id) self.add_collection( "featureFlag", - lambda config, *_: List(any, [{"key": x, "value": config.feature_flags[x]} for x in config.feature_flags]), + lambda config, *_: List( + any, + [ + {"key": x, "value": config.feature_flags[x]} + for x in config.feature_flags + ], + ), ) self.set_field("afkChannelIds", lambda config, *_: config.afk_channel_ids) self.set_field( diff --git a/kdb-bot/src/bot_graphql/queries/server_history_query.py b/bot/src/bot_graphql/queries/server_history_query.py similarity index 100% rename from kdb-bot/src/bot_graphql/queries/server_history_query.py rename to bot/src/bot_graphql/queries/server_history_query.py diff --git a/kdb-bot/src/bot_graphql/queries/server_query.py b/bot/src/bot_graphql/queries/server_query.py similarity index 72% rename from kdb-bot/src/bot_graphql/queries/server_query.py rename to bot/src/bot_graphql/queries/server_query.py index 6ba77149..67879229 100644 --- a/kdb-bot/src/bot_graphql/queries/server_query.py +++ b/bot/src/bot_graphql/queries/server_query.py @@ -12,7 +12,9 @@ from bot_data.abc.level_repository_abc import LevelRepositoryABC from bot_data.abc.server_config_repository_abc import ServerConfigRepositoryABC from bot_data.abc.short_role_name_repository_abc import ShortRoleNameRepositoryABC from bot_data.abc.user_joined_server_repository_abc import UserJoinedServerRepositoryABC -from bot_data.abc.user_joined_voice_channel_repository_abc import UserJoinedVoiceChannelRepositoryABC +from bot_data.abc.user_joined_voice_channel_repository_abc import ( + UserJoinedVoiceChannelRepositoryABC, +) from bot_data.abc.user_repository_abc import UserRepositoryABC from bot_data.model.server import Server from bot_data.model.server_config import ServerConfig @@ -43,7 +45,9 @@ class ServerQuery(DataQueryWithHistoryABC): short_role_names: ShortRoleNameRepositoryABC, server_configs: ServerConfigRepositoryABC, ): - DataQueryWithHistoryABC.__init__(self, "Server", "ServersHistory", ServerHistory, db) + DataQueryWithHistoryABC.__init__( + self, "Server", "ServersHistory", ServerHistory, db + ) self._config = config self._bot = bot @@ -65,22 +69,45 @@ class ServerQuery(DataQueryWithHistoryABC): AutoRoleFilter, ) self.add_collection( - "client", lambda server, *_: self._clients.get_clients_by_server_id(server.id), ClientFilter + "client", + lambda server, *_: self._clients.get_clients_by_server_id(server.id), + ClientFilter, ) - self.add_collection("level", lambda server, *_: self._levels.get_levels_by_server_id(server.id), LevelFilter) - self.add_collection("user", lambda server, *_: self._users.get_users_by_server_id(server.id), UserFilter) - self.add_collection("gameServer", lambda server, *_: game_servers.get_game_servers_by_server_id(server.id)) self.add_collection( - "achievement", lambda server, *_: achievements.get_achievements_by_server_id(server.id), AchievementFilter + "level", + lambda server, *_: self._levels.get_levels_by_server_id(server.id), + LevelFilter, + ) + self.add_collection( + "user", + lambda server, *_: self._users.get_users_by_server_id(server.id), + UserFilter, + ) + self.add_collection( + "gameServer", + lambda server, *_: game_servers.get_game_servers_by_server_id(server.id), + ) + self.add_collection( + "achievement", + lambda server, *_: achievements.get_achievements_by_server_id(server.id), + AchievementFilter, ) self.add_collection( "shortRoleName", - lambda server, *_: short_role_names.get_short_role_names_by_server_id(server.id), + lambda server, *_: short_role_names.get_short_role_names_by_server_id( + server.id + ), ShortRoleNameFilter, ) - self.set_field("config", lambda server, *_: server_configs.get_server_config_by_server(server.id)) self.set_field( - "hasFeatureFlag", lambda server, *_, **kwargs: self._resolve_has_feature_flag(server, *_, **kwargs) + "config", + lambda server, *_: server_configs.get_server_config_by_server(server.id), + ) + self.set_field( + "hasFeatureFlag", + lambda server, *_, **kwargs: self._resolve_has_feature_flag( + server, *_, **kwargs + ), ) @staticmethod @@ -100,10 +127,14 @@ class ServerQuery(DataQueryWithHistoryABC): return server.icon_url def _resolve_has_feature_flag(self, server: Server, *_, **kwargs): - settings: ServerConfig = self._config.get_configuration(f"ServerConfig_{server.discord_id}") + settings: ServerConfig = self._config.get_configuration( + f"ServerConfig_{server.discord_id}" + ) if "flag" not in kwargs: return False return { "key": kwargs["flag"], - "value": FeatureFlagsSettings.get_flag_from_dict(settings.feature_flags, FeatureFlagsEnum(kwargs["flag"])), + "value": FeatureFlagsSettings.get_flag_from_dict( + settings.feature_flags, FeatureFlagsEnum(kwargs["flag"]) + ), } diff --git a/kdb-bot/src/bot_graphql/queries/short_role_name_history_query.py b/bot/src/bot_graphql/queries/short_role_name_history_query.py similarity index 100% rename from kdb-bot/src/bot_graphql/queries/short_role_name_history_query.py rename to bot/src/bot_graphql/queries/short_role_name_history_query.py diff --git a/kdb-bot/src/bot_graphql/queries/short_role_name_query.py b/bot/src/bot_graphql/queries/short_role_name_query.py similarity index 82% rename from kdb-bot/src/bot_graphql/queries/short_role_name_query.py rename to bot/src/bot_graphql/queries/short_role_name_query.py index 75d07ac6..6191aadd 100644 --- a/kdb-bot/src/bot_graphql/queries/short_role_name_query.py +++ b/bot/src/bot_graphql/queries/short_role_name_query.py @@ -9,7 +9,9 @@ class ShortRoleNameQuery(DataQueryWithHistoryABC): self, db: DatabaseContextABC, ): - DataQueryWithHistoryABC.__init__(self, "ShortRoleName", "ShortRoleNamesHistory", ShortRoleNameHistory, db) + DataQueryWithHistoryABC.__init__( + self, "ShortRoleName", "ShortRoleNamesHistory", ShortRoleNameHistory, db + ) self.set_field("id", lambda x, *_: x.id) self.set_field("shortName", lambda x, *_: x.short_name) diff --git a/kdb-bot/src/bot_graphql/queries/technician_config_history_query.py b/bot/src/bot_graphql/queries/technician_config_history_query.py similarity index 60% rename from kdb-bot/src/bot_graphql/queries/technician_config_history_query.py rename to bot/src/bot_graphql/queries/technician_config_history_query.py index a63f88f8..41ebbb54 100644 --- a/kdb-bot/src/bot_graphql/queries/technician_config_history_query.py +++ b/bot/src/bot_graphql/queries/technician_config_history_query.py @@ -7,11 +7,20 @@ class TechnicianConfigHistoryQuery(HistoryQueryABC): def __init__(self): HistoryQueryABC.__init__(self, "TechnicianConfig") - self.set_field("helpCommandReferenceUrl", lambda config, *_: config.help_command_reference_url) + self.set_field( + "helpCommandReferenceUrl", + lambda config, *_: config.help_command_reference_url, + ) self.set_field("waitForRestart", lambda config, *_: config.wait_for_restart) self.set_field("waitForShutdown", lambda config, *_: config.wait_for_shutdown) self.set_field("cacheMaxMessages", lambda config, *_: config.cache_max_messages) self.add_collection( "featureFlag", - lambda config, *_: List(any, [{"key": x, "value": config.feature_flags[x]} for x in config.feature_flags]), + lambda config, *_: List( + any, + [ + {"key": x, "value": config.feature_flags[x]} + for x in config.feature_flags + ], + ), ) diff --git a/kdb-bot/src/bot_graphql/queries/technician_config_query.py b/bot/src/bot_graphql/queries/technician_config_query.py similarity index 76% rename from kdb-bot/src/bot_graphql/queries/technician_config_query.py rename to bot/src/bot_graphql/queries/technician_config_query.py index 2d8bb8f9..a6363d9b 100644 --- a/kdb-bot/src/bot_graphql/queries/technician_config_query.py +++ b/bot/src/bot_graphql/queries/technician_config_query.py @@ -4,21 +4,38 @@ from cpl_query.extension import List from bot_data.abc.table_with_id_abc import TableWithIdABC from bot_data.model.technician_config_history import TechnicianConfigHistory from bot_data.model.technician_id_config_history import TechnicianIdConfigHistory -from bot_data.model.technician_ping_url_config_history import TechnicianPingUrlConfigHistory +from bot_data.model.technician_ping_url_config_history import ( + TechnicianPingUrlConfigHistory, +) from bot_graphql.abc.data_query_with_history_abc import DataQueryWithHistoryABC class TechnicianConfigQuery(DataQueryWithHistoryABC): def __init__(self, db: DatabaseContextABC): - DataQueryWithHistoryABC.__init__(self, "TechnicianConfig", "CFG_TechnicianHistory", TechnicianConfigHistory, db) + DataQueryWithHistoryABC.__init__( + self, + "TechnicianConfig", + "CFG_TechnicianHistory", + TechnicianConfigHistory, + db, + ) - self.set_field("helpCommandReferenceUrl", lambda config, *_: config.help_command_reference_url) + self.set_field( + "helpCommandReferenceUrl", + lambda config, *_: config.help_command_reference_url, + ) self.set_field("waitForRestart", lambda config, *_: config.wait_for_restart) self.set_field("waitForShutdown", lambda config, *_: config.wait_for_shutdown) self.set_field("cacheMaxMessages", lambda config, *_: config.cache_max_messages) self.add_collection( "featureFlag", - lambda config, *_: List(any, [{"key": x, "value": config.feature_flags[x]} for x in config.feature_flags]), + lambda config, *_: List( + any, + [ + {"key": x, "value": config.feature_flags[x]} + for x in config.feature_flags + ], + ), ) self.set_field("pingURLs", lambda config, *_: config.ping_urls) self.set_field("technicianIds", lambda config, *_: config.technician_ids) diff --git a/kdb-bot/src/bot_graphql/queries/technician_id_config_history_query.py b/bot/src/bot_graphql/queries/technician_id_config_history_query.py similarity index 100% rename from kdb-bot/src/bot_graphql/queries/technician_id_config_history_query.py rename to bot/src/bot_graphql/queries/technician_id_config_history_query.py diff --git a/kdb-bot/src/bot_graphql/queries/technician_ping_url_config_history_query.py b/bot/src/bot_graphql/queries/technician_ping_url_config_history_query.py similarity index 100% rename from kdb-bot/src/bot_graphql/queries/technician_ping_url_config_history_query.py rename to bot/src/bot_graphql/queries/technician_ping_url_config_history_query.py diff --git a/kdb-bot/src/bot_graphql/queries/user_history_query.py b/bot/src/bot_graphql/queries/user_history_query.py similarity index 100% rename from kdb-bot/src/bot_graphql/queries/user_history_query.py rename to bot/src/bot_graphql/queries/user_history_query.py diff --git a/kdb-bot/src/bot_graphql/queries/user_joined_game_server_history_query.py b/bot/src/bot_graphql/queries/user_joined_game_server_history_query.py similarity index 100% rename from kdb-bot/src/bot_graphql/queries/user_joined_game_server_history_query.py rename to bot/src/bot_graphql/queries/user_joined_game_server_history_query.py diff --git a/kdb-bot/src/bot_graphql/queries/user_joined_game_server_query.py b/bot/src/bot_graphql/queries/user_joined_game_server_query.py similarity index 90% rename from kdb-bot/src/bot_graphql/queries/user_joined_game_server_query.py rename to bot/src/bot_graphql/queries/user_joined_game_server_query.py index 6a5befaa..0ea7ceb3 100644 --- a/kdb-bot/src/bot_graphql/queries/user_joined_game_server_query.py +++ b/bot/src/bot_graphql/queries/user_joined_game_server_query.py @@ -9,7 +9,11 @@ from bot_graphql.abc.data_query_with_history_abc import DataQueryWithHistoryABC class UserJoinedGameServerQuery(DataQueryWithHistoryABC): def __init__(self, bot: DiscordBotServiceABC, db: DatabaseContextABC): DataQueryWithHistoryABC.__init__( - self, "UserJoinedGameServer", "UserJoinedGameServersHistory", UserJoinedGameServerHistory, db + self, + "UserJoinedGameServer", + "UserJoinedGameServersHistory", + UserJoinedGameServerHistory, + db, ) self._bot = bot diff --git a/kdb-bot/src/bot_graphql/queries/user_joined_server_history_query.py b/bot/src/bot_graphql/queries/user_joined_server_history_query.py similarity index 100% rename from kdb-bot/src/bot_graphql/queries/user_joined_server_history_query.py rename to bot/src/bot_graphql/queries/user_joined_server_history_query.py diff --git a/kdb-bot/src/bot_graphql/queries/user_joined_server_query.py b/bot/src/bot_graphql/queries/user_joined_server_query.py similarity index 87% rename from kdb-bot/src/bot_graphql/queries/user_joined_server_query.py rename to bot/src/bot_graphql/queries/user_joined_server_query.py index a8e236ff..db9967f4 100644 --- a/kdb-bot/src/bot_graphql/queries/user_joined_server_query.py +++ b/bot/src/bot_graphql/queries/user_joined_server_query.py @@ -8,7 +8,11 @@ from bot_graphql.abc.data_query_with_history_abc import DataQueryWithHistoryABC class UserJoinedServerQuery(DataQueryWithHistoryABC): def __init__(self, db: DatabaseContextABC): DataQueryWithHistoryABC.__init__( - self, "UserJoinedServer", "UserJoinedServersHistory", UserJoinedServerHistory, db + self, + "UserJoinedServer", + "UserJoinedServersHistory", + UserJoinedServerHistory, + db, ) self.set_field("id", self.resolve_id) diff --git a/kdb-bot/src/bot_graphql/queries/user_joined_voice_channel_history_query.py b/bot/src/bot_graphql/queries/user_joined_voice_channel_history_query.py similarity index 100% rename from kdb-bot/src/bot_graphql/queries/user_joined_voice_channel_history_query.py rename to bot/src/bot_graphql/queries/user_joined_voice_channel_history_query.py diff --git a/kdb-bot/src/bot_graphql/queries/user_joined_voice_channel_query.py b/bot/src/bot_graphql/queries/user_joined_voice_channel_query.py similarity index 85% rename from kdb-bot/src/bot_graphql/queries/user_joined_voice_channel_query.py rename to bot/src/bot_graphql/queries/user_joined_voice_channel_query.py index a5465581..15a8af9c 100644 --- a/kdb-bot/src/bot_graphql/queries/user_joined_voice_channel_query.py +++ b/bot/src/bot_graphql/queries/user_joined_voice_channel_query.py @@ -2,14 +2,20 @@ from cpl_core.database.context import DatabaseContextABC from cpl_discord.service import DiscordBotServiceABC from bot_data.model.user_joined_voice_channel import UserJoinedVoiceChannel -from bot_data.model.user_joined_voice_channel_history import UserJoinedVoiceChannelHistory +from bot_data.model.user_joined_voice_channel_history import ( + UserJoinedVoiceChannelHistory, +) from bot_graphql.abc.data_query_with_history_abc import DataQueryWithHistoryABC class UserJoinedVoiceChannelQuery(DataQueryWithHistoryABC): def __init__(self, bot: DiscordBotServiceABC, db: DatabaseContextABC): DataQueryWithHistoryABC.__init__( - self, "UserJoinedVoiceChannel", "UserJoinedVoiceChannelsHistory", UserJoinedVoiceChannelHistory, db + self, + "UserJoinedVoiceChannel", + "UserJoinedVoiceChannelsHistory", + UserJoinedVoiceChannelHistory, + db, ) self._bot = bot diff --git a/kdb-bot/src/bot_graphql/queries/user_query.py b/bot/src/bot_graphql/queries/user_query.py similarity index 88% rename from kdb-bot/src/bot_graphql/queries/user_query.py rename to bot/src/bot_graphql/queries/user_query.py index c04fbcc9..d91d5043 100644 --- a/kdb-bot/src/bot_graphql/queries/user_query.py +++ b/bot/src/bot_graphql/queries/user_query.py @@ -3,9 +3,13 @@ from cpl_discord.service import DiscordBotServiceABC from bot_core.abc.client_utils_abc import ClientUtilsABC from bot_data.abc.achievement_repository_abc import AchievementRepositoryABC -from bot_data.abc.user_joined_game_server_repository_abc import UserJoinedGameServerRepositoryABC +from bot_data.abc.user_joined_game_server_repository_abc import ( + UserJoinedGameServerRepositoryABC, +) from bot_data.abc.user_joined_server_repository_abc import UserJoinedServerRepositoryABC -from bot_data.abc.user_joined_voice_channel_repository_abc import UserJoinedVoiceChannelRepositoryABC +from bot_data.abc.user_joined_voice_channel_repository_abc import ( + UserJoinedVoiceChannelRepositoryABC, +) from bot_data.abc.user_warnings_repository_abc import UserWarningsRepositoryABC from bot_data.model.user import User from bot_data.model.user_history import UserHistory @@ -13,7 +17,9 @@ from bot_graphql.abc.data_query_with_history_abc import DataQueryWithHistoryABC from bot_graphql.filter.achievement_filter import AchievementFilter from bot_graphql.filter.user_joined_game_server_filter import UserJoinedGameServerFilter from bot_graphql.filter.user_joined_server_filter import UserJoinedServerFilter -from bot_graphql.filter.user_joined_voice_channel_filter import UserJoinedVoiceChannelFilter +from bot_graphql.filter.user_joined_voice_channel_filter import ( + UserJoinedVoiceChannelFilter, +) from bot_graphql.filter.user_warning_filter import UserWarningFilter from modules.level.service.level_service import LevelService from modules.permission.abc.permission_service_abc import PermissionServiceABC @@ -60,19 +66,27 @@ class UserQuery(DataQueryWithHistoryABC): ) self.add_collection( "joinedVoiceChannel", - lambda user, *_: self._ujvs.get_user_joined_voice_channels_by_user_id(user.id), + lambda user, *_: self._ujvs.get_user_joined_voice_channels_by_user_id( + user.id + ), UserJoinedVoiceChannelFilter, ) self.add_collection( "userJoinedGameServer", - lambda user, *_: self._user_joined_game_server.get_user_joined_game_servers_by_user_id(user.id), + lambda user, *_: self._user_joined_game_server.get_user_joined_game_servers_by_user_id( + user.id + ), UserJoinedGameServerFilter, ) self.add_collection( - "achievement", lambda user, *_: achievements.get_achievements_by_user_id(user.id), AchievementFilter + "achievement", + lambda user, *_: achievements.get_achievements_by_user_id(user.id), + AchievementFilter, ) self.add_collection( - "userWarning", lambda user, *_: user_warnings.get_user_warnings_by_user_id(user.id), UserWarningFilter + "userWarning", + lambda user, *_: user_warnings.get_user_warnings_by_user_id(user.id), + UserWarningFilter, ) self.set_field("server", self.resolve_server) diff --git a/kdb-bot/src/bot_graphql/queries/user_warning_history_query.py b/bot/src/bot_graphql/queries/user_warning_history_query.py similarity index 100% rename from kdb-bot/src/bot_graphql/queries/user_warning_history_query.py rename to bot/src/bot_graphql/queries/user_warning_history_query.py diff --git a/kdb-bot/src/bot_graphql/queries/user_warning_query.py b/bot/src/bot_graphql/queries/user_warning_query.py similarity index 80% rename from kdb-bot/src/bot_graphql/queries/user_warning_query.py rename to bot/src/bot_graphql/queries/user_warning_query.py index f6243d5e..c738e0d7 100644 --- a/kdb-bot/src/bot_graphql/queries/user_warning_query.py +++ b/bot/src/bot_graphql/queries/user_warning_query.py @@ -9,7 +9,9 @@ class UserWarningQuery(DataQueryWithHistoryABC): self, db: DatabaseContextABC, ): - DataQueryWithHistoryABC.__init__(self, "UserWarning", "UserWarningsHistory", UserWarningsHistory, db) + DataQueryWithHistoryABC.__init__( + self, "UserWarning", "UserWarningsHistory", UserWarningsHistory, db + ) self.set_field("id", lambda x, *_: x.id) self.set_field("user", lambda x, *_: x.user) diff --git a/kdb-bot/src/bot_graphql/query.py b/bot/src/bot_graphql/query.py similarity index 70% rename from kdb-bot/src/bot_graphql/query.py rename to bot/src/bot_graphql/query.py index 5ddb67dd..602fe555 100644 --- a/kdb-bot/src/bot_graphql/query.py +++ b/bot/src/bot_graphql/query.py @@ -11,9 +11,13 @@ from bot_data.abc.level_repository_abc import LevelRepositoryABC from bot_data.abc.server_repository_abc import ServerRepositoryABC from bot_data.abc.short_role_name_repository_abc import ShortRoleNameRepositoryABC from bot_data.abc.technician_config_repository_abc import TechnicianConfigRepositoryABC -from bot_data.abc.user_joined_game_server_repository_abc import UserJoinedGameServerRepositoryABC +from bot_data.abc.user_joined_game_server_repository_abc import ( + UserJoinedGameServerRepositoryABC, +) from bot_data.abc.user_joined_server_repository_abc import UserJoinedServerRepositoryABC -from bot_data.abc.user_joined_voice_channel_repository_abc import UserJoinedVoiceChannelRepositoryABC +from bot_data.abc.user_joined_voice_channel_repository_abc import ( + UserJoinedVoiceChannelRepositoryABC, +) from bot_data.abc.user_repository_abc import UserRepositoryABC from bot_data.abc.user_warnings_repository_abc import UserWarningsRepositoryABC from bot_data.model.short_role_name_position_enum import ShortRoleNamePositionEnum @@ -28,7 +32,9 @@ from bot_graphql.filter.short_role_name_filter import ShortRoleNameFilter from bot_graphql.filter.user_filter import UserFilter from bot_graphql.filter.user_joined_game_server_filter import UserJoinedGameServerFilter from bot_graphql.filter.user_joined_server_filter import UserJoinedServerFilter -from bot_graphql.filter.user_joined_voice_channel_filter import UserJoinedVoiceChannelFilter +from bot_graphql.filter.user_joined_voice_channel_filter import ( + UserJoinedVoiceChannelFilter, +) from bot_graphql.filter.user_warning_filter import UserWarningFilter from bot_graphql.model.discord import Discord from modules.achievements.achievement_service import AchievementService @@ -56,15 +62,23 @@ class Query(QueryABC): ): QueryABC.__init__(self, "Query") - self.add_collection("autoRole", lambda *_: auto_roles.get_auto_roles(), AutoRoleFilter) - self.add_collection("autoRoleRule", lambda *_: auto_roles.get_auto_role_rules(), AutoRoleRuleFilter) + self.add_collection( + "autoRole", lambda *_: auto_roles.get_auto_roles(), AutoRoleFilter + ) + self.add_collection( + "autoRoleRule", + lambda *_: auto_roles.get_auto_role_rules(), + AutoRoleRuleFilter, + ) self.add_collection("client", lambda *_: clients.get_clients(), ClientFilter) self.add_collection("knownUser", lambda *_: known_users.get_users()) self.add_collection("level", lambda *_: levels.get_levels(), LevelFilter) self.add_collection("server", lambda *_: servers.get_servers(), ServerFilter) self.add_collection("gameServer", lambda *_: game_servers.get_game_servers()) self.add_collection( - "userJoinedServer", lambda *_: user_joined_servers.get_user_joined_servers(), UserJoinedServerFilter + "userJoinedServer", + lambda *_: user_joined_servers.get_user_joined_servers(), + UserJoinedServerFilter, ) self.add_collection( "userJoinedVoiceChannel", @@ -77,15 +91,38 @@ class Query(QueryABC): UserJoinedGameServerFilter, ) self.add_collection("user", lambda *_: users.get_users(), UserFilter) - self.add_collection("achievement", lambda *_: achievements.get_achievements(), AchievementFilter) - self.add_collection("shortRoleName", lambda *_: short_role_names.get_short_role_names(), ShortRoleNameFilter) - self.add_collection("userWarning", lambda *_: user_warnings.get_user_warnings(), UserWarningFilter) + self.add_collection( + "achievement", lambda *_: achievements.get_achievements(), AchievementFilter + ) + self.add_collection( + "shortRoleName", + lambda *_: short_role_names.get_short_role_names(), + ShortRoleNameFilter, + ) + self.add_collection( + "userWarning", + lambda *_: user_warnings.get_user_warnings(), + UserWarningFilter, + ) - self.set_field("technicianConfig", lambda *_: technician_config.get_technician_config()) + self.set_field( + "technicianConfig", lambda *_: technician_config.get_technician_config() + ) - self.set_field("achievementAttributes", lambda *_: achievement_service.get_attributes()) - self.set_field("achievementOperators", lambda *_: achievement_service.get_operators()) - self.set_field("shortRoleNamePositions", lambda *_: [x.value for x in ShortRoleNamePositionEnum]) + self.set_field( + "achievementAttributes", lambda *_: achievement_service.get_attributes() + ) + self.set_field( + "achievementOperators", lambda *_: achievement_service.get_operators() + ) + self.set_field( + "shortRoleNamePositions", + lambda *_: [x.value for x in ShortRoleNamePositionEnum], + ) - self.set_field("possibleFeatureFlags", lambda *_: [e.value for e in FeatureFlagsEnum]) - self.set_field("discord", lambda *_: Discord(bot.guilds, List(any).extend(bot.users))) + self.set_field( + "possibleFeatureFlags", lambda *_: [e.value for e in FeatureFlagsEnum] + ) + self.set_field( + "discord", lambda *_: Discord(bot.guilds, List(any).extend(bot.users)) + ) diff --git a/kdb-bot/src/bot_graphql/schema.py b/bot/src/bot_graphql/schema.py similarity index 78% rename from kdb-bot/src/bot_graphql/schema.py rename to bot/src/bot_graphql/schema.py index 020efbc8..5e09a19c 100644 --- a/kdb-bot/src/bot_graphql/schema.py +++ b/bot/src/bot_graphql/schema.py @@ -10,7 +10,9 @@ from bot_graphql.query import Query class Schema: def __init__(self, query: Query, mutation: Mutation, queries: list[QueryABC]): - type_defs = load_schema_from_path(os.path.join(os.path.dirname(os.path.realpath(__file__)), "graphql/")) + type_defs = load_schema_from_path( + os.path.join(os.path.dirname(os.path.realpath(__file__)), "graphql/") + ) self._schema = make_executable_schema(type_defs, query, mutation, *queries) @property diff --git a/kdb-bot/src/modules/__init__.py b/bot/src/modules/__init__.py similarity index 100% rename from kdb-bot/src/modules/__init__.py rename to bot/src/modules/__init__.py diff --git a/kdb-bot/src/modules/achievements/__init__.py b/bot/src/modules/achievements/__init__.py similarity index 100% rename from kdb-bot/src/modules/achievements/__init__.py rename to bot/src/modules/achievements/__init__.py diff --git a/kdb-bot/src/modules/achievements/achievement_attribute_resolver.py b/bot/src/modules/achievements/achievement_attribute_resolver.py similarity index 80% rename from kdb-bot/src/modules/achievements/achievement_attribute_resolver.py rename to bot/src/modules/achievements/achievement_attribute_resolver.py index f08f1579..7de2ee0b 100644 --- a/kdb-bot/src/modules/achievements/achievement_attribute_resolver.py +++ b/bot/src/modules/achievements/achievement_attribute_resolver.py @@ -7,9 +7,13 @@ from bot_data.abc.game_server_repository_abc import GameServerRepositoryABC from bot_data.abc.known_user_repository_abc import KnownUserRepositoryABC from bot_data.abc.level_repository_abc import LevelRepositoryABC from bot_data.abc.server_repository_abc import ServerRepositoryABC -from bot_data.abc.user_joined_game_server_repository_abc import UserJoinedGameServerRepositoryABC +from bot_data.abc.user_joined_game_server_repository_abc import ( + UserJoinedGameServerRepositoryABC, +) from bot_data.abc.user_joined_server_repository_abc import UserJoinedServerRepositoryABC -from bot_data.abc.user_joined_voice_channel_repository_abc import UserJoinedVoiceChannelRepositoryABC +from bot_data.abc.user_joined_voice_channel_repository_abc import ( + UserJoinedVoiceChannelRepositoryABC, +) from bot_data.abc.user_repository_abc import UserRepositoryABC from bot_data.model.user import User @@ -42,9 +46,22 @@ class AchievementAttributeResolver: self._achievements = achievements def get_played_on_game_server(self, user: User) -> List[str]: - joins = self._user_joined_game_server.get_user_joined_game_servers_by_user_id(user.id) + joins = self._user_joined_game_server.get_user_joined_game_servers_by_user_id( + user.id + ) return joins.select(lambda x: x.game_server.name) def get_last_ontime_hours(self, user: User) -> int: - ujvs = self._user_joined_voice_channels.get_user_joined_voice_channels_by_user_id(user.id) - return int(str(ujvs.max(lambda join: (join.leaved_on - join.joined_on).total_seconds() / 3600))) + ujvs = ( + self._user_joined_voice_channels.get_user_joined_voice_channels_by_user_id( + user.id + ) + ) + return int( + str( + ujvs.max( + lambda join: (join.leaved_on - join.joined_on).total_seconds() + / 3600 + ) + ) + ) diff --git a/kdb-bot/src/modules/achievements/achievement_service.py b/bot/src/modules/achievements/achievement_service.py similarity index 68% rename from kdb-bot/src/modules/achievements/achievement_service.py rename to bot/src/modules/achievements/achievement_service.py index d7b2a455..9d3bbac5 100644 --- a/kdb-bot/src/modules/achievements/achievement_service.py +++ b/bot/src/modules/achievements/achievement_service.py @@ -12,7 +12,9 @@ from bot_data.model.achievement import Achievement from bot_data.model.server_config import ServerConfig from bot_data.model.user import User from bot_data.model.user_got_achievement import UserGotAchievement -from modules.achievements.achievement_attribute_resolver import AchievementAttributeResolver +from modules.achievements.achievement_attribute_resolver import ( + AchievementAttributeResolver, +) from modules.achievements.model.achievement_attribute import AchievementAttribute @@ -43,16 +45,24 @@ class AchievementService: self._attributes.extend( [ AchievementAttribute("xp", lambda user: user.xp, "number"), - AchievementAttribute("message_count", lambda user: user.message_count, "number"), - AchievementAttribute("reaction_count", lambda user: user.reaction_count, "number"), + AchievementAttribute( + "message_count", lambda user: user.message_count, "number" + ), + AchievementAttribute( + "reaction_count", lambda user: user.reaction_count, "number" + ), AchievementAttribute("ontime", lambda user: user.ontime, "number"), AchievementAttribute("level", lambda user: user.level, "Level"), # special cases AchievementAttribute( - "played_on_game_server", lambda user: resolver.get_played_on_game_server(user), "GameServer" + "played_on_game_server", + lambda user: resolver.get_played_on_game_server(user), + "GameServer", ), AchievementAttribute( - "last_single_ontime_hours", lambda user: resolver.get_last_ontime_hours(user), "number" + "last_single_ontime_hours", + lambda user: resolver.get_last_ontime_hours(user), + "number", ), ] ) @@ -60,10 +70,14 @@ class AchievementService: self._operators = { "==": lambda value, expected_value: value == expected_value, "!=": lambda value, expected_value: value != expected_value, - "<=": lambda value, expected_value: self._num(value) <= self._num(expected_value), - ">=": lambda value, expected_value: self._num(value) >= self._num(expected_value), - "<": lambda value, expected_value: self._num(value) < self._num(expected_value), - ">": lambda value, expected_value: self._num(value) > self._num(expected_value), + "<=": lambda value, expected_value: self._num(value) + <= self._num(expected_value), + ">=": lambda value, expected_value: self._num(value) + >= self._num(expected_value), + "<": lambda value, expected_value: self._num(value) + < self._num(expected_value), + ">": lambda value, expected_value: self._num(value) + > self._num(expected_value), "contains": lambda value, expected_value: expected_value in value, } @@ -86,37 +100,57 @@ class AchievementService: def _match(self, value: any, operator: str, expected_value: str) -> bool: return self._operators[operator](str(value), expected_value) - def has_user_achievement_already(self, user: User, achievement: Achievement) -> bool: + def has_user_achievement_already( + self, user: User, achievement: Achievement + ) -> bool: user_achievements = self._achievements.get_achievements_by_user_id(user.id) return user_achievements.where(lambda x: x.name == achievement.name).count() > 0 def has_user_achievement(self, user: User, achievement: Achievement) -> bool: - attribute: AchievementAttribute = self._attributes.where(lambda x: x.name == achievement.attribute).single() - return self._match(attribute.resolve(user), achievement.operator, achievement.value) + attribute: AchievementAttribute = self._attributes.where( + lambda x: x.name == achievement.attribute + ).single() + return self._match( + attribute.resolve(user), achievement.operator, achievement.value + ) async def validate_achievements_for_user(self, user: User): achievements = self._achievements.get_achievements_by_server_id(user.server.id) for achievement in achievements: - if self.has_user_achievement_already(user, achievement) or not self.has_user_achievement(user, achievement): + if self.has_user_achievement_already( + user, achievement + ) or not self.has_user_achievement(user, achievement): continue - self._achievements.add_user_got_achievement(UserGotAchievement(user, achievement, user.server)) + self._achievements.add_user_got_achievement( + UserGotAchievement(user, achievement, user.server) + ) self._db.save_changes() self._give_user_xp(user) - await self._send_achievement_notification(user.server.discord_id, user.discord_id, achievement.name) + await self._send_achievement_notification( + user.server.discord_id, user.discord_id, achievement.name + ) def _give_user_xp(self, user: User): - settings: ServerConfig = self._config.get_configuration(f"ServerConfig_{user.server.discord_id}") + settings: ServerConfig = self._config.get_configuration( + f"ServerConfig_{user.server.discord_id}" + ) user.xp += settings.xp_per_achievement self._users.update_user(user) self._db.save_changes() - async def _send_achievement_notification(self, guild_id: int, member_id: int, achievement_name: str): + async def _send_achievement_notification( + self, guild_id: int, member_id: int, achievement_name: str + ): member = self._bot.get_guild(guild_id).get_member(member_id) - settings: ServerConfig = self._config.get_configuration(f"ServerConfig_{guild_id}") + settings: ServerConfig = self._config.get_configuration( + f"ServerConfig_{guild_id}" + ) await self._message_service.send_channel_message( self._bot.get_channel(settings.notification_chat_id), - self._t.transform("modules.achievements.got_new_achievement").format(member.mention, achievement_name), + self._t.transform("modules.achievements.got_new_achievement").format( + member.mention, achievement_name + ), is_persistent=True, ) diff --git a/kdb-bot/src/modules/achievements/achievements.json b/bot/src/modules/achievements/achievements.json similarity index 100% rename from kdb-bot/src/modules/achievements/achievements.json rename to bot/src/modules/achievements/achievements.json diff --git a/kdb-bot/src/modules/achievements/achievements_module.py b/bot/src/modules/achievements/achievements_module.py similarity index 55% rename from kdb-bot/src/modules/achievements/achievements_module.py rename to bot/src/modules/achievements/achievements_module.py index 8ea61396..cc7c5ec6 100644 --- a/kdb-bot/src/modules/achievements/achievements_module.py +++ b/bot/src/modules/achievements/achievements_module.py @@ -6,29 +6,53 @@ from cpl_discord.service.discord_collection_abc import DiscordCollectionABC from bot_core.abc.module_abc import ModuleABC from bot_core.configuration.feature_flags_enum import FeatureFlagsEnum -from modules.achievements.achievement_attribute_resolver import AchievementAttributeResolver +from modules.achievements.achievement_attribute_resolver import ( + AchievementAttributeResolver, +) from modules.achievements.achievement_service import AchievementService from modules.achievements.commands.achievements_group import AchievementGroup -from modules.achievements.events.achievement_on_message_event import AchievementOnMessageEvent -from modules.achievements.events.achievement_on_reaction_add_event import AchievementOnReactionAddEvent -from modules.achievements.events.achievement_on_reaction_remove_event import AchievementOnReactionRemoveEvent -from modules.achievements.events.achievement_on_voice_state_update_event import AchievementOnVoiceStateUpdateEvent +from modules.achievements.events.achievement_on_message_event import ( + AchievementOnMessageEvent, +) +from modules.achievements.events.achievement_on_reaction_add_event import ( + AchievementOnReactionAddEvent, +) +from modules.achievements.events.achievement_on_reaction_remove_event import ( + AchievementOnReactionRemoveEvent, +) +from modules.achievements.events.achievement_on_voice_state_update_event import ( + AchievementOnVoiceStateUpdateEvent, +) class AchievementsModule(ModuleABC): def __init__(self, dc: DiscordCollectionABC): ModuleABC.__init__(self, dc, FeatureFlagsEnum.achievements_module) - def configure_configuration(self, config: ConfigurationABC, env: ApplicationEnvironmentABC): + def configure_configuration( + self, config: ConfigurationABC, env: ApplicationEnvironmentABC + ): pass - def configure_services(self, services: ServiceCollectionABC, env: ApplicationEnvironmentABC): + def configure_services( + self, services: ServiceCollectionABC, env: ApplicationEnvironmentABC + ): services.add_transient(AchievementAttributeResolver) services.add_transient(AchievementService) services.add_transient(AchievementGroup) - services.add_transient(DiscordEventTypesEnum.on_message.value, AchievementOnMessageEvent) - services.add_transient(DiscordEventTypesEnum.on_reaction_add.value, AchievementOnReactionAddEvent) - services.add_transient(DiscordEventTypesEnum.on_reaction_remove.value, AchievementOnReactionRemoveEvent) - services.add_transient(DiscordEventTypesEnum.on_voice_state_update.value, AchievementOnVoiceStateUpdateEvent) + services.add_transient( + DiscordEventTypesEnum.on_message.value, AchievementOnMessageEvent + ) + services.add_transient( + DiscordEventTypesEnum.on_reaction_add.value, AchievementOnReactionAddEvent + ) + services.add_transient( + DiscordEventTypesEnum.on_reaction_remove.value, + AchievementOnReactionRemoveEvent, + ) + services.add_transient( + DiscordEventTypesEnum.on_voice_state_update.value, + AchievementOnVoiceStateUpdateEvent, + ) diff --git a/kdb-bot/src/modules/achievements/commands/__init__.py b/bot/src/modules/achievements/commands/__init__.py similarity index 100% rename from kdb-bot/src/modules/achievements/commands/__init__.py rename to bot/src/modules/achievements/commands/__init__.py diff --git a/kdb-bot/src/modules/achievements/commands/achievements_group.py b/bot/src/modules/achievements/commands/achievements_group.py similarity index 97% rename from kdb-bot/src/modules/achievements/commands/achievements_group.py rename to bot/src/modules/achievements/commands/achievements_group.py index a0c73ccb..497dfe4c 100644 --- a/kdb-bot/src/modules/achievements/commands/achievements_group.py +++ b/bot/src/modules/achievements/commands/achievements_group.py @@ -54,7 +54,9 @@ class AchievementGroup(DiscordCommandABC): if ctx.guild is None: return - server_config: ServerConfig = self._config.get_configuration(f"ServerConfig_{ctx.guild.id}") + server_config: ServerConfig = self._config.get_configuration( + f"ServerConfig_{ctx.guild.id}" + ) if not FeatureFlagsSettings.get_flag_from_dict( server_config.feature_flags, FeatureFlagsEnum.achievements_module ): diff --git a/kdb-bot/src/modules/achievements/events/__init__.py b/bot/src/modules/achievements/events/__init__.py similarity index 100% rename from kdb-bot/src/modules/achievements/events/__init__.py rename to bot/src/modules/achievements/events/__init__.py diff --git a/kdb-bot/src/modules/achievements/events/achievement_on_message_event.py b/bot/src/modules/achievements/events/achievement_on_message_event.py similarity index 94% rename from kdb-bot/src/modules/achievements/events/achievement_on_message_event.py rename to bot/src/modules/achievements/events/achievement_on_message_event.py index b3564ccf..1cb6a9ee 100644 --- a/kdb-bot/src/modules/achievements/events/achievement_on_message_event.py +++ b/bot/src/modules/achievements/events/achievement_on_message_event.py @@ -43,14 +43,18 @@ class AchievementOnMessageEvent(OnMessageABC): if message.author.bot: return - server_config: ServerConfig = self._config.get_configuration(f"ServerConfig_{message.guild.id}") + server_config: ServerConfig = self._config.get_configuration( + f"ServerConfig_{message.guild.id}" + ) if not FeatureFlagsSettings.get_flag_from_dict( server_config.feature_flags, FeatureFlagsEnum.achievements_module ): return server = self._servers.get_server_by_discord_id(message.guild.id) - user = self._users.get_user_by_discord_id_and_server_id(message.author.id, server.id) + user = self._users.get_user_by_discord_id_and_server_id( + message.author.id, server.id + ) user.message_count += 1 self._users.update_user(user) diff --git a/kdb-bot/src/modules/achievements/events/achievement_on_reaction_add_event.py b/bot/src/modules/achievements/events/achievement_on_reaction_add_event.py similarity index 90% rename from kdb-bot/src/modules/achievements/events/achievement_on_reaction_add_event.py rename to bot/src/modules/achievements/events/achievement_on_reaction_add_event.py index b033b534..cb4fcec9 100644 --- a/kdb-bot/src/modules/achievements/events/achievement_on_reaction_add_event.py +++ b/bot/src/modules/achievements/events/achievement_on_reaction_add_event.py @@ -36,7 +36,11 @@ class AchievementOnReactionAddEvent(OnReactionAddABC): self._servers = servers self._users = users - async def on_reaction_add(self, reaction: discord.reaction.Reaction, user: Union[discord.Member, discord.User]): + async def on_reaction_add( + self, + reaction: discord.reaction.Reaction, + user: Union[discord.Member, discord.User], + ): if not isinstance(user, discord.Member): return @@ -46,7 +50,9 @@ class AchievementOnReactionAddEvent(OnReactionAddABC): if user.bot: return - server_config: ServerConfig = self._config.get_configuration(f"ServerConfig_{user.guild.id}") + server_config: ServerConfig = self._config.get_configuration( + f"ServerConfig_{user.guild.id}" + ) if not FeatureFlagsSettings.get_flag_from_dict( server_config.feature_flags, FeatureFlagsEnum.achievements_module ): diff --git a/kdb-bot/src/modules/achievements/events/achievement_on_reaction_remove_event.py b/bot/src/modules/achievements/events/achievement_on_reaction_remove_event.py similarity index 90% rename from kdb-bot/src/modules/achievements/events/achievement_on_reaction_remove_event.py rename to bot/src/modules/achievements/events/achievement_on_reaction_remove_event.py index bbb33f28..63aacffc 100644 --- a/kdb-bot/src/modules/achievements/events/achievement_on_reaction_remove_event.py +++ b/bot/src/modules/achievements/events/achievement_on_reaction_remove_event.py @@ -36,7 +36,11 @@ class AchievementOnReactionRemoveEvent(OnReactionRemoveABC): self._servers = servers self._users = users - async def on_reaction_remove(self, reaction: discord.reaction.Reaction, user: Union[discord.Member, discord.User]): + async def on_reaction_remove( + self, + reaction: discord.reaction.Reaction, + user: Union[discord.Member, discord.User], + ): if not isinstance(user, discord.Member): return @@ -46,7 +50,9 @@ class AchievementOnReactionRemoveEvent(OnReactionRemoveABC): if user.bot: return - server_config: ServerConfig = self._config.get_configuration(f"ServerConfig_{user.guild.id}") + server_config: ServerConfig = self._config.get_configuration( + f"ServerConfig_{user.guild.id}" + ) if not FeatureFlagsSettings.get_flag_from_dict( server_config.feature_flags, FeatureFlagsEnum.achievements_module ): diff --git a/kdb-bot/src/modules/achievements/events/achievement_on_voice_state_update_event.py b/bot/src/modules/achievements/events/achievement_on_voice_state_update_event.py similarity index 90% rename from kdb-bot/src/modules/achievements/events/achievement_on_voice_state_update_event.py rename to bot/src/modules/achievements/events/achievement_on_voice_state_update_event.py index 6f60e06e..d7c5aeb7 100644 --- a/kdb-bot/src/modules/achievements/events/achievement_on_voice_state_update_event.py +++ b/bot/src/modules/achievements/events/achievement_on_voice_state_update_event.py @@ -35,7 +35,10 @@ class AchievementOnVoiceStateUpdateEvent(OnVoiceStateUpdateABC): self._users = users async def on_voice_state_update( - self, member: discord.member.Member, before: discord.member.VoiceState, after: discord.member.VoiceState + self, + member: discord.member.Member, + before: discord.member.VoiceState, + after: discord.member.VoiceState, ): if member.guild is None: return @@ -43,7 +46,9 @@ class AchievementOnVoiceStateUpdateEvent(OnVoiceStateUpdateABC): if member.bot: return - server_config: ServerConfig = self._config.get_configuration(f"ServerConfig_{member.guild.id}") + server_config: ServerConfig = self._config.get_configuration( + f"ServerConfig_{member.guild.id}" + ) if not FeatureFlagsSettings.get_flag_from_dict( server_config.feature_flags, FeatureFlagsEnum.achievements_module ): diff --git a/kdb-bot/src/modules/achievements/model/__init__.py b/bot/src/modules/achievements/model/__init__.py similarity index 100% rename from kdb-bot/src/modules/achievements/model/__init__.py rename to bot/src/modules/achievements/model/__init__.py diff --git a/kdb-bot/src/modules/achievements/model/achievement_attribute.py b/bot/src/modules/achievements/model/achievement_attribute.py similarity index 100% rename from kdb-bot/src/modules/achievements/model/achievement_attribute.py rename to bot/src/modules/achievements/model/achievement_attribute.py diff --git a/kdb-bot/src/modules/auto_role/__init__.py b/bot/src/modules/auto_role/__init__.py similarity index 100% rename from kdb-bot/src/modules/auto_role/__init__.py rename to bot/src/modules/auto_role/__init__.py diff --git a/kdb-bot/src/modules/auto_role/auto-role.json b/bot/src/modules/auto_role/auto-role.json similarity index 100% rename from kdb-bot/src/modules/auto_role/auto-role.json rename to bot/src/modules/auto_role/auto-role.json diff --git a/kdb-bot/src/modules/auto_role/auto_role_module.py b/bot/src/modules/auto_role/auto_role_module.py similarity index 86% rename from kdb-bot/src/modules/auto_role/auto_role_module.py rename to bot/src/modules/auto_role/auto_role_module.py index 07eba97e..4fee55e8 100644 --- a/kdb-bot/src/modules/auto_role/auto_role_module.py +++ b/bot/src/modules/auto_role/auto_role_module.py @@ -20,10 +20,14 @@ class AutoRoleModule(ModuleABC): def __init__(self, dc: DiscordCollectionABC): ModuleABC.__init__(self, dc, FeatureFlagsEnum.auto_role_module) - def configure_configuration(self, config: ConfigurationABC, env: ApplicationEnvironmentABC): + def configure_configuration( + self, config: ConfigurationABC, env: ApplicationEnvironmentABC + ): pass - def configure_services(self, services: ServiceCollectionABC, env: ApplicationEnvironmentABC): + def configure_services( + self, services: ServiceCollectionABC, env: ApplicationEnvironmentABC + ): services.add_transient(AutoRoleReactionHandler) # commands services.add_transient(AutoRoleGroup) diff --git a/kdb-bot/src/modules/auto_role/command/__init__.py b/bot/src/modules/auto_role/command/__init__.py similarity index 100% rename from kdb-bot/src/modules/auto_role/command/__init__.py rename to bot/src/modules/auto_role/command/__init__.py diff --git a/kdb-bot/src/modules/auto_role/command/auto_role_group.py b/bot/src/modules/auto_role/command/auto_role_group.py similarity index 74% rename from kdb-bot/src/modules/auto_role/command/auto_role_group.py rename to bot/src/modules/auto_role/command/auto_role_group.py index 58b8532c..6e5ae53c 100644 --- a/kdb-bot/src/modules/auto_role/command/auto_role_group.py +++ b/bot/src/modules/auto_role/command/auto_role_group.py @@ -58,10 +58,14 @@ class AutoRoleGroup(DiscordCommandABC): self, interaction: discord.Interaction, current: str ) -> TList[app_commands.Choice[str]]: server = self._servers.get_server_by_discord_id(interaction.guild.id) - auto_roles = self._auto_roles.get_auto_roles_by_server_id(server.id).select(lambda x: x.id) + auto_roles = self._auto_roles.get_auto_roles_by_server_id(server.id).select( + lambda x: x.id + ) return [ app_commands.Choice(name=auto_role, value=auto_role) - for auto_role in self._client_utils.get_auto_complete_list(auto_roles, current, lambda x: x.name) + for auto_role in self._client_utils.get_auto_complete_list( + auto_roles, current, lambda x: x.name + ) ] @commands.hybrid_group(name="auto-role") @@ -78,8 +82,12 @@ class AutoRoleGroup(DiscordCommandABC): if ctx.guild is None: return - server_config: ServerConfig = self._config.get_configuration(f"ServerConfig_{ctx.guild.id}") - if not FeatureFlagsSettings.get_flag_from_dict(server_config.feature_flags, FeatureFlagsEnum.auto_role_module): + server_config: ServerConfig = self._config.get_configuration( + f"ServerConfig_{ctx.guild.id}" + ) + if not FeatureFlagsSettings.get_flag_from_dict( + server_config.feature_flags, FeatureFlagsEnum.auto_role_module + ): return embed = discord.Embed( @@ -90,7 +98,9 @@ class AutoRoleGroup(DiscordCommandABC): server = self._servers.get_server_by_discord_id(ctx.guild.id) auto_roles = self._auto_roles.get_auto_roles_by_server_id(server.id) if auto_roles.count() < 1: - await self._message_service.send_ctx_msg(ctx, self._t.transform("modules.auto_role.error.nothing_found")) + await self._message_service.send_ctx_msg( + ctx, self._t.transform("modules.auto_role.error.nothing_found") + ) self._logger.trace(__name__, f"Finished command auto-role list") return @@ -118,12 +128,18 @@ class AutoRoleGroup(DiscordCommandABC): @CommandChecks.check_is_ready() @CommandChecks.check_is_member_moderator() async def add(self, ctx: Context, channel: discord.TextChannel, message_id: str): - self._logger.debug(__name__, f"Received command auto-role add {ctx} {message_id}") + self._logger.debug( + __name__, f"Received command auto-role add {ctx} {message_id}" + ) if ctx.guild is None: return - server_config: ServerConfig = self._config.get_configuration(f"ServerConfig_{ctx.guild.id}") - if not FeatureFlagsSettings.get_flag_from_dict(server_config.feature_flags, FeatureFlagsEnum.auto_role_module): + server_config: ServerConfig = self._config.get_configuration( + f"ServerConfig_{ctx.guild.id}" + ) + if not FeatureFlagsSettings.get_flag_from_dict( + server_config.feature_flags, FeatureFlagsEnum.auto_role_module + ): return message = ( @@ -135,38 +151,56 @@ class AutoRoleGroup(DiscordCommandABC): .single_or_default() ) if message is None: - self._logger.debug(__name__, f"Message with id {message_id} not found in {channel.name}") + self._logger.debug( + __name__, f"Message with id {message_id} not found in {channel.name}" + ) await self._message_service.send_ctx_msg( ctx, - self._t.transform("modules.auto_role.add.error.not_found").format(message_id, channel.mention), + self._t.transform("modules.auto_role.add.error.not_found").format( + message_id, channel.mention + ), ) self._logger.trace(__name__, f"Finished command auto-role add") return if self._auto_roles.find_auto_role_by_message_id(int(message_id)) is not None: - self._logger.debug(__name__, f"auto-role for message {message_id} already exists") + self._logger.debug( + __name__, f"auto-role for message {message_id} already exists" + ) await self._message_service.send_ctx_msg( ctx, - self._t.transform("modules.auto_role.add.error.already_exists").format(message_id), + self._t.transform("modules.auto_role.add.error.already_exists").format( + message_id + ), ) self._logger.trace(__name__, f"Finished command auto-role add") return server = self._servers.get_server_by_discord_id(ctx.guild.id) - self._auto_roles.add_auto_role(AutoRole(server, int(channel.id), int(message_id))) + self._auto_roles.add_auto_role( + AutoRole(server, int(channel.id), int(message_id)) + ) self._db_context.save_changes() - self._logger.info(__name__, f"Saved auto-role for message {message_id} at server {server}") + self._logger.info( + __name__, f"Saved auto-role for message {message_id} at server {server}" + ) await self._message_service.send_ctx_msg( ctx, self._t.transform("modules.auto_role.add.success").format(message_id) ) self._logger.trace(__name__, f"Finished command auto-role add") @add.autocomplete("message_id") - async def add_autocomplete(self, interaction: discord.Interaction, current: str) -> TList[app_commands.Choice[str]]: - channel = discord.utils.get(interaction.guild.text_channels, id=interaction.channel_id) + async def add_autocomplete( + self, interaction: discord.Interaction, current: str + ) -> TList[app_commands.Choice[str]]: + channel = discord.utils.get( + interaction.guild.text_channels, id=interaction.channel_id + ) try: channel_from_data = interaction.data["options"][0]["options"][0]["value"] - found_channel = discord.utils.get(interaction.guild.text_channels, id=int(channel_from_data)) + found_channel = discord.utils.get( + interaction.guild.text_channels, id=int(channel_from_data) + ) if found_channel is not None: channel = found_channel finally: @@ -174,7 +208,9 @@ class AutoRoleGroup(DiscordCommandABC): messages = [message async for message in channel.history(limit=10)] return [ - app_commands.Choice(name=f"{message.author}@{message.created_at}", value=str(message.id)) + app_commands.Choice( + name=f"{message.author}@{message.created_at}", value=str(message.id) + ) for message in messages if current in str(message.id) ] @@ -184,12 +220,18 @@ class AutoRoleGroup(DiscordCommandABC): @CommandChecks.check_is_ready() @CommandChecks.check_is_member_moderator() async def remove(self, ctx: Context, auto_role: int): - self._logger.debug(__name__, f"Received command auto-role remove {ctx} {auto_role}") + self._logger.debug( + __name__, f"Received command auto-role remove {ctx} {auto_role}" + ) if ctx.guild is None: return - server_config: ServerConfig = self._config.get_configuration(f"ServerConfig_{ctx.guild.id}") - if not FeatureFlagsSettings.get_flag_from_dict(server_config.feature_flags, FeatureFlagsEnum.auto_role_module): + server_config: ServerConfig = self._config.get_configuration( + f"ServerConfig_{ctx.guild.id}" + ) + if not FeatureFlagsSettings.get_flag_from_dict( + server_config.feature_flags, FeatureFlagsEnum.auto_role_module + ): return auto_role_from_db = self._auto_roles.find_auto_role_by_id(auto_role) @@ -197,12 +239,16 @@ class AutoRoleGroup(DiscordCommandABC): self._logger.debug(__name__, f"auto-role {auto_role} not found") await self._message_service.send_ctx_msg( ctx, - self._t.transform("modules.auto_role.remove.error.not_found").format(auto_role), + self._t.transform("modules.auto_role.remove.error.not_found").format( + auto_role + ), ) self._logger.trace(__name__, f"Finished command auto-role remove") return - for rule in self._auto_roles.get_auto_role_rules_by_auto_role_id(auto_role_from_db.id): + for rule in self._auto_roles.get_auto_role_rules_by_auto_role_id( + auto_role_from_db.id + ): self._auto_roles.delete_auto_role_rule(rule) self._logger.info(__name__, f"Removed auto-role rule {rule.role_id}") @@ -225,12 +271,18 @@ class AutoRoleGroup(DiscordCommandABC): @CommandChecks.check_is_ready() @CommandChecks.check_is_member_moderator() async def react(self, ctx: Context, auto_role: int): - self._logger.debug(__name__, f"Received command auto-role react {ctx} {auto_role}") + self._logger.debug( + __name__, f"Received command auto-role react {ctx} {auto_role}" + ) if ctx.guild is None: return - server_config: ServerConfig = self._config.get_configuration(f"ServerConfig_{ctx.guild.id}") - if not FeatureFlagsSettings.get_flag_from_dict(server_config.feature_flags, FeatureFlagsEnum.auto_role_module): + server_config: ServerConfig = self._config.get_configuration( + f"ServerConfig_{ctx.guild.id}" + ) + if not FeatureFlagsSettings.get_flag_from_dict( + server_config.feature_flags, FeatureFlagsEnum.auto_role_module + ): return auto_role_from_db = self._auto_roles.find_auto_role_by_id(auto_role) @@ -238,14 +290,21 @@ class AutoRoleGroup(DiscordCommandABC): self._logger.debug(__name__, f"auto-role {auto_role} not found") await self._message_service.send_ctx_msg( ctx, - self._t.transform("modules.auto_role.remove.error.not_found").format(auto_role), + self._t.transform("modules.auto_role.remove.error.not_found").format( + auto_role + ), ) self._logger.trace(__name__, f"Finished command auto-role react") return - for rule in self._auto_roles.get_auto_role_rules_by_auto_role_id(auto_role_from_db.id): + for rule in self._auto_roles.get_auto_role_rules_by_auto_role_id( + auto_role_from_db.id + ): await self._client_utils.react_to_message_by_auto_role_rule( - auto_role_from_db.discord_channel_id, auto_role_from_db.discord_message_id, rule, ctx.guild + auto_role_from_db.discord_channel_id, + auto_role_from_db.discord_message_id, + rule, + ctx.guild, ) await self._message_service.send_ctx_msg( @@ -274,8 +333,12 @@ class AutoRoleGroup(DiscordCommandABC): if ctx.guild is None: return - server_config: ServerConfig = self._config.get_configuration(f"ServerConfig_{ctx.guild.id}") - if not FeatureFlagsSettings.get_flag_from_dict(server_config.feature_flags, FeatureFlagsEnum.auto_role_module): + server_config: ServerConfig = self._config.get_configuration( + f"ServerConfig_{ctx.guild.id}" + ) + if not FeatureFlagsSettings.get_flag_from_dict( + server_config.feature_flags, FeatureFlagsEnum.auto_role_module + ): return embed = discord.Embed( @@ -328,20 +391,30 @@ class AutoRoleGroup(DiscordCommandABC): @CommandChecks.check_is_ready() @CommandChecks.check_is_member_moderator() async def add(self, ctx: Context, auto_role: int, emoji_name: str, role_id: str): - self._logger.debug(__name__, f"Received command auto-role add {ctx} {auto_role}") + self._logger.debug( + __name__, f"Received command auto-role add {ctx} {auto_role}" + ) if ctx.guild is None: return - server_config: ServerConfig = self._config.get_configuration(f"ServerConfig_{ctx.guild.id}") - if not FeatureFlagsSettings.get_flag_from_dict(server_config.feature_flags, FeatureFlagsEnum.auto_role_module): + server_config: ServerConfig = self._config.get_configuration( + f"ServerConfig_{ctx.guild.id}" + ) + if not FeatureFlagsSettings.get_flag_from_dict( + server_config.feature_flags, FeatureFlagsEnum.auto_role_module + ): return emoji = discord.utils.get(self._bot.emojis, name=emoji_name) if emoji is None: - self._logger.debug(__name__, f"auto-role rule add emoji {emoji_name} not found") + self._logger.debug( + __name__, f"auto-role rule add emoji {emoji_name} not found" + ) await self._message_service.send_ctx_msg( ctx, - self._t.transform("modules.auto_role.rule.add.error.emoji_not_found").format(emoji_name, auto_role), + self._t.transform( + "modules.auto_role.rule.add.error.emoji_not_found" + ).format(emoji_name, auto_role), ) self._logger.trace(__name__, f"Finished command auto-role add") return @@ -351,7 +424,9 @@ class AutoRoleGroup(DiscordCommandABC): self._logger.debug(__name__, f"auto-role rule add role {role_id} not found") await self._message_service.send_ctx_msg( ctx, - self._t.transform("modules.auto_role.rule.add.error.role_not_found").format(role_id, auto_role), + self._t.transform( + "modules.auto_role.rule.add.error.role_not_found" + ).format(role_id, auto_role), ) self._logger.trace(__name__, f"Finished command auto-role add") return @@ -360,7 +435,9 @@ class AutoRoleGroup(DiscordCommandABC): if auto_role_from_db is None: await self._message_service.send_ctx_msg( ctx, - self._t.transform("modules.auto_role.remove.error.not_found").format(auto_role), + self._t.transform("modules.auto_role.remove.error.not_found").format( + auto_role + ), ) self._logger.trace(__name__, f"Finished command auto-role rule add") return @@ -373,12 +450,16 @@ class AutoRoleGroup(DiscordCommandABC): ): await self._message_service.send_ctx_msg( ctx, - self._t.transform("modules.auto_role.add.error.already_exists").format(auto_role), + self._t.transform("modules.auto_role.add.error.already_exists").format( + auto_role + ), ) self._logger.trace(__name__, f"Finished command auto-role rule add") return - self._auto_roles.add_auto_role_rule(AutoRoleRule(auto_role_from_db, emoji_name, int(role_id))) + self._auto_roles.add_auto_role_rule( + AutoRoleRule(auto_role_from_db, emoji_name, int(role_id)) + ) self._db_context.save_changes() rule = ( self._auto_roles.get_auto_role_rules_by_auto_role_id(auto_role) @@ -389,26 +470,37 @@ class AutoRoleGroup(DiscordCommandABC): # as task to run in background self._bot.loop.create_task( await self._client_utils.react_to_message_by_auto_role_rule( - auto_role_from_db.discord_channel_id, auto_role_from_db.discord_message_id, rule, ctx.guild + auto_role_from_db.discord_channel_id, + auto_role_from_db.discord_message_id, + rule, + ctx.guild, ) ) await self._message_service.send_ctx_msg( ctx, - self._t.transform("modules.auto_role.rule.add.success").format(emoji, role.mention, auto_role), + self._t.transform("modules.auto_role.rule.add.success").format( + emoji, role.mention, auto_role + ), ) self._logger.trace(__name__, f"Finished command auto-role rule add") @add.autocomplete("auto_role") - async def add_autocomplete(self, interaction: discord.Interaction, current: str) -> TList[app_commands.Choice[str]]: + async def add_autocomplete( + self, interaction: discord.Interaction, current: str + ) -> TList[app_commands.Choice[str]]: return await self._auto_role_auto_complete(interaction, current) @add.autocomplete("emoji_name") - async def add_autocomplete(self, interaction: discord.Interaction, current: str) -> TList[app_commands.Choice[str]]: + async def add_autocomplete( + self, interaction: discord.Interaction, current: str + ) -> TList[app_commands.Choice[str]]: emojis = List(discord.Emoji, interaction.guild.emojis) return [ app_commands.Choice(name=emoji.name, value=emoji.name) - for emoji in self._client_utils.get_auto_complete_list(emojis, current, lambda e: e.name) + for emoji in self._client_utils.get_auto_complete_list( + emojis, current, lambda e: e.name + ) ] @add.autocomplete("role_id") @@ -418,7 +510,9 @@ class AutoRoleGroup(DiscordCommandABC): roles = List(discord.Role, interaction.guild.roles) return [ app_commands.Choice(name=role.name, value=str(role.id)) - for role in self._client_utils.get_auto_complete_list(roles, current, lambda r: r.name) + for role in self._client_utils.get_auto_complete_list( + roles, current, lambda r: r.name + ) ] @rule.command() @@ -426,12 +520,18 @@ class AutoRoleGroup(DiscordCommandABC): @CommandChecks.check_is_ready() @CommandChecks.check_is_member_moderator() async def remove(self, ctx: Context, auto_role_rule: int): - self._logger.debug(__name__, f"Received command auto-role remove {ctx} {auto_role_rule}") + self._logger.debug( + __name__, f"Received command auto-role remove {ctx} {auto_role_rule}" + ) if ctx.guild is None: return - server_config: ServerConfig = self._config.get_configuration(f"ServerConfig_{ctx.guild.id}") - if not FeatureFlagsSettings.get_flag_from_dict(server_config.feature_flags, FeatureFlagsEnum.auto_role_module): + server_config: ServerConfig = self._config.get_configuration( + f"ServerConfig_{ctx.guild.id}" + ) + if not FeatureFlagsSettings.get_flag_from_dict( + server_config.feature_flags, FeatureFlagsEnum.auto_role_module + ): return auto_role_from_db = self._auto_roles.get_auto_role_rule_by_id(auto_role_rule) @@ -439,7 +539,9 @@ class AutoRoleGroup(DiscordCommandABC): self._logger.debug(__name__, f"auto-role rule {auto_role_rule} not found") await self._message_service.send_ctx_msg( ctx, - self._t.transform("modules.auto_role.remove.error.not_found").format(auto_role_rule), + self._t.transform("modules.auto_role.remove.error.not_found").format( + auto_role_rule + ), ) self._logger.trace(__name__, f"Finished command auto-role rule remove") return @@ -449,7 +551,9 @@ class AutoRoleGroup(DiscordCommandABC): self._logger.info(__name__, f"Removed auto-role rule {auto_role_rule}") await self._message_service.send_ctx_msg( ctx, - self._t.transform("modules.auto_role.rule.remove.success").format(auto_role_rule), + self._t.transform("modules.auto_role.rule.remove.success").format( + auto_role_rule + ), ) self._logger.trace(__name__, f"Finished command auto-role remove") @@ -458,12 +562,18 @@ class AutoRoleGroup(DiscordCommandABC): self, interaction: discord.Interaction, current: str ) -> TList[app_commands.Choice[str]]: server = self._servers.get_server_by_discord_id(interaction.guild.id) - auto_roles = self._auto_roles.get_auto_roles_by_server_id(server.id).select(lambda x: x.id) - rules = auto_roles.select_many(lambda ar: self._auto_roles.get_auto_role_rules_by_auto_role_id(ar)) + auto_roles = self._auto_roles.get_auto_roles_by_server_id(server.id).select( + lambda x: x.id + ) + rules = auto_roles.select_many( + lambda ar: self._auto_roles.get_auto_role_rules_by_auto_role_id(ar) + ) return [ app_commands.Choice( name=f"{rule.id} {rule.emoji_name} {interaction.guild.get_role(int(rule.role_id))}", value=rule.id, ) - for rule in self._client_utils.get_auto_complete_list(rules, current, lambda r: r.id) + for rule in self._client_utils.get_auto_complete_list( + rules, current, lambda r: r.id + ) ] diff --git a/kdb-bot/src/modules/auto_role/events/__init__.py b/bot/src/modules/auto_role/events/__init__.py similarity index 100% rename from kdb-bot/src/modules/auto_role/events/__init__.py rename to bot/src/modules/auto_role/events/__init__.py diff --git a/kdb-bot/src/modules/auto_role/events/auto_role_on_raw_reaction_add.py b/bot/src/modules/auto_role/events/auto_role_on_raw_reaction_add.py similarity index 89% rename from kdb-bot/src/modules/auto_role/events/auto_role_on_raw_reaction_add.py rename to bot/src/modules/auto_role/events/auto_role_on_raw_reaction_add.py index f5d14804..a85fadd2 100644 --- a/kdb-bot/src/modules/auto_role/events/auto_role_on_raw_reaction_add.py +++ b/bot/src/modules/auto_role/events/auto_role_on_raw_reaction_add.py @@ -35,8 +35,12 @@ class AutoRoleOnRawReactionAddEvent(OnRawReactionAddABC): @EventChecks.check_is_ready() async def on_raw_reaction_add(self, payload: RawReactionActionEvent): self._logger.debug(__name__, f"Module {type(self)} started") - server_config: ServerConfig = self._config.get_configuration(f"ServerConfig_{payload.guild_id}") - if not FeatureFlagsSettings.get_flag_from_dict(server_config.feature_flags, FeatureFlagsEnum.auto_role_module): + server_config: ServerConfig = self._config.get_configuration( + f"ServerConfig_{payload.guild_id}" + ) + if not FeatureFlagsSettings.get_flag_from_dict( + server_config.feature_flags, FeatureFlagsEnum.auto_role_module + ): return await self._reaction_handler.handle(payload, "add") diff --git a/kdb-bot/src/modules/auto_role/events/auto_role_on_raw_reaction_remove.py b/bot/src/modules/auto_role/events/auto_role_on_raw_reaction_remove.py similarity index 89% rename from kdb-bot/src/modules/auto_role/events/auto_role_on_raw_reaction_remove.py rename to bot/src/modules/auto_role/events/auto_role_on_raw_reaction_remove.py index a174c8f5..0defd312 100644 --- a/kdb-bot/src/modules/auto_role/events/auto_role_on_raw_reaction_remove.py +++ b/bot/src/modules/auto_role/events/auto_role_on_raw_reaction_remove.py @@ -35,8 +35,12 @@ class AutoRoleOnRawReactionRemoveEvent(OnRawReactionRemoveABC): @EventChecks.check_is_ready() async def on_raw_reaction_remove(self, payload: RawReactionActionEvent): self._logger.debug(__name__, f"Module {type(self)} started") - server_config: ServerConfig = self._config.get_configuration(f"ServerConfig_{payload.guild_id}") - if not FeatureFlagsSettings.get_flag_from_dict(server_config.feature_flags, FeatureFlagsEnum.auto_role_module): + server_config: ServerConfig = self._config.get_configuration( + f"ServerConfig_{payload.guild_id}" + ) + if not FeatureFlagsSettings.get_flag_from_dict( + server_config.feature_flags, FeatureFlagsEnum.auto_role_module + ): return await self._reaction_handler.handle(payload, "remove") diff --git a/kdb-bot/src/modules/auto_role/helper/__init__.py b/bot/src/modules/auto_role/helper/__init__.py similarity index 100% rename from kdb-bot/src/modules/auto_role/helper/__init__.py rename to bot/src/modules/auto_role/helper/__init__.py diff --git a/kdb-bot/src/modules/auto_role/helper/auto_role_reaction_handler.py b/bot/src/modules/auto_role/helper/auto_role_reaction_handler.py similarity index 88% rename from kdb-bot/src/modules/auto_role/helper/auto_role_reaction_handler.py rename to bot/src/modules/auto_role/helper/auto_role_reaction_handler.py index 47ab3778..b0b59aee 100644 --- a/kdb-bot/src/modules/auto_role/helper/auto_role_reaction_handler.py +++ b/bot/src/modules/auto_role/helper/auto_role_reaction_handler.py @@ -22,7 +22,9 @@ class AutoRoleReactionHandler: self._servers = servers self._auto_roles = auto_roles - self._message_ids = self._auto_roles.get_auto_roles().select(lambda x: x.discord_message_id) + self._message_ids = self._auto_roles.get_auto_roles().select( + lambda x: x.discord_message_id + ) self._roles = self._auto_roles.get_auto_roles() async def handle(self, payload: RawReactionActionEvent, r_type=None) -> None: @@ -34,7 +36,9 @@ class AutoRoleReactionHandler: guild = self._bot.get_guild(payload.guild_id) user = guild.get_member(payload.user_id) if user is None: - self._logger.warn(__name__, f"User {payload.user_id} in {guild.name} not found - skipping") + self._logger.warn( + __name__, f"User {payload.user_id} in {guild.name} not found - skipping" + ) return if user.bot: @@ -49,7 +53,9 @@ class AutoRoleReactionHandler: self._logger.debug(__name__, f"auto-role for message not found - skipping") return - rules: List[AutoRoleRule] = self._auto_roles.get_auto_role_rules_by_auto_role_id(auto_role.id) + rules: List[ + AutoRoleRule + ] = self._auto_roles.get_auto_role_rules_by_auto_role_id(auto_role.id) if rules.count() == 0: self._logger.debug(__name__, f"auto-role rules not found - skipping") return diff --git a/kdb-bot/src/modules/base/__init__.py b/bot/src/modules/base/__init__.py similarity index 100% rename from kdb-bot/src/modules/base/__init__.py rename to bot/src/modules/base/__init__.py diff --git a/kdb-bot/src/modules/base/base.json b/bot/src/modules/base/base.json similarity index 100% rename from kdb-bot/src/modules/base/base.json rename to bot/src/modules/base/base.json diff --git a/kdb-bot/src/modules/base/base_module.py b/bot/src/modules/base/base_module.py similarity index 81% rename from kdb-bot/src/modules/base/base_module.py rename to bot/src/modules/base/base_module.py index e7d597a9..60f17173 100644 --- a/kdb-bot/src/modules/base/base_module.py +++ b/bot/src/modules/base/base_module.py @@ -30,7 +30,9 @@ from modules.base.events.base_on_message_delete_event import BaseOnMessageDelete from modules.base.events.base_on_message_event import BaseOnMessageEvent from modules.base.events.base_on_raw_reaction_add import BaseOnRawReactionAddEvent from modules.base.events.base_on_raw_reaction_remove import BaseOnRawReactionRemoveEvent -from modules.base.events.base_on_scheduled_event_update_event import BaseOnScheduledEventUpdateEvent +from modules.base.events.base_on_scheduled_event_update_event import ( + BaseOnScheduledEventUpdateEvent, +) from modules.base.events.base_on_voice_state_update_event import ( BaseOnVoiceStateUpdateEvent, ) @@ -51,10 +53,14 @@ class BaseModule(ModuleABC): def __init__(self, dc: DiscordCollectionABC): ModuleABC.__init__(self, dc, FeatureFlagsEnum.base_module) - def configure_configuration(self, config: ConfigurationABC, env: ApplicationEnvironmentABC): + def configure_configuration( + self, config: ConfigurationABC, env: ApplicationEnvironmentABC + ): pass - def configure_services(self, services: ServiceCollectionABC, env: ApplicationEnvironmentABC): + def configure_services( + self, services: ServiceCollectionABC, env: ApplicationEnvironmentABC + ): services.add_transient(BaseReactionHandler) services.add_singleton(EventService) services.add_transient(UserWarningsService) @@ -80,13 +86,27 @@ class BaseModule(ModuleABC): services.add_transient(UnregisterGroup) services.add_transient(GameServerGroup) # events - services.add_transient(DiscordEventTypesEnum.on_command.value, BaseOnCommandEvent) - services.add_transient(DiscordEventTypesEnum.on_command_error.value, BaseOnCommandErrorEvent) - services.add_transient(DiscordEventTypesEnum.on_member_join.value, BaseOnMemberJoinEvent) - services.add_transient(DiscordEventTypesEnum.on_member_remove.value, BaseOnMemberRemoveEvent) - services.add_transient(DiscordEventTypesEnum.on_message.value, BaseOnMessageEvent) - services.add_transient(DiscordEventTypesEnum.on_message_delete.value, BaseOnMessageDeleteEvent) - services.add_transient(DiscordEventTypesEnum.on_raw_reaction_add.value, BaseOnRawReactionAddEvent) + services.add_transient( + DiscordEventTypesEnum.on_command.value, BaseOnCommandEvent + ) + services.add_transient( + DiscordEventTypesEnum.on_command_error.value, BaseOnCommandErrorEvent + ) + services.add_transient( + DiscordEventTypesEnum.on_member_join.value, BaseOnMemberJoinEvent + ) + services.add_transient( + DiscordEventTypesEnum.on_member_remove.value, BaseOnMemberRemoveEvent + ) + services.add_transient( + DiscordEventTypesEnum.on_message.value, BaseOnMessageEvent + ) + services.add_transient( + DiscordEventTypesEnum.on_message_delete.value, BaseOnMessageDeleteEvent + ) + services.add_transient( + DiscordEventTypesEnum.on_raw_reaction_add.value, BaseOnRawReactionAddEvent + ) services.add_transient( DiscordEventTypesEnum.on_raw_reaction_remove.value, BaseOnRawReactionRemoveEvent, diff --git a/kdb-bot/src/modules/base/birthday_watcher.py b/bot/src/modules/base/birthday_watcher.py similarity index 92% rename from kdb-bot/src/modules/base/birthday_watcher.py rename to bot/src/modules/base/birthday_watcher.py index 7b19638a..2b01095f 100644 --- a/kdb-bot/src/modules/base/birthday_watcher.py +++ b/bot/src/modules/base/birthday_watcher.py @@ -46,7 +46,9 @@ class BirthdayWatcher(TaskABC): if user.birthday.day != today.day or user.birthday.month != today.month: continue - settings: ServerConfig = self._config.get_configuration(f"ServerConfig_{user.server.discord_id}") + settings: ServerConfig = self._config.get_configuration( + f"ServerConfig_{user.server.discord_id}" + ) user.xp += settings.xp_for_birthday self._users.update_user(user) @@ -56,7 +58,9 @@ class BirthdayWatcher(TaskABC): member = guild.get_member(user.discord_id) await self._message_service.send_channel_message( self._bot.get_channel(settings.notification_chat_id), - self._t.transform("modules.base.user.birthday.has_birthday").format(member.mention), + self._t.transform("modules.base.user.birthday.has_birthday").format( + member.mention + ), is_persistent=True, ) except Exception as e: diff --git a/kdb-bot/src/modules/base/command/__init__.py b/bot/src/modules/base/command/__init__.py similarity index 100% rename from kdb-bot/src/modules/base/command/__init__.py rename to bot/src/modules/base/command/__init__.py diff --git a/kdb-bot/src/modules/base/command/afk_command.py b/bot/src/modules/base/command/afk_command.py similarity index 87% rename from kdb-bot/src/modules/base/command/afk_command.py rename to bot/src/modules/base/command/afk_command.py index 092c9788..924c012d 100644 --- a/kdb-bot/src/modules/base/command/afk_command.py +++ b/bot/src/modules/base/command/afk_command.py @@ -39,7 +39,9 @@ class AFKCommand(DiscordCommandABC): @CommandChecks.check_is_ready() async def afk(self, ctx: Context): self._logger.debug(__name__, f"Received command afk {ctx}") - settings: ServerConfig = self._config.get_configuration(f"ServerConfig_{ctx.guild.id}") + settings: ServerConfig = self._config.get_configuration( + f"ServerConfig_{ctx.guild.id}" + ) if ctx.author.voice is None or ctx.author.voice.channel is None: await self._message_service.send_ctx_msg( @@ -50,7 +52,9 @@ class AFKCommand(DiscordCommandABC): return self._bot.loop.create_task( - self._message_service.send_ctx_msg(ctx, self._t.transform("modules.base.afk_command_move_message")) + self._message_service.send_ctx_msg( + ctx, self._t.transform("modules.base.afk_command_move_message") + ) ) channel: VoiceChannel = ctx.guild.get_channel(settings.afk_command_channel_id) try: @@ -62,6 +66,8 @@ class AFKCommand(DiscordCommandABC): f"Cannot move user {ctx.author.id} to channel {ctx.channel.id}", e, ) - await self._message_service.send_ctx_msg(ctx, self._t.transform("common.no_permission_message")) + await self._message_service.send_ctx_msg( + ctx, self._t.transform("common.no_permission_message") + ) self._logger.trace(__name__, f"Finished afk command") diff --git a/kdb-bot/src/modules/base/command/game_server_group.py b/bot/src/modules/base/command/game_server_group.py similarity index 75% rename from kdb-bot/src/modules/base/command/game_server_group.py rename to bot/src/modules/base/command/game_server_group.py index b822f3de..051db38e 100644 --- a/kdb-bot/src/modules/base/command/game_server_group.py +++ b/bot/src/modules/base/command/game_server_group.py @@ -76,9 +76,15 @@ class GameServerGroup(DiscordCommandABC): if ctx.guild is None: return - settings: ServerConfig = self._config.get_configuration(f"ServerConfig_{ctx.guild.id}") - if not FeatureFlagsSettings.get_flag_from_dict(settings.feature_flags, FeatureFlagsEnum.game_server): - await self._message_service.send_ctx_msg(ctx, self._t.transform("common.feature_not_activated")) + settings: ServerConfig = self._config.get_configuration( + f"ServerConfig_{ctx.guild.id}" + ) + if not FeatureFlagsSettings.get_flag_from_dict( + settings.feature_flags, FeatureFlagsEnum.game_server + ): + await self._message_service.send_ctx_msg( + ctx, self._t.transform("common.feature_not_activated") + ) return server = self._servers.get_server_by_discord_id(ctx.guild.id) @@ -107,7 +113,11 @@ class GameServerGroup(DiscordCommandABC): value=game_server_name, inline=True, ) - embed.add_field(name=self._t.transform("modules.base.game_server.list.api_key"), value=api_key, inline=True) + embed.add_field( + name=self._t.transform("modules.base.game_server.list.api_key"), + value=api_key, + inline=True, + ) await self._message_service.send_ctx_msg(ctx, embed, wait_before_delete=wait) self._logger.trace(__name__, f"Finished command game_server list") @@ -117,14 +127,22 @@ class GameServerGroup(DiscordCommandABC): @CommandChecks.check_is_ready() @CommandChecks.check_is_member_admin() async def add(self, ctx: Context, name: str, api_key_id: int): - self._logger.debug(__name__, f"Received command game-server add {ctx}: {name} {api_key_id}") + self._logger.debug( + __name__, f"Received command game-server add {ctx}: {name} {api_key_id}" + ) if ctx.guild is None: return - settings: ServerConfig = self._config.get_configuration(f"ServerConfig_{ctx.guild.id}") - if not FeatureFlagsSettings.get_flag_from_dict(settings.feature_flags, FeatureFlagsEnum.game_server): - await self._message_service.send_ctx_msg(ctx, self._t.transform("common.feature_not_activated")) + settings: ServerConfig = self._config.get_configuration( + f"ServerConfig_{ctx.guild.id}" + ) + if not FeatureFlagsSettings.get_flag_from_dict( + settings.feature_flags, FeatureFlagsEnum.game_server + ): + await self._message_service.send_ctx_msg( + ctx, self._t.transform("common.feature_not_activated") + ) return server = self._servers.get_server_by_discord_id(ctx.guild.id) @@ -148,7 +166,9 @@ class GameServerGroup(DiscordCommandABC): return [ app_commands.Choice(name=f"{key.identifier}: {key.key}", value=key.id) - for key in self._client_utils.get_auto_complete_list(keys, current, lambda x: x.key) + for key in self._client_utils.get_auto_complete_list( + keys, current, lambda x: x.key + ) ] @game_server.command() @@ -161,26 +181,38 @@ class GameServerGroup(DiscordCommandABC): if ctx.guild is None: return - settings: ServerConfig = self._config.get_configuration(f"ServerConfig_{ctx.guild.id}") - if not FeatureFlagsSettings.get_flag_from_dict(settings.feature_flags, FeatureFlagsEnum.game_server): - await self._message_service.send_ctx_msg(ctx, self._t.transform("common.feature_not_activated")) + settings: ServerConfig = self._config.get_configuration( + f"ServerConfig_{ctx.guild.id}" + ) + if not FeatureFlagsSettings.get_flag_from_dict( + settings.feature_flags, FeatureFlagsEnum.game_server + ): + await self._message_service.send_ctx_msg( + ctx, self._t.transform("common.feature_not_activated") + ) return game_server = self._game_servers.get_game_server_by_id(id) self._game_servers.delete_game_server(game_server) self._db.save_changes() - await self._message_service.send_ctx_msg(ctx, self._t.transform("modules.base.game_server.remove.success")) + await self._message_service.send_ctx_msg( + ctx, self._t.transform("modules.base.game_server.remove.success") + ) self._logger.trace(__name__, f"Finished command game-server remove") @remove.autocomplete("id") - async def id_autocomplete(self, interaction: discord.Interaction, current: str) -> TList[app_commands.Choice[str]]: + async def id_autocomplete( + self, interaction: discord.Interaction, current: str + ) -> TList[app_commands.Choice[str]]: server = self._servers.get_server_by_discord_id(interaction.guild.id) game_servers = self._game_servers.get_game_servers_by_server_id(server.id) return [ app_commands.Choice(name=gs.name, value=gs.id) - for gs in self._client_utils.get_auto_complete_list(game_servers, current, lambda x: x.name) + for gs in self._client_utils.get_auto_complete_list( + game_servers, current, lambda x: x.name + ) ] @game_server.command(name="list-members") @@ -193,33 +225,51 @@ class GameServerGroup(DiscordCommandABC): if ctx.guild is None: return - settings: ServerConfig = self._config.get_configuration(f"ServerConfig_{ctx.guild.id}") - if not FeatureFlagsSettings.get_flag_from_dict(settings.feature_flags, FeatureFlagsEnum.game_server): - await self._message_service.send_ctx_msg(ctx, self._t.transform("common.feature_not_activated")) + settings: ServerConfig = self._config.get_configuration( + f"ServerConfig_{ctx.guild.id}" + ) + if not FeatureFlagsSettings.get_flag_from_dict( + settings.feature_flags, FeatureFlagsEnum.game_server + ): + await self._message_service.send_ctx_msg( + ctx, self._t.transform("common.feature_not_activated") + ) return game_server = self._game_servers.get_game_server_by_id(id) - game_idents = self._user_game_idents.get_user_game_idents_by_game_server_id(game_server.id) + game_idents = self._user_game_idents.get_user_game_idents_by_game_server_id( + game_server.id + ) users = "" for game_ident in game_idents: users += f"\n{game_ident.user.name}" embed = discord.Embed( title=self._t.transform("modules.base.game_server.list_members.title"), - description=self._t.transform("modules.base.game_server.list_members.description"), + description=self._t.transform( + "modules.base.game_server.list_members.description" + ), color=int("ef9d0d", 16), ) - embed.add_field(name=self._t.transform("modules.base.game_server.list_members.users"), value=users, inline=True) + embed.add_field( + name=self._t.transform("modules.base.game_server.list_members.users"), + value=users, + inline=True, + ) await self._message_service.send_ctx_msg(ctx, embed, wait_before_delete=wait) self._logger.trace(__name__, f"Finished command game-server remove") @list_members.autocomplete("id") - async def id_autocomplete(self, interaction: discord.Interaction, current: str) -> TList[app_commands.Choice[str]]: + async def id_autocomplete( + self, interaction: discord.Interaction, current: str + ) -> TList[app_commands.Choice[str]]: server = self._servers.get_server_by_discord_id(interaction.guild.id) game_servers = self._game_servers.get_game_servers_by_server_id(server.id) return [ app_commands.Choice(name=gs.name, value=gs.id) - for gs in self._client_utils.get_auto_complete_list(game_servers, current, lambda x: x.name) + for gs in self._client_utils.get_auto_complete_list( + game_servers, current, lambda x: x.name + ) ] diff --git a/kdb-bot/src/modules/base/command/help_command.py b/bot/src/modules/base/command/help_command.py similarity index 93% rename from kdb-bot/src/modules/base/command/help_command.py rename to bot/src/modules/base/command/help_command.py index beb63e77..e97dc198 100644 --- a/kdb-bot/src/modules/base/command/help_command.py +++ b/bot/src/modules/base/command/help_command.py @@ -50,6 +50,8 @@ class HelpCommand(DiscordCommandABC): self._logger.trace(__name__, f"Finished help command") @help.autocomplete("persistent_flag") - async def help_autocomplete(self, interaction: discord.Interaction, current: str) -> List[app_commands.Choice[str]]: + async def help_autocomplete( + self, interaction: discord.Interaction, current: str + ) -> List[app_commands.Choice[str]]: flags = ["--stay"] return [app_commands.Choice(name=key, value=key) for key in flags] diff --git a/kdb-bot/src/modules/base/command/info_command.py b/bot/src/modules/base/command/info_command.py similarity index 95% rename from kdb-bot/src/modules/base/command/info_command.py rename to bot/src/modules/base/command/info_command.py index e228be84..11290c05 100644 --- a/kdb-bot/src/modules/base/command/info_command.py +++ b/bot/src/modules/base/command/info_command.py @@ -55,7 +55,10 @@ class InfoCommand(DiscordCommandABC): ) start_time = self._config.get_configuration("Bot_StartTime") ontime = round( - (datetime.now() - datetime.strptime(start_time, "%Y-%m-%d %H:%M:%S.%f")).total_seconds() / 3600, + ( + datetime.now() - datetime.strptime(start_time, "%Y-%m-%d %H:%M:%S.%f") + ).total_seconds() + / 3600, 2, ) embed.add_field( diff --git a/kdb-bot/src/modules/base/command/make_coffee_command.py b/bot/src/modules/base/command/make_coffee_command.py similarity index 100% rename from kdb-bot/src/modules/base/command/make_coffee_command.py rename to bot/src/modules/base/command/make_coffee_command.py diff --git a/kdb-bot/src/modules/base/command/mass_move_command.py b/bot/src/modules/base/command/mass_move_command.py similarity index 96% rename from kdb-bot/src/modules/base/command/mass_move_command.py rename to bot/src/modules/base/command/mass_move_command.py index 4dd835d2..cedbaa03 100644 --- a/kdb-bot/src/modules/base/command/mass_move_command.py +++ b/bot/src/modules/base/command/mass_move_command.py @@ -58,7 +58,9 @@ class MassMoveCommand(DiscordCommandABC): await self._message_service.send_ctx_msg( ctx, - self._t.transform("modules.base.mass_move.moved").format(channel_from.mention, channel_to.mention), + self._t.transform("modules.base.mass_move.moved").format( + channel_from.mention, channel_to.mention + ), ) self._logger.trace(__name__, f"Finished mass-move command") diff --git a/kdb-bot/src/modules/base/command/ping_command.py b/bot/src/modules/base/command/ping_command.py similarity index 89% rename from kdb-bot/src/modules/base/command/ping_command.py rename to bot/src/modules/base/command/ping_command.py index ca0a14ac..69aff5cf 100644 --- a/kdb-bot/src/modules/base/command/ping_command.py +++ b/bot/src/modules/base/command/ping_command.py @@ -58,8 +58,12 @@ class PingCommand(DiscordCommandABC): color=int("ef9d0d", 16), ) for server in self._settings.ping_urls: - embed.add_field(name=server, value=f"{self._get_ping(server)} ms", inline=False) + embed.add_field( + name=server, value=f"{self._get_ping(server)} ms", inline=False + ) await self._message_service.send_ctx_msg(ctx, embed) else: - await self._message_service.send_ctx_msg(ctx, self._t.transform("modules.base.pong")) + await self._message_service.send_ctx_msg( + ctx, self._t.transform("modules.base.pong") + ) self._logger.trace(__name__, f"Finished ping command") diff --git a/kdb-bot/src/modules/base/command/presence_command.py b/bot/src/modules/base/command/presence_command.py similarity index 85% rename from kdb-bot/src/modules/base/command/presence_command.py rename to bot/src/modules/base/command/presence_command.py index a314b4aa..688e3d20 100644 --- a/kdb-bot/src/modules/base/command/presence_command.py +++ b/bot/src/modules/base/command/presence_command.py @@ -34,7 +34,9 @@ class PresenceCommand(DiscordCommandABC): if text == "": await self._bot.change_presence(activity=None) - await self._message_service.send_ctx_msg(ctx, self._t.transform("modules.base.presence.removed")) + await self._message_service.send_ctx_msg( + ctx, self._t.transform("modules.base.presence.removed") + ) return if len(text) > 128: @@ -44,6 +46,8 @@ class PresenceCommand(DiscordCommandABC): return await self._bot.change_presence(activity=discord.Game(name=text)) - await self._message_service.send_ctx_msg(ctx, self._t.transform("modules.base.presence.changed")) + await self._message_service.send_ctx_msg( + ctx, self._t.transform("modules.base.presence.changed") + ) self._logger.trace(__name__, f"Finished presence command") diff --git a/kdb-bot/src/modules/base/command/purge_command.py b/bot/src/modules/base/command/purge_command.py similarity index 84% rename from kdb-bot/src/modules/base/command/purge_command.py rename to bot/src/modules/base/command/purge_command.py index 9816e29f..ff40f718 100644 --- a/kdb-bot/src/modules/base/command/purge_command.py +++ b/bot/src/modules/base/command/purge_command.py @@ -41,14 +41,20 @@ class PurgeCommand(DiscordCommandABC): @CommandChecks.check_is_member_moderator() async def purge(self, ctx: Context): self._logger.debug(__name__, f"Received command purge {ctx}") - server_settings: ServerConfig = self._config.get_configuration(f"ServerConfig_{ctx.guild.id}") + server_settings: ServerConfig = self._config.get_configuration( + f"ServerConfig_{ctx.guild.id}" + ) - await self._message_service.send_ctx_msg(ctx, self._t.transform("modules.moderator.purge_message")) + await self._message_service.send_ctx_msg( + ctx, self._t.transform("modules.moderator.purge_message") + ) await asyncio.sleep(server_settings.message_delete_timer) try: await ctx.channel.purge() except Exception as e: self._logger.error(__name__, f"Cannot purge channel {ctx.channel.id}", e) - await self._message_service.send_ctx_msg(ctx, self._t.transform("common.bot_has_no_permission_message")) + await self._message_service.send_ctx_msg( + ctx, self._t.transform("common.bot_has_no_permission_message") + ) self._logger.trace(__name__, f"Finished purge command") diff --git a/kdb-bot/src/modules/base/command/register_group.py b/bot/src/modules/base/command/register_group.py similarity index 90% rename from kdb-bot/src/modules/base/command/register_group.py rename to bot/src/modules/base/command/register_group.py index dc3fed15..4fc94ac3 100644 --- a/kdb-bot/src/modules/base/command/register_group.py +++ b/bot/src/modules/base/command/register_group.py @@ -59,16 +59,21 @@ class RegisterGroup(DiscordCommandABC): @commands.guild_only() @CommandChecks.check_is_ready() @CommandChecks.check_is_member_moderator() - async def minecraft(self, ctx: Context, member: discord.Member, game_server: int, name: str): + async def minecraft( + self, ctx: Context, member: discord.Member, game_server: int, name: str + ): self._logger.debug(__name__, f"Received command register minecraft {ctx}") minecraft_id = None try: self._logger.debug(__name__, f"Try to get minecraft id for {name}") - response = requests.get(url=f"https://api.mojang.com/users/profiles/minecraft/{name}") + response = requests.get( + url=f"https://api.mojang.com/users/profiles/minecraft/{name}" + ) if len(response.content) == 0: await self._message_service.send_interaction_msg( - ctx.interaction, self._t.transform("modules.base.register.not_found") + ctx.interaction, + self._t.transform("modules.base.register.not_found"), ) return @@ -105,5 +110,7 @@ class RegisterGroup(DiscordCommandABC): return [ app_commands.Choice(name=gs.name, value=gs.id) - for gs in self._client_utils.get_auto_complete_list(game_servers, current, lambda x: x.name) + for gs in self._client_utils.get_auto_complete_list( + game_servers, current, lambda x: x.name + ) ] diff --git a/kdb-bot/src/modules/base/command/submit_group.py b/bot/src/modules/base/command/submit_group.py similarity index 93% rename from kdb-bot/src/modules/base/command/submit_group.py rename to bot/src/modules/base/command/submit_group.py index ad1570e3..b832b7c2 100644 --- a/kdb-bot/src/modules/base/command/submit_group.py +++ b/bot/src/modules/base/command/submit_group.py @@ -11,7 +11,9 @@ from modules.base.forms.complaint_form import ComplaintForm class SubmitGroup(DiscordCommandABC): - def __init__(self, services: ServiceProviderABC, logger: LoggerABC, bot: DiscordBotServiceABC): + def __init__( + self, services: ServiceProviderABC, logger: LoggerABC, bot: DiscordBotServiceABC + ): DiscordCommandABC.__init__(self) self._services = services diff --git a/kdb-bot/src/modules/base/command/unregister_group.py b/bot/src/modules/base/command/unregister_group.py similarity index 94% rename from kdb-bot/src/modules/base/command/unregister_group.py rename to bot/src/modules/base/command/unregister_group.py index 4d5f796a..3f4e2c1d 100644 --- a/kdb-bot/src/modules/base/command/unregister_group.py +++ b/bot/src/modules/base/command/unregister_group.py @@ -62,7 +62,9 @@ class UnregisterGroup(DiscordCommandABC): server = self._servers.get_server_by_discord_id(ctx.guild.id) user = self._users.get_user_by_discord_id_and_server_id(member.id, server.id) - ident = user.game_idents.where(lambda x: x.game_server.id == game_server).single() + ident = user.game_idents.where( + lambda x: x.game_server.id == game_server + ).single() self._user_game_idents.delete_user_game_ident(ident) self._users.update_user(user) self._db.save_changes() @@ -82,5 +84,7 @@ class UnregisterGroup(DiscordCommandABC): return [ app_commands.Choice(name=gs.name, value=gs.id) - for gs in self._client_utils.get_auto_complete_list(game_servers, current, lambda x: x.name) + for gs in self._client_utils.get_auto_complete_list( + game_servers, current, lambda x: x.name + ) ] diff --git a/kdb-bot/src/modules/base/command/user_group.py b/bot/src/modules/base/command/user_group.py similarity index 78% rename from kdb-bot/src/modules/base/command/user_group.py rename to bot/src/modules/base/command/user_group.py index 7f8a6510..5ed217e7 100644 --- a/kdb-bot/src/modules/base/command/user_group.py +++ b/bot/src/modules/base/command/user_group.py @@ -111,7 +111,9 @@ class UserGroup(DiscordCommandABC): type = "add" if not is_remove else "remove" await self._message_service.send_interaction_msg( ctx.interaction, - self._t.transform(f"modules.base.user.{type}.{atr.lower()}").format(atr, value, member.mention), + self._t.transform(f"modules.base.user.{type}.{atr.lower()}").format( + atr, value, member.mention + ), ) @commands.hybrid_group() @@ -123,10 +125,15 @@ class UserGroup(DiscordCommandABC): @commands.guild_only() @CommandChecks.check_is_ready() async def birthday(self, ctx: Context, day: int, month: int, year: int): - self._logger.debug(__name__, f"Received command user birthday {ctx}:{ctx.author},{day}:{month}:{year}") + self._logger.debug( + __name__, + f"Received command user birthday {ctx}:{ctx.author},{day}:{month}:{year}", + ) date = datetime.date(year, month, day) server = self._servers.get_server_by_discord_id(ctx.guild.id) - user = self._users.get_user_by_discord_id_and_server_id(ctx.author.id, server.id) + user = self._users.get_user_by_discord_id_and_server_id( + ctx.author.id, server.id + ) user.birthday = date self._users.update_user(user) self._db.save_changes() @@ -134,11 +141,15 @@ class UserGroup(DiscordCommandABC): ctx.interaction, self._t.transform("modules.base.user.birthday.success") ) # notify team to prevent multiple entries every day - settings: ServerConfig = self._config.get_configuration(f"ServerConfig_{ctx.guild.id}") + settings: ServerConfig = self._config.get_configuration( + f"ServerConfig_{ctx.guild.id}" + ) channel = ctx.guild.get_channel(settings.team_channel_id) await self._message_service.send_channel_message( channel, - self._t.transform("modules.base.user.birthday.success_team").format(ctx.author.mention, date), + self._t.transform("modules.base.user.birthday.success_team").format( + ctx.author.mention, date + ), is_persistent=True, ) self._logger.trace(__name__, f"Finished user-info command") @@ -177,12 +188,18 @@ class UserGroup(DiscordCommandABC): @user.command() @commands.guild_only() @CommandChecks.check_is_ready() - async def info(self, ctx: Context, member: Optional[discord.Member] = None, *, wait: int = None): - self._logger.debug(__name__, f"Received command user-info {ctx}:{member},{wait}") + async def info( + self, ctx: Context, member: Optional[discord.Member] = None, *, wait: int = None + ): + self._logger.debug( + __name__, f"Received command user-info {ctx}:{member},{wait}" + ) is_mod = self._permissions.is_member_moderator(ctx.author) if member is not None and not is_mod: - await self._message_service.send_ctx_msg(ctx, self._t.transform("common.no_permission_message")) + await self._message_service.send_ctx_msg( + ctx, self._t.transform("common.no_permission_message") + ) return if member is None or not isinstance(member, discord.Member): @@ -192,10 +209,16 @@ class UserGroup(DiscordCommandABC): user = self._users.find_user_by_discord_id_and_server_id(member.id, server.id) joins = self._user_joined_servers.get_user_joined_servers_by_user_id(user.id) - embed = discord.Embed(title=member.name, description=member.name, color=int("ef9d0d", 16)) + embed = discord.Embed( + title=member.name, description=member.name, color=int("ef9d0d", 16) + ) - embed.add_field(name=self._t.transform("modules.base.user.atr.id"), value=member.id) - embed.add_field(name=self._t.transform("modules.base.user.atr.name"), value=member.name) + embed.add_field( + name=self._t.transform("modules.base.user.atr.id"), value=member.id + ) + embed.add_field( + name=self._t.transform("modules.base.user.atr.name"), value=member.name + ) embed.add_field( name=self._t.transform("modules.base.user.atr.discord_join"), value=self._date.transform(member.created_at), @@ -206,7 +229,9 @@ class UserGroup(DiscordCommandABC): value=self._date.transform(member.joined_at), inline=False, ) - embed.add_field(name=self._t.transform("modules.base.user.atr.xp"), value=str(user.xp)) + embed.add_field( + name=self._t.transform("modules.base.user.atr.xp"), value=str(user.xp) + ) embed.add_field( name=self._t.transform("modules.base.user.atr.ontime"), value=str(self._client_utils.get_ontime_for_user(user)), @@ -256,7 +281,9 @@ class UserGroup(DiscordCommandABC): ) # send to interaction because of sensitive data - await self._message_service.send_interaction_msg(ctx.interaction, embed, wait_before_delete=wait) + await self._message_service.send_interaction_msg( + ctx.interaction, embed, wait_before_delete=wait + ) self._logger.trace(__name__, f"Finished user-info command") @user.command() @@ -267,7 +294,9 @@ class UserGroup(DiscordCommandABC): is_mod = self._permissions.is_member_moderator(ctx.author) if member is not None and not is_mod: - await self._message_service.send_ctx_msg(ctx, self._t.transform("common.no_permission_message")) + await self._message_service.send_ctx_msg( + ctx, self._t.transform("common.no_permission_message") + ) return if member is None or not isinstance(member, discord.Member): @@ -291,18 +320,26 @@ class UserGroup(DiscordCommandABC): await self._message_service.send_interaction_msg( ctx.interaction, - self._t.transform(f"modules.base.user.get.{atr.lower()}").format(member.mention, value), + self._t.transform(f"modules.base.user.get.{atr.lower()}").format( + member.mention, value + ), ) @get.autocomplete("atr") - async def get_autocomplete(self, interaction: discord.Interaction, current: str) -> TList[app_commands.Choice[str]]: - return [app_commands.Choice(name=value, value=key) for key, value in self._atr_TList] + async def get_autocomplete( + self, interaction: discord.Interaction, current: str + ) -> TList[app_commands.Choice[str]]: + return [ + app_commands.Choice(name=value, value=key) for key, value in self._atr_TList + ] @user.command() @commands.guild_only() @CommandChecks.check_is_ready() @CommandChecks.check_is_member_moderator() - async def set(self, ctx: Context, atr: str, value: int, member: discord.Member = None): + async def set( + self, ctx: Context, atr: str, value: int, member: discord.Member = None + ): self._logger.debug(__name__, f"Received command user-set {atr} {ctx}:{member}") if member is None or not isinstance(member, discord.Member): @@ -315,7 +352,9 @@ class UserGroup(DiscordCommandABC): try: user.xp = value except TypeError as te: - self._logger.error(__name__, f"String value couldn't be converted to int", te) + self._logger.error( + __name__, f"String value couldn't be converted to int", te + ) await self._message_service.send_interaction_msg( ctx.interaction, self._t.transform("modules.base.user.set.error.type_error"), @@ -335,11 +374,15 @@ class UserGroup(DiscordCommandABC): await self._message_service.send_interaction_msg( ctx.interaction, - self._t.transform(f"modules.base.user.set.{atr.lower()}").format(member.mention, value), + self._t.transform(f"modules.base.user.set.{atr.lower()}").format( + member.mention, value + ), ) @set.autocomplete("atr") - async def set_autocomplete(self, interaction: discord.Interaction, current: str) -> TList[app_commands.Choice[str]]: + async def set_autocomplete( + self, interaction: discord.Interaction, current: str + ) -> TList[app_commands.Choice[str]]: atr_TList = [("xp", self._atr_dict["xp"])] return [app_commands.Choice(name=value, value=key) for key, value in atr_TList] @@ -347,12 +390,18 @@ class UserGroup(DiscordCommandABC): @commands.guild_only() @CommandChecks.check_is_ready() @CommandChecks.check_is_member_moderator() - async def add(self, ctx: Context, atr: str, value: int, member: discord.Member = None): - self._logger.debug(__name__, f"Received command user-add {atr}-={value} {ctx}:{member}") + async def add( + self, ctx: Context, atr: str, value: int, member: discord.Member = None + ): + self._logger.debug( + __name__, f"Received command user-add {atr}-={value} {ctx}:{member}" + ) await self._handle_atr_calc(ctx, atr, value, member) @add.autocomplete("atr") - async def set_autocomplete(self, interaction: discord.Interaction, current: str) -> TList[app_commands.Choice[str]]: + async def set_autocomplete( + self, interaction: discord.Interaction, current: str + ) -> TList[app_commands.Choice[str]]: atr_TList = [("xp", self._atr_dict["xp"])] return [app_commands.Choice(name=value, value=key) for key, value in atr_TList] @@ -360,12 +409,18 @@ class UserGroup(DiscordCommandABC): @commands.guild_only() @CommandChecks.check_is_ready() @CommandChecks.check_is_member_moderator() - async def remove(self, ctx: Context, atr: str, value: int, member: discord.Member = None): - self._logger.debug(__name__, f"Received command user-remove {atr}-={value} {ctx}:{member}") + async def remove( + self, ctx: Context, atr: str, value: int, member: discord.Member = None + ): + self._logger.debug( + __name__, f"Received command user-remove {atr}-={value} {ctx}:{member}" + ) await self._handle_atr_calc(ctx, atr, value, member, is_remove=True) @remove.autocomplete("atr") - async def set_autocomplete(self, interaction: discord.Interaction, current: str) -> TList[app_commands.Choice[str]]: + async def set_autocomplete( + self, interaction: discord.Interaction, current: str + ) -> TList[app_commands.Choice[str]]: atr_TList = [("xp", self._atr_dict["xp"])] return [app_commands.Choice(name=value, value=key) for key, value in atr_TList] @@ -374,7 +429,9 @@ class UserGroup(DiscordCommandABC): @CommandChecks.check_is_ready() @CommandChecks.check_is_member_moderator() async def reset(self, ctx: Context, atr: str, member: discord.Member = None): - self._logger.debug(__name__, f"Received command user-reset {atr} {ctx}:{member}") + self._logger.debug( + __name__, f"Received command user-reset {atr} {ctx}:{member}" + ) if member is None or not isinstance(member, discord.Member): member = ctx.author @@ -389,7 +446,9 @@ class UserGroup(DiscordCommandABC): await self._level.check_level(member) elif atr == "ontime": - self._user_joined_voice_channel.delete_user_joined_voice_channel_by_user_id(user.id) + self._user_joined_voice_channel.delete_user_joined_voice_channel_by_user_id( + user.id + ) self._db.save_changes() else: @@ -401,14 +460,18 @@ class UserGroup(DiscordCommandABC): await self._message_service.send_interaction_msg( ctx.interaction, - self._t.transform(f"modules.base.user.reset.{atr.lower()}").format(atr, member.mention), + self._t.transform(f"modules.base.user.reset.{atr.lower()}").format( + atr, member.mention + ), ) @reset.autocomplete("atr") async def reset_autocomplete( self, interaction: discord.Interaction, current: str ) -> TList[app_commands.Choice[str]]: - return [app_commands.Choice(name=value, value=key) for key, value in self._atr_TList] + return [ + app_commands.Choice(name=value, value=key) for key, value in self._atr_TList + ] @user.group() @commands.guild_only() @@ -420,13 +483,17 @@ class UserGroup(DiscordCommandABC): @CommandChecks.check_is_ready() @CommandChecks.check_is_member_moderator() async def show(self, ctx: Context, member: discord.Member, wait: int = None): - self._logger.debug(__name__, f"Received command user warning show {ctx}:{member}") + self._logger.debug( + __name__, f"Received command user warning show {ctx}:{member}" + ) server = self._servers.find_server_by_discord_id(ctx.guild.id) user = self._users.find_user_by_discord_id_and_server_id(member.id, server.id) embed = discord.Embed( - title=member.name, description=self._t.transform("modules.base.user.atr.warnings"), color=int("ef9d0d", 16) + title=member.name, + description=self._t.transform("modules.base.user.atr.warnings"), + color=int("ef9d0d", 16), ) warnings = self._user_warnings.get_user_warnings_by_user_id(user.id) @@ -448,7 +515,9 @@ class UserGroup(DiscordCommandABC): value=warnings_description_string, inline=True, ) - await self._message_service.send_interaction_msg(ctx.interaction, embed, wait_before_delete=wait) + await self._message_service.send_interaction_msg( + ctx.interaction, embed, wait_before_delete=wait + ) self._logger.trace(__name__, f"Finished user warning show command") @warning.command() @@ -456,13 +525,21 @@ class UserGroup(DiscordCommandABC): @CommandChecks.check_is_ready() @CommandChecks.check_is_member_moderator() async def add(self, ctx: Context, member: discord.Member, description: str): - self._logger.debug(__name__, f"Received command user warning add {ctx}:{member},{description}") + self._logger.debug( + __name__, f"Received command user warning add {ctx}:{member},{description}" + ) try: - await self._user_warnings_service.add_warnings_async(member, description, ctx.author.id) - await self._message_service.send_ctx_msg(ctx, self._t.transform("modules.base.warnings.add.success")) + await self._user_warnings_service.add_warnings_async( + member, description, ctx.author.id + ) + await self._message_service.send_ctx_msg( + ctx, self._t.transform("modules.base.warnings.add.success") + ) except Exception as e: self._logger.error(__name__, f"Adding user warning failed", e) - await self._message_service.send_ctx_msg(ctx, self._t.transform("modules.base.warnings.add.failed")) + await self._message_service.send_ctx_msg( + ctx, self._t.transform("modules.base.warnings.add.failed") + ) self._logger.trace(__name__, f"Finished user warning add command") @warning.command() @@ -470,11 +547,17 @@ class UserGroup(DiscordCommandABC): @CommandChecks.check_is_ready() @CommandChecks.check_is_member_moderator() async def remove(self, ctx: Context, warning_id: int): - self._logger.debug(__name__, f"Received command user warning remove {ctx}:{warning_id}") + self._logger.debug( + __name__, f"Received command user warning remove {ctx}:{warning_id}" + ) try: await self._user_warnings_service.remove_warnings_async(warning_id) - await self._message_service.send_ctx_msg(ctx, self._t.transform("modules.base.warnings.remove.success")) + await self._message_service.send_ctx_msg( + ctx, self._t.transform("modules.base.warnings.remove.success") + ) except Exception as e: self._logger.error(__name__, f"Removing user warning failed", e) - await self._message_service.send_ctx_msg(ctx, self._t.transform("modules.base.warnings.remove.failed")) + await self._message_service.send_ctx_msg( + ctx, self._t.transform("modules.base.warnings.remove.failed") + ) self._logger.trace(__name__, f"Finished user warning remove command") diff --git a/kdb-bot/src/modules/base/events/__init__.py b/bot/src/modules/base/events/__init__.py similarity index 100% rename from kdb-bot/src/modules/base/events/__init__.py rename to bot/src/modules/base/events/__init__.py diff --git a/kdb-bot/src/modules/base/events/base_on_command_error_event.py b/bot/src/modules/base/events/base_on_command_error_event.py similarity index 94% rename from kdb-bot/src/modules/base/events/base_on_command_error_event.py rename to bot/src/modules/base/events/base_on_command_error_event.py index d5aab492..5a4628f6 100644 --- a/kdb-bot/src/modules/base/events/base_on_command_error_event.py +++ b/bot/src/modules/base/events/base_on_command_error_event.py @@ -167,7 +167,9 @@ class BaseOnCommandErrorEvent(OnCommandErrorABC): ) elif isinstance(error, commands.NotOwner): - await self._messenger.send_ctx_msg(ctx, self._t.transform("common.errors.not_owner"), without_tracking=True) + await self._messenger.send_ctx_msg( + ctx, self._t.transform("common.errors.not_owner"), without_tracking=True + ) elif isinstance(error, commands.MissingPermissions): await self._messenger.send_ctx_msg( @@ -259,13 +261,19 @@ class BaseOnCommandErrorEvent(OnCommandErrorABC): self._t.transform("common.errors.command_error"), without_tracking=True, ) - message = self._t.transform("modules.base.technician_command_error_message").format( + message = self._t.transform( + "modules.base.technician_command_error_message" + ).format( ctx.command, ctx.author, error, - datetime.datetime.now().strftime(self._time_format_settings.date_time_format), + datetime.datetime.now().strftime( + self._time_format_settings.date_time_format + ), uid, ) for t in self._tech_settings.technician_ids: member = self._bot.get_user(t) - await self._messenger.send_dm_message(message, member, without_tracking=True) + await self._messenger.send_dm_message( + message, member, without_tracking=True + ) diff --git a/kdb-bot/src/modules/base/events/base_on_command_event.py b/bot/src/modules/base/events/base_on_command_event.py similarity index 86% rename from kdb-bot/src/modules/base/events/base_on_command_event.py rename to bot/src/modules/base/events/base_on_command_event.py index 407a875f..149426d5 100644 --- a/kdb-bot/src/modules/base/events/base_on_command_event.py +++ b/bot/src/modules/base/events/base_on_command_event.py @@ -49,7 +49,9 @@ class BaseOnCommandEvent(OnCommandABC): self._clients.append_received_command_count(self._bot.user.id, g_id, 1) self._db.save_changes() except Exception as e: - self._logger.error(__name__, f"Cannot edit client {self._bot.user.id}@{g_id}", e) + self._logger.error( + __name__, f"Cannot edit client {self._bot.user.id}@{g_id}", e + ) def _handle_message_for_xp(self, message: discord.Message): dc_user_id = message.author.id @@ -61,7 +63,9 @@ class BaseOnCommandEvent(OnCommandABC): user: Optional[User] = None try: - user = self._users.get_user_by_discord_id_and_server_id(dc_user_id, server.id) + user = self._users.get_user_by_discord_id_and_server_id( + dc_user_id, server.id + ) except Exception as e: self._logger.error(__name__, f"Cannot get user {dc_user_id}", e) return @@ -70,17 +74,23 @@ class BaseOnCommandEvent(OnCommandABC): self._logger.error(__name__, f"User not found {dc_user_id}") return - settings: ServerConfig = self._config.get_configuration(f"ServerConfig_{message.guild.id}") + settings: ServerConfig = self._config.get_configuration( + f"ServerConfig_{message.guild.id}" + ) old_xp = user.xp user.xp += settings.xp_per_message self._users.update_user(user) self._db.save_changes() - self._logger.debug(__name__, f"User {user} sent message. xp: from {old_xp} to {user.xp}") + self._logger.debug( + __name__, f"User {user} sent message. xp: from {old_xp} to {user.xp}" + ) async def on_command(self, ctx: Context): self._logger.debug(__name__, f"Module {type(self)} started") - self._logger.info(__name__, f"Received command: {ctx.command} from {ctx.channel}") + self._logger.info( + __name__, f"Received command: {ctx.command} from {ctx.channel}" + ) if ctx is None or ctx.guild is None: return self._append_received_command_count(ctx.guild.id) diff --git a/kdb-bot/src/modules/base/events/base_on_guild_join_event.py b/bot/src/modules/base/events/base_on_guild_join_event.py similarity index 100% rename from kdb-bot/src/modules/base/events/base_on_guild_join_event.py rename to bot/src/modules/base/events/base_on_guild_join_event.py diff --git a/kdb-bot/src/modules/base/events/base_on_member_join_event.py b/bot/src/modules/base/events/base_on_member_join_event.py similarity index 88% rename from kdb-bot/src/modules/base/events/base_on_member_join_event.py rename to bot/src/modules/base/events/base_on_member_join_event.py index a09772d6..99939a27 100644 --- a/kdb-bot/src/modules/base/events/base_on_member_join_event.py +++ b/bot/src/modules/base/events/base_on_member_join_event.py @@ -66,7 +66,9 @@ class BaseOnMemberJoinEvent(OnMemberJoinABC): except Exception as e: self._logger.error(__name__, f"Cannot get user {member.id}", e) - async def _add_if_not_exists_user_async(self, member: Union[discord.User, discord.Member]): + async def _add_if_not_exists_user_async( + self, member: Union[discord.User, discord.Member] + ): self._logger.debug(__name__, f"Check if user exists {member}") await self._messenger.send_dm_message( self._t.transform("modules.base.welcome_message").format(member.guild.name), @@ -75,28 +77,40 @@ class BaseOnMemberJoinEvent(OnMemberJoinABC): try: server = self._servers.get_server_by_discord_id(member.guild.id) - user = self._users.find_user_by_discord_id_and_server_id(member.id, server.id) + user = self._users.find_user_by_discord_id_and_server_id( + member.id, server.id + ) if user is not None: - self._user_joins.add_user_joined_server(UserJoinedServer(user, datetime.now())) + self._user_joins.add_user_joined_server( + UserJoinedServer(user, datetime.now()) + ) self._db.save_changes() return self._logger.debug(__name__, f"Add user: {member.id}") self._users.add_user(User(member.id, 0, 0, 0, server)) self._db.save_changes() - user = self._users.get_user_by_discord_id_and_server_id(member.id, server.id) - self._user_joins.add_user_joined_server(UserJoinedServer(user, datetime.now())) + user = self._users.get_user_by_discord_id_and_server_id( + member.id, server.id + ) + self._user_joins.add_user_joined_server( + UserJoinedServer(user, datetime.now()) + ) self._db.save_changes() except Exception as e: self._logger.error(__name__, f"Cannot get user {member.id}", e) async def _notify_team(self, member: discord.Member): self._logger.debug(__name__, f"Notify team that a member left") - settings: ServerConfig = self._config.get_configuration(f"ServerConfig_{member.guild.id}") + settings: ServerConfig = self._config.get_configuration( + f"ServerConfig_{member.guild.id}" + ) channel = member.guild.get_channel(settings.team_channel_id) await self._messenger.send_channel_message( channel, - self._t.transform("modules.base.welcome_message_for_team").format(member.mention), + self._t.transform("modules.base.welcome_message_for_team").format( + member.mention + ), is_persistent=True, ) self._logger.trace(__name__, f"Notified team that a member left") diff --git a/kdb-bot/src/modules/base/events/base_on_member_remove_event.py b/bot/src/modules/base/events/base_on_member_remove_event.py similarity index 90% rename from kdb-bot/src/modules/base/events/base_on_member_remove_event.py rename to bot/src/modules/base/events/base_on_member_remove_event.py index adfe7e87..ed6a02df 100644 --- a/kdb-bot/src/modules/base/events/base_on_member_remove_event.py +++ b/bot/src/modules/base/events/base_on_member_remove_event.py @@ -41,12 +41,16 @@ class BaseOnMemberRemoveEvent(OnMemberRemoveABC): async def _remove_user(self, member: Union[discord.User, discord.Member]): self._logger.debug(__name__, f"Remove user {member}") - await self._message_service.send_dm_message(self._t.transform("modules.base.goodbye_message"), member) + await self._message_service.send_dm_message( + self._t.transform("modules.base.goodbye_message"), member + ) try: server = self._servers.get_server_by_discord_id(member.guild.id) - user = self._users.find_user_by_discord_id_and_server_id(member.id, server.id) + user = self._users.find_user_by_discord_id_and_server_id( + member.id, server.id + ) if user is None: self._logger.error(__name__, f"Cannot find user {member}") return @@ -60,11 +64,15 @@ class BaseOnMemberRemoveEvent(OnMemberRemoveABC): async def _notify_team(self, member: discord.Member): self._logger.debug(__name__, f"Notify team that a member left") - settings: ServerConfig = self._config.get_configuration(f"ServerConfig_{member.guild.id}") + settings: ServerConfig = self._config.get_configuration( + f"ServerConfig_{member.guild.id}" + ) channel = member.guild.get_channel(settings.team_channel_id) await self._message_service.send_channel_message( channel, - self._t.transform("modules.base.member_left_message").format(member.mention), + self._t.transform("modules.base.member_left_message").format( + member.mention + ), is_persistent=True, ) self._logger.trace(__name__, f"Notified team that a member left") diff --git a/kdb-bot/src/modules/base/events/base_on_message_delete_event.py b/bot/src/modules/base/events/base_on_message_delete_event.py similarity index 88% rename from kdb-bot/src/modules/base/events/base_on_message_delete_event.py rename to bot/src/modules/base/events/base_on_message_delete_event.py index 3d3aad1c..c3bcd022 100644 --- a/kdb-bot/src/modules/base/events/base_on_message_delete_event.py +++ b/bot/src/modules/base/events/base_on_message_delete_event.py @@ -40,7 +40,9 @@ class BaseOnMessageDeleteEvent(OnMessageDeleteABC): self._clients.append_deleted_message_count(self._bot.user.id, g_id, 1) self._db.save_changes() except Exception as e: - self._logger.error(__name__, f"Cannot edit client {self._bot.user.id}@{g_id}", e) + self._logger.error( + __name__, f"Cannot edit client {self._bot.user.id}@{g_id}", e + ) def _handle_message_delete(self, message: discord.Message): dc_user_id = message.author.id @@ -52,7 +54,9 @@ class BaseOnMessageDeleteEvent(OnMessageDeleteABC): user: Optional[User] = None try: - user = self._users.find_user_by_discord_id_and_server_id(dc_user_id, server.id) + user = self._users.find_user_by_discord_id_and_server_id( + dc_user_id, server.id + ) except Exception as e: self._logger.error(__name__, f"Cannot get user {dc_user_id}", e) return @@ -61,7 +65,9 @@ class BaseOnMessageDeleteEvent(OnMessageDeleteABC): self._logger.error(__name__, f"User not found {dc_user_id}") return - settings: ServerConfig = self._config.get_configuration(f"ServerConfig_{message.guild.id}") + settings: ServerConfig = self._config.get_configuration( + f"ServerConfig_{message.guild.id}" + ) old_xp = user.xp user.xp -= settings.xp_per_message self._users.update_user(user) @@ -77,7 +83,9 @@ class BaseOnMessageDeleteEvent(OnMessageDeleteABC): if message is None or message.guild is None: return - self._logger.info(__name__, f"Received message: {LogMessageHelper.get_log_string(message)}") + self._logger.info( + __name__, f"Received message: {LogMessageHelper.get_log_string(message)}" + ) self._append_deleted_message_count(message.guild.id) if not message.author.bot: diff --git a/kdb-bot/src/modules/base/events/base_on_message_event.py b/bot/src/modules/base/events/base_on_message_event.py similarity index 86% rename from kdb-bot/src/modules/base/events/base_on_message_event.py rename to bot/src/modules/base/events/base_on_message_event.py index e6531385..438b10b8 100644 --- a/kdb-bot/src/modules/base/events/base_on_message_event.py +++ b/bot/src/modules/base/events/base_on_message_event.py @@ -45,7 +45,9 @@ class BaseOnMessageEvent(OnMessageABC): self._clients.append_received_message_count(self._bot.user.id, g_id, 1) self._db.save_changes() except Exception as e: - self._logger.error(__name__, f"Cannot edit client {self._bot.user.id}@{g_id}", e) + self._logger.error( + __name__, f"Cannot edit client {self._bot.user.id}@{g_id}", e + ) def _handle_message_for_xp(self, message: discord.Message): dc_user_id = message.author.id @@ -57,7 +59,9 @@ class BaseOnMessageEvent(OnMessageABC): user: Optional[User] = None try: - user = self._users.find_user_by_discord_id_and_server_id(dc_user_id, server.id) + user = self._users.find_user_by_discord_id_and_server_id( + dc_user_id, server.id + ) except Exception as e: self._logger.error(__name__, f"Cannot get user {dc_user_id}", e) return @@ -66,7 +70,9 @@ class BaseOnMessageEvent(OnMessageABC): self._logger.error(__name__, f"User not found {dc_user_id}") return - settings: ServerConfig = self._config.get_configuration(f"ServerConfig_{server.discord_id}") + settings: ServerConfig = self._config.get_configuration( + f"ServerConfig_{server.discord_id}" + ) if self._client_utils.is_message_xp_count_by_hour_higher_that_max_message_count_per_hour( message.created_at, user, settings ): @@ -77,7 +83,9 @@ class BaseOnMessageEvent(OnMessageABC): self._users.update_user(user) self._db.save_changes() - self._logger.debug(__name__, f"User {user} sent message. xp: from {old_xp} to {user.xp}") + self._logger.debug( + __name__, f"User {user} sent message. xp: from {old_xp} to {user.xp}" + ) @EventChecks.check_is_ready() async def on_message(self, message: discord.Message): @@ -85,7 +93,9 @@ class BaseOnMessageEvent(OnMessageABC): if message is None or message.guild is None: return - self._logger.info(__name__, f"Received message: {LogMessageHelper.get_log_string(message)}") + self._logger.info( + __name__, f"Received message: {LogMessageHelper.get_log_string(message)}" + ) self._append_received_message_count(message.guild.id) if not message.author.bot: diff --git a/kdb-bot/src/modules/base/events/base_on_raw_reaction_add.py b/bot/src/modules/base/events/base_on_raw_reaction_add.py similarity index 100% rename from kdb-bot/src/modules/base/events/base_on_raw_reaction_add.py rename to bot/src/modules/base/events/base_on_raw_reaction_add.py diff --git a/kdb-bot/src/modules/base/events/base_on_raw_reaction_remove.py b/bot/src/modules/base/events/base_on_raw_reaction_remove.py similarity index 100% rename from kdb-bot/src/modules/base/events/base_on_raw_reaction_remove.py rename to bot/src/modules/base/events/base_on_raw_reaction_remove.py diff --git a/kdb-bot/src/modules/base/events/base_on_scheduled_event_update_event.py b/bot/src/modules/base/events/base_on_scheduled_event_update_event.py similarity index 84% rename from kdb-bot/src/modules/base/events/base_on_scheduled_event_update_event.py rename to bot/src/modules/base/events/base_on_scheduled_event_update_event.py index 640a9a80..f3dfda00 100644 --- a/kdb-bot/src/modules/base/events/base_on_scheduled_event_update_event.py +++ b/bot/src/modules/base/events/base_on_scheduled_event_update_event.py @@ -21,7 +21,9 @@ class BaseOnScheduledEventUpdateEvent(OnScheduledEventUpdateABC): self._bot = bot self._events = events - async def on_scheduled_event_update(self, before: discord.ScheduledEvent, after: discord.ScheduledEvent): + async def on_scheduled_event_update( + self, before: discord.ScheduledEvent, after: discord.ScheduledEvent + ): self._logger.debug(__name__, f"Module {type(self)} started") # save started event @@ -33,7 +35,8 @@ class BaseOnScheduledEventUpdateEvent(OnScheduledEventUpdateABC): self._events.give_xp_for_event_participation(member, active_event) # delete stopped event if before.status != after.status and ( - after.status.value == EventStatus.cancelled.value or after.status.value == EventStatus.completed.value + after.status.value == EventStatus.cancelled.value + or after.status.value == EventStatus.completed.value ): event = self._events.get_active_event(after) if event is None: diff --git a/kdb-bot/src/modules/base/events/base_on_voice_state_update_event.py b/bot/src/modules/base/events/base_on_voice_state_update_event.py similarity index 75% rename from kdb-bot/src/modules/base/events/base_on_voice_state_update_event.py rename to bot/src/modules/base/events/base_on_voice_state_update_event.py index 6fb0c113..5a5e25ab 100644 --- a/kdb-bot/src/modules/base/events/base_on_voice_state_update_event.py +++ b/bot/src/modules/base/events/base_on_voice_state_update_event.py @@ -45,10 +45,14 @@ class BaseOnVoiceStateUpdateEvent(OnVoiceStateUpdateABC): self._logger.info(__name__, f"Module {type(self)} loaded") - def _update_voice_state(self, joined: bool, dc_user_id: int, channel_id: int, server: Server): + def _update_voice_state( + self, joined: bool, dc_user_id: int, channel_id: int, server: Server + ): user: Optional[User] = None try: - user = self._users.get_user_by_discord_id_and_server_id(dc_user_id, server.id) + user = self._users.get_user_by_discord_id_and_server_id( + dc_user_id, server.id + ) except Exception as e: self._logger.error(__name__, f"Cannot get user {dc_user_id}", e) return @@ -64,9 +68,13 @@ class BaseOnVoiceStateUpdateEvent(OnVoiceStateUpdateABC): self._db.save_changes() return - settings: ServerConfig = self._config.get_configuration(f"ServerConfig_{server.discord_id}") + settings: ServerConfig = self._config.get_configuration( + f"ServerConfig_{server.discord_id}" + ) - join = self._user_joins_vc.get_active_user_joined_voice_channel_by_user_id(user.id) + join = self._user_joins_vc.get_active_user_joined_voice_channel_by_user_id( + user.id + ) join.leaved_on = datetime.now() old_xp = user.xp @@ -95,7 +103,9 @@ class BaseOnVoiceStateUpdateEvent(OnVoiceStateUpdateABC): __name__, f"Detected on_voice_state_update {member.id} from {before} to {after}", ) - settings: ServerConfig = self._config.get_configuration(f"ServerConfig_{member.guild.id}") + settings: ServerConfig = self._config.get_configuration( + f"ServerConfig_{member.guild.id}" + ) server = self._servers.get_server_by_discord_id(member.guild.id) try: @@ -123,18 +133,36 @@ class BaseOnVoiceStateUpdateEvent(OnVoiceStateUpdateABC): # channel to channel elif before.channel is not None and after.channel is not None: # joined - if before.channel.id in settings.afk_channel_ids and after.channel.id not in settings.afk_channel_ids: - self._logger.trace(__name__, f"User {member.id} joined {after.channel}") + if ( + before.channel.id in settings.afk_channel_ids + and after.channel.id not in settings.afk_channel_ids + ): + self._logger.trace( + __name__, f"User {member.id} joined {after.channel}" + ) self._update_voice_state(True, member.id, after.channel.id, server) # left - elif after.channel.id in settings.afk_channel_ids and before.channel.id not in settings.afk_channel_ids: - self._logger.trace(__name__, f"User {member.id} left {before.channel}") - self._update_voice_state(False, member.id, before.channel.id, server) + elif ( + after.channel.id in settings.afk_channel_ids + and before.channel.id not in settings.afk_channel_ids + ): + self._logger.trace( + __name__, f"User {member.id} left {before.channel}" + ) + self._update_voice_state( + False, member.id, before.channel.id, server + ) else: - self._logger.trace(__name__, f"User {member.id} switched to {after.channel}") - self._update_voice_state(False, member.id, before.channel.id, server) + self._logger.trace( + __name__, f"User {member.id} switched to {after.channel}" + ) + self._update_voice_state( + False, member.id, before.channel.id, server + ) self._update_voice_state(True, member.id, after.channel.id, server) except Exception as e: - self._logger.error(__name__, f"Cannot handle voice state for user {member.id}", e) + self._logger.error( + __name__, f"Cannot handle voice state for user {member.id}", e + ) diff --git a/kdb-bot/src/modules/base/events/base_on_voice_state_update_event_help_channel.py b/bot/src/modules/base/events/base_on_voice_state_update_event_help_channel.py similarity index 92% rename from kdb-bot/src/modules/base/events/base_on_voice_state_update_event_help_channel.py rename to bot/src/modules/base/events/base_on_voice_state_update_event_help_channel.py index 3e1b3da0..d1d24e07 100644 --- a/kdb-bot/src/modules/base/events/base_on_voice_state_update_event_help_channel.py +++ b/bot/src/modules/base/events/base_on_voice_state_update_event_help_channel.py @@ -33,11 +33,15 @@ class BaseOnVoiceStateUpdateEventHelpChannel(OnVoiceStateUpdateABC): async def _notify_team(self, member: discord.Member): self._logger.debug(__name__, f"Notify team that a member needs help") - settings: ServerConfig = self._config.get_configuration(f"ServerConfig_{member.guild.id}") + settings: ServerConfig = self._config.get_configuration( + f"ServerConfig_{member.guild.id}" + ) channel = member.guild.get_channel(settings.team_channel_id) await self._message_service.send_channel_message( channel, - self._t.transform("modules.base.member_joined_help_voice_channel").format(member.mention), + self._t.transform("modules.base.member_joined_help_voice_channel").format( + member.mention + ), is_persistent=True, ) self._logger.trace(__name__, f"Notified team that a member need help") @@ -51,7 +55,9 @@ class BaseOnVoiceStateUpdateEventHelpChannel(OnVoiceStateUpdateABC): ): self._logger.debug(__name__, f"Module {type(self)} started") server = self._servers.get_server_by_discord_id(member.guild.id) - settings: ServerConfig = self._config.get_configuration(f"ServerConfig_{server.discord_id}") + settings: ServerConfig = self._config.get_configuration( + f"ServerConfig_{server.discord_id}" + ) if after.channel is None or after.channel.id != settings.help_voice_channel_id: return diff --git a/kdb-bot/src/modules/base/events/base_on_voice_state_update_event_scheduled_event_bonus.py b/bot/src/modules/base/events/base_on_voice_state_update_event_scheduled_event_bonus.py similarity index 100% rename from kdb-bot/src/modules/base/events/base_on_voice_state_update_event_scheduled_event_bonus.py rename to bot/src/modules/base/events/base_on_voice_state_update_event_scheduled_event_bonus.py diff --git a/kdb-bot/src/modules/base/forms/__init__.py b/bot/src/modules/base/forms/__init__.py similarity index 100% rename from kdb-bot/src/modules/base/forms/__init__.py rename to bot/src/modules/base/forms/__init__.py diff --git a/kdb-bot/src/modules/base/forms/bug_report_form.py b/bot/src/modules/base/forms/bug_report_form.py similarity index 81% rename from kdb-bot/src/modules/base/forms/bug_report_form.py rename to bot/src/modules/base/forms/bug_report_form.py index 185fd51f..88fc6cab 100644 --- a/kdb-bot/src/modules/base/forms/bug_report_form.py +++ b/bot/src/modules/base/forms/bug_report_form.py @@ -10,7 +10,9 @@ from bot_data.model.technician_config import TechnicianConfig class BugReportForm(ui.Modal): - description = ui.TextInput(label="Report a bug", required=True, style=TextStyle.long) + description = ui.TextInput( + label="Report a bug", required=True, style=TextStyle.long + ) def __init__( self, @@ -38,10 +40,14 @@ class BugReportForm(ui.Modal): for t in self._technician_config.technician_ids: member = self._bot.get_user(t) await self._message_service.send_dm_message( - self._t.transform("modules.base.bug.message").format(interaction.user.mention, self.description.value), + self._t.transform("modules.base.bug.message").format( + interaction.user.mention, self.description.value + ), member, without_tracking=True, ) - await self._message_service.send_interaction_msg(interaction, self._t.transform("modules.base.bug.response")) + await self._message_service.send_interaction_msg( + interaction, self._t.transform("modules.base.bug.response") + ) self._logger.trace(__name__, f"Finished bug report form") diff --git a/kdb-bot/src/modules/base/forms/complaint_form.py b/bot/src/modules/base/forms/complaint_form.py similarity index 90% rename from kdb-bot/src/modules/base/forms/complaint_form.py rename to bot/src/modules/base/forms/complaint_form.py index b0d77813..cb39e23c 100644 --- a/kdb-bot/src/modules/base/forms/complaint_form.py +++ b/bot/src/modules/base/forms/complaint_form.py @@ -10,7 +10,9 @@ from bot_data.model.server_config import ServerConfig class ComplaintForm(ui.Modal): - description = ui.TextInput(label="Complain about something", required=True, style=TextStyle.long) + description = ui.TextInput( + label="Complain about something", required=True, style=TextStyle.long + ) def __init__( self, @@ -32,7 +34,9 @@ class ComplaintForm(ui.Modal): async def on_submit(self, interaction: discord.Interaction): self._logger.debug(__name__, f"Started complaint command form") - settings: ServerConfig = self._config.get_configuration(f"ServerConfig_{interaction.guild.id}") + settings: ServerConfig = self._config.get_configuration( + f"ServerConfig_{interaction.guild.id}" + ) channel = interaction.guild.get_channel(settings.team_channel_id) await self._message_service.send_channel_message( channel, diff --git a/kdb-bot/src/modules/base/helper/__init__.py b/bot/src/modules/base/helper/__init__.py similarity index 100% rename from kdb-bot/src/modules/base/helper/__init__.py rename to bot/src/modules/base/helper/__init__.py diff --git a/kdb-bot/src/modules/base/helper/base_reaction_handler.py b/bot/src/modules/base/helper/base_reaction_handler.py similarity index 87% rename from kdb-bot/src/modules/base/helper/base_reaction_handler.py rename to bot/src/modules/base/helper/base_reaction_handler.py index d2cb1581..e63f4412 100644 --- a/kdb-bot/src/modules/base/helper/base_reaction_handler.py +++ b/bot/src/modules/base/helper/base_reaction_handler.py @@ -38,7 +38,9 @@ class BaseReactionHandler: guild = self._bot.get_guild(payload.guild_id) member = guild.get_member(payload.user_id) if member is None: - self._logger.warn(__name__, f"User {payload.user_id} in {guild.name} not found - skipping") + self._logger.warn( + __name__, f"User {payload.user_id} in {guild.name} not found - skipping" + ) return try: @@ -60,8 +62,12 @@ class BaseReactionHandler: self._logger.debug(__name__, f"Skipping reaction handling") return except Exception as e: - self._logger.error(__name__, f"Getting message for reaction logging failed", e) - self._logger.info(__name__, f"{log_msg} to message {payload.message_id}") + self._logger.error( + __name__, f"Getting message for reaction logging failed", e + ) + self._logger.info( + __name__, f"{log_msg} to message {payload.message_id}" + ) except Exception as e: self._logger.error(__name__, f"Reaction logging failed", e) @@ -70,7 +76,9 @@ class BaseReactionHandler: server = self._servers.get_server_by_discord_id(guild.id) user = self._users.get_user_by_discord_id_and_server_id(member.id, server.id) - settings: ServerConfig = self._config.get_configuration(f"ServerConfig_{guild.id}") + settings: ServerConfig = self._config.get_configuration( + f"ServerConfig_{guild.id}" + ) if r_type == "add": if self._client_utils.is_message_xp_count_by_hour_higher_that_max_message_count_per_hour( diff --git a/kdb-bot/src/modules/base/helper/voice_channel_transformer.py b/bot/src/modules/base/helper/voice_channel_transformer.py similarity index 62% rename from kdb-bot/src/modules/base/helper/voice_channel_transformer.py rename to bot/src/modules/base/helper/voice_channel_transformer.py index a9ee5df0..f7fa205f 100644 --- a/kdb-bot/src/modules/base/helper/voice_channel_transformer.py +++ b/bot/src/modules/base/helper/voice_channel_transformer.py @@ -8,7 +8,9 @@ from bot_core.abc.client_utils_abc import ClientUtilsABC class VoiceChannelTransformer(Transformer): - async def transform(self, interaction: Interaction, value: str, /) -> discord.VoiceChannel: + async def transform( + self, interaction: Interaction, value: str, / + ) -> discord.VoiceChannel: voice_channel = ( List(discord.VoiceChannel, interaction.guild.voice_channels) .where(lambda x: str(x.id) == value) @@ -16,15 +18,24 @@ class VoiceChannelTransformer(Transformer): ) return voice_channel - async def autocomplete(self, interaction: Interaction, current: str, /) -> list[Choice[str]]: + async def autocomplete( + self, interaction: Interaction, current: str, / + ) -> list[Choice[str]]: @ServiceProviderABC.inject def get_client_utils(client_utils: ClientUtilsABC) -> ClientUtilsABC: return client_utils - voice_channels = List(discord.Role, interaction.guild.voice_channels).where(lambda x: len(x.members) > 0) + voice_channels = List(discord.Role, interaction.guild.voice_channels).where( + lambda x: len(x.members) > 0 + ) return [ app_commands.Choice( - name=f"{vc.name}" if vc.category is None else f"{vc.name}: {vc.category.name}", value=vc.name + name=f"{vc.name}" + if vc.category is None + else f"{vc.name}: {vc.category.name}", + value=vc.name, + ) + for vc in get_client_utils().get_auto_complete_list( + voice_channels, current, lambda x: x.name ) - for vc in get_client_utils().get_auto_complete_list(voice_channels, current, lambda x: x.name) ] diff --git a/kdb-bot/src/modules/base/model/__init__.py b/bot/src/modules/base/model/__init__.py similarity index 100% rename from kdb-bot/src/modules/base/model/__init__.py rename to bot/src/modules/base/model/__init__.py diff --git a/kdb-bot/src/modules/base/model/active_event.py b/bot/src/modules/base/model/active_event.py similarity index 100% rename from kdb-bot/src/modules/base/model/active_event.py rename to bot/src/modules/base/model/active_event.py diff --git a/kdb-bot/src/modules/base/service/__init__.py b/bot/src/modules/base/service/__init__.py similarity index 100% rename from kdb-bot/src/modules/base/service/__init__.py rename to bot/src/modules/base/service/__init__.py diff --git a/kdb-bot/src/modules/base/service/event_service.py b/bot/src/modules/base/service/event_service.py similarity index 87% rename from kdb-bot/src/modules/base/service/event_service.py rename to bot/src/modules/base/service/event_service.py index 30b19d96..51cf211c 100644 --- a/kdb-bot/src/modules/base/service/event_service.py +++ b/bot/src/modules/base/service/event_service.py @@ -36,7 +36,9 @@ class EventService: self._active_events.add(event) def get_active_event(self, event: discord.ScheduledEvent) -> Optional[ActiveEvent]: - return self._active_events.where(lambda x: x.event.id == event.id).single_or_default() + return self._active_events.where( + lambda x: x.event.id == event.id + ).single_or_default() def get_active_event_by_channel_id(self, channel_id: int) -> Optional[ActiveEvent]: return self._active_events.where( @@ -49,14 +51,18 @@ class EventService: self._active_events.remove(event) - def give_xp_for_event_participation(self, member: discord.Member, active_event: ActiveEvent): + def give_xp_for_event_participation( + self, member: discord.Member, active_event: ActiveEvent + ): server = self._servers.get_server_by_discord_id(member.guild.id) user = self._users.get_user_by_discord_id_and_server_id(member.id, server.id) if active_event.participants.any(lambda x: x.id == user.id): self._logger.debug(__name__, f"Module {type(self)} stopped") return - settings: ServerConfig = self._config.get_configuration(f"ServerConfig_{server.discord_id}") + settings: ServerConfig = self._config.get_configuration( + f"ServerConfig_{server.discord_id}" + ) user.xp += settings.xp_per_event_participation self._users.update_user(user) self._db.save_changes() diff --git a/kdb-bot/src/modules/base/service/user_warnings_service.py b/bot/src/modules/base/service/user_warnings_service.py similarity index 66% rename from kdb-bot/src/modules/base/service/user_warnings_service.py rename to bot/src/modules/base/service/user_warnings_service.py index d69659e6..54c394c7 100644 --- a/kdb-bot/src/modules/base/service/user_warnings_service.py +++ b/bot/src/modules/base/service/user_warnings_service.py @@ -46,101 +46,154 @@ class UserWarningsService: self._t = t self._permissions = permissions - async def notify_team(self, member: discord.Member, description: str, removed=False): + async def notify_team( + self, member: discord.Member, description: str, removed=False + ): try: - settings: ServerConfig = self._config.get_configuration(f"ServerConfig_{member.guild.id}") + settings: ServerConfig = self._config.get_configuration( + f"ServerConfig_{member.guild.id}" + ) channel = member.guild.get_channel(settings.team_channel_id) if removed: - translation = self._t.transform("modules.base.warnings.team_removed").format( - description, member.mention - ) + translation = self._t.transform( + "modules.base.warnings.team_removed" + ).format(description, member.mention) else: - translation = self._t.transform("modules.base.warnings.team_warned").format(member.mention, description) + translation = self._t.transform( + "modules.base.warnings.team_warned" + ).format(member.mention, description) self._bot.loop.create_task( - self._message_service.send_channel_message(channel, translation, is_persistent=True) + self._message_service.send_channel_message( + channel, translation, is_persistent=True + ) ) except Exception as e: - self._logger.error(__name__, f"Team notification for user warning failed!", e) + self._logger.error( + __name__, f"Team notification for user warning failed!", e + ) async def notify_user(self, member: discord.Member, message: str): try: # run as task to keep the interaction alive - self._bot.loop.create_task(self._message_service.send_dm_message(message, member)) + self._bot.loop.create_task( + self._message_service.send_dm_message(message, member) + ) except Exception as e: - self._logger.error(__name__, f"User notification for user warning failed!", e) + self._logger.error( + __name__, f"User notification for user warning failed!", e + ) async def check_for_warnings(self, member: discord.Member, user: User): existing_warnings = self._warnings.get_user_warnings_by_user_id(user.id) if existing_warnings.count() == 1: - await self.notify_user(member, self._t.transform("modules.base.warnings.first")) + await self.notify_user( + member, self._t.transform("modules.base.warnings.first") + ) elif existing_warnings.count() == 2: server = self._servers.get_server_by_discord_id(member.guild.id) - user = self._users.get_user_by_discord_id_and_server_id(member.id, server.id) + user = self._users.get_user_by_discord_id_and_server_id( + member.id, server.id + ) level = self._level_service.get_level(user) - levels = self._levels.get_levels_by_server_id(server.id).order_by(lambda l: l.min_xp) + levels = self._levels.get_levels_by_server_id(server.id).order_by( + lambda l: l.min_xp + ) - new_level = levels.where(lambda l: l.min_xp < level.min_xp).last_or_default() + new_level = levels.where( + lambda l: l.min_xp < level.min_xp + ).last_or_default() if new_level is not None: user.xp = new_level.min_xp self._users.update_user(user) self._db.save_changes() - await self.notify_user(member, self._t.transform("modules.base.warnings.second")) + await self.notify_user( + member, self._t.transform("modules.base.warnings.second") + ) elif existing_warnings.count() == 3: server = self._servers.get_server_by_discord_id(member.guild.id) - user = self._users.get_user_by_discord_id_and_server_id(member.id, server.id) + user = self._users.get_user_by_discord_id_and_server_id( + member.id, server.id + ) levels = self._levels.get_levels_by_server_id(server.id) - new_level = levels.where(lambda l: l.min_xp > 0).order_by(lambda l: l.min_xp).last_or_default() + new_level = ( + levels.where(lambda l: l.min_xp > 0) + .order_by(lambda l: l.min_xp) + .last_or_default() + ) if new_level is not None: user.xp = new_level.min_xp self._users.update_user(user) self._db.save_changes() - await self.notify_user(member, self._t.transform("modules.base.warnings.third")) + await self.notify_user( + member, self._t.transform("modules.base.warnings.third") + ) elif existing_warnings.count() >= 4: user.xp = 0 self._users.update_user(user) self._db.save_changes() - await self.notify_team(member, self._t.transform("modules.base.warnings.kick").format(member.mention)) + await self.notify_team( + member, + self._t.transform("modules.base.warnings.kick").format(member.mention), + ) await member.kick() async def _notify_after_add(self, member: discord.Member, warning: UserWarnings): server = self._servers.get_server_by_discord_id(member.guild.id) user = self._users.get_user_by_discord_id_and_server_id(member.id, server.id) - await self.notify_user(member, self._t.transform("modules.base.warnings.warned").format(warning.description)) + await self.notify_user( + member, + self._t.transform("modules.base.warnings.warned").format( + warning.description + ), + ) await self.notify_team(member, warning.description) await self.check_for_warnings(member, user) - def _add_warnings(self, member: discord.Member, description: str, author_id: int = None): + def _add_warnings( + self, member: discord.Member, description: str, author_id: int = None + ): server = self._servers.get_server_by_discord_id(member.guild.id) user = self._users.get_user_by_discord_id_and_server_id(member.id, server.id) author = None if author_id is not None: - author = self._users.get_user_by_discord_id_and_server_id(author_id, server.id) + author = self._users.get_user_by_discord_id_and_server_id( + author_id, server.id + ) warning = UserWarnings(description, user, author) self._warnings.add_user_warnings(warning) self._db.save_changes() return warning - def add_warnings(self, member: discord.Member, description: str, author_id: int = None): + def add_warnings( + self, member: discord.Member, description: str, author_id: int = None + ): warning = self._add_warnings(member, description, author_id) self._bot.loop.create_task(self._notify_after_add(member, warning)) - async def add_warnings_async(self, member: discord.Member, description: str, author_id: int = None): + async def add_warnings_async( + self, member: discord.Member, description: str, author_id: int = None + ): warning = self._add_warnings(member, description, author_id) await self._notify_after_add(member, warning) async def _notify_after_remove(self, warning: UserWarnings): guild = self._bot.get_guild(warning.user.server.discord_id) member = guild.get_member(warning.user.discord_id) - await self.notify_user(member, self._t.transform("modules.base.warnings.removed").format(warning.description)) + await self.notify_user( + member, + self._t.transform("modules.base.warnings.removed").format( + warning.description + ), + ) await self.notify_team(member, warning.description, removed=True) def _remove_warnings(self, id: int): diff --git a/kdb-bot/src/modules/base/thread/__init__.py b/bot/src/modules/base/thread/__init__.py similarity index 100% rename from kdb-bot/src/modules/base/thread/__init__.py rename to bot/src/modules/base/thread/__init__.py diff --git a/kdb-bot/src/modules/boot_log/__init__.py b/bot/src/modules/boot_log/__init__.py similarity index 100% rename from kdb-bot/src/modules/boot_log/__init__.py rename to bot/src/modules/boot_log/__init__.py diff --git a/kdb-bot/src/modules/boot_log/boot-log.json b/bot/src/modules/boot_log/boot-log.json similarity index 100% rename from kdb-bot/src/modules/boot_log/boot-log.json rename to bot/src/modules/boot_log/boot-log.json diff --git a/kdb-bot/src/modules/boot_log/boot_log_extension.py b/bot/src/modules/boot_log/boot_log_extension.py similarity index 94% rename from kdb-bot/src/modules/boot_log/boot_log_extension.py rename to bot/src/modules/boot_log/boot_log_extension.py index 62b7c6c7..e0f59082 100644 --- a/kdb-bot/src/modules/boot_log/boot_log_extension.py +++ b/bot/src/modules/boot_log/boot_log_extension.py @@ -14,7 +14,9 @@ class BootLogExtension(ApplicationExtensionABC): pass async def run(self, config: ConfigurationABC, services: ServiceProviderABC): - feature_flags: FeatureFlagsSettings = config.get_configuration(FeatureFlagsSettings) + feature_flags: FeatureFlagsSettings = config.get_configuration( + FeatureFlagsSettings + ) if not feature_flags.get_flag(FeatureFlagsEnum.boot_log_module): return logger: LoggerABC = services.get_service(LoggerABC) diff --git a/kdb-bot/src/modules/boot_log/boot_log_module.py b/bot/src/modules/boot_log/boot_log_module.py similarity index 68% rename from kdb-bot/src/modules/boot_log/boot_log_module.py rename to bot/src/modules/boot_log/boot_log_module.py index dde842f0..0701876f 100644 --- a/kdb-bot/src/modules/boot_log/boot_log_module.py +++ b/bot/src/modules/boot_log/boot_log_module.py @@ -13,10 +13,16 @@ class BootLogModule(ModuleABC): def __init__(self, dc: DiscordCollectionABC): ModuleABC.__init__(self, dc, FeatureFlagsEnum.boot_log_module) - def configure_configuration(self, config: ConfigurationABC, env: ApplicationEnvironmentABC): + def configure_configuration( + self, config: ConfigurationABC, env: ApplicationEnvironmentABC + ): pass - def configure_services(self, services: ServiceCollectionABC, env: ApplicationEnvironmentABC): + def configure_services( + self, services: ServiceCollectionABC, env: ApplicationEnvironmentABC + ): # commands # events - services.add_transient(DiscordEventTypesEnum.on_ready.value, BootLogOnReadyEvent) + services.add_transient( + DiscordEventTypesEnum.on_ready.value, BootLogOnReadyEvent + ) diff --git a/kdb-bot/src/modules/boot_log/boot_log_on_ready_event.py b/bot/src/modules/boot_log/boot_log_on_ready_event.py similarity index 88% rename from kdb-bot/src/modules/boot_log/boot_log_on_ready_event.py rename to bot/src/modules/boot_log/boot_log_on_ready_event.py index 4c8aeec7..f0962bae 100644 --- a/kdb-bot/src/modules/boot_log/boot_log_on_ready_event.py +++ b/bot/src/modules/boot_log/boot_log_on_ready_event.py @@ -45,7 +45,10 @@ class BootLogOnReadyEvent(OnReadyABC): try: start_time = self._config.get_configuration("Bot_StartTime") init_time = round( - (datetime.now() - datetime.strptime(start_time, "%Y-%m-%d %H:%M:%S.%f")).total_seconds(), + ( + datetime.now() + - datetime.strptime(start_time, "%Y-%m-%d %H:%M:%S.%f") + ).total_seconds(), 2, ) self._config.add_configuration("InitTime", str(init_time)) @@ -56,7 +59,9 @@ class BootLogOnReadyEvent(OnReadyABC): # print error if initialisation took way too long elif init_time >= 90: - self._logger.error(__name__, "It takes far too long to start the bot!!!") + self._logger.error( + __name__, "It takes far too long to start the bot!!!" + ) except Exception as e: self._logger.error(__name__, "Init time calculation failed", e) return @@ -65,7 +70,9 @@ class BootLogOnReadyEvent(OnReadyABC): g: guild = g self._logger.debug(__name__, f"Server detected: {g.id}") - server_config: ServerConfig = self._config.get_configuration(f"ServerConfig_{g.id}") + server_config: ServerConfig = self._config.get_configuration( + f"ServerConfig_{g.id}" + ) if server_config is None: self._logger.error(__name__, f"Config ServerConfig_{g.id} not found!") return @@ -78,7 +85,9 @@ class BootLogOnReadyEvent(OnReadyABC): self._bot.loop.create_task( self._message_service.send_channel_message( self._bot.get_channel(server_config.login_message_channel_id), - self._t.transform("modules.boot_log.login_message").format(init_time), + self._t.transform("modules.boot_log.login_message").format( + init_time + ), ) ) diff --git a/kdb-bot/src/modules/config/__init__.py b/bot/src/modules/config/__init__.py similarity index 100% rename from kdb-bot/src/modules/config/__init__.py rename to bot/src/modules/config/__init__.py diff --git a/kdb-bot/src/modules/config/config.json b/bot/src/modules/config/config.json similarity index 100% rename from kdb-bot/src/modules/config/config.json rename to bot/src/modules/config/config.json diff --git a/kdb-bot/src/modules/config/config_extension.py b/bot/src/modules/config/config_extension.py similarity index 95% rename from kdb-bot/src/modules/config/config_extension.py rename to bot/src/modules/config/config_extension.py index ce164180..f11ba6ad 100644 --- a/kdb-bot/src/modules/config/config_extension.py +++ b/bot/src/modules/config/config_extension.py @@ -13,7 +13,9 @@ class ConfigExtension(ApplicationExtensionABC): pass async def run(self, config: ConfigurationABC, services: ServiceProviderABC): - feature_flags: FeatureFlagsSettings = config.get_configuration(FeatureFlagsSettings) + feature_flags: FeatureFlagsSettings = config.get_configuration( + FeatureFlagsSettings + ) if not feature_flags.get_flag(FeatureFlagsEnum.config_module): return logger: LoggerABC = services.get_service(LoggerABC) diff --git a/kdb-bot/src/modules/config/config_module.py b/bot/src/modules/config/config_module.py similarity index 77% rename from kdb-bot/src/modules/config/config_module.py rename to bot/src/modules/config/config_module.py index 14c16263..a8180637 100644 --- a/kdb-bot/src/modules/config/config_module.py +++ b/bot/src/modules/config/config_module.py @@ -13,8 +13,12 @@ class ConfigModule(ModuleABC): def __init__(self, dc: DiscordCollectionABC): ModuleABC.__init__(self, dc, FeatureFlagsEnum.config_module) - def configure_configuration(self, config: ConfigurationABC, env: ApplicationEnvironmentABC): + def configure_configuration( + self, config: ConfigurationABC, env: ApplicationEnvironmentABC + ): pass - def configure_services(self, services: ServiceCollectionABC, env: ApplicationEnvironmentABC): + def configure_services( + self, services: ServiceCollectionABC, env: ApplicationEnvironmentABC + ): services.add_transient(DiscordEventTypesEnum.on_ready.value, ConfigOnReadyEvent) diff --git a/kdb-bot/src/modules/config/events/__init__.py b/bot/src/modules/config/events/__init__.py similarity index 100% rename from kdb-bot/src/modules/config/events/__init__.py rename to bot/src/modules/config/events/__init__.py diff --git a/kdb-bot/src/modules/config/events/config_on_ready_event.py b/bot/src/modules/config/events/config_on_ready_event.py similarity index 85% rename from kdb-bot/src/modules/config/events/config_on_ready_event.py rename to bot/src/modules/config/events/config_on_ready_event.py index 14ad229a..ddec8ccf 100644 --- a/kdb-bot/src/modules/config/events/config_on_ready_event.py +++ b/bot/src/modules/config/events/config_on_ready_event.py @@ -26,4 +26,6 @@ class ConfigOnReadyEvent(OnReadyABC): async def on_ready(self): for guild in self._bot.guilds: - await self._config_service.reload_server_config(self._servers.get_server_by_discord_id(guild.id)) + await self._config_service.reload_server_config( + self._servers.get_server_by_discord_id(guild.id) + ) diff --git a/kdb-bot/src/modules/config/service/__init__.py b/bot/src/modules/config/service/__init__.py similarity index 100% rename from kdb-bot/src/modules/config/service/__init__.py rename to bot/src/modules/config/service/__init__.py diff --git a/kdb-bot/src/modules/database/__init__.py b/bot/src/modules/database/__init__.py similarity index 100% rename from kdb-bot/src/modules/database/__init__.py rename to bot/src/modules/database/__init__.py diff --git a/kdb-bot/src/modules/database/database.json b/bot/src/modules/database/database.json similarity index 100% rename from kdb-bot/src/modules/database/database.json rename to bot/src/modules/database/database.json diff --git a/kdb-bot/src/modules/database/database_extension.py b/bot/src/modules/database/database_extension.py similarity index 96% rename from kdb-bot/src/modules/database/database_extension.py rename to bot/src/modules/database/database_extension.py index 1c26e70b..de874826 100644 --- a/kdb-bot/src/modules/database/database_extension.py +++ b/bot/src/modules/database/database_extension.py @@ -17,7 +17,9 @@ class DatabaseExtension(ApplicationExtensionABC): pass async def run(self, config: ConfigurationABC, services: ServiceProviderABC): - feature_flags: FeatureFlagsSettings = config.get_configuration(FeatureFlagsSettings) + feature_flags: FeatureFlagsSettings = config.get_configuration( + FeatureFlagsSettings + ) if not feature_flags.get_flag(FeatureFlagsEnum.data_module): return logger: LoggerABC = services.get_service(DatabaseLogger) diff --git a/kdb-bot/src/modules/database/database_module.py b/bot/src/modules/database/database_module.py similarity index 68% rename from kdb-bot/src/modules/database/database_module.py rename to bot/src/modules/database/database_module.py index bd7c6c6f..65b98988 100644 --- a/kdb-bot/src/modules/database/database_module.py +++ b/bot/src/modules/database/database_module.py @@ -13,10 +13,16 @@ class DatabaseModule(ModuleABC): def __init__(self, dc: DiscordCollectionABC): ModuleABC.__init__(self, dc, FeatureFlagsEnum.database_module) - def configure_configuration(self, config: ConfigurationABC, env: ApplicationEnvironmentABC): + def configure_configuration( + self, config: ConfigurationABC, env: ApplicationEnvironmentABC + ): pass - def configure_services(self, services: ServiceCollectionABC, env: ApplicationEnvironmentABC): + def configure_services( + self, services: ServiceCollectionABC, env: ApplicationEnvironmentABC + ): # commands # events - services.add_transient(DiscordEventTypesEnum.on_ready.value, DatabaseOnReadyEvent) + services.add_transient( + DiscordEventTypesEnum.on_ready.value, DatabaseOnReadyEvent + ) diff --git a/kdb-bot/src/modules/database/database_on_ready_event.py b/bot/src/modules/database/database_on_ready_event.py similarity index 80% rename from kdb-bot/src/modules/database/database_on_ready_event.py rename to bot/src/modules/database/database_on_ready_event.py index 5c3bd775..9b76de38 100644 --- a/kdb-bot/src/modules/database/database_on_ready_event.py +++ b/bot/src/modules/database/database_on_ready_event.py @@ -29,18 +29,25 @@ class DatabaseOnReadyEvent(OnReadyABC): try: start_time = self._config.get_configuration("Database_StartTime") init_time = round( - (datetime.now() - datetime.strptime(start_time, "%Y-%m-%d %H:%M:%S.%f")).total_seconds(), + ( + datetime.now() + - datetime.strptime(start_time, "%Y-%m-%d %H:%M:%S.%f") + ).total_seconds(), 2, ) self._config.add_configuration("Database_InitTime", str(init_time)) self._logger.debug(__name__, f"Database Init time: {init_time}s") # print warning if initialisation took too long if init_time >= 30: - self._logger.warn(__name__, "It takes too long to prepare the database!") + self._logger.warn( + __name__, "It takes too long to prepare the database!" + ) # print error if initialisation took way too long elif init_time >= 90: - self._logger.error(__name__, "It takes far too long to prepare the database!!!") + self._logger.error( + __name__, "It takes far too long to prepare the database!!!" + ) except Exception as e: # self._logger.error(__name__, "Database init time calculation failed", e) return diff --git a/kdb-bot/src/modules/level/__init__.py b/bot/src/modules/level/__init__.py similarity index 100% rename from kdb-bot/src/modules/level/__init__.py rename to bot/src/modules/level/__init__.py diff --git a/kdb-bot/src/modules/level/command/__init__.py b/bot/src/modules/level/command/__init__.py similarity index 100% rename from kdb-bot/src/modules/level/command/__init__.py rename to bot/src/modules/level/command/__init__.py diff --git a/kdb-bot/src/modules/level/command/level_group.py b/bot/src/modules/level/command/level_group.py similarity index 81% rename from kdb-bot/src/modules/level/command/level_group.py rename to bot/src/modules/level/command/level_group.py index 50e03692..e5dca679 100644 --- a/kdb-bot/src/modules/level/command/level_group.py +++ b/bot/src/modules/level/command/level_group.py @@ -108,13 +108,17 @@ class LevelGroup(DiscordCommandABC): except Exception as e: self._logger.error(__name__, f"Level seeding failed", e) - await self._message_service.send_ctx_msg(ctx, self._t.transform("modules.level.seeding_failed")) + await self._message_service.send_ctx_msg( + ctx, self._t.transform("modules.level.seeding_failed") + ) async def _level_auto_complete( self, interaction: discord.Interaction, current: str ) -> TList[app_commands.Choice[str]]: server = self._servers.get_server_by_discord_id(interaction.guild.id) - levels = self._levels.get_levels_by_server_id(server.id).select(lambda l: l.name) + levels = self._levels.get_levels_by_server_id(server.id).select( + lambda l: l.name + ) return [ app_commands.Choice(name=level, value=level) for level in self._client_utils.get_auto_complete_list(levels, current) @@ -134,14 +138,20 @@ class LevelGroup(DiscordCommandABC): if ctx.guild is None: return - server_config: ServerConfig = self._config.get_configuration(f"ServerConfig_{ctx.guild.id}") - if not FeatureFlagsSettings.get_flag_from_dict(server_config.feature_flags, FeatureFlagsEnum.level_module): + server_config: ServerConfig = self._config.get_configuration( + f"ServerConfig_{ctx.guild.id}" + ) + if not FeatureFlagsSettings.get_flag_from_dict( + server_config.feature_flags, FeatureFlagsEnum.level_module + ): return server = self._servers.get_server_by_discord_id(ctx.guild.id) levels = self._levels.get_levels_by_server_id(server.id) if levels.count() < 1: - await self._message_service.send_ctx_msg(ctx, self._t.transform("modules.level.error.nothing_found")) + await self._message_service.send_ctx_msg( + ctx, self._t.transform("modules.level.error.nothing_found") + ) self._logger.trace(__name__, f"Finished command level list") return @@ -163,7 +173,9 @@ class LevelGroup(DiscordCommandABC): value=level_name, inline=True, ) - embed.add_field(name=self._t.transform("modules.level.list.min_xp"), value=xp, inline=True) + embed.add_field( + name=self._t.transform("modules.level.list.min_xp"), value=xp, inline=True + ) embed.add_field( name=self._t.transform("modules.level.list.permission_int"), value=permissions, @@ -176,13 +188,19 @@ class LevelGroup(DiscordCommandABC): @commands.guild_only() @CommandChecks.check_is_ready() @CommandChecks.check_is_member_admin() - async def create(self, ctx: Context, name: str, color: str, min_xp: int, permissions: int): + async def create( + self, ctx: Context, name: str, color: str, min_xp: int, permissions: int + ): self._logger.debug(__name__, f"Received command level create {ctx}") if ctx.guild is None: return - server_config: ServerConfig = self._config.get_configuration(f"ServerConfig_{ctx.guild.id}") - if not FeatureFlagsSettings.get_flag_from_dict(server_config.feature_flags, FeatureFlagsEnum.level_module): + server_config: ServerConfig = self._config.get_configuration( + f"ServerConfig_{ctx.guild.id}" + ) + if not FeatureFlagsSettings.get_flag_from_dict( + server_config.feature_flags, FeatureFlagsEnum.level_module + ): return try: @@ -208,19 +226,26 @@ class LevelGroup(DiscordCommandABC): self._logger.debug(__name__, f"Level with name {level.name} already exists") await self._message_service.send_ctx_msg( ctx, - self._t.transform("modules.level.error.level_with_name_already_exists").format(level.name), + self._t.transform( + "modules.level.error.level_with_name_already_exists" + ).format(level.name), ) - elif levels.where(lambda l: l.min_xp == level.min_xp).first_or_default() is not None: + elif ( + levels.where(lambda l: l.min_xp == level.min_xp).first_or_default() + is not None + ): self._logger.debug( __name__, f"Level with min_xp {level.min_xp} already exists {level.name}", ) - found_level = levels.where(lambda l: l.min_xp == level.min_xp).first_or_default() + found_level = levels.where( + lambda l: l.min_xp == level.min_xp + ).first_or_default() await self._message_service.send_ctx_msg( ctx, - self._t.transform("modules.level.error.level_with_xp_already_exists").format( - found_level.name, found_level.min_xp - ), + self._t.transform( + "modules.level.error.level_with_xp_already_exists" + ).format(found_level.name, found_level.min_xp), ) else: try: @@ -239,7 +264,9 @@ class LevelGroup(DiscordCommandABC): else: await self._message_service.send_ctx_msg( ctx, - self._t.transform("modules.level.create.created").format(name, permissions), + self._t.transform("modules.level.create.created").format( + name, permissions + ), ) await self._seed_levels(ctx) @@ -276,13 +303,19 @@ class LevelGroup(DiscordCommandABC): if ctx.guild is None: return - server_config: ServerConfig = self._config.get_configuration(f"ServerConfig_{ctx.guild.id}") - if not FeatureFlagsSettings.get_flag_from_dict(server_config.feature_flags, FeatureFlagsEnum.level_module): + server_config: ServerConfig = self._config.get_configuration( + f"ServerConfig_{ctx.guild.id}" + ) + if not FeatureFlagsSettings.get_flag_from_dict( + server_config.feature_flags, FeatureFlagsEnum.level_module + ): return server = self._servers.get_server_by_discord_id(ctx.guild.id) level_from_db = ( - self._levels.get_levels_by_server_id(server.id).where(lambda l: l.name == level).single_or_default() + self._levels.get_levels_by_server_id(server.id) + .where(lambda l: l.name == level) + .single_or_default() ) if level_from_db is None: await self._message_service.send_ctx_msg( @@ -316,9 +349,13 @@ class LevelGroup(DiscordCommandABC): except Exception as e: await self._message_service.send_ctx_msg( ctx, - self._t.transform("modules.level.edit.permission_invalid").format(permissions), + self._t.transform("modules.level.edit.permission_invalid").format( + permissions + ), + ) + self._logger.error( + __name__, f"Error parsing permissions {permissions}", e ) - self._logger.error(__name__, f"Error parsing permissions {permissions}", e) return try: @@ -340,7 +377,9 @@ class LevelGroup(DiscordCommandABC): e, ) else: - await self._message_service.send_ctx_msg(ctx, self._t.transform("modules.level.edit.edited").format(level)) + await self._message_service.send_ctx_msg( + ctx, self._t.transform("modules.level.edit.edited").format(level) + ) await self._seed_levels(ctx) self._logger.trace(__name__, f"Finished command level edit") @@ -374,13 +413,19 @@ class LevelGroup(DiscordCommandABC): if ctx.guild is None: return - server_config: ServerConfig = self._config.get_configuration(f"ServerConfig_{ctx.guild.id}") - if not FeatureFlagsSettings.get_flag_from_dict(server_config.feature_flags, FeatureFlagsEnum.level_module): + server_config: ServerConfig = self._config.get_configuration( + f"ServerConfig_{ctx.guild.id}" + ) + if not FeatureFlagsSettings.get_flag_from_dict( + server_config.feature_flags, FeatureFlagsEnum.level_module + ): return server = self._servers.get_server_by_discord_id(ctx.guild.id) level_from_db = ( - self._levels.get_levels_by_server_id(server.id).where(lambda l: l.name == level).first_or_default() + self._levels.get_levels_by_server_id(server.id) + .where(lambda l: l.name == level) + .first_or_default() ) if level_from_db is None: self._logger.debug(__name__, f"level {level} not found") @@ -395,7 +440,9 @@ class LevelGroup(DiscordCommandABC): self._levels.delete_level(level_from_db) self._db.save_changes() guild: Guild = self._bot.guilds.where(lambda g: g == ctx.guild).single() - role: Role = guild.roles.where(lambda r: r.name == level).single_or_default() + role: Role = guild.roles.where( + lambda r: r.name == level + ).single_or_default() if role is not None: await role.delete() self._logger.info(__name__, f"Removed level {level}") @@ -424,8 +471,12 @@ class LevelGroup(DiscordCommandABC): if ctx.guild is None: return - server_config: ServerConfig = self._config.get_configuration(f"ServerConfig_{ctx.guild.id}") - if not FeatureFlagsSettings.get_flag_from_dict(server_config.feature_flags, FeatureFlagsEnum.level_module): + server_config: ServerConfig = self._config.get_configuration( + f"ServerConfig_{ctx.guild.id}" + ) + if not FeatureFlagsSettings.get_flag_from_dict( + server_config.feature_flags, FeatureFlagsEnum.level_module + ): return if member.bot: @@ -434,12 +485,16 @@ class LevelGroup(DiscordCommandABC): server = self._servers.get_server_by_discord_id(ctx.guild.id) user = self._users.get_user_by_discord_id_and_server_id(member.id, server.id) level = self._level_service.get_level(user) - levels = self._levels.get_levels_by_server_id(server.id).order_by(lambda l: l.min_xp) + levels = self._levels.get_levels_by_server_id(server.id).order_by( + lambda l: l.min_xp + ) if level == levels.first(): await self._message_service.send_ctx_msg( ctx, - self._t.transform("modules.level.down.already_first").format(member.mention), + self._t.transform("modules.level.down.already_first").format( + member.mention + ), ) self._logger.trace(__name__, f"Finished command level down") return @@ -451,11 +506,15 @@ class LevelGroup(DiscordCommandABC): self._db.save_changes() await self._message_service.send_ctx_msg( ctx, - self._t.transform("modules.level.down.success").format(member.mention, new_level.name), + self._t.transform("modules.level.down.success").format( + member.mention, new_level.name + ), ) await self._level_service.set_level(user) except Exception as e: - self._logger.error(__name__, f"Cannot level down {member.name} with level {level.name}", e) + self._logger.error( + __name__, f"Cannot level down {member.name} with level {level.name}", e + ) await self._message_service.send_ctx_msg( ctx, self._t.transform("modules.level.down.failed").format(member.mention), @@ -472,8 +531,12 @@ class LevelGroup(DiscordCommandABC): if ctx.guild is None: return - server_config: ServerConfig = self._config.get_configuration(f"ServerConfig_{ctx.guild.id}") - if not FeatureFlagsSettings.get_flag_from_dict(server_config.feature_flags, FeatureFlagsEnum.level_module): + server_config: ServerConfig = self._config.get_configuration( + f"ServerConfig_{ctx.guild.id}" + ) + if not FeatureFlagsSettings.get_flag_from_dict( + server_config.feature_flags, FeatureFlagsEnum.level_module + ): return if member.bot: @@ -482,12 +545,16 @@ class LevelGroup(DiscordCommandABC): server = self._servers.get_server_by_discord_id(ctx.guild.id) user = self._users.get_user_by_discord_id_and_server_id(member.id, server.id) level = self._level_service.get_level(user) - levels = self._levels.get_levels_by_server_id(server.id).order_by(lambda l: l.min_xp) + levels = self._levels.get_levels_by_server_id(server.id).order_by( + lambda l: l.min_xp + ) if level.name == levels.last().name: await self._message_service.send_ctx_msg( ctx, - self._t.transform("modules.level.up.already_last").format(member.mention), + self._t.transform("modules.level.up.already_last").format( + member.mention + ), ) self._logger.trace(__name__, f"Finished command level up") return @@ -499,11 +566,15 @@ class LevelGroup(DiscordCommandABC): self._db.save_changes() await self._message_service.send_ctx_msg( ctx, - self._t.transform("modules.level.up.success").format(member.mention, new_level.name), + self._t.transform("modules.level.up.success").format( + member.mention, new_level.name + ), ) await self._level_service.set_level(user) except Exception as e: - self._logger.error(__name__, f"Cannot level up {member.name} with level {level.name}", e) + self._logger.error( + __name__, f"Cannot level up {member.name} with level {level.name}", e + ) await self._message_service.send_ctx_msg( ctx, self._t.transform("modules.level.up.failed").format(member.mention) ) @@ -519,8 +590,12 @@ class LevelGroup(DiscordCommandABC): if ctx.guild is None: return - server_config: ServerConfig = self._config.get_configuration(f"ServerConfig_{ctx.guild.id}") - if not FeatureFlagsSettings.get_flag_from_dict(server_config.feature_flags, FeatureFlagsEnum.level_module): + server_config: ServerConfig = self._config.get_configuration( + f"ServerConfig_{ctx.guild.id}" + ) + if not FeatureFlagsSettings.get_flag_from_dict( + server_config.feature_flags, FeatureFlagsEnum.level_module + ): return if member.bot: @@ -529,7 +604,11 @@ class LevelGroup(DiscordCommandABC): server = self._servers.get_server_by_discord_id(ctx.guild.id) user = self._users.get_user_by_discord_id_and_server_id(member.id, server.id) current_level = self._level_service.get_level(user) - new_level = self._levels.get_levels_by_server_id(server.id).where(lambda l: l.name == level).single_or_default() + new_level = ( + self._levels.get_levels_by_server_id(server.id) + .where(lambda l: l.name == level) + .single_or_default() + ) if new_level is None: await self._message_service.send_ctx_msg( @@ -541,7 +620,9 @@ class LevelGroup(DiscordCommandABC): if current_level.name == level: await self._message_service.send_ctx_msg( ctx, - self._t.transform("modules.level.set.already_level").format(member.mention, level), + self._t.transform("modules.level.set.already_level").format( + member.mention, level + ), ) self._logger.trace(__name__, f"Finished command level set") return @@ -552,11 +633,15 @@ class LevelGroup(DiscordCommandABC): self._db.save_changes() await self._message_service.send_ctx_msg( ctx, - self._t.transform("modules.level.set.success").format(member.mention, new_level.name), + self._t.transform("modules.level.set.success").format( + member.mention, new_level.name + ), ) await self._level_service.set_level(user) except Exception as e: - self._logger.error(__name__, f"Cannot set level {level} for {member.name}", e) + self._logger.error( + __name__, f"Cannot set level {level} for {member.name}", e + ) await self._message_service.send_ctx_msg( ctx, self._t.transform("modules.level.set.failed").format(member.mention), @@ -565,7 +650,9 @@ class LevelGroup(DiscordCommandABC): self._logger.trace(__name__, f"Finished command level set") @set.autocomplete("level") - async def set_autocomplete(self, interaction: discord.Interaction, current: str) -> TList[app_commands.Choice[str]]: + async def set_autocomplete( + self, interaction: discord.Interaction, current: str + ) -> TList[app_commands.Choice[str]]: return await self._level_auto_complete(interaction, current) @level.command() @@ -577,8 +664,12 @@ class LevelGroup(DiscordCommandABC): if ctx.guild is None: return - server_config: ServerConfig = self._config.get_configuration(f"ServerConfig_{ctx.guild.id}") - if not FeatureFlagsSettings.get_flag_from_dict(server_config.feature_flags, FeatureFlagsEnum.level_module): + server_config: ServerConfig = self._config.get_configuration( + f"ServerConfig_{ctx.guild.id}" + ) + if not FeatureFlagsSettings.get_flag_from_dict( + server_config.feature_flags, FeatureFlagsEnum.level_module + ): return await self._seed_levels(ctx) diff --git a/kdb-bot/src/modules/level/configuration/__init__.py b/bot/src/modules/level/configuration/__init__.py similarity index 100% rename from kdb-bot/src/modules/level/configuration/__init__.py rename to bot/src/modules/level/configuration/__init__.py diff --git a/kdb-bot/src/modules/level/configuration/default_level_settings.py b/bot/src/modules/level/configuration/default_level_settings.py similarity index 100% rename from kdb-bot/src/modules/level/configuration/default_level_settings.py rename to bot/src/modules/level/configuration/default_level_settings.py diff --git a/kdb-bot/src/modules/level/default-level.json b/bot/src/modules/level/default-level.json similarity index 100% rename from kdb-bot/src/modules/level/default-level.json rename to bot/src/modules/level/default-level.json diff --git a/kdb-bot/src/modules/level/events/__init__.py b/bot/src/modules/level/events/__init__.py similarity index 100% rename from kdb-bot/src/modules/level/events/__init__.py rename to bot/src/modules/level/events/__init__.py diff --git a/kdb-bot/src/modules/level/events/level_on_member_join_event.py b/bot/src/modules/level/events/level_on_member_join_event.py similarity index 75% rename from kdb-bot/src/modules/level/events/level_on_member_join_event.py rename to bot/src/modules/level/events/level_on_member_join_event.py index 7113f761..94f74841 100644 --- a/kdb-bot/src/modules/level/events/level_on_member_join_event.py +++ b/bot/src/modules/level/events/level_on_member_join_event.py @@ -11,7 +11,9 @@ from modules.level.service.level_service import LevelService class LevelOnMemberJoinEvent(OnMemberJoinABC): - def __init__(self, config: ConfigurationABC, logger: MessageLogger, level: LevelService): + def __init__( + self, config: ConfigurationABC, logger: MessageLogger, level: LevelService + ): OnMemberJoinABC.__init__(self) self._config = config self._logger = logger @@ -20,8 +22,12 @@ class LevelOnMemberJoinEvent(OnMemberJoinABC): @EventChecks.check_is_ready() async def on_member_join(self, member: discord.Member): self._logger.debug(__name__, f"Module {type(self)} started") - server_config: ServerConfig = self._config.get_configuration(f"ServerConfig_{member.guild.id}") - if not FeatureFlagsSettings.get_flag_from_dict(server_config.feature_flags, FeatureFlagsEnum.level_module): + server_config: ServerConfig = self._config.get_configuration( + f"ServerConfig_{member.guild.id}" + ) + if not FeatureFlagsSettings.get_flag_from_dict( + server_config.feature_flags, FeatureFlagsEnum.level_module + ): return await self._level.check_level(member) diff --git a/kdb-bot/src/modules/level/events/level_on_message_event.py b/bot/src/modules/level/events/level_on_message_event.py similarity index 79% rename from kdb-bot/src/modules/level/events/level_on_message_event.py rename to bot/src/modules/level/events/level_on_message_event.py index 4c98706f..94141f78 100644 --- a/kdb-bot/src/modules/level/events/level_on_message_event.py +++ b/bot/src/modules/level/events/level_on_message_event.py @@ -11,7 +11,9 @@ from modules.level.service.level_service import LevelService class LevelOnMessageEvent(OnMessageABC): - def __init__(self, config: ConfigurationABC, logger: MessageLogger, level: LevelService): + def __init__( + self, config: ConfigurationABC, logger: MessageLogger, level: LevelService + ): OnMessageABC.__init__(self) self._config = config self._logger = logger @@ -26,8 +28,12 @@ class LevelOnMessageEvent(OnMessageABC): if message.author.bot: return - server_config: ServerConfig = self._config.get_configuration(f"ServerConfig_{message.guild.id}") - if not FeatureFlagsSettings.get_flag_from_dict(server_config.feature_flags, FeatureFlagsEnum.level_module): + server_config: ServerConfig = self._config.get_configuration( + f"ServerConfig_{message.guild.id}" + ) + if not FeatureFlagsSettings.get_flag_from_dict( + server_config.feature_flags, FeatureFlagsEnum.level_module + ): return try: diff --git a/kdb-bot/src/modules/level/events/level_on_raw_reaction_add_event.py b/bot/src/modules/level/events/level_on_raw_reaction_add_event.py similarity index 88% rename from kdb-bot/src/modules/level/events/level_on_raw_reaction_add_event.py rename to bot/src/modules/level/events/level_on_raw_reaction_add_event.py index bffc56ef..b59ce939 100644 --- a/kdb-bot/src/modules/level/events/level_on_raw_reaction_add_event.py +++ b/bot/src/modules/level/events/level_on_raw_reaction_add_event.py @@ -29,8 +29,12 @@ class LevelOnRawReactionAddEvent(OnRawReactionAddABC): @EventChecks.check_is_ready() async def on_raw_reaction_add(self, payload: RawReactionActionEvent): self._logger.debug(__name__, f"Module {type(self)} started") - server_config: ServerConfig = self._config.get_configuration(f"ServerConfig_{payload.guild_id}") - if not FeatureFlagsSettings.get_flag_from_dict(server_config.feature_flags, FeatureFlagsEnum.level_module): + server_config: ServerConfig = self._config.get_configuration( + f"ServerConfig_{payload.guild_id}" + ) + if not FeatureFlagsSettings.get_flag_from_dict( + server_config.feature_flags, FeatureFlagsEnum.level_module + ): return try: diff --git a/kdb-bot/src/modules/level/events/level_on_raw_reaction_remove_event.py b/bot/src/modules/level/events/level_on_raw_reaction_remove_event.py similarity index 88% rename from kdb-bot/src/modules/level/events/level_on_raw_reaction_remove_event.py rename to bot/src/modules/level/events/level_on_raw_reaction_remove_event.py index fa94e334..fceccd0b 100644 --- a/kdb-bot/src/modules/level/events/level_on_raw_reaction_remove_event.py +++ b/bot/src/modules/level/events/level_on_raw_reaction_remove_event.py @@ -29,8 +29,12 @@ class LevelOnRawReactionRemoveEvent(OnRawReactionRemoveABC): @EventChecks.check_is_ready() async def on_raw_reaction_remove(self, payload: RawReactionActionEvent): self._logger.debug(__name__, f"Module {type(self)} started") - server_config: ServerConfig = self._config.get_configuration(f"ServerConfig_{payload.guild_id}") - if not FeatureFlagsSettings.get_flag_from_dict(server_config.feature_flags, FeatureFlagsEnum.level_module): + server_config: ServerConfig = self._config.get_configuration( + f"ServerConfig_{payload.guild_id}" + ) + if not FeatureFlagsSettings.get_flag_from_dict( + server_config.feature_flags, FeatureFlagsEnum.level_module + ): return try: diff --git a/kdb-bot/src/modules/level/events/level_on_voice_state_update_event.py b/bot/src/modules/level/events/level_on_voice_state_update_event.py similarity index 78% rename from kdb-bot/src/modules/level/events/level_on_voice_state_update_event.py rename to bot/src/modules/level/events/level_on_voice_state_update_event.py index 9a0b5978..c529311c 100644 --- a/kdb-bot/src/modules/level/events/level_on_voice_state_update_event.py +++ b/bot/src/modules/level/events/level_on_voice_state_update_event.py @@ -11,7 +11,9 @@ from modules.level.service.level_service import LevelService class LevelOnVoiceStateUpdateEvent(OnVoiceStateUpdateABC): - def __init__(self, config: ConfigurationABC, logger: LoggerABC, level: LevelService): + def __init__( + self, config: ConfigurationABC, logger: LoggerABC, level: LevelService + ): OnVoiceStateUpdateABC.__init__(self) self._config = config self._logger = logger @@ -27,8 +29,12 @@ class LevelOnVoiceStateUpdateEvent(OnVoiceStateUpdateABC): after: discord.VoiceState, ): self._logger.debug(__name__, f"Module {type(self)} started") - server_config: ServerConfig = self._config.get_configuration(f"ServerConfig_{member.guild.id}") - if not FeatureFlagsSettings.get_flag_from_dict(server_config.feature_flags, FeatureFlagsEnum.level_module): + server_config: ServerConfig = self._config.get_configuration( + f"ServerConfig_{member.guild.id}" + ) + if not FeatureFlagsSettings.get_flag_from_dict( + server_config.feature_flags, FeatureFlagsEnum.level_module + ): return await self._level.check_level(member) diff --git a/kdb-bot/src/modules/level/level.json b/bot/src/modules/level/level.json similarity index 100% rename from kdb-bot/src/modules/level/level.json rename to bot/src/modules/level/level.json diff --git a/kdb-bot/src/modules/level/level_module.py b/bot/src/modules/level/level_module.py similarity index 68% rename from kdb-bot/src/modules/level/level_module.py rename to bot/src/modules/level/level_module.py index fced470c..19e04459 100644 --- a/kdb-bot/src/modules/level/level_module.py +++ b/bot/src/modules/level/level_module.py @@ -12,8 +12,12 @@ from bot_data.abc.data_seeder_abc import DataSeederABC from modules.level.command.level_group import LevelGroup from modules.level.events.level_on_member_join_event import LevelOnMemberJoinEvent from modules.level.events.level_on_message_event import LevelOnMessageEvent -from modules.level.events.level_on_raw_reaction_add_event import LevelOnRawReactionAddEvent -from modules.level.events.level_on_raw_reaction_remove_event import LevelOnRawReactionRemoveEvent +from modules.level.events.level_on_raw_reaction_add_event import ( + LevelOnRawReactionAddEvent, +) +from modules.level.events.level_on_raw_reaction_remove_event import ( + LevelOnRawReactionRemoveEvent, +) from modules.level.events.level_on_voice_state_update_event import ( LevelOnVoiceStateUpdateEvent, ) @@ -25,13 +29,17 @@ class LevelModule(ModuleABC): def __init__(self, dc: DiscordCollectionABC): ModuleABC.__init__(self, dc, FeatureFlagsEnum.level_module) - def configure_configuration(self, config: ConfigurationABC, env: ApplicationEnvironmentABC): + def configure_configuration( + self, config: ConfigurationABC, env: ApplicationEnvironmentABC + ): cwd = env.working_directory env.set_working_directory(os.path.dirname(os.path.realpath(__file__))) config.add_json_file(f"default-level.json", optional=False) env.set_working_directory(cwd) - def configure_services(self, services: ServiceCollectionABC, env: ApplicationEnvironmentABC): + def configure_services( + self, services: ServiceCollectionABC, env: ApplicationEnvironmentABC + ): services.add_transient(DataSeederABC, LevelSeeder) services.add_transient(LevelService) @@ -39,11 +47,20 @@ class LevelModule(ModuleABC): services.add_transient(LevelGroup) # events - services.add_transient(DiscordEventTypesEnum.on_message.value, LevelOnMessageEvent) + services.add_transient( + DiscordEventTypesEnum.on_message.value, LevelOnMessageEvent + ) services.add_transient( DiscordEventTypesEnum.on_voice_state_update.value, LevelOnVoiceStateUpdateEvent, ) - services.add_transient(DiscordEventTypesEnum.on_member_join.value, LevelOnMemberJoinEvent) - services.add_transient(DiscordEventTypesEnum.on_raw_reaction_add.value, LevelOnRawReactionAddEvent) - services.add_transient(DiscordEventTypesEnum.on_raw_reaction_remove.value, LevelOnRawReactionRemoveEvent) + services.add_transient( + DiscordEventTypesEnum.on_member_join.value, LevelOnMemberJoinEvent + ) + services.add_transient( + DiscordEventTypesEnum.on_raw_reaction_add.value, LevelOnRawReactionAddEvent + ) + services.add_transient( + DiscordEventTypesEnum.on_raw_reaction_remove.value, + LevelOnRawReactionRemoveEvent, + ) diff --git a/kdb-bot/src/modules/level/level_seeder.py b/bot/src/modules/level/level_seeder.py similarity index 79% rename from kdb-bot/src/modules/level/level_seeder.py rename to bot/src/modules/level/level_seeder.py index 19c7b773..e0f81148 100644 --- a/kdb-bot/src/modules/level/level_seeder.py +++ b/bot/src/modules/level/level_seeder.py @@ -46,7 +46,10 @@ class LevelSeeder(DataSeederABC): async def _create_level(self, level: Level, guild: Guild, server: Server): level.server = server try: - if guild.roles.where(lambda r: r.name == level.name).first_or_default() is None: + if ( + guild.roles.where(lambda r: r.name == level.name).first_or_default() + is None + ): await guild.create_role( name=level.name, colour=Colour(int(level.color, 16)), @@ -57,7 +60,11 @@ class LevelSeeder(DataSeederABC): self._logger.debug(__name__, f"Created role {level.name}") levels = self._levels.find_levels_by_server_id(server.id) - if levels is None or levels.where(lambda l: l.name == level.name).first_or_default() is None: + if ( + levels is None + or levels.where(lambda l: l.name == level.name).first_or_default() + is None + ): self._levels.add_level(level) self._logger.debug(__name__, f"Saved level {level.name}") self._db.save_changes() @@ -71,12 +78,21 @@ class LevelSeeder(DataSeederABC): async def seed(self): # create levels for guild in self._bot.guilds: - server_config: ServerConfig = self._config.get_configuration(f"ServerConfig_{guild.id}") - if not FeatureFlagsSettings.get_flag_from_dict(server_config.feature_flags, FeatureFlagsEnum.level_module): + server_config: ServerConfig = self._config.get_configuration( + f"ServerConfig_{guild.id}" + ) + if not FeatureFlagsSettings.get_flag_from_dict( + server_config.feature_flags, FeatureFlagsEnum.level_module + ): continue created_default = False - if guild.roles.where(lambda r: r.name == self._level_header).first_or_default() is None: + if ( + guild.roles.where( + lambda r: r.name == self._level_header + ).first_or_default() + is None + ): await guild.create_role(name=self._level_header) server = self._servers.find_server_by_discord_id(guild.id) @@ -102,13 +118,20 @@ class LevelSeeder(DataSeederABC): continue levels = levels.order_by_descending(lambda l: l.min_xp) - position_above_levels = guild.roles.where(lambda r: r.name == self._level_header).single().position + position_above_levels = ( + guild.roles.where(lambda r: r.name == self._level_header) + .single() + .position + ) for role in guild.roles.order_by_descending(lambda r: r.position): if levels.where(lambda l: l.name == role.name).count() == 0: continue new_position = position_above_levels - ( - levels.index_of(levels.where(lambda l: l.name == role.name).single()) + 1 + levels.index_of( + levels.where(lambda l: l.name == role.name).single() + ) + + 1 ) if new_position <= 0: new_position = 1 @@ -119,7 +142,9 @@ class LevelSeeder(DataSeederABC): ) await role.edit(position=new_position) except Exception as e: - self._logger.error(__name__, f"Cannot change position of {role.name}", e) + self._logger.error( + __name__, f"Cannot change position of {role.name}", e + ) for m in guild.members: await self._level.check_level(m) diff --git a/kdb-bot/src/modules/level/service/__init__.py b/bot/src/modules/level/service/__init__.py similarity index 100% rename from kdb-bot/src/modules/level/service/__init__.py rename to bot/src/modules/level/service/__init__.py diff --git a/kdb-bot/src/modules/level/service/level_service.py b/bot/src/modules/level/service/level_service.py similarity index 73% rename from kdb-bot/src/modules/level/service/level_service.py rename to bot/src/modules/level/service/level_service.py index e85c1719..258bec27 100644 --- a/kdb-bot/src/modules/level/service/level_service.py +++ b/bot/src/modules/level/service/level_service.py @@ -43,7 +43,9 @@ class LevelService: if user.xp < 0: return levels_by_server.order_by(lambda l: l.min_xp).first() - levels = levels_by_server.order_by(lambda l: l.min_xp).where(lambda l: user.xp >= l.min_xp) + levels = levels_by_server.order_by(lambda l: l.min_xp).where( + lambda l: user.xp >= l.min_xp + ) if levels.count() == 0: return levels_by_server.order_by(lambda l: l.min_xp).last() @@ -51,8 +53,12 @@ class LevelService: return levels.last() async def set_level(self, user: User): - level_names = self._levels.get_levels_by_server_id(user.server.id).select(lambda l: l.name) - guild: Guild = self._bot.guilds.where(lambda g: g.id == user.server.discord_id).single() + level_names = self._levels.get_levels_by_server_id(user.server.id).select( + lambda l: l.name + ) + guild: Guild = self._bot.guilds.where( + lambda g: g.id == user.server.discord_id + ).single() member: Member = guild.members.where(lambda m: m.id == user.discord_id).single() level = self.get_level(user) @@ -63,25 +69,39 @@ class LevelService: notification_needed = False for role in member.roles.where(lambda r: r.name in level_names.to_list()): try: - self._logger.debug(__name__, f"Try to remove role {role.name} from {member.name}") + self._logger.debug( + __name__, f"Try to remove role {role.name} from {member.name}" + ) await member.remove_roles(role) notification_needed = True - self._logger.info(__name__, f"Removed role {role.name} from {member.name}") + self._logger.info( + __name__, f"Removed role {role.name} from {member.name}" + ) except Exception as e: - self._logger.error(__name__, f"Removing role {role.name} from {member.name} failed!", e) + self._logger.error( + __name__, f"Removing role {role.name} from {member.name} failed!", e + ) try: - self._logger.debug(__name__, f"Try to add role {level_role.name} to {member.name}") + self._logger.debug( + __name__, f"Try to add role {level_role.name} to {member.name}" + ) await member.add_roles(level_role) self._logger.info(__name__, f"Add role {level_role.name} to {member.name}") except Exception as e: - self._logger.error(__name__, f"Adding role {level_role.name} to {member.name} failed!", e) + self._logger.error( + __name__, f"Adding role {level_role.name} to {member.name} failed!", e + ) if notification_needed: - settings: ServerConfig = self._config.get_configuration(f"ServerConfig_{guild.id}") + settings: ServerConfig = self._config.get_configuration( + f"ServerConfig_{guild.id}" + ) await self._message_service.send_channel_message( self._bot.get_channel(settings.notification_chat_id), - self._t.transform("modules.level.new_level_message").format(member.mention, level.name), + self._t.transform("modules.level.new_level_message").format( + member.mention, level.name + ), is_persistent=True, ) @@ -92,7 +112,9 @@ class LevelService: server = self._servers.get_server_by_discord_id(member.guild.id) user = self._users.find_user_by_discord_id_and_server_id(member.id, server.id) if user is None: - self._logger.warn(__name__, f"User not found {member.guild.name}@{member.name}") + self._logger.warn( + __name__, f"User not found {member.guild.name}@{member.name}" + ) return await self.set_level(user) diff --git a/kdb-bot/src/modules/permission/__init__.py b/bot/src/modules/permission/__init__.py similarity index 100% rename from kdb-bot/src/modules/permission/__init__.py rename to bot/src/modules/permission/__init__.py diff --git a/kdb-bot/src/modules/permission/abc/__init__.py b/bot/src/modules/permission/abc/__init__.py similarity index 100% rename from kdb-bot/src/modules/permission/abc/__init__.py rename to bot/src/modules/permission/abc/__init__.py diff --git a/kdb-bot/src/modules/permission/abc/permission_service_abc.py b/bot/src/modules/permission/abc/permission_service_abc.py similarity index 100% rename from kdb-bot/src/modules/permission/abc/permission_service_abc.py rename to bot/src/modules/permission/abc/permission_service_abc.py diff --git a/kdb-bot/src/modules/permission/permission.json b/bot/src/modules/permission/permission.json similarity index 100% rename from kdb-bot/src/modules/permission/permission.json rename to bot/src/modules/permission/permission.json diff --git a/kdb-bot/src/modules/permission/permission_module.py b/bot/src/modules/permission/permission_module.py similarity index 78% rename from kdb-bot/src/modules/permission/permission_module.py rename to bot/src/modules/permission/permission_module.py index 75da783e..fb6c509d 100644 --- a/kdb-bot/src/modules/permission/permission_module.py +++ b/bot/src/modules/permission/permission_module.py @@ -13,10 +13,14 @@ class PermissionModule(ModuleABC): def __init__(self, dc: DiscordCollectionABC): ModuleABC.__init__(self, dc, FeatureFlagsEnum.permission_module) - def configure_configuration(self, config: ConfigurationABC, env: ApplicationEnvironmentABC): + def configure_configuration( + self, config: ConfigurationABC, env: ApplicationEnvironmentABC + ): pass - def configure_services(self, services: ServiceCollectionABC, env: ApplicationEnvironmentABC): + def configure_services( + self, services: ServiceCollectionABC, env: ApplicationEnvironmentABC + ): services.add_transient(PermissionServiceABC, PermissionService) # commands # events diff --git a/kdb-bot/src/modules/permission/service/__init__.py b/bot/src/modules/permission/service/__init__.py similarity index 100% rename from kdb-bot/src/modules/permission/service/__init__.py rename to bot/src/modules/permission/service/__init__.py diff --git a/kdb-bot/src/modules/permission/service/permission_service.py b/bot/src/modules/permission/service/permission_service.py similarity index 80% rename from kdb-bot/src/modules/permission/service/permission_service.py rename to bot/src/modules/permission/service/permission_service.py index 9ac28c55..c75175e7 100644 --- a/kdb-bot/src/modules/permission/service/permission_service.py +++ b/bot/src/modules/permission/service/permission_service.py @@ -28,18 +28,22 @@ class PermissionService(PermissionServiceABC): self._server_configs = server_configs self._technician_configs = technician_configs - def _has_member_role(self, member: discord.Member, team_member_type: TeamMemberTypeEnum) -> bool: + def _has_member_role( + self, member: discord.Member, team_member_type: TeamMemberTypeEnum + ) -> bool: if member is None or member.guild is None: return False - self._logger.debug(__name__, f"Checking is member {member.name} {team_member_type.value}") + self._logger.debug( + __name__, f"Checking is member {member.name} {team_member_type.value}" + ) try: server = self._servers.get_server_by_discord_id(member.guild.id) config = self._server_configs.get_server_config_by_server(server.id) - roles = config.team_role_ids.where(lambda x: x.team_member_type == team_member_type).select( - lambda x: member.guild.get_role(x.role_id) - ) + roles = config.team_role_ids.where( + lambda x: x.team_member_type == team_member_type + ).select(lambda x: member.guild.get_role(x.role_id)) for role in roles: if role not in member.roles: continue @@ -54,9 +58,9 @@ class PermissionService(PermissionServiceABC): return self._has_member_role(member, TeamMemberTypeEnum.admin) def is_member_moderator(self, member: discord.Member) -> bool: - return self._has_member_role(member, TeamMemberTypeEnum.moderator) or self._has_member_role( - member, TeamMemberTypeEnum.admin - ) + return self._has_member_role( + member, TeamMemberTypeEnum.moderator + ) or self._has_member_role(member, TeamMemberTypeEnum.admin) def is_member_technician(self, member: discord.Member) -> bool: if member is None or member.guild is None: diff --git a/kdb-bot/src/modules/short_role_name/__init__.py b/bot/src/modules/short_role_name/__init__.py similarity index 100% rename from kdb-bot/src/modules/short_role_name/__init__.py rename to bot/src/modules/short_role_name/__init__.py diff --git a/kdb-bot/src/modules/short_role_name/events/__init__.py b/bot/src/modules/short_role_name/events/__init__.py similarity index 100% rename from kdb-bot/src/modules/short_role_name/events/__init__.py rename to bot/src/modules/short_role_name/events/__init__.py diff --git a/kdb-bot/src/modules/short_role_name/events/short_role_name_on_member_update_event.py b/bot/src/modules/short_role_name/events/short_role_name_on_member_update_event.py similarity index 80% rename from kdb-bot/src/modules/short_role_name/events/short_role_name_on_member_update_event.py rename to bot/src/modules/short_role_name/events/short_role_name_on_member_update_event.py index 6b942ed1..574b3379 100644 --- a/kdb-bot/src/modules/short_role_name/events/short_role_name_on_member_update_event.py +++ b/bot/src/modules/short_role_name/events/short_role_name_on_member_update_event.py @@ -9,6 +9,8 @@ class ShortRoleNameOnMemberUpdateEvent(OnMemberUpdateABC): OnMemberUpdateABC.__init__(self) self._service = service - async def on_member_update(self, before: discord.member.Member, after: discord.member.Member): + async def on_member_update( + self, before: discord.member.Member, after: discord.member.Member + ): if before.roles != after.roles or before.name != after.name: await self._service.check_short_role_names(after) diff --git a/kdb-bot/src/modules/short_role_name/service/__init__.py b/bot/src/modules/short_role_name/service/__init__.py similarity index 100% rename from kdb-bot/src/modules/short_role_name/service/__init__.py rename to bot/src/modules/short_role_name/service/__init__.py diff --git a/kdb-bot/src/modules/short_role_name/service/short_role_name_service.py b/bot/src/modules/short_role_name/service/short_role_name_service.py similarity index 89% rename from kdb-bot/src/modules/short_role_name/service/short_role_name_service.py rename to bot/src/modules/short_role_name/service/short_role_name_service.py index 5a2e8af8..f85f2d01 100644 --- a/kdb-bot/src/modules/short_role_name/service/short_role_name_service.py +++ b/bot/src/modules/short_role_name/service/short_role_name_service.py @@ -32,8 +32,12 @@ class ShortRoleNameService: async def check_short_role_names(self, member: discord.Member): self._logger.debug(__name__, f"Started short role name check for {member.id}") - settings: ServerConfig = self._config.get_configuration(f"ServerConfig_{member.guild.id}") - if not FeatureFlagsSettings.get_flag_from_dict(settings.feature_flags, FeatureFlagsEnum.short_role_name): + settings: ServerConfig = self._config.get_configuration( + f"ServerConfig_{member.guild.id}" + ) + if not FeatureFlagsSettings.get_flag_from_dict( + settings.feature_flags, FeatureFlagsEnum.short_role_name + ): self._logger.debug(__name__, f"Feature not active") return @@ -45,12 +49,16 @@ class ShortRoleNameService: new_nick = member.nick if member.nick is not None else member.name member_roles = List(discord.Role, member.roles) highest_role: Optional[discord.Role] = ( - member_roles.last_or_default() if settings.short_role_name_only_set_highest_role else None + member_roles.last_or_default() + if settings.short_role_name_only_set_highest_role + else None ) member_role_ids = member_roles.select(lambda x: x.id) server = self._server.get_server_by_discord_id(member.guild.id) - for short_role_name in self._short_role_names.get_short_role_names_by_server_id(server.id): + for short_role_name in self._short_role_names.get_short_role_names_by_server_id( + server.id + ): short_role_name: ShortRoleName = short_role_name new_nick = new_nick.replace(f" [{short_role_name.short_name}]", "") diff --git a/kdb-bot/src/modules/short_role_name/short-role-name.json b/bot/src/modules/short_role_name/short-role-name.json similarity index 100% rename from kdb-bot/src/modules/short_role_name/short-role-name.json rename to bot/src/modules/short_role_name/short-role-name.json diff --git a/kdb-bot/src/modules/short_role_name/short_role_name_check_command.py b/bot/src/modules/short_role_name/short_role_name_check_command.py similarity index 82% rename from kdb-bot/src/modules/short_role_name/short_role_name_check_command.py rename to bot/src/modules/short_role_name/short_role_name_check_command.py index 663be0f1..feb35a99 100644 --- a/kdb-bot/src/modules/short_role_name/short_role_name_check_command.py +++ b/bot/src/modules/short_role_name/short_role_name_check_command.py @@ -47,14 +47,22 @@ class ShortRoleNameCheckCommand(DiscordCommandABC): if ctx.guild is None: return - settings: ServerConfig = self._config.get_configuration(f"ServerConfig_{ctx.guild.id}") - if not FeatureFlagsSettings.get_flag_from_dict(settings.feature_flags, FeatureFlagsEnum.short_role_name): - await self._message_service.send_ctx_msg(ctx, self._t.transform("common.feature_not_activated")) + settings: ServerConfig = self._config.get_configuration( + f"ServerConfig_{ctx.guild.id}" + ) + if not FeatureFlagsSettings.get_flag_from_dict( + settings.feature_flags, FeatureFlagsEnum.short_role_name + ): + await self._message_service.send_ctx_msg( + ctx, self._t.transform("common.feature_not_activated") + ) return for member in ctx.guild.members: await self._service.check_short_role_names(member) - await self._message_service.send_ctx_msg(ctx, self._t.transform("modules.short_role_name.checked_message")) + await self._message_service.send_ctx_msg( + ctx, self._t.transform("modules.short_role_name.checked_message") + ) self._logger.trace(__name__, f"Finished purge command") diff --git a/kdb-bot/src/modules/short_role_name/short_role_name_module.py b/bot/src/modules/short_role_name/short_role_name_module.py similarity index 71% rename from kdb-bot/src/modules/short_role_name/short_role_name_module.py rename to bot/src/modules/short_role_name/short_role_name_module.py index 6eff2a02..224e52d9 100644 --- a/kdb-bot/src/modules/short_role_name/short_role_name_module.py +++ b/bot/src/modules/short_role_name/short_role_name_module.py @@ -7,9 +7,13 @@ from cpl_discord.service.discord_collection_abc import DiscordCollectionABC from bot_core.abc.module_abc import ModuleABC from bot_core.configuration.feature_flags_enum import FeatureFlagsEnum from bot_data.abc.data_seeder_abc import DataSeederABC -from modules.short_role_name.events.short_role_name_on_member_update_event import ShortRoleNameOnMemberUpdateEvent +from modules.short_role_name.events.short_role_name_on_member_update_event import ( + ShortRoleNameOnMemberUpdateEvent, +) from modules.short_role_name.service.short_role_name_service import ShortRoleNameService -from modules.short_role_name.short_role_name_check_command import ShortRoleNameCheckCommand +from modules.short_role_name.short_role_name_check_command import ( + ShortRoleNameCheckCommand, +) from modules.short_role_name.short_role_name_seeder import ShortRoleNameSeeder @@ -17,14 +21,21 @@ class ShortRoleNameModule(ModuleABC): def __init__(self, dc: DiscordCollectionABC): ModuleABC.__init__(self, dc, FeatureFlagsEnum.short_role_name_module) - def configure_configuration(self, config: ConfigurationABC, env: ApplicationEnvironmentABC): + def configure_configuration( + self, config: ConfigurationABC, env: ApplicationEnvironmentABC + ): pass - def configure_services(self, services: ServiceCollectionABC, env: ApplicationEnvironmentABC): + def configure_services( + self, services: ServiceCollectionABC, env: ApplicationEnvironmentABC + ): services.add_transient(DataSeederABC, ShortRoleNameSeeder) services.add_transient(ShortRoleNameService) # commands services.add_transient(ShortRoleNameCheckCommand) # events - services.add_transient(DiscordEventTypesEnum.on_member_update.value, ShortRoleNameOnMemberUpdateEvent) + services.add_transient( + DiscordEventTypesEnum.on_member_update.value, + ShortRoleNameOnMemberUpdateEvent, + ) diff --git a/kdb-bot/src/modules/short_role_name/short_role_name_seeder.py b/bot/src/modules/short_role_name/short_role_name_seeder.py similarity index 100% rename from kdb-bot/src/modules/short_role_name/short_role_name_seeder.py rename to bot/src/modules/short_role_name/short_role_name_seeder.py diff --git a/kdb-bot/src/modules/special_offers/__init__.py b/bot/src/modules/special_offers/__init__.py similarity index 100% rename from kdb-bot/src/modules/special_offers/__init__.py rename to bot/src/modules/special_offers/__init__.py diff --git a/kdb-bot/src/modules/special_offers/special-offers.json b/bot/src/modules/special_offers/special-offers.json similarity index 100% rename from kdb-bot/src/modules/special_offers/special-offers.json rename to bot/src/modules/special_offers/special-offers.json diff --git a/kdb-bot/src/modules/special_offers/special_offers_module.py b/bot/src/modules/special_offers/special_offers_module.py similarity index 77% rename from kdb-bot/src/modules/special_offers/special_offers_module.py rename to bot/src/modules/special_offers/special_offers_module.py index e64108b5..4a35120d 100644 --- a/kdb-bot/src/modules/special_offers/special_offers_module.py +++ b/bot/src/modules/special_offers/special_offers_module.py @@ -13,10 +13,14 @@ class SteamSpecialOffersModule(ModuleABC): def __init__(self, dc: DiscordCollectionABC): ModuleABC.__init__(self, dc, FeatureFlagsEnum.steam_special_offers_module) - def configure_configuration(self, config: ConfigurationABC, env: ApplicationEnvironmentABC): + def configure_configuration( + self, config: ConfigurationABC, env: ApplicationEnvironmentABC + ): pass - def configure_services(self, services: ServiceCollectionABC, env: ApplicationEnvironmentABC): + def configure_services( + self, services: ServiceCollectionABC, env: ApplicationEnvironmentABC + ): services.add_singleton(TaskABC, SteamOfferWatcher) # commands # events diff --git a/kdb-bot/src/modules/special_offers/steam_offer_watcher.py b/bot/src/modules/special_offers/steam_offer_watcher.py similarity index 81% rename from kdb-bot/src/modules/special_offers/steam_offer_watcher.py rename to bot/src/modules/special_offers/steam_offer_watcher.py index 0aedda1d..b31e6a6a 100644 --- a/kdb-bot/src/modules/special_offers/steam_offer_watcher.py +++ b/bot/src/modules/special_offers/steam_offer_watcher.py @@ -16,7 +16,9 @@ from bot_core.configuration.feature_flags_enum import FeatureFlagsEnum from bot_core.configuration.feature_flags_settings import FeatureFlagsSettings from bot_core.logging.task_logger import TaskLogger from bot_core.service.message_service import MessageService -from bot_data.abc.steam_special_offer_repository_abc import SteamSpecialOfferRepositoryABC +from bot_data.abc.steam_special_offer_repository_abc import ( + SteamSpecialOfferRepositoryABC, +) from bot_data.model.server_config import ServerConfig from bot_data.model.steam_special_offer import SteamSpecialOffer @@ -51,7 +53,9 @@ class SteamOfferWatcher(TaskABC): @staticmethod def _get_max_count() -> int: count = 0 - result = requests.get(f"https://store.steampowered.com/search/results?specials=1") + result = requests.get( + f"https://store.steampowered.com/search/results?specials=1" + ) soup = bs4.BeautifulSoup(result.text, "lxml") element = soup.find_all("div", {"class": "search_results_count"}) if len(element) < 1: @@ -73,9 +77,13 @@ class SteamOfferWatcher(TaskABC): for element in elements: name_element = element.find("span", {"class": "title"}) - original_price_element = element.find("div", {"class": "discount_original_price"}) + original_price_element = element.find( + "div", {"class": "discount_original_price"} + ) discount_element = element.find("div", {"class": "discount_pct"}) - discount_price_element = element.find("div", {"class": "discount_final_price"}) + discount_price_element = element.find( + "div", {"class": "discount_final_price"} + ) if ( name_element is None @@ -91,15 +99,25 @@ class SteamOfferWatcher(TaskABC): name = name_element.contents[0].replace("'", "`").replace('"', "`") original_price = float( - original_price_element.contents[0].replace(" ", "").replace("€", "").replace(",", ".") + original_price_element.contents[0] + .replace(" ", "") + .replace("€", "") + .replace(",", ".") ) discount = int(discount_element.contents[0].replace("%", "")) discount_price = float( - discount_price_element.contents[0].replace(" ", "").replace("€", "").replace(",", ".") + discount_price_element.contents[0] + .replace(" ", "") + .replace("€", "") + .replace(",", ".") ) games.add(SteamSpecialOffer(name, original_price, discount_price, discount)) self._urls[name] = element.attrs["href"] - self._image_urls[name] = element.find("div", {"class": "search_capsule"}).find("img").attrs["src"] + self._image_urls[name] = ( + element.find("div", {"class": "search_capsule"}) + .find("img") + .attrs["src"] + ) return games @@ -116,7 +134,9 @@ class SteamOfferWatcher(TaskABC): return new_offers - async def _send_embed_for_offer(self, offer: SteamSpecialOffer, channel_id: int) -> discord.Embed: + async def _send_embed_for_offer( + self, offer: SteamSpecialOffer, channel_id: int + ) -> discord.Embed: embed = discord.Embed( title=offer.name, url=self._urls[offer.name], @@ -130,7 +150,9 @@ class SteamOfferWatcher(TaskABC): inline=True, ) embed.add_field( - name=self._t.transform("modules.special_offers.discount"), value=f"{offer.discount_pct}%", inline=True + name=self._t.transform("modules.special_offers.discount"), + value=f"{offer.discount_pct}%", + inline=True, ) embed.add_field( name=self._t.transform("modules.special_offers.discount_price"), @@ -182,11 +204,16 @@ class SteamOfferWatcher(TaskABC): self._logger.info(__name__, "Watching steam special offers") try: offers_for_notifications = self._watch() - self._logger.debug(__name__, f"Sending offer notifications for {offers_for_notifications.count()} offers") + self._logger.debug( + __name__, + f"Sending offer notifications for {offers_for_notifications.count()} offers", + ) if self._is_new: return for guild in self._bot.guilds: - settings: ServerConfig = self._config.get_configuration(f"ServerConfig_{guild.id}") + settings: ServerConfig = self._config.get_configuration( + f"ServerConfig_{guild.id}" + ) if ( not FeatureFlagsSettings.get_flag_from_dict( settings.feature_flags, FeatureFlagsEnum.steam_special_offers @@ -197,7 +224,9 @@ class SteamOfferWatcher(TaskABC): for offer in offers_for_notifications: self._bot.loop.create_task( - self._send_embed_for_offer(offer, settings.game_offer_notification_chat_id) + self._send_embed_for_offer( + offer, settings.game_offer_notification_chat_id + ) ) except Exception as e: self._logger.error(__name__, f"Steam offer watcher failed", e) diff --git a/kdb-bot/src/modules/technician/__init__.py b/bot/src/modules/technician/__init__.py similarity index 100% rename from kdb-bot/src/modules/technician/__init__.py rename to bot/src/modules/technician/__init__.py diff --git a/kdb-bot/src/modules/technician/api_key_seeder.py b/bot/src/modules/technician/api_key_seeder.py similarity index 92% rename from kdb-bot/src/modules/technician/api_key_seeder.py rename to bot/src/modules/technician/api_key_seeder.py index f8f1305c..70792942 100644 --- a/kdb-bot/src/modules/technician/api_key_seeder.py +++ b/bot/src/modules/technician/api_key_seeder.py @@ -36,7 +36,9 @@ class ApiKeySeeder(DataSeederABC): return try: - frontend_key = ApiKey("frontend", "87f529fd-a32e-40b3-a1d1-7a1583cf3ff5", None) + frontend_key = ApiKey( + "frontend", "87f529fd-a32e-40b3-a1d1-7a1583cf3ff5", None + ) self._api_keys.add_api_key(frontend_key) self._db.save_changes() self._logger.info(__name__, f"Created frontend API-Key") diff --git a/kdb-bot/src/modules/technician/command/__init__.py b/bot/src/modules/technician/command/__init__.py similarity index 100% rename from kdb-bot/src/modules/technician/command/__init__.py rename to bot/src/modules/technician/command/__init__.py diff --git a/kdb-bot/src/modules/technician/command/api_key_group.py b/bot/src/modules/technician/command/api_key_group.py similarity index 84% rename from kdb-bot/src/modules/technician/command/api_key_group.py rename to bot/src/modules/technician/command/api_key_group.py index 11912385..f0171553 100644 --- a/kdb-bot/src/modules/technician/command/api_key_group.py +++ b/bot/src/modules/technician/command/api_key_group.py @@ -54,7 +54,9 @@ class ApiKeyGroup(DiscordCommandABC): def _get_api_key_str(self, api_key: ApiKey) -> str: return hashlib.sha256( - f"{api_key.identifier}:{api_key.key}+{self._auth_settings.secret_key}".encode("utf-8") + f"{api_key.identifier}:{api_key.key}+{self._auth_settings.secret_key}".encode( + "utf-8" + ) ).hexdigest() @commands.hybrid_group(name="api-key") @@ -67,7 +69,9 @@ class ApiKeyGroup(DiscordCommandABC): @CommandChecks.check_is_ready() @CommandChecks.check_is_member_technician() async def get(self, ctx: Context, key: str, wait: int = None): - self._logger.debug(__name__, f"Received command api-key get {ctx}: {key},{wait}") + self._logger.debug( + __name__, f"Received command api-key get {ctx}: {key},{wait}" + ) api_key = self._api_keys.get_api_key_by_key(key) await self._message_service.send_ctx_msg( @@ -79,12 +83,16 @@ class ApiKeyGroup(DiscordCommandABC): self._logger.trace(__name__, f"Finished command api-key get") @get.autocomplete("key") - async def get_autocomplete(self, interaction: discord.Interaction, current: str) -> TList[app_commands.Choice[str]]: + async def get_autocomplete( + self, interaction: discord.Interaction, current: str + ) -> TList[app_commands.Choice[str]]: keys = self._api_keys.get_api_keys() return [ app_commands.Choice(name=f"{key.identifier}: {key.key}", value=key.key) - for key in self._client_utils.get_auto_complete_list(keys, current, lambda x: x.key) + for key in self._client_utils.get_auto_complete_list( + keys, current, lambda x: x.key + ) ] @api_key.command() @@ -92,10 +100,14 @@ class ApiKeyGroup(DiscordCommandABC): @CommandChecks.check_is_ready() @CommandChecks.check_is_member_moderator() async def add(self, ctx: Context, identifier: str): - self._logger.debug(__name__, f"Received command api-key add {ctx}: {identifier}") + self._logger.debug( + __name__, f"Received command api-key add {ctx}: {identifier}" + ) server = self._servers.get_server_by_discord_id(ctx.guild.id) - user = self._users.get_user_by_discord_id_and_server_id(ctx.author.id, server.id) + user = self._users.get_user_by_discord_id_and_server_id( + ctx.author.id, server.id + ) api_key = ApiKey(identifier, str(uuid.uuid4()), user) self._api_keys.add_api_key(api_key) self._db.save_changes() @@ -125,15 +137,21 @@ class ApiKeyGroup(DiscordCommandABC): api_key = keys.single() self._api_keys.delete_api_key(api_key) self._db.save_changes() - await self._message_service.send_ctx_msg(ctx, self._t.transform("modules.technician.api_key.remove.success")) + await self._message_service.send_ctx_msg( + ctx, self._t.transform("modules.technician.api_key.remove.success") + ) self._logger.trace(__name__, f"Finished command api-key remove") @remove.autocomplete("key") - async def set_autocomplete(self, interaction: discord.Interaction, current: str) -> TList[app_commands.Choice[str]]: + async def set_autocomplete( + self, interaction: discord.Interaction, current: str + ) -> TList[app_commands.Choice[str]]: keys = self._api_keys.get_api_keys() return [ app_commands.Choice(name=f"{key.identifier}: {key.key}", value=key.key) - for key in self._client_utils.get_auto_complete_list(keys, current, lambda x: x.key) + for key in self._client_utils.get_auto_complete_list( + keys, current, lambda x: x.key + ) ] diff --git a/kdb-bot/src/modules/technician/command/log_command.py b/bot/src/modules/technician/command/log_command.py similarity index 96% rename from kdb-bot/src/modules/technician/command/log_command.py rename to bot/src/modules/technician/command/log_command.py index 2f799d61..27e8c557 100644 --- a/kdb-bot/src/modules/technician/command/log_command.py +++ b/bot/src/modules/technician/command/log_command.py @@ -98,7 +98,10 @@ class LogCommand(DiscordCommandABC): continue split_filename = file.split(".") - if f".{split_filename[len(split_filename) - 1]}" not in file_extensions: + if ( + f".{split_filename[len(split_filename) - 1]}" + not in file_extensions + ): continue files.append(os.path.join(r, file)) diff --git a/kdb-bot/src/modules/technician/command/restart_command.py b/bot/src/modules/technician/command/restart_command.py similarity index 94% rename from kdb-bot/src/modules/technician/command/restart_command.py rename to bot/src/modules/technician/command/restart_command.py index 76fda82c..102519fd 100644 --- a/kdb-bot/src/modules/technician/command/restart_command.py +++ b/bot/src/modules/technician/command/restart_command.py @@ -52,7 +52,9 @@ class RestartCommand(DiscordCommandABC): self._config.add_configuration("IS_RESTART", "true") await self._client_utils.presence_game("common.presence.restart") - await self._message_service.send_ctx_msg(ctx, self._t.transform("modules.technician.restart_message")) + await self._message_service.send_ctx_msg( + ctx, self._t.transform("modules.technician.restart_message") + ) await asyncio.sleep(self._settings.wait_for_restart) await self._data_integrity.check_data_integrity(is_for_shutdown=True) await self._bot.stop_async() diff --git a/kdb-bot/src/modules/technician/command/shutdown_command.py b/bot/src/modules/technician/command/shutdown_command.py similarity index 94% rename from kdb-bot/src/modules/technician/command/shutdown_command.py rename to bot/src/modules/technician/command/shutdown_command.py index db2f807a..5ddf9603 100644 --- a/kdb-bot/src/modules/technician/command/shutdown_command.py +++ b/bot/src/modules/technician/command/shutdown_command.py @@ -51,7 +51,9 @@ class ShutdownCommand(DiscordCommandABC): self._logger.debug(__name__, f"Received command shutdown {ctx}") await self._client_utils.presence_game("common.presence.shutdown") - await self._message_service.send_ctx_msg(ctx, self._t.transform("modules.technician.shutdown_message")) + await self._message_service.send_ctx_msg( + ctx, self._t.transform("modules.technician.shutdown_message") + ) await asyncio.sleep(self._settings.wait_for_shutdown) await self._data_integrity.check_data_integrity(is_for_shutdown=True) await self._bot.stop_async() diff --git a/kdb-bot/src/modules/technician/command/sync_xp_command.py b/bot/src/modules/technician/command/sync_xp_command.py similarity index 78% rename from kdb-bot/src/modules/technician/command/sync_xp_command.py rename to bot/src/modules/technician/command/sync_xp_command.py index e54a770f..90e97554 100644 --- a/kdb-bot/src/modules/technician/command/sync_xp_command.py +++ b/bot/src/modules/technician/command/sync_xp_command.py @@ -71,18 +71,28 @@ class SyncXpGroup(DiscordCommandABC): if ctx.guild is None: return - settings: ServerConfig = self._config.get_configuration(f"ServerConfig_{ctx.guild.id}") - if not FeatureFlagsSettings.get_flag_from_dict(settings.feature_flags, FeatureFlagsEnum.sync_xp): - await self._message_service.send_ctx_msg(ctx, self._t.transform("common.feature_not_activated")) + settings: ServerConfig = self._config.get_configuration( + f"ServerConfig_{ctx.guild.id}" + ) + if not FeatureFlagsSettings.get_flag_from_dict( + settings.feature_flags, FeatureFlagsEnum.sync_xp + ): + await self._message_service.send_ctx_msg( + ctx, self._t.transform("common.feature_not_activated") + ) return other_server = self._servers.get_server_by_id(server_id) - users_on_other_server = self._users.get_users_by_server_id(other_server.id).where(lambda x: not x.left_server) - discord_ids_on_other_server = users_on_other_server.select(lambda x: x.discord_id) + users_on_other_server = self._users.get_users_by_server_id( + other_server.id + ).where(lambda x: not x.left_server) + discord_ids_on_other_server = users_on_other_server.select( + lambda x: x.discord_id + ) - for user in self._users.get_users_by_server_id(self._servers.get_server_by_discord_id(ctx.guild.id).id).where( - lambda x: not x.left_server - ): + for user in self._users.get_users_by_server_id( + self._servers.get_server_by_discord_id(ctx.guild.id).id + ).where(lambda x: not x.left_server): try: if user.discord_id not in discord_ids_on_other_server: continue @@ -96,15 +106,21 @@ class SyncXpGroup(DiscordCommandABC): user.xp = user_on_other_server.xp self._users.update_user(user) self._db.save_changes() - await self._level_service.check_level(ctx.guild.get_member(user.discord_id)) + await self._level_service.check_level( + ctx.guild.get_member(user.discord_id) + ) except Exception as e: self._logger.error(__name__, f"Cannot sync user {user.name}", e) - await self._message_service.send_ctx_msg(ctx, self._t.transform("modules.technician.synced_message")) + await self._message_service.send_ctx_msg( + ctx, self._t.transform("modules.technician.synced_message") + ) self._logger.trace(__name__, f"Finished sync xp command") @all_members.autocomplete("server_id") - async def list_autocomplete(self, interaction: discord.Interaction, current: str) -> list[app_commands.Choice]: + async def list_autocomplete( + self, interaction: discord.Interaction, current: str + ) -> list[app_commands.Choice]: return [ app_commands.Choice(name=server.name, value=server.id) for server in self._client_utils.get_auto_complete_list( @@ -122,9 +138,15 @@ class SyncXpGroup(DiscordCommandABC): if ctx.guild is None: return - settings: ServerConfig = self._config.get_configuration(f"ServerConfig_{ctx.guild.id}") - if not FeatureFlagsSettings.get_flag_from_dict(settings.feature_flags, FeatureFlagsEnum.sync_xp): - await self._message_service.send_ctx_msg(ctx, self._t.transform("common.feature_not_activated")) + settings: ServerConfig = self._config.get_configuration( + f"ServerConfig_{ctx.guild.id}" + ) + if not FeatureFlagsSettings.get_flag_from_dict( + settings.feature_flags, FeatureFlagsEnum.sync_xp + ): + await self._message_service.send_ctx_msg( + ctx, self._t.transform("common.feature_not_activated") + ) return other_server = self._servers.get_server_by_id(server_id) @@ -147,12 +169,16 @@ class SyncXpGroup(DiscordCommandABC): except Exception as e: self._logger.error(__name__, f"Cannot sync user {user.name}", e) - await self._message_service.send_ctx_msg(ctx, self._t.transform("modules.technician.synced_message")) + await self._message_service.send_ctx_msg( + ctx, self._t.transform("modules.technician.synced_message") + ) await self._level_service.check_level(member) self._logger.trace(__name__, f"Finished sync xp command") @by_member.autocomplete("server_id") - async def list_autocomplete(self, interaction: discord.Interaction, current: str) -> list[app_commands.Choice]: + async def list_autocomplete( + self, interaction: discord.Interaction, current: str + ) -> list[app_commands.Choice]: return [ app_commands.Choice(name=server.name, value=server.id) for server in self._client_utils.get_auto_complete_list( diff --git a/kdb-bot/src/modules/technician/technician.json b/bot/src/modules/technician/technician.json similarity index 100% rename from kdb-bot/src/modules/technician/technician.json rename to bot/src/modules/technician/technician.json diff --git a/kdb-bot/src/modules/technician/technician_module.py b/bot/src/modules/technician/technician_module.py similarity index 85% rename from kdb-bot/src/modules/technician/technician_module.py rename to bot/src/modules/technician/technician_module.py index 8550b7d6..77677cc9 100644 --- a/kdb-bot/src/modules/technician/technician_module.py +++ b/bot/src/modules/technician/technician_module.py @@ -18,10 +18,14 @@ class TechnicianModule(ModuleABC): def __init__(self, dc: DiscordCollectionABC): ModuleABC.__init__(self, dc, FeatureFlagsEnum.base_module) - def configure_configuration(self, config: ConfigurationABC, env: ApplicationEnvironmentABC): + def configure_configuration( + self, config: ConfigurationABC, env: ApplicationEnvironmentABC + ): pass - def configure_services(self, services: ServiceCollectionABC, env: ApplicationEnvironmentABC): + def configure_services( + self, services: ServiceCollectionABC, env: ApplicationEnvironmentABC + ): services.add_transient(DataSeederABC, ApiKeySeeder) # commands services.add_transient(RestartCommand) diff --git a/kdb-bot/tools/checks/UserJoinedVoiceChannel.json b/bot/tools/checks/UserJoinedVoiceChannel.json similarity index 100% rename from kdb-bot/tools/checks/UserJoinedVoiceChannel.json rename to bot/tools/checks/UserJoinedVoiceChannel.json diff --git a/kdb-bot/tools/checks/__init__.py b/bot/tools/checks/__init__.py similarity index 100% rename from kdb-bot/tools/checks/__init__.py rename to bot/tools/checks/__init__.py diff --git a/kdb-bot/tools/checks/checks.json b/bot/tools/checks/checks.json similarity index 100% rename from kdb-bot/tools/checks/checks.json rename to bot/tools/checks/checks.json diff --git a/kdb-bot/tools/checks/get_ontime_overlaps.py b/bot/tools/checks/get_ontime_overlaps.py similarity index 100% rename from kdb-bot/tools/checks/get_ontime_overlaps.py rename to bot/tools/checks/get_ontime_overlaps.py diff --git a/kdb-bot/tools/get_version/__init__.py b/bot/tools/get_version/__init__.py similarity index 100% rename from kdb-bot/tools/get_version/__init__.py rename to bot/tools/get_version/__init__.py diff --git a/kdb-bot/tools/get_version/application.py b/bot/tools/get_version/application.py similarity index 100% rename from kdb-bot/tools/get_version/application.py rename to bot/tools/get_version/application.py diff --git a/kdb-bot/tools/get_version/get-version.json b/bot/tools/get_version/get-version.json similarity index 100% rename from kdb-bot/tools/get_version/get-version.json rename to bot/tools/get_version/get-version.json diff --git a/kdb-bot/tools/get_version/main.py b/bot/tools/get_version/main.py similarity index 100% rename from kdb-bot/tools/get_version/main.py rename to bot/tools/get_version/main.py diff --git a/kdb-bot/tools/get_version/startup.py b/bot/tools/get_version/startup.py similarity index 78% rename from kdb-bot/tools/get_version/startup.py rename to bot/tools/get_version/startup.py index 8cb6680f..eaa731d7 100644 --- a/kdb-bot/tools/get_version/startup.py +++ b/bot/tools/get_version/startup.py @@ -14,10 +14,14 @@ class Startup(StartupABC): def configure_configuration( self, configuration: ConfigurationABC, environment: ApplicationEnvironment ) -> ConfigurationABC: - environment.set_working_directory(os.path.abspath(os.path.join(environment.working_directory, "../../"))) + environment.set_working_directory( + os.path.abspath(os.path.join(environment.working_directory, "../../")) + ) configuration.add_json_file(f"cpl-workspace.json", optional=False, output=False) ws: WorkspaceSettings = configuration.get_configuration(WorkspaceSettings) - configuration.add_json_file(ws.projects[ws.default_project], optional=False, output=False) + configuration.add_json_file( + ws.projects[ws.default_project], optional=False, output=False + ) return configuration diff --git a/kdb-bot/tools/post_build/__init__.py b/bot/tools/post_build/__init__.py similarity index 100% rename from kdb-bot/tools/post_build/__init__.py rename to bot/tools/post_build/__init__.py diff --git a/kdb-bot/tools/post_build/application.py b/bot/tools/post_build/application.py similarity index 100% rename from kdb-bot/tools/post_build/application.py rename to bot/tools/post_build/application.py diff --git a/kdb-bot/tools/post_build/appsettings.json b/bot/tools/post_build/appsettings.json similarity index 100% rename from kdb-bot/tools/post_build/appsettings.json rename to bot/tools/post_build/appsettings.json diff --git a/kdb-bot/tools/post_build/main.py b/bot/tools/post_build/main.py similarity index 100% rename from kdb-bot/tools/post_build/main.py rename to bot/tools/post_build/main.py diff --git a/kdb-bot/tools/post_build/post-build.json b/bot/tools/post_build/post-build.json similarity index 100% rename from kdb-bot/tools/post_build/post-build.json rename to bot/tools/post_build/post-build.json diff --git a/kdb-bot/tools/post_build/post_build_settings.py b/bot/tools/post_build/post_build_settings.py similarity index 73% rename from kdb-bot/tools/post_build/post_build_settings.py rename to bot/tools/post_build/post_build_settings.py index 3c8a789e..b1d815da 100644 --- a/kdb-bot/tools/post_build/post_build_settings.py +++ b/bot/tools/post_build/post_build_settings.py @@ -24,5 +24,9 @@ class PostBuildSettings(ConfigurationModelABC): self._keep_config = settings["KeepConfigs"] self._config_paths = settings["ConfigPaths"] except Exception as e: - Console.error(f"[ ERROR ] [ {__name__} ]: Reading error in {type(self).__name__} settings") - Console.error(f"[ EXCEPTION ] [ {__name__} ]: {e} -> {traceback.format_exc()}") + Console.error( + f"[ ERROR ] [ {__name__} ]: Reading error in {type(self).__name__} settings" + ) + Console.error( + f"[ EXCEPTION ] [ {__name__} ]: {e} -> {traceback.format_exc()}" + ) diff --git a/kdb-bot/tools/post_build/service/__init__.py b/bot/tools/post_build/service/__init__.py similarity index 100% rename from kdb-bot/tools/post_build/service/__init__.py rename to bot/tools/post_build/service/__init__.py diff --git a/kdb-bot/tools/post_build/service/dependencies.py b/bot/tools/post_build/service/dependencies.py similarity index 93% rename from kdb-bot/tools/post_build/service/dependencies.py rename to bot/tools/post_build/service/dependencies.py index 060adae4..b0362257 100644 --- a/kdb-bot/tools/post_build/service/dependencies.py +++ b/bot/tools/post_build/service/dependencies.py @@ -54,7 +54,9 @@ class Dependencies: ) for project in self._workspace.projects: - project_file = os.path.join(self._env.working_directory, self._workspace.projects[project]) + project_file = os.path.join( + self._env.working_directory, self._workspace.projects[project] + ) self._config.add_json_file(project_file, output=False, optional=False) project: ProjectSettings = self._config.get_configuration(ProjectSettings) self._add_dependencies(project.dependencies) diff --git a/kdb-bot/tools/post_build/service/remove_config.py b/bot/tools/post_build/service/remove_config.py similarity index 100% rename from kdb-bot/tools/post_build/service/remove_config.py rename to bot/tools/post_build/service/remove_config.py diff --git a/kdb-bot/tools/post_build/startup.py b/bot/tools/post_build/startup.py similarity index 82% rename from kdb-bot/tools/post_build/startup.py rename to bot/tools/post_build/startup.py index 537f3f2a..6d5e484d 100644 --- a/kdb-bot/tools/post_build/startup.py +++ b/bot/tools/post_build/startup.py @@ -18,10 +18,14 @@ class Startup(StartupABC): self, configuration: ConfigurationABC, environment: ApplicationEnvironment ) -> ConfigurationABC: configuration.add_json_file(f"appsettings.json", optional=False, output=False) - environment.set_working_directory(os.path.abspath(os.path.join(environment.working_directory, "../../"))) + environment.set_working_directory( + os.path.abspath(os.path.join(environment.working_directory, "../../")) + ) configuration.add_json_file(f"cpl-workspace.json", optional=False, output=False) ws: WorkspaceSettings = configuration.get_configuration(WorkspaceSettings) - configuration.add_json_file(ws.projects[ws.default_project], optional=False, output=False) + configuration.add_json_file( + ws.projects[ws.default_project], optional=False, output=False + ) return configuration diff --git a/kdb-bot/tools/set_version/__init__.py b/bot/tools/set_version/__init__.py similarity index 100% rename from kdb-bot/tools/set_version/__init__.py rename to bot/tools/set_version/__init__.py diff --git a/kdb-bot/tools/set_version/application.py b/bot/tools/set_version/application.py similarity index 74% rename from kdb-bot/tools/set_version/application.py rename to bot/tools/set_version/application.py index 92055455..f773982c 100644 --- a/kdb-bot/tools/set_version/application.py +++ b/bot/tools/set_version/application.py @@ -22,7 +22,9 @@ class Application(ApplicationABC): self._workspace: WorkspaceSettings = config.get_configuration(WorkspaceSettings) self._git_service: GitService = self._services.get_service(GitService) - self._version_setter: VersionSetterService = self._services.get_service(VersionSetterService) + self._version_setter: VersionSetterService = self._services.get_service( + VersionSetterService + ) self._version_pipe: VersionPipe = self._services.get_service(VersionPipe) def configure(self): @@ -57,13 +59,19 @@ class Application(ApplicationABC): try: if branch.startswith("#"): self._configuration.add_json_file( - self._workspace.projects[self._workspace.default_project], optional=False, output=False + self._workspace.projects[self._workspace.default_project], + optional=False, + output=False, + ) + ps: ProjectSettings = self._configuration.get_configuration( + ProjectSettings ) - ps: ProjectSettings = self._configuration.get_configuration(ProjectSettings) version[VersionSettingsNameEnum.major.value] = ps.version.major version[VersionSettingsNameEnum.minor.value] = ps.version.minor - version[VersionSettingsNameEnum.micro.value] = f'dev{branch.split("#")[1]}' + version[ + VersionSettingsNameEnum.micro.value + ] = f'dev{branch.split("#")[1]}' else: if "." not in branch and "." in suffix: branch = suffix @@ -78,7 +86,9 @@ class Application(ApplicationABC): else: if not suffix.startswith(".") and suffix != "": suffix = f".{suffix}" - version[VersionSettingsNameEnum.micro.value] = f'{branch.split(".")[2]}{suffix}' + version[ + VersionSettingsNameEnum.micro.value + ] = f'{branch.split(".")[2]}{suffix}' except Exception as e: Console.error(f"Branch {branch} does not contain valid version") return @@ -104,21 +114,37 @@ class Application(ApplicationABC): try: skipped = [] for project in self._workspace.projects: - if project not in diff_paths and String.convert_to_snake_case(project) not in diff_paths and not force: + if ( + project not in diff_paths + and String.convert_to_snake_case(project) not in diff_paths + and not force + ): # Console.write_line(f'Skipping {project} due to missing changes') skipped.append(project) continue - Console.write_line(f"Set dependencies {self._version_pipe.transform(version)} for {project}") - self._version_setter.set_dependencies( - self._workspace.projects[project], version, "Dependencies", skipped=skipped + Console.write_line( + f"Set dependencies {self._version_pipe.transform(version)} for {project}" ) self._version_setter.set_dependencies( - self._workspace.projects[project], version, "DevDependencies", skipped=skipped + self._workspace.projects[project], + version, + "Dependencies", + skipped=skipped, + ) + self._version_setter.set_dependencies( + self._workspace.projects[project], + version, + "DevDependencies", + skipped=skipped, ) - Console.write_line(f"Set version {self._version_pipe.transform(version)} for {project}") - self._version_setter.set_version(self._workspace.projects[project], version) + Console.write_line( + f"Set version {self._version_pipe.transform(version)} for {project}" + ) + self._version_setter.set_version( + self._workspace.projects[project], version + ) except Exception as e: Console.error("Version could not be set", traceback.format_exc()) return diff --git a/kdb-bot/tools/set_version/git_service.py b/bot/tools/set_version/git_service.py similarity index 100% rename from kdb-bot/tools/set_version/git_service.py rename to bot/tools/set_version/git_service.py diff --git a/kdb-bot/tools/set_version/main.py b/bot/tools/set_version/main.py similarity index 100% rename from kdb-bot/tools/set_version/main.py rename to bot/tools/set_version/main.py diff --git a/kdb-bot/tools/set_version/set-version.json b/bot/tools/set_version/set-version.json similarity index 100% rename from kdb-bot/tools/set_version/set-version.json rename to bot/tools/set_version/set-version.json diff --git a/kdb-bot/tools/set_version/startup.py b/bot/tools/set_version/startup.py similarity index 82% rename from kdb-bot/tools/set_version/startup.py rename to bot/tools/set_version/startup.py index ce7fb47f..47898325 100644 --- a/kdb-bot/tools/set_version/startup.py +++ b/bot/tools/set_version/startup.py @@ -19,8 +19,12 @@ class Startup(StartupABC): ) -> ConfigurationABC: configuration.add_json_file("cpl-workspace.json", optional=True, output=False) if configuration.get_configuration(WorkspaceSettings) is None: - environment.set_working_directory(os.path.join(environment.working_directory, "../../")) - configuration.add_json_file("cpl-workspace.json", optional=False, output=False) + environment.set_working_directory( + os.path.join(environment.working_directory, "../../") + ) + configuration.add_json_file( + "cpl-workspace.json", optional=False, output=False + ) return configuration diff --git a/kdb-bot/tools/set_version/version_setter_service.py b/bot/tools/set_version/version_setter_service.py similarity index 76% rename from kdb-bot/tools/set_version/version_setter_service.py rename to bot/tools/set_version/version_setter_service.py index e1dfcf8a..e4b0545d 100644 --- a/kdb-bot/tools/set_version/version_setter_service.py +++ b/bot/tools/set_version/version_setter_service.py @@ -12,7 +12,9 @@ class VersionSetterService: def _read_file(self, file: str) -> dict: project_json = {} - with open(os.path.join(self._env.working_directory, file), "r", encoding="utf-8") as f: + with open( + os.path.join(self._env.working_directory, file), "r", encoding="utf-8" + ) as f: # load json project_json = json.load(f) f.close() @@ -20,7 +22,9 @@ class VersionSetterService: return project_json def _write_file(self, file: str, project_json: dict): - with open(os.path.join(self._env.working_directory, file), "w", encoding="utf-8") as f: + with open( + os.path.join(self._env.working_directory, file), "w", encoding="utf-8" + ) as f: f.write(json.dumps(project_json, indent=2)) f.close() @@ -48,14 +52,20 @@ class VersionSetterService: if ( skipped is not None - and (dep_name in skipped or String.convert_to_snake_case(dep_name) in skipped) + and ( + dep_name in skipped + or String.convert_to_snake_case(dep_name) in skipped + ) or dep_version == "" ): new_deps.append(dependency) continue new_deps.append( - dependency.replace(dep_version, f'{version["Major"]}.{version["Minor"]}.{version["Micro"]}') + dependency.replace( + dep_version, + f'{version["Major"]}.{version["Minor"]}.{version["Micro"]}', + ) ) project_json["ProjectSettings"][key] = new_deps diff --git a/kdb-bot/LICENSE b/kdb-bot/LICENSE deleted file mode 100644 index 374f2e3a..00000000 --- a/kdb-bot/LICENSE +++ /dev/null @@ -1,9 +0,0 @@ -MIT License - -Copyright (c) 2022-2023 sh-edraft.de - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/kdb-bot/README.md b/kdb-bot/README.md deleted file mode 100644 index 72b3dd33..00000000 --- a/kdb-bot/README.md +++ /dev/null @@ -1,2 +0,0 @@ -# kd_discord_bot - diff --git a/kdb-bot/cpl-workspace.json b/kdb-bot/cpl-workspace.json deleted file mode 100644 index 833b19a0..00000000 --- a/kdb-bot/cpl-workspace.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "WorkspaceSettings": { - "DefaultProject": "bot", - "Projects": { - "bot": "src/bot/bot.json", - "bot-api": "src/bot_api/bot-api.json", - "bot-core": "src/bot_core/bot-core.json", - "bot-data": "src/bot_data/bot-data.json", - "bot-graphql": "src/bot_graphql/bot-graphql.json", - "achievements": "src/modules/achievements/achievements.json", - "auto-role": "src/modules/auto_role/auto-role.json", - "base": "src/modules/base/base.json", - "boot-log": "src/modules/boot_log/boot-log.json", - "config": "src/modules/config/config.json", - "database": "src/modules/database/database.json", - "level": "src/modules/level/level.json", - "permission": "src/modules/permission/permission.json", - "technician": "src/modules/technician/technician.json", - "short-role-name": "src/modules/short_role_name/short-role-name.json", - "special-offers": "src/modules/special_offers/special-offers.json", - "checks": "tools/checks/checks.json", - "get-version": "tools/get_version/get-version.json", - "post-build": "tools/post_build/post-build.json", - "set-version": "tools/set_version/set-version.json" - }, - "Scripts": { - "format": "black ./", - "sv": "cpl set-version $ARGS", - "set-version": "cpl run set-version $ARGS --dev; echo '';", - "gv": "cpl get-version", - "get-version": "export VERSION=$(cpl run get-version --dev); echo $VERSION;", - "pre-build": "cpl set-version $ARGS; black ./;", - "post-build": "cpl run post-build --dev; black ./;", - "pre-prod": "cpl build", - "prod": "export KDB_ENVIRONMENT=production; export KDB_NAME=KDB-Prod; cpl start;", - "pre-stage": "cpl build", - "stage": "export KDB_ENVIRONMENT=staging; export KDB_NAME=KDB-Stage; cpl start;", - "pre-dev": "cpl build", - "dev": "export KDB_ENVIRONMENT=development; export KDB_NAME=KDB-Dev; cpl start;", - "docker-build": "cpl build $ARGS; docker build -t sh-edraft.de/kdb-bot:$(cpl gv) .;", - "dc-up": "docker-compose up -d", - "dc-down": "docker-compose down", - "docker": "cpl dc-down; cpl docker-build; cpl dc-up;" - } - } -} \ No newline at end of file diff --git a/kdb-bot/docker b/kdb-bot/docker deleted file mode 160000 index 7ae47838..00000000 --- a/kdb-bot/docker +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 7ae4783874d5aa8015d8f0da2c19c293fcd72762 diff --git a/kdb-bot/dockerfile b/kdb-bot/dockerfile deleted file mode 100644 index 478bf7e7..00000000 --- a/kdb-bot/dockerfile +++ /dev/null @@ -1,21 +0,0 @@ -# syntax=docker/dockerfile:1 -FROM python:3.10.4-alpine - -WORKDIR /app -COPY ./dist/bot/build/kdb-bot/ . -COPY ./dist/bot/build/requirements.txt . - -RUN python -m pip install --upgrade pip - -RUN apk update -RUN apk add --update alpine-sdk linux-headers -RUN apk add bash -RUN apk add nano - -RUN pip install -r requirements.txt --extra-index-url https://pip.sh-edraft.de -RUN pip install flask[async] - -# RUN pip install dnspython==2.2.1 # https://stackoverflow.com/questions/75137717/eventlet-dns-python-attribute-error-module-dns-rdtypes-has-no-attribute-any -# ^ probably fixed py package updates - -CMD [ "bash", "/app/bot/bot"] diff --git a/kdb-bot/pyproject.toml b/kdb-bot/pyproject.toml deleted file mode 100644 index e34796ec..00000000 --- a/kdb-bot/pyproject.toml +++ /dev/null @@ -1,2 +0,0 @@ -[tool.black] -line-length = 120 \ No newline at end of file diff --git a/kdb-bot/src/bot/config b/kdb-bot/src/bot/config deleted file mode 160000 index aa124934..00000000 --- a/kdb-bot/src/bot/config +++ /dev/null @@ -1 +0,0 @@ -Subproject commit aa1249341910f2877522a2002df7feea95256749 diff --git a/kdb-bot/src/bot_api/config b/kdb-bot/src/bot_api/config deleted file mode 160000 index b6ffed4d..00000000 --- a/kdb-bot/src/bot_api/config +++ /dev/null @@ -1 +0,0 @@ -Subproject commit b6ffed4da1f75f5fbad1ce7f312b67f32de010b5 diff --git a/kdb-web/.browserslistrc b/web/.browserslistrc similarity index 100% rename from kdb-web/.browserslistrc rename to web/.browserslistrc diff --git a/kdb-web/.editorconfig b/web/.editorconfig similarity index 100% rename from kdb-web/.editorconfig rename to web/.editorconfig diff --git a/kdb-web/.gitignore b/web/.gitignore similarity index 100% rename from kdb-web/.gitignore rename to web/.gitignore diff --git a/kdb-web/.prettierrc b/web/.prettierrc similarity index 100% rename from kdb-web/.prettierrc rename to web/.prettierrc diff --git a/kdb-web/README.md b/web/README.md similarity index 100% rename from kdb-web/README.md rename to web/README.md diff --git a/kdb-web/angular.json b/web/angular.json similarity index 100% rename from kdb-web/angular.json rename to web/angular.json diff --git a/kdb-web/dockerfile b/web/dockerfile similarity index 100% rename from kdb-web/dockerfile rename to web/dockerfile diff --git a/kdb-web/karma.conf.js b/web/karma.conf.js similarity index 100% rename from kdb-web/karma.conf.js rename to web/karma.conf.js diff --git a/kdb-web/nginx.conf.template b/web/nginx.conf.template similarity index 100% rename from kdb-web/nginx.conf.template rename to web/nginx.conf.template diff --git a/kdb-web/package-lock.json b/web/package-lock.json similarity index 100% rename from kdb-web/package-lock.json rename to web/package-lock.json diff --git a/kdb-web/package.json b/web/package.json similarity index 100% rename from kdb-web/package.json rename to web/package.json diff --git a/kdb-web/src/app/app-routing.module.ts b/web/src/app/app-routing.module.ts similarity index 100% rename from kdb-web/src/app/app-routing.module.ts rename to web/src/app/app-routing.module.ts diff --git a/kdb-web/src/app/app.component.html b/web/src/app/app.component.html similarity index 100% rename from kdb-web/src/app/app.component.html rename to web/src/app/app.component.html diff --git a/kdb-web/src/app/app.component.scss b/web/src/app/app.component.scss similarity index 100% rename from kdb-web/src/app/app.component.scss rename to web/src/app/app.component.scss diff --git a/kdb-web/src/app/app.component.spec.ts b/web/src/app/app.component.spec.ts similarity index 100% rename from kdb-web/src/app/app.component.spec.ts rename to web/src/app/app.component.spec.ts diff --git a/kdb-web/src/app/app.component.ts b/web/src/app/app.component.ts similarity index 100% rename from kdb-web/src/app/app.component.ts rename to web/src/app/app.component.ts diff --git a/kdb-web/src/app/app.module.ts b/web/src/app/app.module.ts similarity index 100% rename from kdb-web/src/app/app.module.ts rename to web/src/app/app.module.ts diff --git a/kdb-web/src/app/base/component-with-table.spec.ts b/web/src/app/base/component-with-table.spec.ts similarity index 100% rename from kdb-web/src/app/base/component-with-table.spec.ts rename to web/src/app/base/component-with-table.spec.ts diff --git a/kdb-web/src/app/base/component-with-table.ts b/web/src/app/base/component-with-table.ts similarity index 100% rename from kdb-web/src/app/base/component-with-table.ts rename to web/src/app/base/component-with-table.ts diff --git a/kdb-web/src/app/components/error/not-found/not-found.component.html b/web/src/app/components/error/not-found/not-found.component.html similarity index 100% rename from kdb-web/src/app/components/error/not-found/not-found.component.html rename to web/src/app/components/error/not-found/not-found.component.html diff --git a/kdb-web/src/app/components/error/not-found/not-found.component.scss b/web/src/app/components/error/not-found/not-found.component.scss similarity index 100% rename from kdb-web/src/app/components/error/not-found/not-found.component.scss rename to web/src/app/components/error/not-found/not-found.component.scss diff --git a/kdb-web/src/app/components/error/not-found/not-found.component.spec.ts b/web/src/app/components/error/not-found/not-found.component.spec.ts similarity index 100% rename from kdb-web/src/app/components/error/not-found/not-found.component.spec.ts rename to web/src/app/components/error/not-found/not-found.component.spec.ts diff --git a/kdb-web/src/app/components/error/not-found/not-found.component.ts b/web/src/app/components/error/not-found/not-found.component.ts similarity index 100% rename from kdb-web/src/app/components/error/not-found/not-found.component.ts rename to web/src/app/components/error/not-found/not-found.component.ts diff --git a/kdb-web/src/app/components/footer/footer.component.html b/web/src/app/components/footer/footer.component.html similarity index 100% rename from kdb-web/src/app/components/footer/footer.component.html rename to web/src/app/components/footer/footer.component.html diff --git a/kdb-web/src/app/components/footer/footer.component.scss b/web/src/app/components/footer/footer.component.scss similarity index 100% rename from kdb-web/src/app/components/footer/footer.component.scss rename to web/src/app/components/footer/footer.component.scss diff --git a/kdb-web/src/app/components/footer/footer.component.spec.ts b/web/src/app/components/footer/footer.component.spec.ts similarity index 100% rename from kdb-web/src/app/components/footer/footer.component.spec.ts rename to web/src/app/components/footer/footer.component.spec.ts diff --git a/kdb-web/src/app/components/footer/footer.component.ts b/web/src/app/components/footer/footer.component.ts similarity index 100% rename from kdb-web/src/app/components/footer/footer.component.ts rename to web/src/app/components/footer/footer.component.ts diff --git a/kdb-web/src/app/components/header/header.component.html b/web/src/app/components/header/header.component.html similarity index 100% rename from kdb-web/src/app/components/header/header.component.html rename to web/src/app/components/header/header.component.html diff --git a/kdb-web/src/app/components/header/header.component.scss b/web/src/app/components/header/header.component.scss similarity index 100% rename from kdb-web/src/app/components/header/header.component.scss rename to web/src/app/components/header/header.component.scss diff --git a/kdb-web/src/app/components/header/header.component.spec.ts b/web/src/app/components/header/header.component.spec.ts similarity index 100% rename from kdb-web/src/app/components/header/header.component.spec.ts rename to web/src/app/components/header/header.component.spec.ts diff --git a/kdb-web/src/app/components/header/header.component.ts b/web/src/app/components/header/header.component.ts similarity index 100% rename from kdb-web/src/app/components/header/header.component.ts rename to web/src/app/components/header/header.component.ts diff --git a/kdb-web/src/app/components/sidebar/sidebar.component.html b/web/src/app/components/sidebar/sidebar.component.html similarity index 100% rename from kdb-web/src/app/components/sidebar/sidebar.component.html rename to web/src/app/components/sidebar/sidebar.component.html diff --git a/kdb-web/src/app/components/sidebar/sidebar.component.scss b/web/src/app/components/sidebar/sidebar.component.scss similarity index 100% rename from kdb-web/src/app/components/sidebar/sidebar.component.scss rename to web/src/app/components/sidebar/sidebar.component.scss diff --git a/kdb-web/src/app/components/sidebar/sidebar.component.spec.ts b/web/src/app/components/sidebar/sidebar.component.spec.ts similarity index 100% rename from kdb-web/src/app/components/sidebar/sidebar.component.spec.ts rename to web/src/app/components/sidebar/sidebar.component.spec.ts diff --git a/kdb-web/src/app/components/sidebar/sidebar.component.ts b/web/src/app/components/sidebar/sidebar.component.ts similarity index 100% rename from kdb-web/src/app/components/sidebar/sidebar.component.ts rename to web/src/app/components/sidebar/sidebar.component.ts diff --git a/kdb-web/src/app/components/spinner/spinner.component.html b/web/src/app/components/spinner/spinner.component.html similarity index 100% rename from kdb-web/src/app/components/spinner/spinner.component.html rename to web/src/app/components/spinner/spinner.component.html diff --git a/kdb-web/src/app/components/spinner/spinner.component.scss b/web/src/app/components/spinner/spinner.component.scss similarity index 100% rename from kdb-web/src/app/components/spinner/spinner.component.scss rename to web/src/app/components/spinner/spinner.component.scss diff --git a/kdb-web/src/app/components/spinner/spinner.component.spec.ts b/web/src/app/components/spinner/spinner.component.spec.ts similarity index 100% rename from kdb-web/src/app/components/spinner/spinner.component.spec.ts rename to web/src/app/components/spinner/spinner.component.spec.ts diff --git a/kdb-web/src/app/components/spinner/spinner.component.ts b/web/src/app/components/spinner/spinner.component.ts similarity index 100% rename from kdb-web/src/app/components/spinner/spinner.component.ts rename to web/src/app/components/spinner/spinner.component.ts diff --git a/kdb-web/src/app/models/auth/admin-update-user.dto.ts b/web/src/app/models/auth/admin-update-user.dto.ts similarity index 100% rename from kdb-web/src/app/models/auth/admin-update-user.dto.ts rename to web/src/app/models/auth/admin-update-user.dto.ts diff --git a/kdb-web/src/app/models/auth/auth-error-messages.enum.ts b/web/src/app/models/auth/auth-error-messages.enum.ts similarity index 100% rename from kdb-web/src/app/models/auth/auth-error-messages.enum.ts rename to web/src/app/models/auth/auth-error-messages.enum.ts diff --git a/kdb-web/src/app/models/auth/auth-roles.enum.ts b/web/src/app/models/auth/auth-roles.enum.ts similarity index 100% rename from kdb-web/src/app/models/auth/auth-roles.enum.ts rename to web/src/app/models/auth/auth-roles.enum.ts diff --git a/kdb-web/src/app/models/auth/auth-user-atr-errors.ts b/web/src/app/models/auth/auth-user-atr-errors.ts similarity index 100% rename from kdb-web/src/app/models/auth/auth-user-atr-errors.ts rename to web/src/app/models/auth/auth-user-atr-errors.ts diff --git a/kdb-web/src/app/models/auth/auth-user.dto.ts b/web/src/app/models/auth/auth-user.dto.ts similarity index 100% rename from kdb-web/src/app/models/auth/auth-user.dto.ts rename to web/src/app/models/auth/auth-user.dto.ts diff --git a/kdb-web/src/app/models/auth/discord-auth-url.dto.ts b/web/src/app/models/auth/discord-auth-url.dto.ts similarity index 100% rename from kdb-web/src/app/models/auth/discord-auth-url.dto.ts rename to web/src/app/models/auth/discord-auth-url.dto.ts diff --git a/kdb-web/src/app/models/auth/email-string.dto.ts b/web/src/app/models/auth/email-string.dto.ts similarity index 100% rename from kdb-web/src/app/models/auth/email-string.dto.ts rename to web/src/app/models/auth/email-string.dto.ts diff --git a/kdb-web/src/app/models/auth/oauth.dto.ts b/web/src/app/models/auth/oauth.dto.ts similarity index 100% rename from kdb-web/src/app/models/auth/oauth.dto.ts rename to web/src/app/models/auth/oauth.dto.ts diff --git a/kdb-web/src/app/models/auth/register-error-messages.enum.ts b/web/src/app/models/auth/register-error-messages.enum.ts similarity index 100% rename from kdb-web/src/app/models/auth/register-error-messages.enum.ts rename to web/src/app/models/auth/register-error-messages.enum.ts diff --git a/kdb-web/src/app/models/auth/reset-password.dto.ts b/web/src/app/models/auth/reset-password.dto.ts similarity index 100% rename from kdb-web/src/app/models/auth/reset-password.dto.ts rename to web/src/app/models/auth/reset-password.dto.ts diff --git a/kdb-web/src/app/models/auth/token.dto.ts b/web/src/app/models/auth/token.dto.ts similarity index 100% rename from kdb-web/src/app/models/auth/token.dto.ts rename to web/src/app/models/auth/token.dto.ts diff --git a/kdb-web/src/app/models/auth/update-user.dto.ts b/web/src/app/models/auth/update-user.dto.ts similarity index 100% rename from kdb-web/src/app/models/auth/update-user.dto.ts rename to web/src/app/models/auth/update-user.dto.ts diff --git a/kdb-web/src/app/models/config/api-version.ts b/web/src/app/models/config/api-version.ts similarity index 100% rename from kdb-web/src/app/models/config/api-version.ts rename to web/src/app/models/config/api-version.ts diff --git a/kdb-web/src/app/models/config/app-settings.ts b/web/src/app/models/config/app-settings.ts similarity index 100% rename from kdb-web/src/app/models/config/app-settings.ts rename to web/src/app/models/config/app-settings.ts diff --git a/kdb-web/src/app/models/config/feature-flags.model.ts b/web/src/app/models/config/feature-flags.model.ts similarity index 100% rename from kdb-web/src/app/models/config/feature-flags.model.ts rename to web/src/app/models/config/feature-flags.model.ts diff --git a/kdb-web/src/app/models/config/server-config.model.ts b/web/src/app/models/config/server-config.model.ts similarity index 100% rename from kdb-web/src/app/models/config/server-config.model.ts rename to web/src/app/models/config/server-config.model.ts diff --git a/kdb-web/src/app/models/config/settings.dto.ts b/web/src/app/models/config/settings.dto.ts similarity index 100% rename from kdb-web/src/app/models/config/settings.dto.ts rename to web/src/app/models/config/settings.dto.ts diff --git a/kdb-web/src/app/models/config/software-version.dto.ts b/web/src/app/models/config/software-version.dto.ts similarity index 100% rename from kdb-web/src/app/models/config/software-version.dto.ts rename to web/src/app/models/config/software-version.dto.ts diff --git a/kdb-web/src/app/models/config/software-version.ts b/web/src/app/models/config/software-version.ts similarity index 100% rename from kdb-web/src/app/models/config/software-version.ts rename to web/src/app/models/config/software-version.ts diff --git a/kdb-web/src/app/models/config/technician-config.model.ts b/web/src/app/models/config/technician-config.model.ts similarity index 100% rename from kdb-web/src/app/models/config/technician-config.model.ts rename to web/src/app/models/config/technician-config.model.ts diff --git a/kdb-web/src/app/models/data/achievement.model.ts b/web/src/app/models/data/achievement.model.ts similarity index 100% rename from kdb-web/src/app/models/data/achievement.model.ts rename to web/src/app/models/data/achievement.model.ts diff --git a/kdb-web/src/app/models/data/auto_role.model.ts b/web/src/app/models/data/auto_role.model.ts similarity index 100% rename from kdb-web/src/app/models/data/auto_role.model.ts rename to web/src/app/models/data/auto_role.model.ts diff --git a/kdb-web/src/app/models/data/client.model.ts b/web/src/app/models/data/client.model.ts similarity index 100% rename from kdb-web/src/app/models/data/client.model.ts rename to web/src/app/models/data/client.model.ts diff --git a/kdb-web/src/app/models/data/data.model.ts b/web/src/app/models/data/data.model.ts similarity index 100% rename from kdb-web/src/app/models/data/data.model.ts rename to web/src/app/models/data/data.model.ts diff --git a/kdb-web/src/app/models/data/discord.model.ts b/web/src/app/models/data/discord.model.ts similarity index 100% rename from kdb-web/src/app/models/data/discord.model.ts rename to web/src/app/models/data/discord.model.ts diff --git a/kdb-web/src/app/models/data/level.model.ts b/web/src/app/models/data/level.model.ts similarity index 100% rename from kdb-web/src/app/models/data/level.model.ts rename to web/src/app/models/data/level.model.ts diff --git a/kdb-web/src/app/models/data/server.model.ts b/web/src/app/models/data/server.model.ts similarity index 100% rename from kdb-web/src/app/models/data/server.model.ts rename to web/src/app/models/data/server.model.ts diff --git a/kdb-web/src/app/models/data/short_role_name.model.ts b/web/src/app/models/data/short_role_name.model.ts similarity index 100% rename from kdb-web/src/app/models/data/short_role_name.model.ts rename to web/src/app/models/data/short_role_name.model.ts diff --git a/kdb-web/src/app/models/data/user.model.ts b/web/src/app/models/data/user.model.ts similarity index 100% rename from kdb-web/src/app/models/data/user.model.ts rename to web/src/app/models/data/user.model.ts diff --git a/kdb-web/src/app/models/data/user_joined_game_server.model.ts b/web/src/app/models/data/user_joined_game_server.model.ts similarity index 100% rename from kdb-web/src/app/models/data/user_joined_game_server.model.ts rename to web/src/app/models/data/user_joined_game_server.model.ts diff --git a/kdb-web/src/app/models/data/user_joined_server.model.ts b/web/src/app/models/data/user_joined_server.model.ts similarity index 100% rename from kdb-web/src/app/models/data/user_joined_server.model.ts rename to web/src/app/models/data/user_joined_server.model.ts diff --git a/kdb-web/src/app/models/data/user_joined_voice_channel.model.ts b/web/src/app/models/data/user_joined_voice_channel.model.ts similarity index 100% rename from kdb-web/src/app/models/data/user_joined_voice_channel.model.ts rename to web/src/app/models/data/user_joined_voice_channel.model.ts diff --git a/kdb-web/src/app/models/data/user_warning.model.ts b/web/src/app/models/data/user_warning.model.ts similarity index 100% rename from kdb-web/src/app/models/data/user_warning.model.ts rename to web/src/app/models/data/user_warning.model.ts diff --git a/kdb-web/src/app/models/error/error-dto.ts b/web/src/app/models/error/error-dto.ts similarity index 100% rename from kdb-web/src/app/models/error/error-dto.ts rename to web/src/app/models/error/error-dto.ts diff --git a/kdb-web/src/app/models/error/service-error-code.enum.ts b/web/src/app/models/error/service-error-code.enum.ts similarity index 100% rename from kdb-web/src/app/models/error/service-error-code.enum.ts rename to web/src/app/models/error/service-error-code.enum.ts diff --git a/kdb-web/src/app/models/graphql/filter/page.model.ts b/web/src/app/models/graphql/filter/page.model.ts similarity index 100% rename from kdb-web/src/app/models/graphql/filter/page.model.ts rename to web/src/app/models/graphql/filter/page.model.ts diff --git a/kdb-web/src/app/models/graphql/filter/sort.model.ts b/web/src/app/models/graphql/filter/sort.model.ts similarity index 100% rename from kdb-web/src/app/models/graphql/filter/sort.model.ts rename to web/src/app/models/graphql/filter/sort.model.ts diff --git a/kdb-web/src/app/models/graphql/mutations.model.ts b/web/src/app/models/graphql/mutations.model.ts similarity index 100% rename from kdb-web/src/app/models/graphql/mutations.model.ts rename to web/src/app/models/graphql/mutations.model.ts diff --git a/kdb-web/src/app/models/graphql/queries.model.ts b/web/src/app/models/graphql/queries.model.ts similarity index 100% rename from kdb-web/src/app/models/graphql/queries.model.ts rename to web/src/app/models/graphql/queries.model.ts diff --git a/kdb-web/src/app/models/graphql/query.model.ts b/web/src/app/models/graphql/query.model.ts similarity index 100% rename from kdb-web/src/app/models/graphql/query.model.ts rename to web/src/app/models/graphql/query.model.ts diff --git a/kdb-web/src/app/models/graphql/result.model.ts b/web/src/app/models/graphql/result.model.ts similarity index 100% rename from kdb-web/src/app/models/graphql/result.model.ts rename to web/src/app/models/graphql/result.model.ts diff --git a/kdb-web/src/app/models/graphql/variables.model.ts b/web/src/app/models/graphql/variables.model.ts similarity index 100% rename from kdb-web/src/app/models/graphql/variables.model.ts rename to web/src/app/models/graphql/variables.model.ts diff --git a/kdb-web/src/app/models/selection/auth-user/auth-user-select-criterion.dto.ts b/web/src/app/models/selection/auth-user/auth-user-select-criterion.dto.ts similarity index 100% rename from kdb-web/src/app/models/selection/auth-user/auth-user-select-criterion.dto.ts rename to web/src/app/models/selection/auth-user/auth-user-select-criterion.dto.ts diff --git a/kdb-web/src/app/models/selection/auth-user/get-filtered-auth-users-result.dto.ts b/web/src/app/models/selection/auth-user/get-filtered-auth-users-result.dto.ts similarity index 100% rename from kdb-web/src/app/models/selection/auth-user/get-filtered-auth-users-result.dto.ts rename to web/src/app/models/selection/auth-user/get-filtered-auth-users-result.dto.ts diff --git a/kdb-web/src/app/models/selection/select-criterion.model.ts b/web/src/app/models/selection/select-criterion.model.ts similarity index 100% rename from kdb-web/src/app/models/selection/select-criterion.model.ts rename to web/src/app/models/selection/select-criterion.model.ts diff --git a/kdb-web/src/app/models/utils/confirmation-dialog.ts b/web/src/app/models/utils/confirmation-dialog.ts similarity index 100% rename from kdb-web/src/app/models/utils/confirmation-dialog.ts rename to web/src/app/models/utils/confirmation-dialog.ts diff --git a/kdb-web/src/app/models/utils/toast-options.ts b/web/src/app/models/utils/toast-options.ts similarity index 100% rename from kdb-web/src/app/models/utils/toast-options.ts rename to web/src/app/models/utils/toast-options.ts diff --git a/kdb-web/src/app/models/view/theme.ts b/web/src/app/models/view/theme.ts similarity index 100% rename from kdb-web/src/app/models/view/theme.ts rename to web/src/app/models/view/theme.ts diff --git a/kdb-web/src/app/models/view/themes.enum.ts b/web/src/app/models/view/themes.enum.ts similarity index 100% rename from kdb-web/src/app/models/view/themes.enum.ts rename to web/src/app/models/view/themes.enum.ts diff --git a/kdb-web/src/app/modules/admin/auth-users/auth-user-routing.module.ts b/web/src/app/modules/admin/auth-users/auth-user-routing.module.ts similarity index 100% rename from kdb-web/src/app/modules/admin/auth-users/auth-user-routing.module.ts rename to web/src/app/modules/admin/auth-users/auth-user-routing.module.ts diff --git a/kdb-web/src/app/modules/admin/auth-users/auth-user.module.ts b/web/src/app/modules/admin/auth-users/auth-user.module.ts similarity index 100% rename from kdb-web/src/app/modules/admin/auth-users/auth-user.module.ts rename to web/src/app/modules/admin/auth-users/auth-user.module.ts diff --git a/kdb-web/src/app/modules/admin/auth-users/components/auth-user/auth-user.component.html b/web/src/app/modules/admin/auth-users/components/auth-user/auth-user.component.html similarity index 100% rename from kdb-web/src/app/modules/admin/auth-users/components/auth-user/auth-user.component.html rename to web/src/app/modules/admin/auth-users/components/auth-user/auth-user.component.html diff --git a/kdb-web/src/app/modules/admin/auth-users/components/auth-user/auth-user.component.scss b/web/src/app/modules/admin/auth-users/components/auth-user/auth-user.component.scss similarity index 100% rename from kdb-web/src/app/modules/admin/auth-users/components/auth-user/auth-user.component.scss rename to web/src/app/modules/admin/auth-users/components/auth-user/auth-user.component.scss diff --git a/kdb-web/src/app/modules/admin/auth-users/components/auth-user/auth-user.component.spec.ts b/web/src/app/modules/admin/auth-users/components/auth-user/auth-user.component.spec.ts similarity index 100% rename from kdb-web/src/app/modules/admin/auth-users/components/auth-user/auth-user.component.spec.ts rename to web/src/app/modules/admin/auth-users/components/auth-user/auth-user.component.spec.ts diff --git a/kdb-web/src/app/modules/admin/auth-users/components/auth-user/auth-user.component.ts b/web/src/app/modules/admin/auth-users/components/auth-user/auth-user.component.ts similarity index 100% rename from kdb-web/src/app/modules/admin/auth-users/components/auth-user/auth-user.component.ts rename to web/src/app/modules/admin/auth-users/components/auth-user/auth-user.component.ts diff --git a/kdb-web/src/app/modules/admin/settings/components/settings/settings.component.html b/web/src/app/modules/admin/settings/components/settings/settings.component.html similarity index 100% rename from kdb-web/src/app/modules/admin/settings/components/settings/settings.component.html rename to web/src/app/modules/admin/settings/components/settings/settings.component.html diff --git a/kdb-web/src/app/modules/admin/settings/components/settings/settings.component.scss b/web/src/app/modules/admin/settings/components/settings/settings.component.scss similarity index 100% rename from kdb-web/src/app/modules/admin/settings/components/settings/settings.component.scss rename to web/src/app/modules/admin/settings/components/settings/settings.component.scss diff --git a/kdb-web/src/app/modules/admin/settings/components/settings/settings.component.spec.ts b/web/src/app/modules/admin/settings/components/settings/settings.component.spec.ts similarity index 100% rename from kdb-web/src/app/modules/admin/settings/components/settings/settings.component.spec.ts rename to web/src/app/modules/admin/settings/components/settings/settings.component.spec.ts diff --git a/kdb-web/src/app/modules/admin/settings/components/settings/settings.component.ts b/web/src/app/modules/admin/settings/components/settings/settings.component.ts similarity index 100% rename from kdb-web/src/app/modules/admin/settings/components/settings/settings.component.ts rename to web/src/app/modules/admin/settings/components/settings/settings.component.ts diff --git a/kdb-web/src/app/modules/admin/settings/settings-routing.module.ts b/web/src/app/modules/admin/settings/settings-routing.module.ts similarity index 100% rename from kdb-web/src/app/modules/admin/settings/settings-routing.module.ts rename to web/src/app/modules/admin/settings/settings-routing.module.ts diff --git a/kdb-web/src/app/modules/admin/settings/settings.module.ts b/web/src/app/modules/admin/settings/settings.module.ts similarity index 100% rename from kdb-web/src/app/modules/admin/settings/settings.module.ts rename to web/src/app/modules/admin/settings/settings.module.ts diff --git a/kdb-web/src/app/modules/auth/auth-routing.module.ts b/web/src/app/modules/auth/auth-routing.module.ts similarity index 100% rename from kdb-web/src/app/modules/auth/auth-routing.module.ts rename to web/src/app/modules/auth/auth-routing.module.ts diff --git a/kdb-web/src/app/modules/auth/auth.module.ts b/web/src/app/modules/auth/auth.module.ts similarity index 100% rename from kdb-web/src/app/modules/auth/auth.module.ts rename to web/src/app/modules/auth/auth.module.ts diff --git a/kdb-web/src/app/modules/auth/components/auth-footer/auth-footer.component.html b/web/src/app/modules/auth/components/auth-footer/auth-footer.component.html similarity index 100% rename from kdb-web/src/app/modules/auth/components/auth-footer/auth-footer.component.html rename to web/src/app/modules/auth/components/auth-footer/auth-footer.component.html diff --git a/kdb-web/src/app/modules/auth/components/auth-footer/auth-footer.component.scss b/web/src/app/modules/auth/components/auth-footer/auth-footer.component.scss similarity index 100% rename from kdb-web/src/app/modules/auth/components/auth-footer/auth-footer.component.scss rename to web/src/app/modules/auth/components/auth-footer/auth-footer.component.scss diff --git a/kdb-web/src/app/modules/auth/components/auth-footer/auth-footer.component.spec.ts b/web/src/app/modules/auth/components/auth-footer/auth-footer.component.spec.ts similarity index 100% rename from kdb-web/src/app/modules/auth/components/auth-footer/auth-footer.component.spec.ts rename to web/src/app/modules/auth/components/auth-footer/auth-footer.component.spec.ts diff --git a/kdb-web/src/app/modules/auth/components/auth-footer/auth-footer.component.ts b/web/src/app/modules/auth/components/auth-footer/auth-footer.component.ts similarity index 100% rename from kdb-web/src/app/modules/auth/components/auth-footer/auth-footer.component.ts rename to web/src/app/modules/auth/components/auth-footer/auth-footer.component.ts diff --git a/kdb-web/src/app/modules/auth/components/auth-header/auth-header.component.html b/web/src/app/modules/auth/components/auth-header/auth-header.component.html similarity index 100% rename from kdb-web/src/app/modules/auth/components/auth-header/auth-header.component.html rename to web/src/app/modules/auth/components/auth-header/auth-header.component.html diff --git a/kdb-web/src/app/modules/auth/components/auth-header/auth-header.component.scss b/web/src/app/modules/auth/components/auth-header/auth-header.component.scss similarity index 100% rename from kdb-web/src/app/modules/auth/components/auth-header/auth-header.component.scss rename to web/src/app/modules/auth/components/auth-header/auth-header.component.scss diff --git a/kdb-web/src/app/modules/auth/components/auth-header/auth-header.component.spec.ts b/web/src/app/modules/auth/components/auth-header/auth-header.component.spec.ts similarity index 100% rename from kdb-web/src/app/modules/auth/components/auth-header/auth-header.component.spec.ts rename to web/src/app/modules/auth/components/auth-header/auth-header.component.spec.ts diff --git a/kdb-web/src/app/modules/auth/components/auth-header/auth-header.component.ts b/web/src/app/modules/auth/components/auth-header/auth-header.component.ts similarity index 100% rename from kdb-web/src/app/modules/auth/components/auth-header/auth-header.component.ts rename to web/src/app/modules/auth/components/auth-header/auth-header.component.ts diff --git a/kdb-web/src/app/modules/auth/components/forget-password/forget-password.component.html b/web/src/app/modules/auth/components/forget-password/forget-password.component.html similarity index 100% rename from kdb-web/src/app/modules/auth/components/forget-password/forget-password.component.html rename to web/src/app/modules/auth/components/forget-password/forget-password.component.html diff --git a/kdb-web/src/app/modules/auth/components/forget-password/forget-password.component.scss b/web/src/app/modules/auth/components/forget-password/forget-password.component.scss similarity index 100% rename from kdb-web/src/app/modules/auth/components/forget-password/forget-password.component.scss rename to web/src/app/modules/auth/components/forget-password/forget-password.component.scss diff --git a/kdb-web/src/app/modules/auth/components/forget-password/forget-password.component.spec.ts b/web/src/app/modules/auth/components/forget-password/forget-password.component.spec.ts similarity index 100% rename from kdb-web/src/app/modules/auth/components/forget-password/forget-password.component.spec.ts rename to web/src/app/modules/auth/components/forget-password/forget-password.component.spec.ts diff --git a/kdb-web/src/app/modules/auth/components/forget-password/forget-password.component.ts b/web/src/app/modules/auth/components/forget-password/forget-password.component.ts similarity index 100% rename from kdb-web/src/app/modules/auth/components/forget-password/forget-password.component.ts rename to web/src/app/modules/auth/components/forget-password/forget-password.component.ts diff --git a/kdb-web/src/app/modules/auth/components/login/login.component.html b/web/src/app/modules/auth/components/login/login.component.html similarity index 100% rename from kdb-web/src/app/modules/auth/components/login/login.component.html rename to web/src/app/modules/auth/components/login/login.component.html diff --git a/kdb-web/src/app/modules/auth/components/login/login.component.scss b/web/src/app/modules/auth/components/login/login.component.scss similarity index 100% rename from kdb-web/src/app/modules/auth/components/login/login.component.scss rename to web/src/app/modules/auth/components/login/login.component.scss diff --git a/kdb-web/src/app/modules/auth/components/login/login.component.spec.ts b/web/src/app/modules/auth/components/login/login.component.spec.ts similarity index 100% rename from kdb-web/src/app/modules/auth/components/login/login.component.spec.ts rename to web/src/app/modules/auth/components/login/login.component.spec.ts diff --git a/kdb-web/src/app/modules/auth/components/login/login.component.ts b/web/src/app/modules/auth/components/login/login.component.ts similarity index 100% rename from kdb-web/src/app/modules/auth/components/login/login.component.ts rename to web/src/app/modules/auth/components/login/login.component.ts diff --git a/kdb-web/src/app/modules/auth/components/registration/registration.component.html b/web/src/app/modules/auth/components/registration/registration.component.html similarity index 100% rename from kdb-web/src/app/modules/auth/components/registration/registration.component.html rename to web/src/app/modules/auth/components/registration/registration.component.html diff --git a/kdb-web/src/app/modules/auth/components/registration/registration.component.scss b/web/src/app/modules/auth/components/registration/registration.component.scss similarity index 100% rename from kdb-web/src/app/modules/auth/components/registration/registration.component.scss rename to web/src/app/modules/auth/components/registration/registration.component.scss diff --git a/kdb-web/src/app/modules/auth/components/registration/registration.component.spec.ts b/web/src/app/modules/auth/components/registration/registration.component.spec.ts similarity index 100% rename from kdb-web/src/app/modules/auth/components/registration/registration.component.spec.ts rename to web/src/app/modules/auth/components/registration/registration.component.spec.ts diff --git a/kdb-web/src/app/modules/auth/components/registration/registration.component.ts b/web/src/app/modules/auth/components/registration/registration.component.ts similarity index 100% rename from kdb-web/src/app/modules/auth/components/registration/registration.component.ts rename to web/src/app/modules/auth/components/registration/registration.component.ts diff --git a/kdb-web/src/app/modules/shared/base/hideable-component.spec.ts b/web/src/app/modules/shared/base/hideable-component.spec.ts similarity index 100% rename from kdb-web/src/app/modules/shared/base/hideable-component.spec.ts rename to web/src/app/modules/shared/base/hideable-component.spec.ts diff --git a/kdb-web/src/app/modules/shared/base/hideable-component.ts b/web/src/app/modules/shared/base/hideable-component.ts similarity index 100% rename from kdb-web/src/app/modules/shared/base/hideable-component.ts rename to web/src/app/modules/shared/base/hideable-component.ts diff --git a/kdb-web/src/app/modules/shared/base/multi-select-columns/multi-select-columns.component.html b/web/src/app/modules/shared/base/multi-select-columns/multi-select-columns.component.html similarity index 100% rename from kdb-web/src/app/modules/shared/base/multi-select-columns/multi-select-columns.component.html rename to web/src/app/modules/shared/base/multi-select-columns/multi-select-columns.component.html diff --git a/kdb-web/src/app/modules/shared/base/multi-select-columns/multi-select-columns.component.scss b/web/src/app/modules/shared/base/multi-select-columns/multi-select-columns.component.scss similarity index 100% rename from kdb-web/src/app/modules/shared/base/multi-select-columns/multi-select-columns.component.scss rename to web/src/app/modules/shared/base/multi-select-columns/multi-select-columns.component.scss diff --git a/kdb-web/src/app/modules/shared/base/multi-select-columns/multi-select-columns.component.spec.ts b/web/src/app/modules/shared/base/multi-select-columns/multi-select-columns.component.spec.ts similarity index 100% rename from kdb-web/src/app/modules/shared/base/multi-select-columns/multi-select-columns.component.spec.ts rename to web/src/app/modules/shared/base/multi-select-columns/multi-select-columns.component.spec.ts diff --git a/kdb-web/src/app/modules/shared/base/multi-select-columns/multi-select-columns.component.ts b/web/src/app/modules/shared/base/multi-select-columns/multi-select-columns.component.ts similarity index 100% rename from kdb-web/src/app/modules/shared/base/multi-select-columns/multi-select-columns.component.ts rename to web/src/app/modules/shared/base/multi-select-columns/multi-select-columns.component.ts diff --git a/kdb-web/src/app/modules/shared/components/config-list/config-list.component.html b/web/src/app/modules/shared/components/config-list/config-list.component.html similarity index 100% rename from kdb-web/src/app/modules/shared/components/config-list/config-list.component.html rename to web/src/app/modules/shared/components/config-list/config-list.component.html diff --git a/kdb-web/src/app/modules/shared/components/config-list/config-list.component.scss b/web/src/app/modules/shared/components/config-list/config-list.component.scss similarity index 100% rename from kdb-web/src/app/modules/shared/components/config-list/config-list.component.scss rename to web/src/app/modules/shared/components/config-list/config-list.component.scss diff --git a/kdb-web/src/app/modules/shared/components/config-list/config-list.component.spec.ts b/web/src/app/modules/shared/components/config-list/config-list.component.spec.ts similarity index 100% rename from kdb-web/src/app/modules/shared/components/config-list/config-list.component.spec.ts rename to web/src/app/modules/shared/components/config-list/config-list.component.spec.ts diff --git a/kdb-web/src/app/modules/shared/components/config-list/config-list.component.ts b/web/src/app/modules/shared/components/config-list/config-list.component.ts similarity index 100% rename from kdb-web/src/app/modules/shared/components/config-list/config-list.component.ts rename to web/src/app/modules/shared/components/config-list/config-list.component.ts diff --git a/kdb-web/src/app/modules/shared/components/feature-flag-list/feature-flag-list.component.html b/web/src/app/modules/shared/components/feature-flag-list/feature-flag-list.component.html similarity index 100% rename from kdb-web/src/app/modules/shared/components/feature-flag-list/feature-flag-list.component.html rename to web/src/app/modules/shared/components/feature-flag-list/feature-flag-list.component.html diff --git a/kdb-web/src/app/modules/shared/components/feature-flag-list/feature-flag-list.component.scss b/web/src/app/modules/shared/components/feature-flag-list/feature-flag-list.component.scss similarity index 100% rename from kdb-web/src/app/modules/shared/components/feature-flag-list/feature-flag-list.component.scss rename to web/src/app/modules/shared/components/feature-flag-list/feature-flag-list.component.scss diff --git a/kdb-web/src/app/modules/shared/components/feature-flag-list/feature-flag-list.component.spec.ts b/web/src/app/modules/shared/components/feature-flag-list/feature-flag-list.component.spec.ts similarity index 100% rename from kdb-web/src/app/modules/shared/components/feature-flag-list/feature-flag-list.component.spec.ts rename to web/src/app/modules/shared/components/feature-flag-list/feature-flag-list.component.spec.ts diff --git a/kdb-web/src/app/modules/shared/components/feature-flag-list/feature-flag-list.component.ts b/web/src/app/modules/shared/components/feature-flag-list/feature-flag-list.component.ts similarity index 100% rename from kdb-web/src/app/modules/shared/components/feature-flag-list/feature-flag-list.component.ts rename to web/src/app/modules/shared/components/feature-flag-list/feature-flag-list.component.ts diff --git a/kdb-web/src/app/modules/shared/components/hideable-column/hideable-column.component.html b/web/src/app/modules/shared/components/hideable-column/hideable-column.component.html similarity index 100% rename from kdb-web/src/app/modules/shared/components/hideable-column/hideable-column.component.html rename to web/src/app/modules/shared/components/hideable-column/hideable-column.component.html diff --git a/kdb-web/src/app/modules/shared/components/hideable-column/hideable-column.component.scss b/web/src/app/modules/shared/components/hideable-column/hideable-column.component.scss similarity index 100% rename from kdb-web/src/app/modules/shared/components/hideable-column/hideable-column.component.scss rename to web/src/app/modules/shared/components/hideable-column/hideable-column.component.scss diff --git a/kdb-web/src/app/modules/shared/components/hideable-column/hideable-column.component.spec.ts b/web/src/app/modules/shared/components/hideable-column/hideable-column.component.spec.ts similarity index 100% rename from kdb-web/src/app/modules/shared/components/hideable-column/hideable-column.component.spec.ts rename to web/src/app/modules/shared/components/hideable-column/hideable-column.component.spec.ts diff --git a/kdb-web/src/app/modules/shared/components/hideable-column/hideable-column.component.ts b/web/src/app/modules/shared/components/hideable-column/hideable-column.component.ts similarity index 100% rename from kdb-web/src/app/modules/shared/components/hideable-column/hideable-column.component.ts rename to web/src/app/modules/shared/components/hideable-column/hideable-column.component.ts diff --git a/kdb-web/src/app/modules/shared/components/hideable-header/hideable-header.component.html b/web/src/app/modules/shared/components/hideable-header/hideable-header.component.html similarity index 100% rename from kdb-web/src/app/modules/shared/components/hideable-header/hideable-header.component.html rename to web/src/app/modules/shared/components/hideable-header/hideable-header.component.html diff --git a/kdb-web/src/app/modules/shared/components/hideable-header/hideable-header.component.scss b/web/src/app/modules/shared/components/hideable-header/hideable-header.component.scss similarity index 100% rename from kdb-web/src/app/modules/shared/components/hideable-header/hideable-header.component.scss rename to web/src/app/modules/shared/components/hideable-header/hideable-header.component.scss diff --git a/kdb-web/src/app/modules/shared/components/hideable-header/hideable-header.component.spec.ts b/web/src/app/modules/shared/components/hideable-header/hideable-header.component.spec.ts similarity index 100% rename from kdb-web/src/app/modules/shared/components/hideable-header/hideable-header.component.spec.ts rename to web/src/app/modules/shared/components/hideable-header/hideable-header.component.spec.ts diff --git a/kdb-web/src/app/modules/shared/components/hideable-header/hideable-header.component.ts b/web/src/app/modules/shared/components/hideable-header/hideable-header.component.ts similarity index 100% rename from kdb-web/src/app/modules/shared/components/hideable-header/hideable-header.component.ts rename to web/src/app/modules/shared/components/hideable-header/hideable-header.component.ts diff --git a/kdb-web/src/app/modules/shared/components/history-btn/history-btn.component.html b/web/src/app/modules/shared/components/history-btn/history-btn.component.html similarity index 100% rename from kdb-web/src/app/modules/shared/components/history-btn/history-btn.component.html rename to web/src/app/modules/shared/components/history-btn/history-btn.component.html diff --git a/kdb-web/src/app/modules/shared/components/history-btn/history-btn.component.scss b/web/src/app/modules/shared/components/history-btn/history-btn.component.scss similarity index 100% rename from kdb-web/src/app/modules/shared/components/history-btn/history-btn.component.scss rename to web/src/app/modules/shared/components/history-btn/history-btn.component.scss diff --git a/kdb-web/src/app/modules/shared/components/history-btn/history-btn.component.spec.ts b/web/src/app/modules/shared/components/history-btn/history-btn.component.spec.ts similarity index 100% rename from kdb-web/src/app/modules/shared/components/history-btn/history-btn.component.spec.ts rename to web/src/app/modules/shared/components/history-btn/history-btn.component.spec.ts diff --git a/kdb-web/src/app/modules/shared/components/history-btn/history-btn.component.ts b/web/src/app/modules/shared/components/history-btn/history-btn.component.ts similarity index 100% rename from kdb-web/src/app/modules/shared/components/history-btn/history-btn.component.ts rename to web/src/app/modules/shared/components/history-btn/history-btn.component.ts diff --git a/kdb-web/src/app/modules/shared/guards/auth/auth.guard.spec.ts b/web/src/app/modules/shared/guards/auth/auth.guard.spec.ts similarity index 100% rename from kdb-web/src/app/modules/shared/guards/auth/auth.guard.spec.ts rename to web/src/app/modules/shared/guards/auth/auth.guard.spec.ts diff --git a/kdb-web/src/app/modules/shared/guards/auth/auth.guard.ts b/web/src/app/modules/shared/guards/auth/auth.guard.ts similarity index 100% rename from kdb-web/src/app/modules/shared/guards/auth/auth.guard.ts rename to web/src/app/modules/shared/guards/auth/auth.guard.ts diff --git a/kdb-web/src/app/modules/shared/pipes/auth-role.pipe.ts b/web/src/app/modules/shared/pipes/auth-role.pipe.ts similarity index 100% rename from kdb-web/src/app/modules/shared/pipes/auth-role.pipe.ts rename to web/src/app/modules/shared/pipes/auth-role.pipe.ts diff --git a/kdb-web/src/app/modules/shared/pipes/bool.pipe.spec.ts b/web/src/app/modules/shared/pipes/bool.pipe.spec.ts similarity index 100% rename from kdb-web/src/app/modules/shared/pipes/bool.pipe.spec.ts rename to web/src/app/modules/shared/pipes/bool.pipe.spec.ts diff --git a/kdb-web/src/app/modules/shared/pipes/bool.pipe.ts b/web/src/app/modules/shared/pipes/bool.pipe.ts similarity index 100% rename from kdb-web/src/app/modules/shared/pipes/bool.pipe.ts rename to web/src/app/modules/shared/pipes/bool.pipe.ts diff --git a/kdb-web/src/app/modules/shared/pipes/ip-address.pipe.ts b/web/src/app/modules/shared/pipes/ip-address.pipe.ts similarity index 100% rename from kdb-web/src/app/modules/shared/pipes/ip-address.pipe.ts rename to web/src/app/modules/shared/pipes/ip-address.pipe.ts diff --git a/kdb-web/src/app/modules/shared/shared.module.ts b/web/src/app/modules/shared/shared.module.ts similarity index 100% rename from kdb-web/src/app/modules/shared/shared.module.ts rename to web/src/app/modules/shared/shared.module.ts diff --git a/kdb-web/src/app/modules/view/change-password/change-password-routing.module.ts b/web/src/app/modules/view/change-password/change-password-routing.module.ts similarity index 100% rename from kdb-web/src/app/modules/view/change-password/change-password-routing.module.ts rename to web/src/app/modules/view/change-password/change-password-routing.module.ts diff --git a/kdb-web/src/app/modules/view/change-password/change-password.module.ts b/web/src/app/modules/view/change-password/change-password.module.ts similarity index 100% rename from kdb-web/src/app/modules/view/change-password/change-password.module.ts rename to web/src/app/modules/view/change-password/change-password.module.ts diff --git a/kdb-web/src/app/modules/view/change-password/components/change-password/change-password.component.html b/web/src/app/modules/view/change-password/components/change-password/change-password.component.html similarity index 100% rename from kdb-web/src/app/modules/view/change-password/components/change-password/change-password.component.html rename to web/src/app/modules/view/change-password/components/change-password/change-password.component.html diff --git a/kdb-web/src/app/modules/view/change-password/components/change-password/change-password.component.scss b/web/src/app/modules/view/change-password/components/change-password/change-password.component.scss similarity index 100% rename from kdb-web/src/app/modules/view/change-password/components/change-password/change-password.component.scss rename to web/src/app/modules/view/change-password/components/change-password/change-password.component.scss diff --git a/kdb-web/src/app/modules/view/change-password/components/change-password/change-password.component.spec.ts b/web/src/app/modules/view/change-password/components/change-password/change-password.component.spec.ts similarity index 100% rename from kdb-web/src/app/modules/view/change-password/components/change-password/change-password.component.spec.ts rename to web/src/app/modules/view/change-password/components/change-password/change-password.component.spec.ts diff --git a/kdb-web/src/app/modules/view/change-password/components/change-password/change-password.component.ts b/web/src/app/modules/view/change-password/components/change-password/change-password.component.ts similarity index 100% rename from kdb-web/src/app/modules/view/change-password/components/change-password/change-password.component.ts rename to web/src/app/modules/view/change-password/components/change-password/change-password.component.ts diff --git a/kdb-web/src/app/modules/view/dashboard/components/dashboard/dashboard.component.html b/web/src/app/modules/view/dashboard/components/dashboard/dashboard.component.html similarity index 100% rename from kdb-web/src/app/modules/view/dashboard/components/dashboard/dashboard.component.html rename to web/src/app/modules/view/dashboard/components/dashboard/dashboard.component.html diff --git a/kdb-web/src/app/modules/view/dashboard/components/dashboard/dashboard.component.scss b/web/src/app/modules/view/dashboard/components/dashboard/dashboard.component.scss similarity index 100% rename from kdb-web/src/app/modules/view/dashboard/components/dashboard/dashboard.component.scss rename to web/src/app/modules/view/dashboard/components/dashboard/dashboard.component.scss diff --git a/kdb-web/src/app/modules/view/dashboard/components/dashboard/dashboard.component.spec.ts b/web/src/app/modules/view/dashboard/components/dashboard/dashboard.component.spec.ts similarity index 100% rename from kdb-web/src/app/modules/view/dashboard/components/dashboard/dashboard.component.spec.ts rename to web/src/app/modules/view/dashboard/components/dashboard/dashboard.component.spec.ts diff --git a/kdb-web/src/app/modules/view/dashboard/components/dashboard/dashboard.component.ts b/web/src/app/modules/view/dashboard/components/dashboard/dashboard.component.ts similarity index 100% rename from kdb-web/src/app/modules/view/dashboard/components/dashboard/dashboard.component.ts rename to web/src/app/modules/view/dashboard/components/dashboard/dashboard.component.ts diff --git a/kdb-web/src/app/modules/view/dashboard/dashboard-routing.module.ts b/web/src/app/modules/view/dashboard/dashboard-routing.module.ts similarity index 100% rename from kdb-web/src/app/modules/view/dashboard/dashboard-routing.module.ts rename to web/src/app/modules/view/dashboard/dashboard-routing.module.ts diff --git a/kdb-web/src/app/modules/view/dashboard/dashboard.module.ts b/web/src/app/modules/view/dashboard/dashboard.module.ts similarity index 100% rename from kdb-web/src/app/modules/view/dashboard/dashboard.module.ts rename to web/src/app/modules/view/dashboard/dashboard.module.ts diff --git a/kdb-web/src/app/modules/view/server/achievements/achievements-routing.module.ts b/web/src/app/modules/view/server/achievements/achievements-routing.module.ts similarity index 100% rename from kdb-web/src/app/modules/view/server/achievements/achievements-routing.module.ts rename to web/src/app/modules/view/server/achievements/achievements-routing.module.ts diff --git a/kdb-web/src/app/modules/view/server/achievements/achievements.module.ts b/web/src/app/modules/view/server/achievements/achievements.module.ts similarity index 100% rename from kdb-web/src/app/modules/view/server/achievements/achievements.module.ts rename to web/src/app/modules/view/server/achievements/achievements.module.ts diff --git a/kdb-web/src/app/modules/view/server/achievements/components/achievement/achievement.component.html b/web/src/app/modules/view/server/achievements/components/achievement/achievement.component.html similarity index 100% rename from kdb-web/src/app/modules/view/server/achievements/components/achievement/achievement.component.html rename to web/src/app/modules/view/server/achievements/components/achievement/achievement.component.html diff --git a/kdb-web/src/app/modules/view/server/achievements/components/achievement/achievement.component.scss b/web/src/app/modules/view/server/achievements/components/achievement/achievement.component.scss similarity index 100% rename from kdb-web/src/app/modules/view/server/achievements/components/achievement/achievement.component.scss rename to web/src/app/modules/view/server/achievements/components/achievement/achievement.component.scss diff --git a/kdb-web/src/app/modules/view/server/achievements/components/achievement/achievement.component.spec.ts b/web/src/app/modules/view/server/achievements/components/achievement/achievement.component.spec.ts similarity index 100% rename from kdb-web/src/app/modules/view/server/achievements/components/achievement/achievement.component.spec.ts rename to web/src/app/modules/view/server/achievements/components/achievement/achievement.component.spec.ts diff --git a/kdb-web/src/app/modules/view/server/achievements/components/achievement/achievement.component.ts b/web/src/app/modules/view/server/achievements/components/achievement/achievement.component.ts similarity index 100% rename from kdb-web/src/app/modules/view/server/achievements/components/achievement/achievement.component.ts rename to web/src/app/modules/view/server/achievements/components/achievement/achievement.component.ts diff --git a/kdb-web/src/app/modules/view/server/auto-role/auto-role-routing.module.ts b/web/src/app/modules/view/server/auto-role/auto-role-routing.module.ts similarity index 100% rename from kdb-web/src/app/modules/view/server/auto-role/auto-role-routing.module.ts rename to web/src/app/modules/view/server/auto-role/auto-role-routing.module.ts diff --git a/kdb-web/src/app/modules/view/server/auto-role/auto-role.module.ts b/web/src/app/modules/view/server/auto-role/auto-role.module.ts similarity index 100% rename from kdb-web/src/app/modules/view/server/auto-role/auto-role.module.ts rename to web/src/app/modules/view/server/auto-role/auto-role.module.ts diff --git a/kdb-web/src/app/modules/view/server/auto-role/components/auto-roles-rules/auto-roles-rules.component.html b/web/src/app/modules/view/server/auto-role/components/auto-roles-rules/auto-roles-rules.component.html similarity index 100% rename from kdb-web/src/app/modules/view/server/auto-role/components/auto-roles-rules/auto-roles-rules.component.html rename to web/src/app/modules/view/server/auto-role/components/auto-roles-rules/auto-roles-rules.component.html diff --git a/kdb-web/src/app/modules/view/server/auto-role/components/auto-roles-rules/auto-roles-rules.component.scss b/web/src/app/modules/view/server/auto-role/components/auto-roles-rules/auto-roles-rules.component.scss similarity index 100% rename from kdb-web/src/app/modules/view/server/auto-role/components/auto-roles-rules/auto-roles-rules.component.scss rename to web/src/app/modules/view/server/auto-role/components/auto-roles-rules/auto-roles-rules.component.scss diff --git a/kdb-web/src/app/modules/view/server/auto-role/components/auto-roles-rules/auto-roles-rules.component.spec.ts b/web/src/app/modules/view/server/auto-role/components/auto-roles-rules/auto-roles-rules.component.spec.ts similarity index 100% rename from kdb-web/src/app/modules/view/server/auto-role/components/auto-roles-rules/auto-roles-rules.component.spec.ts rename to web/src/app/modules/view/server/auto-role/components/auto-roles-rules/auto-roles-rules.component.spec.ts diff --git a/kdb-web/src/app/modules/view/server/auto-role/components/auto-roles-rules/auto-roles-rules.component.ts b/web/src/app/modules/view/server/auto-role/components/auto-roles-rules/auto-roles-rules.component.ts similarity index 100% rename from kdb-web/src/app/modules/view/server/auto-role/components/auto-roles-rules/auto-roles-rules.component.ts rename to web/src/app/modules/view/server/auto-role/components/auto-roles-rules/auto-roles-rules.component.ts diff --git a/kdb-web/src/app/modules/view/server/auto-role/components/auto-roles/auto-roles.component.html b/web/src/app/modules/view/server/auto-role/components/auto-roles/auto-roles.component.html similarity index 100% rename from kdb-web/src/app/modules/view/server/auto-role/components/auto-roles/auto-roles.component.html rename to web/src/app/modules/view/server/auto-role/components/auto-roles/auto-roles.component.html diff --git a/kdb-web/src/app/modules/view/server/auto-role/components/auto-roles/auto-roles.component.scss b/web/src/app/modules/view/server/auto-role/components/auto-roles/auto-roles.component.scss similarity index 100% rename from kdb-web/src/app/modules/view/server/auto-role/components/auto-roles/auto-roles.component.scss rename to web/src/app/modules/view/server/auto-role/components/auto-roles/auto-roles.component.scss diff --git a/kdb-web/src/app/modules/view/server/auto-role/components/auto-roles/auto-roles.component.spec.ts b/web/src/app/modules/view/server/auto-role/components/auto-roles/auto-roles.component.spec.ts similarity index 100% rename from kdb-web/src/app/modules/view/server/auto-role/components/auto-roles/auto-roles.component.spec.ts rename to web/src/app/modules/view/server/auto-role/components/auto-roles/auto-roles.component.spec.ts diff --git a/kdb-web/src/app/modules/view/server/auto-role/components/auto-roles/auto-roles.component.ts b/web/src/app/modules/view/server/auto-role/components/auto-roles/auto-roles.component.ts similarity index 100% rename from kdb-web/src/app/modules/view/server/auto-role/components/auto-roles/auto-roles.component.ts rename to web/src/app/modules/view/server/auto-role/components/auto-roles/auto-roles.component.ts diff --git a/kdb-web/src/app/modules/view/server/config/components/config/config.component.html b/web/src/app/modules/view/server/config/components/config/config.component.html similarity index 100% rename from kdb-web/src/app/modules/view/server/config/components/config/config.component.html rename to web/src/app/modules/view/server/config/components/config/config.component.html diff --git a/kdb-web/src/app/modules/view/server/config/components/config/config.component.scss b/web/src/app/modules/view/server/config/components/config/config.component.scss similarity index 100% rename from kdb-web/src/app/modules/view/server/config/components/config/config.component.scss rename to web/src/app/modules/view/server/config/components/config/config.component.scss diff --git a/kdb-web/src/app/modules/view/server/config/components/config/config.component.spec.ts b/web/src/app/modules/view/server/config/components/config/config.component.spec.ts similarity index 100% rename from kdb-web/src/app/modules/view/server/config/components/config/config.component.spec.ts rename to web/src/app/modules/view/server/config/components/config/config.component.spec.ts diff --git a/kdb-web/src/app/modules/view/server/config/components/config/config.component.ts b/web/src/app/modules/view/server/config/components/config/config.component.ts similarity index 100% rename from kdb-web/src/app/modules/view/server/config/components/config/config.component.ts rename to web/src/app/modules/view/server/config/components/config/config.component.ts diff --git a/kdb-web/src/app/modules/view/server/config/config-routing.module.ts b/web/src/app/modules/view/server/config/config-routing.module.ts similarity index 100% rename from kdb-web/src/app/modules/view/server/config/config-routing.module.ts rename to web/src/app/modules/view/server/config/config-routing.module.ts diff --git a/kdb-web/src/app/modules/view/server/config/config.module.ts b/web/src/app/modules/view/server/config/config.module.ts similarity index 100% rename from kdb-web/src/app/modules/view/server/config/config.module.ts rename to web/src/app/modules/view/server/config/config.module.ts diff --git a/kdb-web/src/app/modules/view/server/levels/components/levels/levels.component.html b/web/src/app/modules/view/server/levels/components/levels/levels.component.html similarity index 100% rename from kdb-web/src/app/modules/view/server/levels/components/levels/levels.component.html rename to web/src/app/modules/view/server/levels/components/levels/levels.component.html diff --git a/kdb-web/src/app/modules/view/server/levels/components/levels/levels.component.scss b/web/src/app/modules/view/server/levels/components/levels/levels.component.scss similarity index 100% rename from kdb-web/src/app/modules/view/server/levels/components/levels/levels.component.scss rename to web/src/app/modules/view/server/levels/components/levels/levels.component.scss diff --git a/kdb-web/src/app/modules/view/server/levels/components/levels/levels.component.spec.ts b/web/src/app/modules/view/server/levels/components/levels/levels.component.spec.ts similarity index 100% rename from kdb-web/src/app/modules/view/server/levels/components/levels/levels.component.spec.ts rename to web/src/app/modules/view/server/levels/components/levels/levels.component.spec.ts diff --git a/kdb-web/src/app/modules/view/server/levels/components/levels/levels.component.ts b/web/src/app/modules/view/server/levels/components/levels/levels.component.ts similarity index 100% rename from kdb-web/src/app/modules/view/server/levels/components/levels/levels.component.ts rename to web/src/app/modules/view/server/levels/components/levels/levels.component.ts diff --git a/kdb-web/src/app/modules/view/server/levels/levels-routing.module.ts b/web/src/app/modules/view/server/levels/levels-routing.module.ts similarity index 100% rename from kdb-web/src/app/modules/view/server/levels/levels-routing.module.ts rename to web/src/app/modules/view/server/levels/levels-routing.module.ts diff --git a/kdb-web/src/app/modules/view/server/levels/levels.module.ts b/web/src/app/modules/view/server/levels/levels.module.ts similarity index 100% rename from kdb-web/src/app/modules/view/server/levels/levels.module.ts rename to web/src/app/modules/view/server/levels/levels.module.ts diff --git a/kdb-web/src/app/modules/view/server/members/members.component.html b/web/src/app/modules/view/server/members/members.component.html similarity index 100% rename from kdb-web/src/app/modules/view/server/members/members.component.html rename to web/src/app/modules/view/server/members/members.component.html diff --git a/kdb-web/src/app/modules/view/server/members/members.component.scss b/web/src/app/modules/view/server/members/members.component.scss similarity index 100% rename from kdb-web/src/app/modules/view/server/members/members.component.scss rename to web/src/app/modules/view/server/members/members.component.scss diff --git a/kdb-web/src/app/modules/view/server/members/members.component.spec.ts b/web/src/app/modules/view/server/members/members.component.spec.ts similarity index 100% rename from kdb-web/src/app/modules/view/server/members/members.component.spec.ts rename to web/src/app/modules/view/server/members/members.component.spec.ts diff --git a/kdb-web/src/app/modules/view/server/members/members.component.ts b/web/src/app/modules/view/server/members/members.component.ts similarity index 100% rename from kdb-web/src/app/modules/view/server/members/members.component.ts rename to web/src/app/modules/view/server/members/members.component.ts diff --git a/kdb-web/src/app/modules/view/server/profile/profile.component.html b/web/src/app/modules/view/server/profile/profile.component.html similarity index 100% rename from kdb-web/src/app/modules/view/server/profile/profile.component.html rename to web/src/app/modules/view/server/profile/profile.component.html diff --git a/kdb-web/src/app/modules/view/server/profile/profile.component.scss b/web/src/app/modules/view/server/profile/profile.component.scss similarity index 100% rename from kdb-web/src/app/modules/view/server/profile/profile.component.scss rename to web/src/app/modules/view/server/profile/profile.component.scss diff --git a/kdb-web/src/app/modules/view/server/profile/profile.component.spec.ts b/web/src/app/modules/view/server/profile/profile.component.spec.ts similarity index 100% rename from kdb-web/src/app/modules/view/server/profile/profile.component.spec.ts rename to web/src/app/modules/view/server/profile/profile.component.spec.ts diff --git a/kdb-web/src/app/modules/view/server/profile/profile.component.ts b/web/src/app/modules/view/server/profile/profile.component.ts similarity index 100% rename from kdb-web/src/app/modules/view/server/profile/profile.component.ts rename to web/src/app/modules/view/server/profile/profile.component.ts diff --git a/kdb-web/src/app/modules/view/server/server-dashboard/components/client/client.component.html b/web/src/app/modules/view/server/server-dashboard/components/client/client.component.html similarity index 100% rename from kdb-web/src/app/modules/view/server/server-dashboard/components/client/client.component.html rename to web/src/app/modules/view/server/server-dashboard/components/client/client.component.html diff --git a/kdb-web/src/app/modules/view/server/server-dashboard/components/client/client.component.scss b/web/src/app/modules/view/server/server-dashboard/components/client/client.component.scss similarity index 100% rename from kdb-web/src/app/modules/view/server/server-dashboard/components/client/client.component.scss rename to web/src/app/modules/view/server/server-dashboard/components/client/client.component.scss diff --git a/kdb-web/src/app/modules/view/server/server-dashboard/components/client/client.component.spec.ts b/web/src/app/modules/view/server/server-dashboard/components/client/client.component.spec.ts similarity index 100% rename from kdb-web/src/app/modules/view/server/server-dashboard/components/client/client.component.spec.ts rename to web/src/app/modules/view/server/server-dashboard/components/client/client.component.spec.ts diff --git a/kdb-web/src/app/modules/view/server/server-dashboard/components/client/client.component.ts b/web/src/app/modules/view/server/server-dashboard/components/client/client.component.ts similarity index 100% rename from kdb-web/src/app/modules/view/server/server-dashboard/components/client/client.component.ts rename to web/src/app/modules/view/server/server-dashboard/components/client/client.component.ts diff --git a/kdb-web/src/app/modules/view/server/server-dashboard/server-dashboard.component.html b/web/src/app/modules/view/server/server-dashboard/server-dashboard.component.html similarity index 100% rename from kdb-web/src/app/modules/view/server/server-dashboard/server-dashboard.component.html rename to web/src/app/modules/view/server/server-dashboard/server-dashboard.component.html diff --git a/kdb-web/src/app/modules/view/server/server-dashboard/server-dashboard.component.scss b/web/src/app/modules/view/server/server-dashboard/server-dashboard.component.scss similarity index 100% rename from kdb-web/src/app/modules/view/server/server-dashboard/server-dashboard.component.scss rename to web/src/app/modules/view/server/server-dashboard/server-dashboard.component.scss diff --git a/kdb-web/src/app/modules/view/server/server-dashboard/server-dashboard.component.spec.ts b/web/src/app/modules/view/server/server-dashboard/server-dashboard.component.spec.ts similarity index 100% rename from kdb-web/src/app/modules/view/server/server-dashboard/server-dashboard.component.spec.ts rename to web/src/app/modules/view/server/server-dashboard/server-dashboard.component.spec.ts diff --git a/kdb-web/src/app/modules/view/server/server-dashboard/server-dashboard.component.ts b/web/src/app/modules/view/server/server-dashboard/server-dashboard.component.ts similarity index 100% rename from kdb-web/src/app/modules/view/server/server-dashboard/server-dashboard.component.ts rename to web/src/app/modules/view/server/server-dashboard/server-dashboard.component.ts diff --git a/kdb-web/src/app/modules/view/server/server-routing.module.ts b/web/src/app/modules/view/server/server-routing.module.ts similarity index 100% rename from kdb-web/src/app/modules/view/server/server-routing.module.ts rename to web/src/app/modules/view/server/server-routing.module.ts diff --git a/kdb-web/src/app/modules/view/server/server.module.ts b/web/src/app/modules/view/server/server.module.ts similarity index 100% rename from kdb-web/src/app/modules/view/server/server.module.ts rename to web/src/app/modules/view/server/server.module.ts diff --git a/kdb-web/src/app/modules/view/server/short-role-name/components/short-role-names/short-role-names.component.html b/web/src/app/modules/view/server/short-role-name/components/short-role-names/short-role-names.component.html similarity index 100% rename from kdb-web/src/app/modules/view/server/short-role-name/components/short-role-names/short-role-names.component.html rename to web/src/app/modules/view/server/short-role-name/components/short-role-names/short-role-names.component.html diff --git a/kdb-web/src/app/modules/view/server/short-role-name/components/short-role-names/short-role-names.component.scss b/web/src/app/modules/view/server/short-role-name/components/short-role-names/short-role-names.component.scss similarity index 100% rename from kdb-web/src/app/modules/view/server/short-role-name/components/short-role-names/short-role-names.component.scss rename to web/src/app/modules/view/server/short-role-name/components/short-role-names/short-role-names.component.scss diff --git a/kdb-web/src/app/modules/view/server/short-role-name/components/short-role-names/short-role-names.component.spec.ts b/web/src/app/modules/view/server/short-role-name/components/short-role-names/short-role-names.component.spec.ts similarity index 100% rename from kdb-web/src/app/modules/view/server/short-role-name/components/short-role-names/short-role-names.component.spec.ts rename to web/src/app/modules/view/server/short-role-name/components/short-role-names/short-role-names.component.spec.ts diff --git a/kdb-web/src/app/modules/view/server/short-role-name/components/short-role-names/short-role-names.component.ts b/web/src/app/modules/view/server/short-role-name/components/short-role-names/short-role-names.component.ts similarity index 100% rename from kdb-web/src/app/modules/view/server/short-role-name/components/short-role-names/short-role-names.component.ts rename to web/src/app/modules/view/server/short-role-name/components/short-role-names/short-role-names.component.ts diff --git a/kdb-web/src/app/modules/view/server/short-role-name/short-role-name-routing.module.ts b/web/src/app/modules/view/server/short-role-name/short-role-name-routing.module.ts similarity index 100% rename from kdb-web/src/app/modules/view/server/short-role-name/short-role-name-routing.module.ts rename to web/src/app/modules/view/server/short-role-name/short-role-name-routing.module.ts diff --git a/kdb-web/src/app/modules/view/server/short-role-name/short-role-name.module.ts b/web/src/app/modules/view/server/short-role-name/short-role-name.module.ts similarity index 100% rename from kdb-web/src/app/modules/view/server/short-role-name/short-role-name.module.ts rename to web/src/app/modules/view/server/short-role-name/short-role-name.module.ts diff --git a/kdb-web/src/app/modules/view/user-settings/components/user-settings/user-settings.component.html b/web/src/app/modules/view/user-settings/components/user-settings/user-settings.component.html similarity index 100% rename from kdb-web/src/app/modules/view/user-settings/components/user-settings/user-settings.component.html rename to web/src/app/modules/view/user-settings/components/user-settings/user-settings.component.html diff --git a/kdb-web/src/app/modules/view/user-settings/components/user-settings/user-settings.component.scss b/web/src/app/modules/view/user-settings/components/user-settings/user-settings.component.scss similarity index 100% rename from kdb-web/src/app/modules/view/user-settings/components/user-settings/user-settings.component.scss rename to web/src/app/modules/view/user-settings/components/user-settings/user-settings.component.scss diff --git a/kdb-web/src/app/modules/view/user-settings/components/user-settings/user-settings.component.spec.ts b/web/src/app/modules/view/user-settings/components/user-settings/user-settings.component.spec.ts similarity index 100% rename from kdb-web/src/app/modules/view/user-settings/components/user-settings/user-settings.component.spec.ts rename to web/src/app/modules/view/user-settings/components/user-settings/user-settings.component.spec.ts diff --git a/kdb-web/src/app/modules/view/user-settings/components/user-settings/user-settings.component.ts b/web/src/app/modules/view/user-settings/components/user-settings/user-settings.component.ts similarity index 100% rename from kdb-web/src/app/modules/view/user-settings/components/user-settings/user-settings.component.ts rename to web/src/app/modules/view/user-settings/components/user-settings/user-settings.component.ts diff --git a/kdb-web/src/app/modules/view/user-settings/user-settings-routing.module.ts b/web/src/app/modules/view/user-settings/user-settings-routing.module.ts similarity index 100% rename from kdb-web/src/app/modules/view/user-settings/user-settings-routing.module.ts rename to web/src/app/modules/view/user-settings/user-settings-routing.module.ts diff --git a/kdb-web/src/app/modules/view/user-settings/user-settings.module.ts b/web/src/app/modules/view/user-settings/user-settings.module.ts similarity index 100% rename from kdb-web/src/app/modules/view/user-settings/user-settings.module.ts rename to web/src/app/modules/view/user-settings/user-settings.module.ts diff --git a/kdb-web/src/app/services/auth/auth.service.spec.ts b/web/src/app/services/auth/auth.service.spec.ts similarity index 100% rename from kdb-web/src/app/services/auth/auth.service.spec.ts rename to web/src/app/services/auth/auth.service.spec.ts diff --git a/kdb-web/src/app/services/auth/auth.service.ts b/web/src/app/services/auth/auth.service.ts similarity index 100% rename from kdb-web/src/app/services/auth/auth.service.ts rename to web/src/app/services/auth/auth.service.ts diff --git a/kdb-web/src/app/services/confirmation-dialog/confirmation-dialog.service.spec.ts b/web/src/app/services/confirmation-dialog/confirmation-dialog.service.spec.ts similarity index 100% rename from kdb-web/src/app/services/confirmation-dialog/confirmation-dialog.service.spec.ts rename to web/src/app/services/confirmation-dialog/confirmation-dialog.service.spec.ts diff --git a/kdb-web/src/app/services/confirmation-dialog/confirmation-dialog.service.ts b/web/src/app/services/confirmation-dialog/confirmation-dialog.service.ts similarity index 100% rename from kdb-web/src/app/services/confirmation-dialog/confirmation-dialog.service.ts rename to web/src/app/services/confirmation-dialog/confirmation-dialog.service.ts diff --git a/kdb-web/src/app/services/data/data.service.spec.ts b/web/src/app/services/data/data.service.spec.ts similarity index 100% rename from kdb-web/src/app/services/data/data.service.spec.ts rename to web/src/app/services/data/data.service.spec.ts diff --git a/kdb-web/src/app/services/data/data.service.ts b/web/src/app/services/data/data.service.ts similarity index 100% rename from kdb-web/src/app/services/data/data.service.ts rename to web/src/app/services/data/data.service.ts diff --git a/kdb-web/src/app/services/error-handler/error-handler.service.spec.ts b/web/src/app/services/error-handler/error-handler.service.spec.ts similarity index 100% rename from kdb-web/src/app/services/error-handler/error-handler.service.spec.ts rename to web/src/app/services/error-handler/error-handler.service.spec.ts diff --git a/kdb-web/src/app/services/error-handler/error-handler.service.ts b/web/src/app/services/error-handler/error-handler.service.ts similarity index 100% rename from kdb-web/src/app/services/error-handler/error-handler.service.ts rename to web/src/app/services/error-handler/error-handler.service.ts diff --git a/kdb-web/src/app/services/gui/gui.service.spec.ts b/web/src/app/services/gui/gui.service.spec.ts similarity index 100% rename from kdb-web/src/app/services/gui/gui.service.spec.ts rename to web/src/app/services/gui/gui.service.spec.ts diff --git a/kdb-web/src/app/services/gui/gui.service.ts b/web/src/app/services/gui/gui.service.ts similarity index 100% rename from kdb-web/src/app/services/gui/gui.service.ts rename to web/src/app/services/gui/gui.service.ts diff --git a/kdb-web/src/app/services/server.service.spec.ts b/web/src/app/services/server.service.spec.ts similarity index 100% rename from kdb-web/src/app/services/server.service.spec.ts rename to web/src/app/services/server.service.spec.ts diff --git a/kdb-web/src/app/services/server.service.ts b/web/src/app/services/server.service.ts similarity index 100% rename from kdb-web/src/app/services/server.service.ts rename to web/src/app/services/server.service.ts diff --git a/kdb-web/src/app/services/settings/settings.service.spec.ts b/web/src/app/services/settings/settings.service.spec.ts similarity index 100% rename from kdb-web/src/app/services/settings/settings.service.spec.ts rename to web/src/app/services/settings/settings.service.spec.ts diff --git a/kdb-web/src/app/services/settings/settings.service.ts b/web/src/app/services/settings/settings.service.ts similarity index 100% rename from kdb-web/src/app/services/settings/settings.service.ts rename to web/src/app/services/settings/settings.service.ts diff --git a/kdb-web/src/app/services/sidebar/sidebar.service.spec.ts b/web/src/app/services/sidebar/sidebar.service.spec.ts similarity index 100% rename from kdb-web/src/app/services/sidebar/sidebar.service.spec.ts rename to web/src/app/services/sidebar/sidebar.service.spec.ts diff --git a/kdb-web/src/app/services/sidebar/sidebar.service.ts b/web/src/app/services/sidebar/sidebar.service.ts similarity index 100% rename from kdb-web/src/app/services/sidebar/sidebar.service.ts rename to web/src/app/services/sidebar/sidebar.service.ts diff --git a/kdb-web/src/app/services/socket/socket.service.spec.ts b/web/src/app/services/socket/socket.service.spec.ts similarity index 100% rename from kdb-web/src/app/services/socket/socket.service.spec.ts rename to web/src/app/services/socket/socket.service.spec.ts diff --git a/kdb-web/src/app/services/socket/socket.service.ts b/web/src/app/services/socket/socket.service.ts similarity index 100% rename from kdb-web/src/app/services/socket/socket.service.ts rename to web/src/app/services/socket/socket.service.ts diff --git a/kdb-web/src/app/services/spinner/spinner.service.spec.ts b/web/src/app/services/spinner/spinner.service.spec.ts similarity index 100% rename from kdb-web/src/app/services/spinner/spinner.service.spec.ts rename to web/src/app/services/spinner/spinner.service.spec.ts diff --git a/kdb-web/src/app/services/spinner/spinner.service.ts b/web/src/app/services/spinner/spinner.service.ts similarity index 100% rename from kdb-web/src/app/services/spinner/spinner.service.ts rename to web/src/app/services/spinner/spinner.service.ts diff --git a/kdb-web/src/app/services/theme/theme.service.spec.ts b/web/src/app/services/theme/theme.service.spec.ts similarity index 100% rename from kdb-web/src/app/services/theme/theme.service.spec.ts rename to web/src/app/services/theme/theme.service.spec.ts diff --git a/kdb-web/src/app/services/theme/theme.service.ts b/web/src/app/services/theme/theme.service.ts similarity index 100% rename from kdb-web/src/app/services/theme/theme.service.ts rename to web/src/app/services/theme/theme.service.ts diff --git a/kdb-web/src/app/services/toast/toast.service.spec.ts b/web/src/app/services/toast/toast.service.spec.ts similarity index 100% rename from kdb-web/src/app/services/toast/toast.service.spec.ts rename to web/src/app/services/toast/toast.service.spec.ts diff --git a/kdb-web/src/app/services/toast/toast.service.ts b/web/src/app/services/toast/toast.service.ts similarity index 100% rename from kdb-web/src/app/services/toast/toast.service.ts rename to web/src/app/services/toast/toast.service.ts diff --git a/kdb-web/src/assets/config.json b/web/src/assets/config.json similarity index 100% rename from kdb-web/src/assets/config.json rename to web/src/assets/config.json diff --git a/kdb-web/src/assets/i18n/de.json b/web/src/assets/i18n/de.json similarity index 100% rename from kdb-web/src/assets/i18n/de.json rename to web/src/assets/i18n/de.json diff --git a/kdb-web/src/assets/i18n/en.json b/web/src/assets/i18n/en.json similarity index 100% rename from kdb-web/src/assets/i18n/en.json rename to web/src/assets/i18n/en.json diff --git a/kdb-web/src/assets/images/favicon.ico b/web/src/assets/images/favicon.ico similarity index 100% rename from kdb-web/src/assets/images/favicon.ico rename to web/src/assets/images/favicon.ico diff --git a/kdb-web/src/assets/version.json b/web/src/assets/version.json similarity index 100% rename from kdb-web/src/assets/version.json rename to web/src/assets/version.json diff --git a/kdb-web/src/environments/environment.development.ts b/web/src/environments/environment.development.ts similarity index 100% rename from kdb-web/src/environments/environment.development.ts rename to web/src/environments/environment.development.ts diff --git a/kdb-web/src/environments/environment.prod.ts b/web/src/environments/environment.prod.ts similarity index 100% rename from kdb-web/src/environments/environment.prod.ts rename to web/src/environments/environment.prod.ts diff --git a/kdb-web/src/environments/environment.staging.ts b/web/src/environments/environment.staging.ts similarity index 100% rename from kdb-web/src/environments/environment.staging.ts rename to web/src/environments/environment.staging.ts diff --git a/kdb-web/src/environments/environment.ts b/web/src/environments/environment.ts similarity index 100% rename from kdb-web/src/environments/environment.ts rename to web/src/environments/environment.ts diff --git a/kdb-web/src/favicon.ico b/web/src/favicon.ico similarity index 100% rename from kdb-web/src/favicon.ico rename to web/src/favicon.ico diff --git a/kdb-web/src/index.html b/web/src/index.html similarity index 100% rename from kdb-web/src/index.html rename to web/src/index.html diff --git a/kdb-web/src/main.ts b/web/src/main.ts similarity index 100% rename from kdb-web/src/main.ts rename to web/src/main.ts diff --git a/kdb-web/src/polyfills.ts b/web/src/polyfills.ts similarity index 100% rename from kdb-web/src/polyfills.ts rename to web/src/polyfills.ts diff --git a/kdb-web/src/styles.scss b/web/src/styles.scss similarity index 100% rename from kdb-web/src/styles.scss rename to web/src/styles.scss diff --git a/kdb-web/src/styles/constants.scss b/web/src/styles/constants.scss similarity index 100% rename from kdb-web/src/styles/constants.scss rename to web/src/styles/constants.scss diff --git a/kdb-web/src/styles/primeng-fixes.scss b/web/src/styles/primeng-fixes.scss similarity index 100% rename from kdb-web/src/styles/primeng-fixes.scss rename to web/src/styles/primeng-fixes.scss diff --git a/kdb-web/src/styles/themes/default-dark-theme.scss b/web/src/styles/themes/default-dark-theme.scss similarity index 100% rename from kdb-web/src/styles/themes/default-dark-theme.scss rename to web/src/styles/themes/default-dark-theme.scss diff --git a/kdb-web/src/styles/themes/default-light-theme.scss b/web/src/styles/themes/default-light-theme.scss similarity index 100% rename from kdb-web/src/styles/themes/default-light-theme.scss rename to web/src/styles/themes/default-light-theme.scss diff --git a/kdb-web/src/styles/themes/sh-edraft-dark-theme.scss b/web/src/styles/themes/sh-edraft-dark-theme.scss similarity index 100% rename from kdb-web/src/styles/themes/sh-edraft-dark-theme.scss rename to web/src/styles/themes/sh-edraft-dark-theme.scss diff --git a/kdb-web/src/styles/themes/sh-edraft-light-theme.scss b/web/src/styles/themes/sh-edraft-light-theme.scss similarity index 100% rename from kdb-web/src/styles/themes/sh-edraft-light-theme.scss rename to web/src/styles/themes/sh-edraft-light-theme.scss diff --git a/kdb-web/src/test.ts b/web/src/test.ts similarity index 100% rename from kdb-web/src/test.ts rename to web/src/test.ts diff --git a/kdb-web/tsconfig.app.json b/web/tsconfig.app.json similarity index 100% rename from kdb-web/tsconfig.app.json rename to web/tsconfig.app.json diff --git a/kdb-web/tsconfig.json b/web/tsconfig.json similarity index 100% rename from kdb-web/tsconfig.json rename to web/tsconfig.json diff --git a/kdb-web/tsconfig.spec.json b/web/tsconfig.spec.json similarity index 100% rename from kdb-web/tsconfig.spec.json rename to web/tsconfig.spec.json diff --git a/kdb-web/update-version.ts b/web/update-version.ts similarity index 100% rename from kdb-web/update-version.ts rename to web/update-version.ts