pip install hyper-bot开发环境使用 uv:
git clone <repo-url>
cd HyperBotCore
uv syncHypeR Core 支持 OneBot v11 与 Milky 两种协议,通过 config.json 的 protocol 字段切换。
-
创建
config.json(详见配置文件);使用 Milky 协议则创建milky_config.json并调用hyperot.init("milky_config.json") -
编写机器人:
import asyncio
import hyperot
hyperot.init() # 加载配置、初始化适配器
from hyperot import Client
from hyperot.events import GroupMessageEvent
async def handler(event, actions):
if str(event.message) == ".ping":
await actions.send_msg(
f"pong! HypeR Core {hyperot.HYPER_BOT_VERSION}",
group_id=event.group_id,
user_id=event.user_id
)
with Client() as cli:
cli.subscribe(handler, GroupMessageEvent)
asyncio.get_event_loop().run_until_complete(cli.run())- 启动协议端实现,再运行你的 bot 脚本。