← All dev projects

Astronomy Bot

  • Node.js
  • JavaScript
Visit project

Overview

Astronomy Bot was originally a Twitter bot, until that guy who begged to go to that island decided API access to Twitter shouldn't be free and open source, like he originally said, but very very expensive.

Astronomy Bot is now a Mastodon bot, and can be found at Astronomy Bot's Mastodon profile

The problem

No problem to solve, just a learning exercise in nodejs and the Twitter/Mastodon APIs (which are incredibly similar), as well as connecting to various third party APIs like NASA, and performing globe based calculations to allow users to locate any body in the solar system on any date at any time (From 1/1/0000 to 31/12/3999 if I remember correctly)

What I built

One main nodejs app per bot (Astronomy bot has been cloned and repurposed a few times), with global functions stored in utils files.

It has a set list of daily posts such as:

Astronomy Photo of the Day Blue Marble photo of the day (From EPIC) Mars Rover photo of the day

It also posts a random post every 15 minutes from a list of:

Current location of the International Space Station (Overhead) Astronaut spotlight Upcoming launches Spacecraft spotlight Number of people on (and off) Earth JWST photo of the day Current Moon phase North v South

Screenshots

Astronomy Bot profile

Profile


Blue Marble of the Day

Blue Marble of the day


Moon phase (Northern hemisphere)

Current Moon phase (Northern hemisphere)

Moon phase (Southern hemisphere)

Current Moon phase (Southern hemisphere)

Spacecraft spotlight

Spacecraft spotlight

James Webb Space Telescope photos

James Webb Space Telescope photos

Number of people on Earth`

Number of people on Earth

What I learnt

It was an interesting exercise in learning how the social media platform APIs work, what can be automated and what can't, what measures are in place to ensure bots are only well behaved bots like mine, and not up to no good.

It was also helpful to learn about pm2, which is used to keep the services online, so as long as my house has electricity and wifi the bots are online.

I can also see a planet in the sky and message the bot with my coordinates to find out which planet it is