安装

安装 NoneBot OneBot 适配器

nb adapter install nonebot-adapter-onebot

或者使用 pip

pip install nonebot-adapter-onebot

加载适配器

OneBot V11

bot.py
import nonebot
from nonebot.adapters.onebot.v11 import Adapter

nonebot.init()

driver = nonebot.get_driver()
driver.register_adapter(Adapter)

OneBot V12

bot.py
import nonebot
from nonebot.adapters.onebot.v12 import Adapter

nonebot.init()

driver = nonebot.get_driver()
driver.register_adapter(Adapter)