Skip to content

Lexxx42/yandex-weather-bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

60 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

weather-bot

  • Simple weather bot python-telegram-bot v20.0b0

Used libraries


How to start the bot?

  1. Created new bot from https://t.me/BotFather if you don't have one
  2. Get token for API Yandex Weather https://yandex.com/dev/weather/
  3. Install all requirements from requirements.txt
pip install -r requirements.txt  
  1. Create file .env in project root
  2. Copy the line into you .env file with token provided by BotFather
BOT_TOKEN=YOUR_BOT_TOKEN  
  1. Copy the line into you .env file with token provided by Yandex.Weather API
TOKEN_YANDEX_WEATHER=YOUR_API_YANDEX_WEATHER_TOKEN  

New features with docker

If there is an error about lack of access, add current user to the docker group:

sudo usermod -a -G docker [user]
newgrp docker

Use this sequence of commands to run the container:

  1. To run the application in docker, you need to install docker-compose:
sudo apt install docker-compose 
  1. Clone the repository
git clone https://github.com/Lexxx42/yandex-weather-bot.git
  1. Change directory to project dir
cd yandex-weather-bot/
  1. 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!

  1. Start the build
docker-compose up --build

Added docker image to public repository

Docker Hub

If you are using docker image from DockerHub use following commands:

  1. To pull repository use:
docker pull alex42konukhov/yandex-weather-bot:debian-bullseye
  1. Create a container from the image. Should be an error message.
docker run alex42konukhov/yandex-weather-bot:debian-bullseye
  1. Create .env file and add your telegram token and yandex weather api key
BOT_TOKEN=
TOKEN_YANDEX_WEATHER=
  1. Copy the modified configuration file from your host machine to the container's file system:
docker cp .env docker_container_id:/app/.env
  1. Run docker container in detached mode
docker start container_id

About

Simple weather bot python-telegram-bot v20.0b0

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published