pysyun / pysyun_conversation_flow

Conversation flow control library by Syun Lee
GNU Lesser General Public License v2.1
1 stars 2 forks source link

Implement Feature: Inactive User Notification System #5

Open pysyun opened 2 weeks ago

pysyun commented 2 weeks ago

Implement Feature: Inactive User Notification System

Objective

Develop a system to notify users who have not interacted with the Telegram Bot for an extended period of time.

Description

The aim of this task is to implement a feature in the pysyun_conversation_flow library that schedules regular checks for user activity. If a user has not communicated with the bot for a specific duration, a reminder message should be sent to them.

Requirements

  1. Scheduler Library:

    • Use one of the Python scheduler libraries (e.g., schedule, APScheduler, Celery).
  2. Check Interval:

    • The scheduler should run every 30 minutes to perform the following checks.
  3. User Iteration:

    • Iterate over the complete list of users who have ever communicated with the Telegram Bot.
  4. Activity Check:

    • Check if there have been any messages from the given user within the specified period (define what "too long" means, e.g., 24 hours, 7 days, etc.).
  5. Notification:

    • Send a reminder message to users who have not communicated for the defined period.

Implementation Steps

  1. Scheduler Setup:

    • Integrate a Python scheduler library into the project.
    • Configure the scheduler to run every 30 minutes.
  2. Database Interaction:

    • Retrieve the list of users who have communicated with the bot.
    • Fetch the timestamp of the last message from each user.
  3. Activity Verification:

    • Compare the current time with the last message timestamp to determine inactivity.
  4. Notification Sending:

    • Send a predefined message to users identified as inactive.

Technical Stack

Contributing

Contributions are welcome! Check out the issues section of the repository to see what tasks need attention. Feel free to assign yourself an issue or open a new one for a feature or bug you want to work on. Make sure to discuss your approach with the maintainers before starting the implementation.

Submission

pysyun commented 2 weeks ago

This task can be quickly implemented using the GPT Morph tool attached to THIS repository.

https://gptmorph.com/