Git Product home page Git Product logo

tg-launchbot's Introduction

LaunchBot โ€“ a rocket launch information and notifications bot for Telegram ๐Ÿš€

LaunchBot keeps you up to date with what's going up, around the clock, since 2019. Reachable as @rocketrybot on Telegram.

LaunchBot uses the LaunchLibrary2 API to fetch launch information on intelligently scheduled intervals. The bot provides multiple forms of information: launch notifications, information about upcoming flights, and a simple flight schedule showing upcoming flights at a glance.

โœจ Other features include...

  • user-configurable notifications on...
    • per-provider basis
    • per-country basis
  • user-choosable notification times from 4 different options
  • mutable launches
  • notifications of launches being postponed
  • a quick, easily digestible message format
  • direct links to launch webcasts
  • automatically cleared notification messages
  • neat statistics about the bot
  • direct feedback to the developer via the bot
  • spam management
  • simple information refresh with Telegram's message buttons,

and tons of other things!

๐Ÿ“ƒ Basic instructions

Install the Python3 dependencies with pip, using the requirements.txt file found in the repository: python3 -m pip install -R requirements.txt.

After the dependencies are installed, you can run the bot with python3 launchbot.py -start. For debugging purposes and running in the background with nohup, add -debug: this prevents the flooding of the nohup.out file.

๐Ÿ–ฅ Data structures

The bot creates the following supporting files under ../launchbot/:

SQLite: launchbot-data.db: houses all data the bot needs to operate, including launch caching, statistics, etc.

JSON: bot-settings.json: used to configure the bot by setting the Telegram bot API key, alongside with some other configuration information.

You can specify your personal account's Telegram user ID in bot_settings.json in the form owner: "your_user_id". This disabled the logging of commands sent by you, and sends a notification for new feedback.

๐Ÿ”’ Privacy

The bot stores every interaction (i.e. command) sent to it if logging is enabled, alongside with a truncated, unsalted SHA-1 hash of the user ID. No text messages are stored, aside from text sent as a reply to a feedback request message. The bot's privacy settings forbid the bot from reading regular text, as in text messages which have not tagged the bot (@botusername) or are not a reply to a message sent by the bot (these are not logged, unless they're a reply to a feedback message.)

Only information stored by the bot is the chat ID, which can also be the user ID of a user in the case of a private chat. This is the only user information stored, which is used to deliver notifications. If no notifications are enabled, no information is stored, aside from an in-memory chat ID for managing spam, which is automatically cleared when the program quits and is thus never stored.

Please note, that the above only applies on a per-bot basis. The creator of the bot chooses whether to configure the bot to be able to read all text messages, not just ones directed at the bot. Telegram bots are, by nature, extremely privacy invasive: don't add unknown bots to group chats, unless it's hosted by you or someone you trust.

Bot roadmap

1.0 / first implementation (November 2019)

- โœ… implemented uncached API requests

- โœ… implemented the request of next launch via a direct API call

1.2 / basic features (December 2019)

- โœ… implement /next using DB calls

- โœ… implement support for SpaceX core information

1.3 / user-facing features (January 2020)

- โœ… add "next" and "previous" button(s) to /next command

- โœ… add a mute button to notifications

- โœ… update /notify to be more user friendly

- โœ… implement /feedback

- โœ… improve notification handling with the hold flag -> moving NETs and info text regarding them

- โœ… change launch database index from tminus to net

1.4 / basic improvements (February 2020 ->)

- โœ… Notify users of a launch being postponed if a notification has already been sent

- โœ… disable logging of text messages; how to do feedback? (log feedback messages in a global array?)

- โœ… add tbd-field to launches, so schedule can only show certain launch dates (filter certain and uncertain with a button)

- โœ… add location (i.e. state/country) below pad information (Florida, USA etc.)

1.5 / user-facing features

- โœ… delete older notification messages when a new one is sent

- add a "more info"/"less info" button to /next and notification messages

- โœ… add probability of launch and launch location, separate from mission name etc. with \n\n

- โœ… allow users to set their own notifications (i.e. 24h/12h/...)

- โœ… allow users to set their own timezone

1.6 / major back-end changes (October 2020)

- โœ… upgrade to the LL2 API (LL1 closes at the end of October)

- โœ… perform API requests intelligently, as the monthly request quota is enough for only one request every 8 minutes

	- โœ… don't update API on startup, unless it has been sufficiently long since last check: store requests in memory + storage
	
	- โœ… use schedule to schedule requests: just before a launch is due, plus for when notifications are supposed to be sent
	
	- โœ… a raw update schedule of once every 15 - 60 minutes
	
- โœ… check for launch notifications intelligently
	
	- โœ… on API update, check for updated launch times (notification send times) -> clear schedule queue -> schedule next checks for when a notification is supposed to be sent
	
- โœ… store LL2 and SpX API data in the same database

- โœ… combine all separate database files into one file with multiple tables

- โœ… attempt to split the monolithic file into multiple separate files, starting with the API request functions

- โœ… index launches by the new unique launch ID instead of launch name

- โœ… fully integrate new API and notifications systems with LaunchBot 1.5

- โœ… complete pre_handler(), so we can update time zone information and get feedback

- โœ… re-add statistics to all needed places

- add "show changelog" button under /statistics or /help

	- load from a changelog.txt file?

- โœ… open-source LaunchBot โœจ

1.7 / performance optimizations

- โœ… update from telepot Telegram API wrapper to python-telegram-bot

- identify bottlenecks in processing by benchmarking and timing functions

	- the largest bottleneck is usually Telegram's API

- improve json-parsing performance by using multiprocessing

- use in-memory caching, like redis or memcached, to handle all responses

	- reduce disk writes and reads: SD cards have terrible latency, LPDDR4 on RasPi is pretty snappy

	- update cache on API call

	- key:vals for all chats: simple, fast, easy

- enable the disabling of postpone notifications

	- globally or on a per-launch basis

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.