Skip to content

Repository files navigation

NodeRSSBot

Another telegram RSSBot in Node.js

A RSSBot in telegram similar to https://github.com/iovxw/rssbot/. But this time in Node.js.

Support version

RSS is parsered using rss-parser

Usage

The same as https://github.com/iovxw/rssbot/

/rss - show subscriptions,add raw to show links
/sub - subscribe a RSS: /sub http://example.com/feed.xml
/unsub - unsubscribe a RSS: /unsub http://example.com/feed.xml
/unsubthis - reply a message from a RSS feed to unsubscribe it
/allunsub - unsubscribe all feeds
/export - export subscriptions to opml file
/viewall - view all subscriptions and number of subscribers need to enable in settings
/import - reply this message a opml file to import(in group)

You can add channel id to subscribe a feed for a channel in private chat after add the bot as administrator
for example /sub <channel id > <feed url> (channel id is startwith @)

You can send a opml file directly to import feed in private chat use /import in group viewall can only be uesed in private chat

Depolyment

Docker

Use autobuild docker image

After install docker

  1. Rundocker pull fengkx/node_rssbot
  2. Run docker run --name rssbot -d -v <directory to store database file>:/app/data/ -e RSSBOT_TOKEN=<YOUR_TGBOT_TOKEN> fengkx/node_rssbot

for exmaple docker run --name rssbot -d -v /var/data:/app/data/ -e RSSBOT_TOKEN=123456:abcdef123456-U fengkx/rssbot

Build docker locally

  1. Install Docker
  2. clone this repository git clone https://github.com/fengkx/NodeRSSBot.git
  3. Run docker build . then you will get a image id
  4. Rundocker run --name rssbot -d -e RSSBOT_TOKEN=<YOUR_TGBOT_TOKEN> <YOUR_IMAGE_ID>

for example docker run --name rssbot -d -e RSSBOT_TOKEN=123456:abcdef123456-U fd54321bff2

PM2

  1. Node.js and npm installed
  2. clone this repository git clone https://github.com/fengkx/NodeRSSBot.git
  3. Set the RSSBOT_TOKEN environment variable or set it in config/index.js
  4. Install dependencies run npm i in the root directory of the repository
  5. Run pm2 start index.js

Setting

All setting can be set by either environment variable or in config/index.js

settingenvdefault/requiredescription
tokenRSSBOT_TOKENrequiretelegram bot token
db_pathRSSBOT_DB_PATHdata/database.dbpath to store database file
langRSSBOT_LANGzh-cnlanguage
item_numRSSBOT_ITEM_NUM10send the laset number of item
fetch_gapRSSBOT_FETCH_GAP5mfetch gap
notify_error_countNOTIFY_ERR_COUNT5error count when it will notfiy
view_allRSSBOT_VIEW_ALLfalseenable or not
UARSSBOT_UA'Mozilla/5.0 NodeRSSBot(https://github.com/fengkx/NodeRSSBot)'user-agent of requrest
proxy.protocolPROXY_PROTOCOLnullproxy protocol http/https/socks
proxy.hostPROXY_HOSTnullproxy host
proxy.portPROXY_PORTnullproxy port

language can be setting in zh-cn or en

fetch_gap can be setting in how many minutes or hours。m for minute, h for hour

for example 5m means every 5 minutes, 1h means every 1 hour

i18n

translate the file in i18n in the another yaml and make a pull request (๑•̀ㅂ•́)و✧


中文文档

NodeRSSBot

又是一个 telegram RSS Bot 不过这次用的是 Node.js

模仿https://github.com/iovxw/rssbot/ 做的一个 RSSBot,用telegraf
首先感谢 iovxw 的 RSSBot 一直用的很好
做这个东西只是为了,配置起来更方便一些不用安装 Rust 的工具链和编译

支持的版本

RSS 解析用的是 rss-parser,它支持的就支持

Usage

基本与 https://github.com/iovxw/rssbot/一致

/rss - 显示订阅列表,加 `raw`显示链接
/sub - 订阅 RSS: /sub http://example.com/feed.xml
/unsub - 退订 RSS: /unsub http://example.com/feed.xml
/unsubthis - 回复一个 RSS 发来的消息退订该 RSS
/allunsub - 退订所有源
/export - 导出订阅到opml文件
/viewall - 查看所有订阅和订阅人数 需要在设置中打开
/import - 回复此消息 opml 文件导入订阅(群组)

把 bot 设为频道管理员并正确配置权限后,可通过私聊在/sub后加上频道 id 来在频道中订阅 feed 例如 /sub <频道 id > <feed url> (频道 id 是@打头的)

直接发送 opml 文件,可以导入 RSS 源
viewall 只能在私聊中使用

部署

Docker

使用自动构建的 docker image

安装好了 docker 之后

  1. 运行docker pull fengkx/node_rssbot
  2. 运行 docker run --name rssbot -d -v <directory to store database file>:/app/data/ -e RSSBOT_TOKEN=<YOUR_TGBOT_TOKEN> fengkx/node_rssbot

例如 docker run --name rssbot -d -v /var/data:/app/data/ -e RSSBOT_TOKEN=123456:abcdef123456-U fengkx/rssbot

本地构建

  1. 安装 Docker
  2. 克隆仓库 git clone https://github.com/fengkx/NodeRSSBot.git
  3. 构建 docker image docker build . then you will get a image id
  4. 运行 docker run --name rssbot -d -e RSSBOT_TOKEN=<YOUR_TGBOT_TOKEN> <YOUR_IMAGE_ID>

例如 docker run --name rssbot -d -e RSSBOT_TOKEN=123456:abcdef123456-U fd54321bff2

PM2

  1. 首先要有 Node.js 和 npm 或 yarn
  2. 克隆仓库 git clone https://github.com/fengkx/NodeRSSBot.git
  3. 设置 RSSBOT_TOKEN 环境变量,或者直接在 config/index.js 中修改
  4. 安装依赖 在仓库根目录运行npm i
  5. 推荐用 pm2 守护进程 pm2 start index.js 如果没有安装pm2 就先安装 npm i -g pm2

TODO

  • export 命令
  • 代理
  • unit test

配置项

所有配置项都可以用环境变量或者直接在 config/index.js中修改

设置项环境变量默认/必填描述
tokenRSSBOT_TOKENrequiretelegram bot token
db_pathRSSBOT_DB_PATHdata/database.db数据库文件路径
langRSSBOT_LANGzh-cn语言
item_numRSSBOT_ITEM_NUM10发送最新几条信息
fetch_gapRSSBOT_FETCH_GAP5m抓取间隔
notify_error_countNOTIFY_ERR_COUNT5发出通知的错误次数
view_allRSSBOT_VIEW_ALLfalse是否开启
UARSSBOT_UA'Mozilla/5.0 NodeRSSBot(https://github.com/fengkx/NodeRSSBot)'请求的 user-agent
proxy.protocoolPROXY_PROTOCOLnull代理协议 http/https/socks
proxy.hostPROXY_HOSTnull代理地址
proxy.portPROXY_PORTnull代理端口

语言可以设置为 zh-cn or en 时间间隔可设置为每多少分钟或多少小时。m 表示分钟, h 表示小时

例如 5m 表示每 5 分钟, 1h 表示每 1 小时

i18n

i18n目录翻译 yaml 文件然后来个 ·pr· (๑•̀ㅂ•́)و✧

About

Another telegram RSSBot but in Node.js

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages