- Simple weather bot python-telegram-bot v20.0b0
- https://docs.python-telegram-bot.org/en/v20.0b0/
- Coded with Python 3.11.1
- Created new bot from https://t.me/BotFather if you don't have one
- Get token for API Yandex Weather https://yandex.com/dev/weather/
- Install all requirements from requirements.txt
pip install -r requirements.txt
- Create file .env in project root
- Copy the line into you .env file with token provided by BotFather
BOT_TOKEN=YOUR_BOT_TOKEN
- Copy the line into you .env file with token provided by Yandex.Weather API
TOKEN_YANDEX_WEATHER=YOUR_API_YANDEX_WEATHER_TOKEN
sudo usermod -a -G docker [user]
newgrp docker
- To run the application in docker, you need to install docker-compose:
sudo apt install docker-compose
- Clone the repository
git clone https://github.com/Lexxx42/yandex-weather-bot.git
- Change directory to project dir
cd yandex-weather-bot/
- Add your tokens for telegram bot and yandex weather
nano .env
BOT_TOKEN=YOUR_BOT_TOKEN
TOKEN_YANDEX_WEATHER=YOUR_API_YANDEX_WEATHER_TOKEN
Don't forget to save changes!
- Start the build
docker-compose up --build
If you are using docker image from DockerHub use following commands:
- To pull repository use:
docker pull alex42konukhov/yandex-weather-bot:debian-bullseye
- Create a container from the image. Should be an error message.
docker run alex42konukhov/yandex-weather-bot:debian-bullseye
- Create
.env
file and add your telegram token and yandex weather api key
BOT_TOKEN=
TOKEN_YANDEX_WEATHER=
- Copy the modified configuration file from your host machine to the container's file system:
docker cp .env docker_container_id:/app/.env
- Run docker container in detached mode
docker start container_id