Giter Site home page Giter Site logo

0xyyy / alpaca-excerpt-bot-ts Goto Github PK

View Code? Open in Web Editor NEW
3.0 2.0 0.0 105 KB

๐Ÿค– A Telegram bot that extracts dev alpha from DefiLlama Round Up.

Home Page: https://t.me/defillama_roundup_dev

License: Apache License 2.0

Shell 14.79% TypeScript 85.21%
defillama google-cloud bot telegram

alpaca-excerpt-bot-ts's Introduction

๐Ÿฆ™ Alpaca Excerpt Bot

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.

Requirements

Service/API used in this bot.

Google Cloud

  1. Create a Google Cloud account and a project.
  2. Set up a Scheduler for the daily cron job.
  3. Set up a Pub/Sub topic.
  4. Install the gcloud command line tool.

Architecture

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
Loading

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.

Telegram

Obtain a Telegram bot token and store it in Google Cloud Secret Manager.

Deploy

  1. yarn lint: code formatting and linting.
  2. yarn deploy: build and deploy the bot.
  3. 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.

Contribution

Absolutely welcome. Also feel free to reach out to discuss the project or anything else!

License

Dual licensed under either MIT License or Apache License, Version 2.0.

alpaca-excerpt-bot-ts's People

Contributors

0xyyy avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

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.