Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/frizensami/singapore-bloodstocks-bot
Telegram bot that informs users of the blood stocks levels from https://www.redcross.sg. Raw data available at https://github.com/datascapesg/red-cross-blood-stocks
https://github.com/frizensami/singapore-bloodstocks-bot
blood-donation redcross telegram telegram-bot
Last synced: 27 days ago
JSON representation
Telegram bot that informs users of the blood stocks levels from https://www.redcross.sg. Raw data available at https://github.com/datascapesg/red-cross-blood-stocks
- Host: GitHub
- URL: https://github.com/frizensami/singapore-bloodstocks-bot
- Owner: frizensami
- License: mit
- Created: 2021-06-07T11:15:16.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-10-11T09:07:32.000Z (about 1 year ago)
- Last Synced: 2023-10-11T14:01:09.796Z (about 1 year ago)
- Topics: blood-donation, redcross, telegram, telegram-bot
- Language: Python
- Homepage:
- Size: 52.7 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Singapore Blood Stocks Telegram Bot (Unofficial)
Telegram bot that informs users of Singapore's blood stocks levels from https://www.redcross.sg.
Bot is live at http://t.me/sgbloodstocksbot or @sgbloodstocksbot.
*Disclaimer*: This is an unofficial data source: I do not know for sure if these are the exact numbers, but I strongly believe that they are via some educated guesses. Regardless, this information comes without any warranty or guarantees of any sort.
## Features
- `/check` current blood stocks level
- `/subscribe` to updates on blood stocks changes for either a specific blood type, or for any changes at all.
- `/changes` shows the blood stock changes since the previous day
- `/about`, `/help`, `/unsubscribe` work as expected## Stack
- Hosted on a $5/mo DigitalOcean instance, with a free Firebase Realtime Database as the backend.
- `BeautifulSoup` to get updates from the Red Cross website, `python-telegram-bot` for the bot itself## Running the bot
- Clone the repo
- Install libraries with `pip install -r requirements.txt`
- Get a Firebase `.json` private key file and the URL for your Firebase database. Save it as `firebase.json`.
- Before running the bot, add at least `{'bot_data': {'users_data': {'1111': {'blood_subscription': 'all'}}}}` to the Firebase database through the web UI. This minimal seeding is necessary so that the persistence layer doesn't complain.
- Then, run the bot with `FIREBASE_URL="YOUR URL HERE" FIREBASE_CREDENTIALS=$(< firebase.json) python3 bot_local.py "TELEGRAM BOT API KEY"`