Another telegram RSSBot but in Node.js
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
config user-agent config Jan 3, 2019
controlers remove markup number of subscriber Jan 4, 2019
data format code Jan 5, 2019
database update sql foregin key Jan 8, 2019
i18n import in group Jan 5, 2019
logs logs gitkeep Dec 22, 2018
middlewares sub by send url directly Jan 14, 2019
migrate format devDependencies Dec 24, 2018
proxies
template export supoort Dec 23, 2018
utils better log Jan 8, 2019
.eslintrc.js sub by send url directly Jan 14, 2019
.gitignore migrate Dec 22, 2018
.prettierignore Prettier Dec 24, 2018
.prettierrc pre-commit-config Jan 5, 2019
Dockerfile remove more useless file in Dockerfile Jan 5, 2019
LICENSE Initial commit Dec 21, 2018
README.md
index.js sub by send url directly Jan 14, 2019
package-lock.json Update prettier to version 1.16.0 Jan 22, 2019
package.json

README.md

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

setting env default/require description
token RSSBOT_TOKEN require telegram bot token
db_path RSSBOT_DB_PATH data/database.db path to store database file
lang RSSBOT_LANG zh-cn language
item_num RSSBOT_ITEM_NUM 10 send the laset number of item
fetch_gap RSSBOT_FETCH_GAP 5m fetch gap
notify_error_count NOTIFY_ERR_COUNT 5 error count when it will notfiy
view_all RSSBOT_VIEW_ALL false enable or not
UA RSSBOT_UA 'Mozilla/5.0 NodeRSSBot(https://github.com/fengkx/NodeRSSBot)' user-agent of requrest

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中修改

设置项 环境变量 默认/必填 描述
token RSSBOT_TOKEN require telegram bot token
db_path RSSBOT_DB_PATH data/database.db 数据库文件路径
lang RSSBOT_LANG zh-cn 语言
item_num RSSBOT_ITEM_NUM 10 发送最新几条信息
fetch_gap RSSBOT_FETCH_GAP 5m 抓取间隔
notify_error_count NOTIFY_ERR_COUNT 5 发出通知的错误次数
view_all RSSBOT_VIEW_ALL false 是否开启
UA RSSBOT_UA 'Mozilla/5.0 NodeRSSBot(https://github.com/fengkx/NodeRSSBot)' 请求的 user-agent

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

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

i18n

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