major refactor (untested)
This commit is contained in:
parent
a29412b4da
commit
a77a0c0393
22 changed files with 1037 additions and 24 deletions
68
README.md
68
README.md
|
|
@ -119,6 +119,72 @@ When applications fail, the bot saves:
|
|||
|
||||
Check these files to understand why an application failed.
|
||||
|
||||
## Code Structure
|
||||
|
||||
The bot has been modularized for better maintainability. The main components are:
|
||||
|
||||
- `main.py`: The entry point for the bot.
|
||||
- `handlers/`: Contains company-specific handlers for auto-apply functionality. Each company has its own handler file:
|
||||
- `howoge_handler.py`
|
||||
- `gewobag_handler.py`
|
||||
- `degewo_handler.py`
|
||||
- `gesobau_handler.py`
|
||||
- `stadtundland_handler.py`
|
||||
- `wbm_handler.py`
|
||||
- `application_handler.py`: Orchestrates the application process by delegating to the appropriate handler.
|
||||
- `telegram_bot.py`: Handles Telegram bot commands and notifications.
|
||||
|
||||
The `handlers/` directory includes a `BaseHandler` class that provides shared functionality for all company-specific handlers.
|
||||
|
||||
## Unit Tests
|
||||
|
||||
The project includes unit tests to ensure functionality and reliability. Key test files:
|
||||
|
||||
- `tests/test_telegram_bot.py`: Tests the Telegram bot's commands and messaging functionality.
|
||||
- `tests/test_error_rate_plot.py`: Tests the error rate plot generator for autopilot applications.
|
||||
|
||||
### Running Tests
|
||||
|
||||
To run the tests, use:
|
||||
|
||||
```bash
|
||||
pytest tests/
|
||||
```
|
||||
|
||||
Ensure all dependencies are installed and the environment is configured correctly before running the tests.
|
||||
|
||||
## Workflow Diagram
|
||||
|
||||
```mermaid
|
||||
graph TD
|
||||
A[Start] --> B[Fetch Listings]
|
||||
B --> C{New Listings?}
|
||||
C -->|Yes| D[Log to CSV]
|
||||
C -->|Yes| E[Send Telegram Notification]
|
||||
C -->|Yes| F{Autopilot Enabled?}
|
||||
F -->|Yes| G[Auto-Apply to Listings]
|
||||
F -->|No| H[Save to Applications.json]
|
||||
C -->|No| I[End]
|
||||
D --> I
|
||||
E --> I
|
||||
G --> H
|
||||
H --> I
|
||||
```
|
||||
|
||||
This diagram illustrates the workflow of the bot, from fetching listings to logging, notifying, and optionally applying to new listings.
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
||||
This project is licensed under the Creative Commons Attribution-NonCommercial 4.0 International (CC BY-NC 4.0) License.
|
||||
|
||||
You are free to:
|
||||
|
||||
- **Share** — copy and redistribute the material in any medium or format
|
||||
- **Adapt** — remix, transform, and build upon the material
|
||||
|
||||
Under the following terms:
|
||||
|
||||
- **Attribution** — You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
|
||||
- **NonCommercial** — You may not use the material for commercial purposes.
|
||||
|
||||
For more details, see the [full license text](https://creativecommons.org/licenses/by-nc/4.0/).
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue