StickerViaBot
一个用于生成 Sticker 的简易 Telegram Bot 框架
Requirements
python>=3.7pyrogram~=2.0.97pluginlib~=0.9.0
Installation
pip install StickerViaBot
Usage
只需简单一个 main.py 即可运行,把项目 git 下来改下 main.py 不也能跑
"""
main.py
"""
from StickerViaBot import create_bot
bot = create_bot(
session_name = 'StickerViaBot',
api_id = 0, # TELEGRAM_API_ID
api_hash = "", # TELEGRAM_API_HASH
bot_token = "", # TELEGRAM_BOT_TOKEN
plugins=dict(root="plugins"), # PLUGINS_DIR_PATH
)
if __name__ == '__main__':
import logging
logging.basicConfig(level=logging.INFO)
bot.run()
如果你要运行在 Docker 之中,只需要通过环境变量进行传递
For Plugins
虽然说了怎么使用,但最重要一点还是如何编写插件。
插件的简单范例在plugins文件夹内,插件的规范需要参考pluginlib的 文档 。
编写插件常用的函数放在StickerViaBot.utils里面。文件中Utils类的函数一般与Telegram Bot有关,依赖于pyrogram.Client才能使用,
设计上直接继承到StickerViaBot.Bot之中。
Note
- 设计 inline mode 用到的绘图,需要注意结果返回时间,如果超时将不返回结果。对于动图类的,建议改用 command mode ,以确保稳定工作
License
MIT License
Metadata
Release files for StickerViaBot 0.2.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| StickerViaBot-0.2.2.tar.gz | 5.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| StickerViaBot-0.2.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 13.3 kB
Release files / StickerViaBot-0.2.2.tar.gz
| Download URL | StickerViaBot-0.2.2.tar.gz |
|---|---|
| Size | 5.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3da8e01c35238e086119412ade573073bdca8bf7f760845c3101f3529caad775
|
|
BLAKE2b-256 checksum How to use checksums |
771d210bd7ba92819268465dd2503952a1d031e32c923ba4a5abe3e201436b96
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.18
|
Release files / StickerViaBot-0.2.2-py3-none-any.whl
| Download URL | StickerViaBot-0.2.2-py3-none-any.whl |
|---|---|
| Size | 7.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9ad9e9cb1c2de5f82ae79b6756bf9dd18ba3f145ebcbbbd75de0ac5be44ac3ff
|
|
BLAKE2b-256 checksum How to use checksums |
e2d009108e7bf1fa11bbb924bfc1ce1407eb2c7ea59a84db4b8b3487c01a1cf4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.18
|