米游社大别野Bot Python SDK。MiHoYo Villa Bot Python SDK.
Project description
特性
- 基于
FastAPI
和Pydantic
,异步、快速、高性能! - 完整的类型注解支持
- 便捷的消息构造和发送方法
- 丰富的消息段和完整的API支持
想不出来了
安装
- 使用pip:
pip install villa
- 使用poetry:
poetry add villa
- 使用pdm:
pdm add villa
快速开始
首先你需要一个米游社大别野的Bot,如果没有请先到机器人开发者社区(别野ID: OpenVilla)申请,取得bot_id
、bot_secret
from villa import Bot
from villa.event import SendMessageEvent
bot = Bot(bot_id="your_bot_id", bot_secret="your_bot_secret", callback_url="your_callback_url")
# 初始化Bot,填写你的bot_id、密钥以及回调地址
@bot.on_startswith("hello")
async def handler(event: SendMessageEvent):
await event.send("world!")
# 一个简单的处理函数,向你的Bot发送`@Bot hello`,它将会回复你`world`!
if __name__ == "__main__":
bot.run(host="127.0.0.1", port=13350)
# 启动bot,注意,port端口号要和你的回调地址对上
使用说明
详见example
文件夹:
single_bot.py
: 单Bot运行multiple_bots.py
: 多Bot运行handle_func.py
: 各种处理器介绍send_message.py
: 各种消息发送方法介绍
反馈
目前无论是大别野Bot还是本SDK都在测试开发中,如遇问题请提出issue,感谢支持!
也欢迎来我的大别野【尘世闲游】进行交流~
- 大别野ID: wgiJNaU
- Web端链接
相关项目
- NoneBot2 非常好用的Python跨平台机器人框架!
- nonebot-adapter-villa NoneBot2的大别野Bot适配器。
推荐有成熟Python开发经验但对NoneBot2不熟悉的小伙伴选择本SDK
,
对NoneBot2熟悉或希望接触更成熟的生态的小伙伴选择NoneBot2+Villa适配器
进行开发。
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
villa-0.1.1.tar.gz
(19.2 kB
view details)
Built Distribution
villa-0.1.1-py3-none-any.whl
(20.6 kB
view details)
File details
Details for the file villa-0.1.1.tar.gz
.
File metadata
- Download URL: villa-0.1.1.tar.gz
- Upload date:
- Size: 19.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.17
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 91581029fd14eef0a49b4e400a0beb9cf0a56df3fcf9f105ea372daf7b29b9e0 |
|
MD5 | 5f81af1210ab85d4580cabaa23b7c491 |
|
BLAKE2b-256 | 41816f9e16e784c549b58d28b92caa2ad65b24689bc6e2152d99fa209c810873 |
File details
Details for the file villa-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: villa-0.1.1-py3-none-any.whl
- Upload date:
- Size: 20.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.17
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6c6b426adce46c2cf8c8ec55d05314906aa4af72ff91ec2da98b9250db512eb8 |
|
MD5 | 8550940812030c832979fcfe7465f45d |
|
BLAKE2b-256 | 17de9bee8a41dbb0f963601910933e83451a4b813269009a2da77e79c19a221c |