Rat's

Linux VPS搭建Telegram RSS中文订阅机器人教程
说明:我们很多人喜欢一些网站或者博客,有时候会错过好东西或者福利,这里我们可以搭建个Telegram RSS中文订...
扫描右侧二维码阅读全文
30
2018/03

Linux VPS搭建Telegram RSS中文订阅机器人教程

说明:我们很多人喜欢一些网站或者博客,有时候会错过好东西或者福利,这里我们可以搭建个Telegram RSS中文订阅机器人,这样可以通过它来实现在Telegram里订阅网站并快速推送RSS内容。

搭建

Github地址:https://github.com/iovxw/rssbot

1、申请Bot
打开Telegram,搜索@BotFather,发送/newbot ,申请一个Bot

然后再输入/mybots找到自己的bot,选择它,然后选择Edit Bot,选择Edit Commands就可以输入你的指令了。

#以下一起复制到对话框发送
rss       - 显示当前订阅的 RSS 列表,加 raw 参数显示链接
sub       - 订阅一个 RSS: /sub http://example.com/feed.xml
unsub     - 退订一个 RSS: /unsub http://example.com/feed.xml
unsubthis - 使用此命令回复想要退订的 RSS 消息即可退订, 不支持 Channel
export    - 导出为 OPML

请输入图片描述

2、安装机器人
首先得登录VPS,然后安装相关依赖。

#CentOS系统
yum -y update && yum -y install gcc make openssl* pkg* libssl* screen curl

#Ubuntu、Debian系统
apt-get -y update && apt-get -y install gcc make openssl pkg-config libssl-dev screen curl

这里坑不少,博主就多写了点依赖,如果还有其它错误,请留言报错内容。

安装Rust Nightly

curl https://sh.rustup.rs -sSf | sh

安装rssbot

wget https://github.com/iovxw/rssbot/archive/v1.4.2.tar.gz
tar xvf v1.4.2.tar.gz
cd rssbot-1.4.2
cargo build --release

请输入图片描述

运行rssbot

cd target/release
screen -S rssbot
./rssbot DATAFILE TELEGRAM-BOT-TOKEN

DATAFILE为数据库保存路径(其实就是一个json文件,不需要手动创建)。
TELEGRAM-BOT-TOKEN就是你创建的机器人的Token

搭建成功后,我们就关注自己的机器人,再使用指令订阅你喜欢的博客RSS了。

Vultr新用户注册送100美元/16个机房按小时计费,支持支付宝,【点击查看】。
最后修改:2019 年 07 月 04 日 01 : 45 PM

发表评论

34 条评论

  1. 学习笔记Blog

    不知道阿里云上部署这个行不行!就怕是被Q呀!

    1. Rat's
      @学习笔记Blog

      不会的。

  2. 爱趣弹

    您好,我在编译安装时总是出现
    error[E0433]: failed to resolve. Could not find TokenNode in proc_macro
    --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/proc-macro2-0.1.10/src/unstable.rs:64:33
    |
    64 | proc_macro::TokenNode::Group(delim, (s.0).0)
    | ^^^^^^^^^ Could not find TokenNode in proc_macro

    error[E0433]: failed to resolve. Could not find TokenNode in proc_macro
    --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/proc-macro2-0.1.10/src/unstable.rs:71:33
    |
    71 | proc_macro::TokenNode::Op(ch, kind)
    | ^^^^^^^^^ Could not find TokenNode in proc_macro

    error[E0433]: failed to resolve. Could not find TokenNode in proc_macro
    --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/proc-macro2-0.1.10/src/unstable.rs:74:33
    |
    74 | proc_macro::TokenNode::Term((s.0).0)
    | ^^^^^^^^^ Could not find TokenNode in proc_macro

    error[E0433]: failed to resolve. Could not find TokenNode in proc_macro
    --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/proc-macro2-0.1.10/src/unstable.rs:77:33
    |
    77 | proc_macro::TokenNode::Literal((l.0).0)
    | ^^^^^^^^^ Could not find TokenNode in proc_macro

    error[E0433]: failed to resolve. Could not find TokenNode in proc_macro
    --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/proc-macro2-0.1.10/src/unstable.rs:125:29

    |

    125 | proc_macro::TokenNode::Group(delim, s) => {

    | ^^^^^^^^^ Could not find `TokenNode` in `proc_macro`

    error[E0433]: failed to resolve. Could not find TokenNode in proc_macro
    --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/proc-macro2-0.1.10/src/unstable.rs:134:29

    |

    134 | proc_macro::TokenNode::Op(ch, kind) => {

    | ^^^^^^^^^ Could not find `TokenNode` in `proc_macro`

    error[E0433]: failed to resolve. Could not find TokenNode in proc_macro
    --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/proc-macro2-0.1.10/src/unstable.rs:141:29

    |

    141 | proc_macro::TokenNode::Term(s) => {

    | ^^^^^^^^^ Could not find `TokenNode` in `proc_macro`

    error[E0433]: failed to resolve. Could not find TokenNode in proc_macro
    --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/proc-macro2-0.1.10/src/unstable.rs:144:29

    |

    144 | proc_macro::TokenNode::Literal(l) => {

    | ^^^^^^^^^ Could not find `TokenNode` in `proc_macro`

    error[E0433]: failed to resolve. Could not find Term in proc_macro
    --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/proc-macro2-0.1.10/src/unstable.rs:274:26

    |

    274 | Term(proc_macro::Term::intern(string))

    | ^^^^ Could not find `Term` in `proc_macro`

    error[E0433]: failed to resolve. Could not find TokenNode in proc_macro
    --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/proc-macro2-0.1.10/src/unstable.rs:361:21

    |

    361 | proc_macro::TokenNode::Literal(l) => l,

    | ^^^^^^^^^ Could not find `TokenNode` in `proc_macro`

    error[E0574]: expected struct, variant or union type, found enum proc_macro::TokenTree
    --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/proc-macro2-0.1.10/src/unstable.rs:54:21
    |
    54 | TokenStream(proc_macro::TokenTree {
    | ^^^^^^^^^^^^^^^^^^^^^ not a struct, variant or union type
    help: possible better candidate is found in another module, you can import it into scope
    |
    1 | use TokenTree;
    |

    error[E0412]: cannot find type TokenTreeIter in module proc_macro
    --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/proc-macro2-0.1.10/src/unstable.rs:103:38

    |

    103 | pub struct TokenTreeIter(proc_macro::TokenTreeIter);

    | ^^^^^^^^^^^^^ did you mean `TokenTree`?

    help: possible candidates are found in other modules, you can import them into scope

    |

    1 | use TokenTreeIter;

    |

    1 | use imp::TokenTreeIter;

    |

    error[E0412]: cannot find type Term in module proc_macro
    --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/proc-macro2-0.1.10/src/unstable.rs:270:29

    |

    270 | pub struct Term(proc_macro::Term);

    | ^^^^ not found in `proc_macro`

    help: possible candidates are found in other modules, you can import them into scope

    |

    1 | use Term;

    |

    1 | use imp::Term;

    |

    error[E0599]: no function or associated item named empty found for type proc_macro::TokenStream in the current scope
    --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/proc-macro2-0.1.10/src/unstable.rs:18:21
    |
    18 | TokenStream(proc_macro::TokenStream::empty())
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function or associated item not found in proc_macro::TokenStream

    error[E0658]: use of unstable library feature 'proc_macro_span' (see issue #38356)
    --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/proc-macro2-0.1.10/src/unstable.rs:225:14

    |

    225 | Span(proc_macro::Span::def_site())

    | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(proc_macro_span)] to the crate attributes to enable

    error[E0658]: use of unstable library feature 'proc_macro_span' (see issue #38356)
    --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/proc-macro2-0.1.10/src/unstable.rs:229:21

    |

    229 | Span(self.0.resolved_at(other.0))

    | ^^^^^^^^^^^ | = help: add #![feature(proc_macro_span)] to the crate attributes to enable

    error[E0658]: use of unstable library feature 'proc_macro_span' (see issue #38356)
    --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/proc-macro2-0.1.10/src/unstable.rs:233:21

    |

    233 | Span(self.0.located_at(other.0))

    | ^^^^^^^^^^ | = help: add #![feature(proc_macro_span)] to the crate attributes to enable

    error[E0599]: no function or associated item named float found for type proc_macro::Literal in the current scope
    --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/proc-macro2-0.1.10/src/unstable.rs:318:17

    |

    318 | Literal(proc_macro::Literal::float(s))

    | ^^^^^^^^^^^^^^^^^^^^^^^^^^ function or associated item not found in `proc_macro::Literal`

    error[E0599]: no function or associated item named integer found for type proc_macro::Literal in the current scope
    --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/proc-macro2-0.1.10/src/unstable.rs:322:17

    |

    322 | Literal(proc_macro::Literal::integer(s.into()))

    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function or associated item not found in `proc_macro::Literal`

    error[E0609]: no field kind on type proc_macro::TokenTree
    --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/proc-macro2-0.1.10/src/unstable.rs:360:46

    |

    360 | match stream.into_iter().next().unwrap().kind {

    | ^^^^

    error[E0599]: no function or associated item named u8 found for type proc_macro::Literal in the current scope
    --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/proc-macro2-0.1.10/src/unstable.rs:370:25

    |

    370 | Literal(proc_macro::Literal::$t(t))

    | ^^^^^^^^^^^^^^^^^^^^^^^ function or associated item not found in `proc_macro::Literal`

    ...
    376 | / ints! {
    377 | | u8, u16, u32, u64, usize,
    378 | | i8, i16, i32, i64, isize,
    379 | | }

    | |_- in this macro invocation

    error[E0599]: no function or associated item named u16 found for type proc_macro::Literal in the current scope
    --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/proc-macro2-0.1.10/src/unstable.rs:370:25

    |

    370 | Literal(proc_macro::Literal::$t(t))

    | ^^^^^^^^^^^^^^^^^^^^^^^ function or associated item not found in `proc_macro::Literal`

    ...
    376 | / ints! {
    377 | | u8, u16, u32, u64, usize,
    378 | | i8, i16, i32, i64, isize,
    379 | | }

    | |_- in this macro invocation

    error[E0599]: no function or associated item named u32 found for type proc_macro::Literal in the current scope
    --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/proc-macro2-0.1.10/src/unstable.rs:370:25

    |

    370 | Literal(proc_macro::Literal::$t(t))

    | ^^^^^^^^^^^^^^^^^^^^^^^ function or associated item not found in `proc_macro::Literal`

    ...
    376 | / ints! {
    377 | | u8, u16, u32, u64, usize,
    378 | | i8, i16, i32, i64, isize,
    379 | | }

    | |_- in this macro invocation

    error[E0599]: no function or associated item named u64 found for type proc_macro::Literal in the current scope
    --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/proc-macro2-0.1.10/src/unstable.rs:370:25

    |

    370 | Literal(proc_macro::Literal::$t(t))

    | ^^^^^^^^^^^^^^^^^^^^^^^ function or associated item not found in `proc_macro::Literal`

    ...
    376 | / ints! {
    377 | | u8, u16, u32, u64, usize,
    378 | | i8, i16, i32, i64, isize,
    379 | | }

    | |_- in this macro invocation

    error[E0599]: no function or associated item named usize found for type proc_macro::Literal in the current scope
    --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/proc-macro2-0.1.10/src/unstable.rs:370:25

    |

    370 | Literal(proc_macro::Literal::$t(t))

    | ^^^^^^^^^^^^^^^^^^^^^^^ function or associated item not found in `proc_macro::Literal`

    ...
    376 | / ints! {
    377 | | u8, u16, u32, u64, usize,
    378 | | i8, i16, i32, i64, isize,
    379 | | }

    | |_- in this macro invocation

    error[E0599]: no function or associated item named i8 found for type proc_macro::Literal in the current scope
    --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/proc-macro2-0.1.10/src/unstable.rs:370:25

    |

    370 | Literal(proc_macro::Literal::$t(t))

    | ^^^^^^^^^^^^^^^^^^^^^^^ function or associated item not found in `proc_macro::Literal`

    ...
    376 | / ints! {
    377 | | u8, u16, u32, u64, usize,
    378 | | i8, i16, i32, i64, isize,
    379 | | }

    | |_- in this macro invocation

    error[E0599]: no function or associated item named i16 found for type proc_macro::Literal in the current scope
    --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/proc-macro2-0.1.10/src/unstable.rs:370:25

    |

    370 | Literal(proc_macro::Literal::$t(t))

    | ^^^^^^^^^^^^^^^^^^^^^^^ function or associated item not found in `proc_macro::Literal`

    ...
    376 | / ints! {
    377 | | u8, u16, u32, u64, usize,
    378 | | i8, i16, i32, i64, isize,
    379 | | }

    | |_- in this macro invocation

    error[E0599]: no function or associated item named i32 found for type proc_macro::Literal in the current scope
    --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/proc-macro2-0.1.10/src/unstable.rs:370:25

    |

    370 | Literal(proc_macro::Literal::$t(t))

    | ^^^^^^^^^^^^^^^^^^^^^^^ function or associated item not found in `proc_macro::Literal`

    ...
    376 | / ints! {
    377 | | u8, u16, u32, u64, usize,
    378 | | i8, i16, i32, i64, isize,
    379 | | }

    | |_- in this macro invocation

    error[E0599]: no function or associated item named i64 found for type proc_macro::Literal in the current scope
    --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/proc-macro2-0.1.10/src/unstable.rs:370:25

    |

    370 | Literal(proc_macro::Literal::$t(t))

    | ^^^^^^^^^^^^^^^^^^^^^^^ function or associated item not found in `proc_macro::Literal`

    ...
    376 | / ints! {
    377 | | u8, u16, u32, u64, usize,
    378 | | i8, i16, i32, i64, isize,
    379 | | }

    | |_- in this macro invocation

    error[E0599]: no function or associated item named isize found for type proc_macro::Literal in the current scope
    --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/proc-macro2-0.1.10/src/unstable.rs:370:25

    |

    370 | Literal(proc_macro::Literal::$t(t))

    | ^^^^^^^^^^^^^^^^^^^^^^^ function or associated item not found in `proc_macro::Literal`

    ...
    376 | / ints! {
    377 | | u8, u16, u32, u64, usize,
    378 | | i8, i16, i32, i64, isize,
    379 | | }

    | |_- in this macro invocation

    error[E0599]: no function or associated item named f32 found for type proc_macro::Literal in the current scope
    --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/proc-macro2-0.1.10/src/unstable.rs:385:25

    |

    385 | Literal(proc_macro::Literal::$t(t))

    | ^^^^^^^^^^^^^^^^^^^^^^^ function or associated item not found in `proc_macro::Literal`

    ...
    391 | / floats! {
    392 | | f32, f64,
    393 | | }

    | |_- in this macro invocation

    error[E0599]: no function or associated item named f64 found for type proc_macro::Literal in the current scope
    --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/proc-macro2-0.1.10/src/unstable.rs:385:25

    |

    385 | Literal(proc_macro::Literal::$t(t))

    | ^^^^^^^^^^^^^^^^^^^^^^^ function or associated item not found in `proc_macro::Literal`

    ...
    391 | / floats! {
    392 | | f32, f64,
    393 | | }

    | |_- in this macro invocation

    error: aborting due to 32 previous errors

    Some errors occurred: E0412, E0433, E0574, E0599, E0609, E0658.
    For more information about an error, try rustc --explain E0412.
    error: Could not compile proc-macro2.
    请问这是由于什么原因呀23333

    1. Rat's
      @爱趣弹

      这么长错误看着脑壳痛,你换系统试试。

  3. lbroot

    已经试了debain9 centos7都报错,求解!!!谢谢大大

    error[E0599]: no function or associated item named empty found for type proc_macro::TokenStream in the current scope
    --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/proc-macro2-0.4.3/src/unstable.rs:45:34
    |
    45 | TokenStream::Nightly(proc_macro::TokenStream::empty())
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function or associated item not found in proc_macro::TokenStream

    error: aborting due to previous error

    For more information about this error, try rustc --explain E0599.
    error: Could not compile proc-macro2.
    warning: build failed, waiting for other jobs to finish...
    error: build failed

  4. Overnightneko

    请问这是什么原因?
    root@AppropriateVicious-VM:~/rssbot-1.4.2# cargo build --release
    Compiling serde v1.0.36
    error: Could not compile serde.

    1. Rat's
      @Overnightneko

      显示是无法编译serde,建议换系统操作吧。

  5. itone

    Could not compile proc-macro2.
    error[E0433]: failed to resolve. Could not find TokenNode in proc_macro
    --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/proc-macro2-0.1.10/src/unstable.rs:71:33
    |
    71 | proc_macro::TokenNode::Op(ch, kind)
    | ^^^^^^^^^ Could not find TokenNode in proc_macro

    类似这样的一堆报错求解

    1. Rat's
      @itone

      是最后一步出现的错误吗?Token填正确了没。

      1. itone
        @Rat's

        是编译的时候 proc_macro有问题,看到issue了https://github.com/iovxw/rssbot/issues/13 正在尝试

        1. Rat's
          @itone

          还不如换个系统尝试下吧。

          1. itone
            @Rat's

            最后发现是他的release有问题,重新从github打包了再编译就好了。。谢啦
            另外他默认的5分钟刷新有点快了,像feed43这种会被认为是DDOS,编译的时候在main.rs 中第五十行 .unwrap_or(300)改成半小时了

            1. Rat's
              @itone

              那个修改默认刷新时间我之前准备写上去的,感觉5分钟正好就没写了。

  6. zy

    error: Could not compile futures.

    Caused by:
    process didn't exit successfully: rustc --crate-name futures /root/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-0.1.20/src/lib.rs --crate-type lib --emit=dep-info,link -C opt-level=3 --cfg feature="default" --cfg feature="use_std" --cfg feature="with-deprecated" -C metadata=02762cd7efc8e4c3 -C extra-filename=-02762cd7efc8e4c3 --out-dir /root/rssbot-1.4.2/target/release/deps -L dependency=/root/rssbot-1.4.2/target/release/deps --cap-lints allow (signal: 9, SIGKILL: kill)

    1. Rat's
      @zy

      之前安装过一次了?建议换系统试试。