el_monitorro

ayrat555MIT更新放缓

用 Rust 写的高性能 RSS 阅读器,以 Telegram 机器人形式运行,支持 RSS、Atom 和 JSON 订阅源,让你直接在聊天窗口里追更。

🐂 El Monitorro is a high-performance feed reader as a Telegram bot. It supports RSS, Atom and JSON feeds

0.14.0发布于 2024-01-13 17:15 UTC215star39fork同步于 2026-11-07 07:33 UTC

怎么上手

由 README 提炼,执行前请确认
docker run --env-file ./.env --network host -t ayratbadykov/el_monitorro:latest
硬件要求按 README 说明

README 未说明硬件要求,仅需能运行 Rust 程序并连接 PostgreSQL 的环境

有 Docker 镜像
下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

由 README 自动翻译提炼

把 RSS、Atom、JSON 订阅源变成 Telegram 机器人推送,自托管即可用

用 Rust 写的高性能 RSS 阅读器,以 Telegram 机器人形式运行,支持 RSS、Atom 和 JSON 订阅源,让你直接在聊天窗口里追更。

核心能力

  • 支持 RSS、Atom 和 JSON 三种订阅源格式
  • 用 /set_template 自定义每条推送的模板与字段
  • 用 /set_filter 按关键词或 !排除词过滤推送内容
  • 拆分 sync、deliver、cleaner 多个二进制并行调度
  • 可设置时区、预览开关与全局模板/过滤器

容易踩的坑

必须先在 .env 配置 DATABASE_URL 和 TELEGRAM_BOT_TOKEN,否则无法启动;手动部署需安装 diesel-cli 并执行 diesel database setup 建库;命令、同步、投递是独立二进制,需分别启动或设 ALL_BINARIES=true 合并运行

内容由模型根据 README 生成,可能不完整或不准确,以官方文档为准。看原文 README

最近发版

5 个版本0.14.0
  1. 0.14.0最新正式版2024-01-13 · 2024-01-13 17:15 UTC

    What's Changed

    Full Changelog: https://github.com/ayrat555/el_monitorro/compare/0.12.1...0.14.0

  2. 0.12.12023-09-29 · 2023-09-29 11:44 UTC
    查看更新说明

    What's Changed

  3. 0.12.00.12.0 2023-02-05 · 2023-02-05 14:01 UTC
    查看更新说明

    0.12.0 (2023-02-05)

    • Add inline keyboard for help command (#288)
    • Add command to close/remove keyboards and messages (#289)
    • Support author in templates (#294)
    • Support authors from dublincore (#295)
    • Add preview_enabled to chats (#296)
    • Feed keyboards (#298)
    • Process commands in conversational style (#301)
    • CommandsKeyboard improvements (#302)
    • Display only read-only commands for feed keyboards in public chats (#303)
    • Update rust version and dependencies
  4. 0.11.02022-09-24 · 2022-09-24 17:33 UTC
    查看更新说明

    0.11.0 (2022-09-24)

    Improved

    • Optimize filter word matching using the ahocorasick crate (#263)
    • Configure the max number of filter words with the env var (#264)
    • Re-use the http client for all requests (#265)
    • Parse links along with their content (#266)

    Fixed

    • Fix long links in templates (#257)
  5. 0.10.02022-09-04 · 2022-09-04 19:54 UTC
    查看更新说明

    0.10.0 (2022-09-04)

    Added

    • Add template helpers (html links, text formatting) (#244) by @athulkrishnaaei

    Improved

    • Update diesel crate to 2.0 version. (#247) by @pxp9
    • Update fang crate to 0.9.0 version. (#247) by @pxp9 and @ayrat555
    • Docker push automatization. (#239) by @pxp9

    New Contributors

    • @pxp9 made their first contribution in #239
    • @athulkrishnaaei made their first contribution in #240

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    +++ title = "El Monitorro" sort_by = "weight" +++

    paypal

    El Monitorro

    El Monitorro is RSS, Atom and JSON feed reader as a Telegram bot.

    It's available at @el_monitorro_bot.

    Usage

    Commands

    /start - show the bot's description and contact information
    
    /subscribe url - subscribe to feed
    
    /unsubscribe url - unsubscribe from feed
    
    /list_subscriptions - list your subscriptions
    
    /help - show available commands
    
    /set_timezone - set your timezone. All received dates will be converted to this timezone. It should be offset in minutes from UTC. For example, if you live in UTC +10 timezone, offset is equal to 600
    
    /get_timezone - get your timezone
    
    /set_template url template - set a template for all received items for the specified subscription. All new updates will be converted to the format defined by this subscription. Supported fields you can use for templates:
    - bot_feed_name - name of the feed
    - bot_feed_link - url of the feed
    - bot_item_name - name of the item
    - bot_item_link - url of the item
    - bot_item_description - description of the item
    - bot_date - publication date of the feed
    
    Example: /set_template https://www.badykov.com/feed.xml {{bot_feed_name}}
    
    
        {{bot_item_name}}
    
    
        {{bot_date}}
    
    
        {{bot_item_link}}
    
    Also, there are some helpers for templates:
    - `substring` helper that can be used to limit the number of characters. For example, {{substring bot_item_description 100}}
    - `create_link` helper. This helper creates an html link. For example, {{create_link bot_item_name bot_item_link}} or {{create_link "custom_name" bot_item_link}}
    - `italic` helper. Usage: {{italic bot_item_description}}
    - `bold` helper. Usage:  {{bold bot_item_name}}
    
    /get_template url - get a template for the subscription
    
    /remove_template url - remove the template
    
    /set_global_template - set global template. This template will be used for all subscriptions. If the subscription has its own template, the subscription template will be used. See /set_template for available fields.
    
    /remove_global_template - remove global template
    
    /get_global_template - get global template
    
    /get_filter url - get a filter for the subscription
    
    /set_filter url filter - set filter, for example, /set_filter https://www.badykov.com/feed.xml telegram,bots. You'll start receiving posts only containing words in the filter. Use `!word` to stop receiving messages containing the specified `word`. You can combine regular filter words with ! filter words. For example, `!bot,telegram`
    
    /remove_filter url - remove filter
    
    /set_global_filter filter - set global filter
    
    /get_global_filter - get a global filter
    
    /remove_global_filter - remove global filter
    
    /info - shows the number of subscriptions and chats. it's available only for the admin (`ADMIN_TELEGRAM_ID`)
    
    /set_content_fields url fields - changes content hash fields of the specified feed. it's available only for the admin (`ADMIN_TELEGRAM_ID`).
    Example: /set_content_fields https://www.badykov.com/feed.xml author,title
    
    By default content hash is calculated from title and url.
    
    Available fields:
        - link
        - title
        - publication_date
        - guid
        - description
        - author
    
    /toggle_preview_enabled - disable or enable previews
    
    /get_preview_enabled - check if previews are enabled for the current chat. by default, previews are enabled
    

    Common info

    • Feed updates check interval is 1 minute.
    • Unread items delivery interval is 1 minute.
    • The number of subscriptions is limited to 5 for private chats, to 1 for groups and channels

    The bot works in private chats, groups and channels. A couple of channels created with el monitorro:

    Setup

    Manual setup

    You can deploy your instance of el_monitorro by:

    1. Set postgres db url (DATABASE_URL) and telegram bot token (TELEGRAM_BOT_TOKEN) to .env file in the root directory. For example:
    DATABASE_URL=postgres://admin:pass@localhost/el_monitorro
    TELEGRAM_BOT_TOKEN=MYTOKEN
    
    1. Setup database by running:
    diesel database setup
    

    You'll need diesel-cli for this

    1. Start the bot
    • Start the command bot
    RUST_LOG=info RUST_BACKTRACE=1 cargo run --bin el_monitorro
    
    • Start the sync binary
    RUST_LOG=info RUST_BACKTRACE=1 cargo run --bin sync
    
    • Start the delivery binary
    RUST_LOG=info RUST_BACKTRACE=1 cargo run --bin deliver
    
    • If you don't want to store all feed items that were synced and feeds without any subscriptions, start the cleaner binary
    RUST_LOG=info RUST_BACKTRACE=1 cargo run --bin cleaner
    

    Running all services from a single binary

    Set ALL_BINARIES to run all binaries (clean, commands, deliver, sync) in the same binary:

    ALL_BINARIES=true
    

    Configuration

    All configuration is done through env variables

    NameRequiredDefault valueExample / Description
    DATABASE_URLyes--postgres://postgres:postgres@localhost/el_monitorro
    TELEGRAM_BOT_TOKENyes--6666618370:AAGx5YhNQvUG4eUcQXN-OB_a09ZzYl6aaaa
    DATABASE_POOL_SIZEno5The maximum number of connections for global connection pool (global per binary except if ALL_BINARIES is set to true).
    ALL_BINARIESno--If this var is set, all services will be started in the main binary
    TELEGRAM_BOT_HANDLEno--This value is used during parsing of commands. If you set autocompletion menu for your bot, the bot will understand commands like /subscribe@handle along with just /subscribe
    SUBSCRIPTION_LIMITno20
    FILTER_LIMITno20The maximum number of filter words that can be set per subscription or as the global filter
    SYNC_INTERVAL_SECONDSno60The bot tries to sync feeds every SYNC_INTERVAL_SECONDS seconds
    SYNC_WORKERS_NUMBERno1The number of workers to sync feeds
    DELIVER_INTERVAL_SECONDSno60The bot tries to deliver new feed items every DELIVER_INTERVAL_SECONDS seconds
    DELIVER_WORKERS_NUMBERno1The number of workers to deliver updates
    CLEAN_INTERVAL_SECONDSno3600The bot cleans old feed items and feeds without subscriptions every CLEAN_INTERVAL_SECONDS seconds
    CLEAN_WORKERS_NUMBERno1The number of workers to remove old data
    OWNER_TELEGRAM_IDno--If this value is set, the bot will process commands only from the specified user id
    REQUEST_TIMEOUTno5Timeout in seconds for feed syncing requests
    ADMIN_TELEGRAM_IDno--If this value is set, /info command with stats is available for ADMIN_TELEGRAM_ID

    Deployment suggestions

    It's recommended to use a self hosted PostgreSQL instance but if it's not possible there are free services that can host it fo you:

    Using docker image

    The image is published on docker hub under ayratbadykov/el_monitorro. It accepts additional env variables:

    • SETUP_DB - if this variable is not empty, diesel database setup is run. It creates DB and runs migrations.
    • RUN_MIGRATION - if this variable is not empty, diesel migration run is run. It just runs migrations.
    • BOT_BINARY - depending on this variable, docker container will run one of four binaries. Possible values are commands, sync, deliver, cleaner. To run all services in the main binary, set:
    RUN_MIGRATION=true
    BOT_BINARY=commands
    ALL_BINARIES=true
    

    Run the docker container:

    docker run --env-file ./.env --network host -t ayratbadykov/el_monitorro:latest
    

    Notes:

    • --network host is used so the docker container can access a host network if you're running Postgres on the same machine

    You can check out an example of docker-compose file in the root directory of the project.

    Creating a docker image from the latest master branch

    Run the following command in the el_monitorro directory to build the image from the master branch:

    docker build ./ -t ayratbadykov/el_monitorro:latest