-
Notifications
You must be signed in to change notification settings - Fork 17
Open
Description
我希望借助使用 koishi + koishi-plugin-adapter-onebot 来迭代已有的聊天机器人项目,因此我按照 koishi 的官方文档:https://github.com/koishijs/docs/blob/main/zh-CN/manual/starter/direct.md 进行配置。但是按照教程配置完成之后,发现 OneBotBot
类没有被有效的实例化,也没有调用 ctx.server
来创建 onebot 路由,导致最终请求 404。
我的现有的代码如下:
import server from "@koishijs/plugin-server"
import { Context } from "koishi"
import OneBotAdapter from "koishi-plugin-adapter-onebot"
import { qqBotConfig } from "../config"
const ctx = new Context()
ctx.plugin(server, {
port: 3001,
host: "0.0.0.0",
}) // 提供后端服务
ctx.plugin(OneBotAdapter, {
protocol: "http",
selfId: qqBotConfig.botQQ,
path: "/onebot",
endpoint: "localhost:3000",
})
export function getKoishiCtx() {
return ctx
}
Metadata
Metadata
Assignees
Labels
No labels