Conversation
… accordingly to main struct of needed constructs
… accordingly to main struct of needed constructs
…ommand is python3 app.py being in src(root package)
…mming. Docker works. Everything builds fine. Need to complete methods.
…mming. Docker works. Everything builds fine. Need to complete methods.
…mming. Docker works. Everything builds fine. Need to complete methods.
# Conflicts: # Dockerfile # src/app/handlers.py
# Conflicts: # Makefile # src/app/handlers.py
…e same filename + class for Translations.
handlers managed to be better, class Translator_Language additional function to handle last stage. Everything is working
handlers managed to be better, class Translator_Language additional function to handle last stage. Everything is working
… + logic_registration and other tools.
… + logic_registration and other tools.
one_reason.py - for serises wit no long states(line 1 or 2 maximum)
…s working, added language_keyboard(prev was in one_reasons and keyboards.py) added new ACRONYMS and LANGUAGES, that through zip handle language operations. Format works for any language. TODO: Need to find the way of working with age(got the range() and handle str symbols. 2. Need to make better first msg. 3. Add keyboard for users to work with cmds. Work on module commands.
There was a problem hiding this comment.
This PR is being reviewed by Cursor Bugbot
Details
You are on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle.
To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.
| && rm -rf $(poetry config cache-dir)/{cache,artifacts} | ||
|
|
||
| && rm -rf $(poetry config cache-dir)/{cache,artifacts} \ | ||
| apt install gettext |
There was a problem hiding this comment.
Bug: Dockerfile command chaining broken causes incorrect behavior
The apt install gettext command is missing the && operator to chain it with the previous command. With the backslash line continuation, apt, install, and gettext become additional arguments to rm -rf, causing it to attempt deleting files/directories with those names instead of installing the gettext package. The line needs && apt install gettext instead of just apt install gettext.
|
|
||
| @bot.message_handler(state=RegistrateUser.waiting_for_name) | ||
| async def name_get(message: types.Message, state: StateContext): | ||
| await handle_name_input(bot, message, state) |
There was a problem hiding this comment.
Bug: Duplicate function name overwrites first handler definition
Two handler functions are defined with the identical name name_get. In Python, the second definition on line 83-85 overwrites the first one on lines 79-81. This means the handler for RegistrateUser.waiting_for_start state will never be called because its function reference is replaced by the handler for waiting_for_name. One of these functions needs to be renamed.
| await bot.send_message( | ||
| user_id, | ||
| text, | ||
| reply_markup= _.languages_keyboard()) |
There was a problem hiding this comment.
Bug: Missing return causes registration flow for registered users
The handle_start function checks if the user is already registered (is_registered == 1) and handles that case, but there's no return statement after line 40. This causes the code to continue executing lines 47-54, which sends the registration start message and sets the waiting_for_language state. Already-registered users will be incorrectly prompted to register again.
|
|
||
| await state.set(RegistrateUser.waiting_for_age) | ||
| text = _.translate("REG","prompts.ask_age", user_id=call.from_user.id) | ||
| await bot.send_message(call.from_user.id, text) |
There was a problem hiding this comment.
Bug: Sex selection never saved causing incorrect user data
The handle_sex_selection function receives the user's sex choice in call.data but never saves it to state via state.add_data(sex=call.data). Later in handle_city_input, the code attempts to retrieve this value with data.get("sex") which returns None. The expression 1 if data.get("sex") == "male" else 0 will always evaluate to 0 since None == "male" is False, resulting in all users being recorded as female regardless of their selection.
| user_id, | ||
| text, | ||
| reply_markup=self.any_agree_keyboard(user_id) | ||
| ) |
There was a problem hiding this comment.
Bug: Wrong translation key in rules agreement keyboard
The send_rules_agreement_keyboard method uses the translation key "choose_sex" on line 96, which is copy-pasted from the sex selection keyboard. This causes the rules agreement prompt to incorrectly display "Choose your sex:" text instead of a rules-related message. The key should likely be "show_rules_question" based on the available BUTTONS keys in the translator.
| current_dict: Any = Translated_Language.BUTTONS | ||
| try: | ||
| for k in keys: | ||
| current_dict = current_dict[k] |
There was a problem hiding this comment.
Bug: Uninitialized variable causes crash on invalid dictionary name
The get_translation method only assigns current_dict when dict_ equals 'REG' or 'BUTT'. If any other value is passed, current_dict remains undefined, and the code will raise an UnboundLocalError when it attempts to iterate with for k in keys: current_dict = current_dict[k]. An else clause or default initialization is needed.
okay
Note
Introduces an async TeleBot app with i18n-backed registration flow, inline keyboards/commands, and an async SQLAlchemy/Postgres layer, plus CI, Docker, and config updates.
src/bot_instance.pywith state storage and middlewares; new entrypointsrc/main.py(polling, init commands, keyboard manager, DB reset).src/app/handlers/handlers.pywiring registration, language change, rules, and menu callbacks.src/app/services/*and states insrc/app/states.py.src/configs/commands.py,src/configs/commands.yaml,src/configs/keyboard_manager.py.src/middleware/i18n_middleware/*and translatorsrc/app/translator.py.src/middleware/locales/{en,ru,fr,it,es}/LC_MESSAGES/messages.po.src/database/database.pyand CRUD insrc/database/db_sessions.py.Usermodel insrc/database/models.py.src/configs/config.py(env-based, DB URL, paths); replace oldsrc/config/config.py..env.example(port5433,ADMIN_IDS) anddocker-compose.ymlto map5433:5432and runpython3 -m src.main.pyproject.tomladds deps (aiohttp,asyncpg,alembic,pydantic-settings,babel,aiogram, etc.)..github/workflows/pylint.yml.Dockerfileinstalls Poetry deps andgettext;Makefileadds i18n utilities.README.md; add exampletelebot_examples/STATE_EXAMPLE.py.Written by Cursor Bugbot for commit ff89625. This will update automatically on new commits. Configure here.