Telegram bot in brief.
Project description
brief-telegram-bot
使用简洁的代码来创建你的电报机器人
1.安装
pip install brief-telegram-bot
2.快速上手
from brieftgbot import Bot
#你的机器人token
token = ''
myBot = Bot(token)
#启动机器人
myBot.launch()
之后你与机器人对话就可以看到控制台打印的消息了
3.高级
发送消息
from brieftgbot import Bot
#你的机器人token
token = ''
myBot = Bot(token)
#自定义你的函数
def handler():
message = myBot.Msg
chat_id = message['message']['chat']['id']
if message['message']['texat'] == 'Hi':
myBot.sendMessage(chat_id,'Hi from bot.')
#启动机器人,并将你的逻辑函数传递进去
myBot.launch(handler)
- 通过myBot.Msg即可获得机器人所收到的信息,并以json格式返回,这也是您编写您的逻辑的基础需求
- 在代码的launch()方法中可以传递的参数:
myBot.launch(function='',print_info=True)
- function参数:置空则不会执行任何东西,填写后将会在机器人运行时执行您缩写的函数。默认为空
- print_info参数:True表示在控制台以json格式打印机器人所收到的信息,False表示不打印。默认为True
机器人的所有方法都是根据Telegram官方文档进行编写的,详细参数请参考官方文档
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file brief-telegram-bot-0.0.6.tar.gz.
File metadata
- Download URL: brief-telegram-bot-0.0.6.tar.gz
- Upload date:
- Size: 4.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.6.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.6.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4a319fc25ec663ea742f49ef0125c2eb2617eb19938ecfe0c3002b8a02069c87
|
|
| MD5 |
c49a484530c73882eb245bdf8b961b52
|
|
| BLAKE2b-256 |
0c6985d48a1e616ea9353263b97724b8e6f06413b7f7248e1a6bee406b8861cf
|
File details
Details for the file brief_telegram_bot-0.0.6-py3-none-any.whl.
File metadata
- Download URL: brief_telegram_bot-0.0.6-py3-none-any.whl
- Upload date:
- Size: 5.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.6.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.6.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
36e8b1b423943ffbb5757c97e12c1cdda1fb2c45aef9658b0343a9b080956cb8
|
|
| MD5 |
9b3edb0ea00fc2bd9c16bf6f14c72786
|
|
| BLAKE2b-256 |
ba52dc4645d7400b47299fe56a45430b226d3e0ce743b3e08259eab1aac601f2
|