特性
- 基于
FastAPI和Pydantic,异步优先、快速、高性能! - 完整的类型注解支持,便于开发。
- 便捷的消息构造和发送方法。
- 完整的消息段和API支持。
Serverless云函数支持。- More
想不出来了
安装
- 使用 pip:
pip install villa - 使用 poetry:
poetry add villa - 使用 pdm:
pdm add villa
快速开始
你需要一个米游社大别野的 Bot,可前往大别野「机器人开发者社区」(ID: OpenVilla)申请,取得bot_id、bot_secret和pub_key。
from villa import Bot
from villa.event import SendMessageEvent
bot = Bot(
bot_id="your_bot_id",
bot_secret="your_bot_secret",
pub_key="-----BEGIN PUBLIC KEY-----\nyour_pub_key\n-----END PUBLIC KEY-----\n",
callback_url="your_callback_url_endpoint",
)
# 初始化Bot,填写你的bot_id、密钥、pub_key以及回调地址endpoint
# 举例:若申请时提供的回调地址为https://域名/callback,这里的callback_url就填`/callback`
@bot.on_startswith("hello")
async def handler(event: SendMessageEvent):
await event.send("world!")
# 一个简单的处理函数,向你的Bot发送包含`hello`关键词的消息,它将会回复你`world`!
if __name__ == "__main__":
bot.run(host="127.0.0.1", port=13350)
# 启动bot,注意,port端口号要和你所使用的回调地址端口对上
示例
详见 example 文件夹:
交流、建议和反馈
注意:本SDK并非官方SDK
大别野 Bot 和本 SDK 均为开发测试中,如遇问题请提出 issue ,感谢支持!
也欢迎来我的大别野「尘世闲游」(ID: wgiJNaU)进行交流~
相关项目
- NoneBot2 非常好用的 Python 跨平台机器人框架!
- nonebot-adapter-villa NoneBot2 的大别野 Bot 适配器。
- Herta-villa-SDK 另一个大别野 Python SDK。
Metadata
Release files for villa 0.8.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| villa-0.8.0.tar.gz | 25.7 kB | Without provenance | Details for villa-0.8.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| villa-0.8.0-py3-none-any.whl | Python 3 | none | any | Details for villa-0.8.0-py3-none-any.whl |
Total release size: 52.9 kB
Release files / villa-0.8.0.tar.gz
| Download URL | villa-0.8.0.tar.gz |
|---|---|
| Size | 25.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
313f90a060445f9bba137d0dffab698ba64036e0895273ecf7b23dadcbc81856
|
|
BLAKE2b-256 checksum How to use checksums |
bf82e7b943b21644109583a582c3ed8a0135a5b16ee472b5f1989a15d3e80daf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.18
|
Release files / villa-0.8.0-py3-none-any.whl
| Download URL | villa-0.8.0-py3-none-any.whl |
|---|---|
| Size | 27.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a68cc2cfdce0f0aeb49eaa149deaebb1a362d772ae5774e1e8a01090856a0b02
|
|
BLAKE2b-256 checksum How to use checksums |
7c6b283b519c664b09ec057726e32e22550fcd8ec5c8986cb23fac252f3308c4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.18
|
Security for villa 0.8.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.