Skip to content

Commit f21cee2

Browse files
committed
fix
1 parent f300538 commit f21cee2

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

src/develop/plugin.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,18 @@ obCore.apis.MsgApi.createSendElements()
3434
// 调用 NapCat OneBot Api 用于创建消息
3535
```
3636

37-
前两种方法比较常用,obCore.apis 主要用于 OB->NT 消息内容转换,实际内容不多。
37+
前两种方法比较常用,obCore.apis 主要用于 OB->NT 消息内容转换,实际内容不多。
38+
39+
下面为 发送ping 回应ping 的群消息示例 `/src/plugin/index.ts`
40+
```typescript
41+
import { NapCatOneBot11Adapter, OB11Message } from "@/onebot";
42+
import SendGroupMsg from "@/onebot/action/group/SendGroupMsg";
43+
import { NapCatCore } from "../core";
44+
45+
export const plugin_onmessage = async (adapter: string, core: NapCatCore, obCore: NapCatOneBot11Adapter, message: OB11Message) => {
46+
if (message.raw_message === 'ping') {
47+
const ret = await new SendGroupMsg(obCore, core).handle({ group_id: String(message.group_id), message: 'pong' }, adapter);
48+
console.log(ret);
49+
}
50+
}
51+
```

0 commit comments

Comments
 (0)