Skip to main content

大别野「黑塔」Python SDK

Project description

Herta-villa-SDK

license pypi python version Ruff

大别野「黑塔」Python SDK

特性

  • aiohttp 客户端+服务端,完整异步支持
  • 完整类型注解支持
  • ...

安装

pip install herta-villa-sdk

快速开始

你需要拥有一个大别野机器人。可前往大别野「机器人开发者社区」OpenVilla)申请。

from hertavilla import MessageChain, SendMessageEvent, VillaBot, run

bot = VillaBot(
    "bot_id",  # 这里填写 bot_id
    "bot_secret",  # 这里填写 secret
    "/",  # bot 回调 endpoint
)


@bot.startswith("/")  # 注册一个消息匹配器,匹配前缀为 / 的消息
async def _(event: SendMessageEvent, bot: VillaBot):
    message = event.message
    if str(message[1]) == "/hello":
        chain = MessageChain()
        chain.append("world")
        await bot.send(event.villa_id, event.room_id, chain)


run(bot)  # 运行 bot

可以向你的 bot 发送 @Bot /hello,bot 会回复 world

示例

详见 examples 文件夹

Bug 反馈及建议

大别野 Bot 和 Herta SDK 均处于开发状态中,如遇到问题或有相关建议可通过 Issue 提出,感谢支持!

相关项目

交流

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

herta_villa_sdk-0.3.2.tar.gz (15.1 kB view details)

Uploaded Source

Built Distribution

herta_villa_sdk-0.3.2-py3-none-any.whl (18.6 kB view details)

Uploaded Python 3

File details

Details for the file herta_villa_sdk-0.3.2.tar.gz.

File metadata

  • Download URL: herta_villa_sdk-0.3.2.tar.gz
  • Upload date:
  • Size: 15.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.7.4 CPython/3.10.6

File hashes

Hashes for herta_villa_sdk-0.3.2.tar.gz
Algorithm Hash digest
SHA256 0f29d1743173d62b2e48425aa4899a5dbd19e4f1f9a3bad8015c2c479cb6b2d6
MD5 4f7a831c19968b1fa5c789f167ce0233
BLAKE2b-256 05b8d70ba885cd86315b2a74ee35241e7d9117ba7014afae8f6d87dfc29dddb6

See more details on using hashes here.

File details

Details for the file herta_villa_sdk-0.3.2-py3-none-any.whl.

File metadata

File hashes

Hashes for herta_villa_sdk-0.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 efbcec3bb04f3926cf8c7d51633590032821784f478a6b3b65ef76d323d8dac0
MD5 820c3004683787093e4feb11713839a7
BLAKE2b-256 9b0e61d2ba7a891a8b5579f4a04e8c4a546ffa4df277e0fa8e98c87efc36add5

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