A beginner level bot using Dialog Flow Framework
Requirements.
It's not recommended to use Windows if you plan on collecting data, because Apache Superset doesn't have official support for it. So far, I haven't managed to launch data collection on Windows. Instead, you could use Linux or a virtual machine. Windows has another issue described at the end of this .md file. So far, Windows has zero merits over Linux in regard to this project.
To use the bot you need either one of:
- Python 3 + Dialog Flow Framework (dff[telegram, stats])
- Docker with Docker-Compose (Can't use data collection in this mode right now, it's TBD in the future)
Running the bot from Telegram-Bot directory:
- Directly with your python interpreter.
In order for the bot to work, set the bot token environment variable to your bot token:
export TG_BOT_TOKEN=*******
(To get the bot token follow the 'telebot' library documentation) For now a single bot token is in the .env file. In the future it will be hidden with Docker Secrets
To run the bot, type in the terminal when in Telegram-Bot directory:
python bot/main.py
Note that all dependencies (dff[telegram, stats]) need to be installed, unlike when you use Docker-Compose. You can check out the installation guide in the official DFF documentation: https://deeppavlov.github.io/dialog_flow_framework/get_started.html
- Using Docker-Compose (Recommended)
To run the bot, type in the terminal:
docker-compose run bot python main.py
To run the data collector, check out the official DFF User Guide on Supersets, but don't use their example_data_provider.py, as it will save that data and I don't know how to delete it from the DB, it will clog up the results. After going through the guide's first few steps, you can import the .zip dashboard configuration file from this repo to the localhost:8088 page, the instructions in the guide show the steps to do so.
Link to the guide: https://deeppavlov.github.io/dialog_flow_framework/user_guides/superset_guide
Issues:
- When running the bot from Docker, OpenTelemetry can't send data to the collector. I guess I just don't know enough about the two of these things to make it work.
- When running the bot without the data collector running, you may want to ignore Command Line output. The program will inform you that it can't collect the data with OpenTelemetry. To remove that you can comment the after_handler[] lines in main.py
- Running Docker-Compose doesn't work on Windows, you could change the WORKDIR in Dockerfile and compose.yml to /app and it will work, but that will break the program on Linux. I guess, the two OS's treat WORKDIRs differently, so I chose to default to running the program in Linux
Possible TBD:
- Maybe switch to Compose instead of Docker-Compose (OpenTelemetry marks the latter as deprecated)