Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
MliKiowa committed Dec 12, 2024
1 parent f300538 commit f21cee2
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/develop/plugin.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,18 @@ obCore.apis.MsgApi.createSendElements()
// 调用 NapCat OneBot Api 用于创建消息
```

前两种方法比较常用,obCore.apis 主要用于 OB->NT 消息内容转换,实际内容不多。
前两种方法比较常用,obCore.apis 主要用于 OB->NT 消息内容转换,实际内容不多。

下面为 发送ping 回应ping 的群消息示例 `/src/plugin/index.ts`
```typescript
import { NapCatOneBot11Adapter, OB11Message } from "@/onebot";
import SendGroupMsg from "@/onebot/action/group/SendGroupMsg";
import { NapCatCore } from "../core";
export const plugin_onmessage = async (adapter: string, core: NapCatCore, obCore: NapCatOneBot11Adapter, message: OB11Message) => {
if (message.raw_message === 'ping') {
const ret = await new SendGroupMsg(obCore, core).handle({ group_id: String(message.group_id), message: 'pong' }, adapter);
console.log(ret);
}
}
```

0 comments on commit f21cee2

Please sign in to comment.