Giter Club home page Giter Club logo

space-image-telegram-bot's Introduction

Telegram bot for posting space images to telegram channel

This project implements a module to fetch & publish space images to telegram channel using Telegram Bot API. The theme of the images is all about space and the universe. The images are fetched from different sources:

This module fetches images with meta information such as date and description, downloads them and directly posts it to your channel.
The image publication appears with user defined interval - by default once in 24 hours.
The images showed (downloaded) once, won't be published again.

First steps

  1. Clone / download the repository
  2. Read installation and configuration steps below
  3. Read user manual

How to install & configure

  1. Install Python3 and project dependencies
    Python3 should be already installed.

    The project uses Pipenv tool, that automatically creates a virtual environment and installs all project dependencies.
    Please refer to Pipenv documentation to install it.

    When Pipenv is installed, use the following command to create virtual environment and install dependencies:

    pipenv install --dev
    

    To activate this project's virtualenv, run:

    pipenv shell
    
  2. Create Telegram Bot & generate authentication token. Telegram Bot is needed to publish messages (e.g. images, posts etc.) to your channel.

    Please read the official documentation in order to create a bot using BotFather.

    Once you've created a bot and received your authentication token, add the bot to your channel and make it an administrator. Afterwards the channel id should be placed in configuration file .config:

    ...
    TELEGRAM_CHAT_ID='@your_channel_id'
    ...
    

    Finally, place the generated authentication token in a file named .secrets. The file should be located in root directory of the project. The authentication token should look like:

    TELEGRAM_BOT_TOKEN=2109472554:DDE8MfhNK8J_x75Fx-A_RZ7b3mYK3PhOO10
    
  3. Generate NASA API key This module works with NASA API, which requires an API key.
    To generate an API key follow the instructions in the official NASA documentation page.

    Finally, place the key in the .secrets file like:

    NASA_API_KEY=AeFGjzewVGGySj5MLksqOcJf8HwrcXmkeslbNshh
    

Usage and configuration

  1. To run the module use the following command within created virtual environment:

    python3 main.py  
    
  2. Possible user configurations:
    Use the configuration file .config to configure more precise settings.

    The file is used to configure settings such as the location to save images, the publishing interval time, and the channel ID:

    IMAGES_DIR_PATH=data/images
    TELEGRAM_CHAT_ID='@your_channel_id'
    IMAGE_PUBLISHING_INTERVAL_SECONDS=86400
    

    You are free to change it!

Project Goals

The code is written for educational purposes on online-course for web-developers dvmn.org.

space-image-telegram-bot's People

Contributors

vogelfenx avatar

Stargazers

 avatar

Watchers

 avatar macs avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.