使用python Telegram 机器人推送消息

环境安装

也可以通过pip安装
pip install python-telegram-bot
或者通过源码安装

$ git clone https://github.com/python-telegram-bot/python-telegram-bot --recursive
$ cd python-telegram-bot
$ python setup.py install

一、注册机器人获取api

关注@BotFather用户

I can help you create and manage Telegram bots. If you're new to the Bot API, please see the manual (https://core.telegram.org/bots).

You can control me by sending these commands:

/newbot - 创建一个机器人账号
/mybots - 修改急切五年配置

(第一次输入的为name,第二次输入的为bot的 id)

二、把机器人拉入频道(必须设置为管理员)

三、运用机器人推送消息

下面为发送文本、网址和图片的方法

项目地址:
https://github.com/SaltNego/telegram_python_bot/tree/master

发布了61 篇原创文章 · 获赞 22 · 访问量 4241

猜你喜欢

转载自blog.csdn.net/yiqiushi4748/article/details/103994364