GithubHelp home page GithubHelp logo

fabifont / buchino Goto Github PK

View Code? Open in Web Editor NEW
8.0 8.0 0.0 236 KB

A telegram bot that messages you available vaccine appointments in the Lombardia region and allows you to book one

Home Page: https://t.me/buchinobot

License: Mozilla Public License 2.0

Python 100.00%

buchino's People

Contributors

fabifont avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

buchino's Issues

Better project structure and import management

A possible project structure is:

buchino/
|-- db/
|    |-- init.py
|    |-- data.py
|    |-- controller.py
|    |-- user.py
|    |-- place.py
|-- utils/
|    |-- validation.py
|    |-- config.py
|-- bot.py
|-- scraper.py
|-- booker.py
|-- main.py

Add the possibility to book

Add a new command /prenota that allows you to book the appointment for the last date and place notified. It is necessary to check that at the next cycle that the appointment is still available and then proceed with the booking. Finally the user state is_vaccinated must be set to True to stop looking for new appointments for him.

Check for new users while waiting

Use the same approach implemented in booker.py

with open("appointments.txt", "r") as f:
to look for new users when the scraper is sleeping
time.sleep(sleep_time)

In bot.py after the user is added to the database

buchino/bot.py

Line 238 in 77d48bb

await controller.add_user(user)

this should be added:

with open("new_users.txt", "a+") as f:
    f.writelines(message.chat.id)

Then in scraper.py you should create a loop for the timeout here

time.sleep(sleep_time)

For example:

for i in range(sleep_time):
    # check new_users.txt
    # if there is a new user skip the waiting time with a `break`
    # but it's better to wrap the main process and call it on the new user
    time.sleep(1)

Type hints

Type hinting is a formal solution to statically indicate the type of a value within your Python code.
You should add type hints to this project.

For more info check here

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.