Files
HeXi/bot.py
T
sansenhoshiandClaude b61d09f09f Add HeXi bot codebase: custom plugins, web frontends, tests
- hexi core: message handling, rate limiting, cooldown, plugin manager
- Custom plugins: BF stats, daily check-in, quotes, persona cards, etc.
- Community plugins vendored under hexi/plugins with local fixes
- Web admin frontends (learning-chat, persona-admin), unified hexi/web
- Tests for rate_limit/cooldown/memes/persona; poetry.lock

Co-Authored-By: Claude <noreply@anthropic.com>
2026-09-01 13:13:40 +08:00

34 lines
903 B
Python

import nonebot
from nonebot.adapters.onebot.v11 import Adapter as ONEBOTV11Adapter
from nonebot.log import logger
from sqlalchemy import StaticPool
from starlette.middleware.cors import CORSMiddleware
# 初始化 NoneBot 以及 数据库
nonebot.init(datastore_engine_options={"poolclass": StaticPool})
# 获取应用和驱动实例
app = nonebot.get_app()
app.add_middleware(
CORSMiddleware,
allow_origins=[
"http://localhost:5173",
"http://192.168.2.186:5173",
"http://127.0.0.1:5173"
],
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
driver = nonebot.get_driver()
# 注册适配器
driver.register_adapter(ONEBOTV11Adapter)
# 加载插件
nonebot.load_plugins("hexi")
nonebot.load_from_toml("pyproject.toml")
if __name__ == "__main__":
logger.warning("hexi?启动!")
nonebot.run() # 直接运行,不需要传参