Skip to content

Telegram channel that works with the participation of a telegram bot. The channel publishes photos from Spaсe_X API and NASA API.

License

Notifications You must be signed in to change notification settings

MiraNizam/Space_trip_bot

Repository files navigation

Space trip bot

Space trip bot Telegram channel that works with the participation of a telegram bot. The channel publishes photos from Spaсe_X API and NASA API. You can also add photos and Space trip bot publish them.

Getting Started

Below you will find instructions on how to use Space trip bot.

Prerequisites

Please be sure that Python3 is already installed.

Installing

  1. Clone the repository:
git clone https://github.com/MiraNizam/Space_trip_bot.git
  1. Create a new virtual environment env in the directory
python -m virtualenv env
  1. Activate the new environment
source env/bin/activate
  1. Use pip (or pip3, if there is a conflict with Python2) to install dependencies in new environment:
pip install -r requirements.txt

How to use it:

The first part (NASA API and SpaceX API)

  1. The scripts use API from two sites: Public SpaceX API and Private NASA API.

  2. Now you need to generate your own unique API Key to do this, you need to fill the form on the site api.nasa.gov. You receive API Key on the Email.

  3. Create .env file with unique environmental variable, that was generated above.

NASA_KEY="unique value"

The second part (Telegram API):

  1. You need to create Telegram Bot and receive telegram - TOKEN: using @BotFather in Telegram app push /newbot, follow instructions, copy the token to access the HTTP API.

  2. After we create a telegram channel and assign the bot as its Administrator so that it can publish photos on the channel. This article will help: How to create Telegram Channel

  3. Add in .env file your unique token and chat_id.

TG_TOKEN="unique value"
TG_CHAT_ID="@chat_id"

Now everything is ready.

How to run code:

The script takes the launch_id for spacex API as an argument or use "latest" as default meaning.

python3 main.py "5eb87d46ffd86e000604b388"

The script takes the interval for publishing photos as an argument or use 14400 seconds = 4 hours as default meaning.

python3 telegram_api.py 30

Enjoy Space!

Project Goals

This code was written for educational purposes as part of an online course for web developers at dvmn.org.

About

Telegram channel that works with the participation of a telegram bot. The channel publishes photos from Spaсe_X API and NASA API.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages