Deprecated,
because I suck at TS, for maintained version of this bot, see this repo.
Extract news under topics of interest (MEV, security, development) from DefiLlama Round Up and forward to DefiLlama Round Up for Devs.
Service/API used in this bot.
- Create a Google Cloud account and a project.
- Set up a Scheduler for the daily cron job.
- Set up a Pub/Sub topic.
- Install the
gcloud
command line tool.
The script itself is quite simple. Actually, more work is done on figuring out and setting up the environment where it runs. I chose to deploy the bot on Google Cloud Functions (a serverless platform). The following chart describe the overall architecture.
flowchart LR
A("Daily Cron Jub<br>(Cloud Scheduler)")
B("Topic<br>(Cloud Pub/Sub)")
C("Bot Script<br>(Cloud Functions)")
A -- publish --> B
C -- subscribe --> B
The cron job will publish an event to the topic daily, triggering the bot function to execute its logic to crawl the Round Up content from DefiLlama's website, extract relevant news, and then send an excerpt to the channel.
Obtain a Telegram bot token and store it in Google Cloud Secret Manager.
yarn lint
: code formatting and linting.yarn deploy
: build and deploy the bot.yarn trigger
: manually trigger the bot function (often used for testing).
Note The first time deploying the bot to Google Cloud, some warnings and errors will pop up asking for permissions, e.g. granting default service account access to Secret Manager. Simply follow the hints and set up the required permissions to proceed.
Absolutely welcome. Also feel free to reach out to discuss the project or anything else!
Dual licensed under either MIT License or Apache License, Version 2.0.