惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

S
Secure Thoughts
罗磊的独立博客
T
The Blog of Author Tim Ferriss
人人都是产品经理
人人都是产品经理
博客园 - 叶小钗
Last Week in AI
Last Week in AI
美团技术团队
Google Online Security Blog
Google Online Security Blog
Application and Cybersecurity Blog
Application and Cybersecurity Blog
D
Docker
G
Google Developers Blog
大猫的无限游戏
大猫的无限游戏
酷 壳 – CoolShell
酷 壳 – CoolShell
小众软件
小众软件
月光博客
月光博客
L
LINUX DO - 最新话题
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
W
WeLiveSecurity
H
Heimdal Security Blog
Vercel News
Vercel News
SecWiki News
SecWiki News
Forbes - Security
Forbes - Security
Blog — PlanetScale
Blog — PlanetScale
Google DeepMind News
Google DeepMind News
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
www.infosecurity-magazine.com
www.infosecurity-magazine.com
TaoSecurity Blog
TaoSecurity Blog
T
Troy Hunt's Blog
A
About on SuperTechFans
C
Check Point Blog
S
Security Affairs
Hacker News - Newest:
Hacker News - Newest: "LLM"
AI
AI
WordPress大学
WordPress大学
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Help Net Security
Help Net Security
博客园_首页
The Last Watchdog
The Last Watchdog
S
SegmentFault 最新的问题
Hugging Face - Blog
Hugging Face - Blog
Security Archives - TechRepublic
Security Archives - TechRepublic
Engineering at Meta
Engineering at Meta
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
I
Intezer
K
Kaspersky official blog
M
MIT News - Artificial intelligence
J
Java Code Geeks
G
GRAHAM CLULEY
P
Palo Alto Networks Blog

噜啦 - telegram

CentOS 7 搭建私聊 Telegram Bot
Debian 9 搭建私聊 Telegram Bot
博主: 噜啦 · 2019-02-26 · via 噜啦 - telegram

最近看到了Github上面一个开源的项目 PmCenter ,可以通过此项目来搭建一个私聊Bot,解决+86用户不能私聊的问题

此教程仅在Vultr Debian 9 测试通过,不保证其他Linux系统的可用性,不建议使用minimal系统,精简得太厉害



更新了CentOS 7 x64的教程,更加简单,可能是这篇写复杂了,嘻嘻



安装 NET Core SDK

更新以及安装组件

apt-get update && apt-get install unzip curl sudo libunwind8 gettext apt-transport-https

注册产品密钥以及产品源

curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg
sudo mv microsoft.gpg /etc/apt/trusted.gpg.d/microsoft.gpg
sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-debian-stretch-prod stretch main" > /etc/apt/sources.list.d/dotnetdev.list'

Install NET Core SDK

sudo apt-get update && sudo apt-get install dotnet-sdk-2.0.0

将 dotnet 添加到 PATH

export PATH=$PATH:$HOME/dotnet

检查是否安装成功

dotnet --version

出现

root@Lula:~# dotnet --version
2.0.0

即安装成功


安装.NET Core Runtime

注册Microsoft密钥和订阅源

wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.asc.gpg
sudo mv microsoft.asc.gpg /etc/apt/trusted.gpg.d/
wget -q https://packages.microsoft.com/config/debian/9/prod.list
sudo mv prod.list /etc/apt/sources.list.d/microsoft-prod.list
sudo chown root:root /etc/apt/trusted.gpg.d/microsoft.asc.gpg
sudo chown root:root /etc/apt/sources.list.d/microsoft-prod.list

Install .NET Runtime

sudo apt-get update && sudo apt-get install aspnetcore-runtime-2.2

运行 pmcenter 机器人

拉取源码

mkdir pmcenter
cd pmcenter
wget https://ci.appveyor.com/api/projects/Elepover/pmcenter/artifacts/pmcenter.zip
unzip pmcenter.zip

运行

dotnet pmcenter.dll

第一次运行将会在/root/pmcenter目录下生成pmcenter.json配置文件,修改APIKeyOwnerID以及LangURL后其他使用默认配置即可

配置文件说明

APIKey是Bot的密钥,Botfather里面可以查看
OwnerID为主人TG账号的ID,第三方的TG(Plus message)可以看到,不要弄错了
LangURL是语言文件地址

两份汉化语言文件地址:

正常一点的
https://raw.githubusercontent.com/Elepover/pmcenter/master/locales/pmcenter_locale_zh.json

萌哒哒的
https://raw.githubusercontent.com/Elepover/pmcenter/master/locales/pmcenter_locale_zh.meow.json

设置pmceter开机自启

Debian 9是带有rc.local服务,但是不带/etc/rc.local文件

手工添加一个/etc/rc.local文件


cat <<EOF >/etc/rc.local
    #!/bin/sh -e
    #
    # rc.local
    #
    # This script is executed at the end of each multiuser runlevel.
    # Make sure that the script will "exit 0" on success or any other
    # value on error.
    #
    # In order to enable or disable this script just change the execution
    # bits.
    #
    # By default this script does nothing.
    
    cd /root/pmcenter && dotnet pmcenter.dll
    exit 0
    EOF

然后赋予权限

chmod +x /etc/rc.local

启动接着rc-local服务

systemctl start rc-local

查看状态

systemctl status rc-local

机器人开启后,与Bot的对话中输入/help查看帮助信息

赞赏作者

如果觉得我的文章对你有用,请随意赞赏