You are browsing as a guest. Sign up (or log in) to start making projects!

4h 51m 48s logged

DevLog #2:


Switching Libraries

Initially, I started building this bot using another library. However, I decided to rewrite the codebase using python-telegram-bot

Why? python-telegram-bot is much more practical and scalable for complex, multi-step projects. Since I plan to build bigger features in the future, I figured it was best to learn and adopt a solid framework right now. I spent about an hour migrating my previous logic to PTB, and it was definitely worth it!


New Features

I added core bot commands and integrated custom reply keyboards:

  • /help: Shows available commands.
  • /log: Prompts you to pick an activity via a custom reply keyboard and log your stats.
  • /analytic: Allows you to select an activity and view your current recorded progress.

The trickiest part:

was figuring out how to handle sequential user inputs :

  1. First function: Catches the initial command (e.g., /log).
  2. Second function: Receives the chosen activity (e.g., Sport), asks a follow-up question (e.g., “How long have you been doing this?”)
  3. Third function: Takes the entered number/value and saves it to the selected activity state.

fix-it list:

  1. Custom Prompts per Activity: Currently, selecting “Water” asks “How long have you been doing this?” instead of “How much water did you drink?”. I need to customize questions based on the activity type.
  2. Data Accumulation: Right now, logging a value overwrites context.user_data[activity] instead of adding to it. I will fix this so values accumulate properly over time.
  3. Weekly Reset: I need to implement an automated mechanism to reset tracking data every Saturday.

Since fixing these remaining issues won’t take too much time, I’ll soon be ready to add new features.

So let me know if you got any ideas in the comments below

0
10

Comments 0

No comments yet. Be the first!