~josealberto4444/apodnasabot

Fix a new error in scrapping explanation
Update python-telegram-bot library

clone

read-only
https://git.sr.ht/~josealberto4444/apodnasabot
read/write
git@git.sr.ht:~josealberto4444/apodnasabot

You can also use your local clone with git send-email.

#APOD NASA bot

This is a bot that will be able to handle different requests regarding Astronomy Picture Of the Day in https://apod.nasa.gov/. It's still work in progress, not even in an alpha stage.

#Deprecated Telegram version

This bot used to be only a Telegram bot. I have that version running on a server. You can find it in https://t.me/ApodNasaBot, and the code in deprecated-* branches. Besides, the bot cannot interact, it only sends the picture everyday to the ones already subscribed. If you are interested in subscribing, just let me know. Beware of bugs.

#New version

The aim of this new version is to make a new bot compatible with many platforms released under AGPL and with help of as many contributors as possible. I want to make real free software, with a community behind, even a little one. ;)

#Expected features

The bot should be able to:

  1. Download automatically the APOD from NASA, including description and links inside it.
  2. Send last picture.
  3. Manage subscriptions, including:
    • Subscribe.
    • Unsubscribe.
    • Send automatically the picture to subscribed users at the time they choose.
  4. Send the picture of a given date.
  5. Ping.
  6. Log all messages received and sent.
  7. Manage admins: add, remove, send admin list.
  8. Send log lines to an admin, when asked.
  9. Redownload APOD when an admin asks to, keeping a backup of the old one.
  10. Send subscriber list to an admin, when asked.

#Contribute

Did you find a bug? Feel free to report it to the mailing list ~josealberto4444/apodnasabot@lists.sr.ht if it's not reported yet (take a look at the etiquette).

Do you want to contribute to the code? Glad to hear it, that's the purpose of putting it here! Simply send a patch to ~josealberto4444/apodnasabot@lists.sr.ht. Take a look at https://git-send-email.io/ if you need help. =)

#Installation

For running this bot, you will need

  • Python 3
  • Python pipenv

Execute the initialization script:

$ ./init.sh

This will do the following steps:

  1. Create the configuration file config.cfg if it does not exist.
  2. Create the directory for storing data called data.
  3. Create the python virtual environment if it's not created yet and install all the dependencies.

Then, you should get an API key from NASA and copy it in the corresponding section of config.cfg.

#Running

#Telegram bot

First, you should copy your bot token to the config.cfg file. Next, you can run the Telegram bot with

$ pipenv run python telegram_bot.py

The bot will reply to the apod command sending the apod of today or, if followed by a date, sending the one of that date.