This bot can solve different tasks using computational knowledge engine Wolfram Alpha
Setup the following environment variables:
- MATH_BOT_TOKEN - telegram token of the bot. It can be obtained from BotFather.
- WOLFRAM_APP_ID - an ID of the Wolfram Alpha application. Visit WolframAlpha API and register your app to get it.
- DATABASE_URL - path to the database.
- URL - URL of the hosting server. If you are using long polling method, you may do not specify this.
Setup environment variables on Linux:
export <NAME>=<VALUE>Python 3 should be already installed. Create virtual environment and use pip to install dependencies. Example on Linux:
virtualenv -p python3 venv
source venv/bin/activate
pip install -r requirements.txtYou can install dependencies without virtual environment, but it's not recommended.
Run polling.py to use this method. Virtual environment must be activated.
source venv/bin/activate
python polling.pyIf you are using nginx, then you need to configure path to the SSL certificate and private key. For example
server {
listen 443 ssl;
server_name example.com;
ssl_certificate cert.pem;
ssl_certificate_key private.key;
location /BOT_TOKEN {
proxy_pass http://127.0.0.1:5000;
}
}
This example uses reverse proxy approach. It can be helpful, when you need to host several bots on the same server.
Also you can host the bot on Heroku. Sign up on this site, install heroku-cli on your PC and run following commands:
heroku login
heroku create <your app name>
git push heroku masterEnjoy (: