使用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 - 修改急切五年配置

使用python Telegram 机器人推送消息_第1张图片

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

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

使用python Telegram 机器人推送消息_第2张图片

三、运用机器人推送消息

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

使用python Telegram 机器人推送消息_第3张图片

使用python Telegram 机器人推送消息_第4张图片

使用python Telegram 机器人推送消息_第5张图片

使用python Telegram 机器人推送消息_第6张图片

使用python Telegram 机器人推送消息_第7张图片

使用python Telegram 机器人推送消息_第8张图片

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

你可能感兴趣的:(Python,Github)