Skip to main content

米游社大别野Bot Python SDK。MiHoYo Villa Bot Python SDK.

Project description

Villa

✨ 米游社大别野Bot Python SDK ✨

version python license

特性

  • 基于FastAPIPydantic,异步、快速、高性能!
  • 完整的类型注解支持
  • 便捷的消息构造和发送方法
  • 丰富的消息段和完整的API支持
  • 想不出来了

安装

  • 使用pip: pip install villa
  • 使用poetry: poetry add villa
  • 使用pdm: pdm add villa

快速开始

首先你需要一个米游社大别野的Bot,如果没有请先到机器人开发者社区(别野ID: OpenVilla)申请,取得bot_idbot_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,感谢支持!

也欢迎来我的大别野【尘世闲游】进行交流~

相关项目

推荐有成熟Python开发经验但对NoneBot2不熟悉的小伙伴选择本SDK

对NoneBot2熟悉或希望接触更成熟的生态的小伙伴选择NoneBot2+Villa适配器进行开发。

Project details


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.2.tar.gz (19.1 kB view details)

Uploaded Source

Built Distribution

villa-0.1.2-py3-none-any.whl (20.6 kB view details)

Uploaded Python 3

File details

Details for the file villa-0.1.2.tar.gz.

File metadata

  • Download URL: villa-0.1.2.tar.gz
  • Upload date:
  • Size: 19.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.17

File hashes

Hashes for villa-0.1.2.tar.gz
Algorithm Hash digest
SHA256 f15a4f9d3156bad996d0961edb2a36b8b372d265bc29319cd521f8671458abc5
MD5 8875028acd7e5442b0f5cb302df9794e
BLAKE2b-256 0ea6444cd5df5b1ed775cf6a31187fc4dca8c77abb3768abf4b2f9d32d13de2c

See more details on using hashes here.

File details

Details for the file villa-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: villa-0.1.2-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

Hashes for villa-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 3e69a1ff80d7bf36d782d169c3f2c29edd61cd215380cfd7e64c49bd260d72bc
MD5 03a9b5182d5e2aef2d21442cb2384658
BLAKE2b-256 6c7a97ace558862b3090024b53234da8adbdc116c5a2cdfda69674915cffc5e4

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page