mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2025-07-19 12:03:37 +00:00
fix
This commit is contained in:
@@ -1,10 +1,10 @@
|
|||||||
import { OB11Message } from "@/onebot";
|
import { NapCatOneBot11Adapter, OB11Message } from "@/onebot";
|
||||||
|
import SendGroupMsg from "@/onebot/action/group/SendGroupMsg";
|
||||||
import { NapCatCore } from "..";
|
import { NapCatCore } from "..";
|
||||||
import { ActionMap } from "@/onebot/action";
|
|
||||||
|
|
||||||
export const plugin_onmessage = async (adapter: string, core: NapCatCore, action: ActionMap, message: OB11Message) => {
|
export const plugin_onmessage = async (adapter: string, core: NapCatCore, obCore: NapCatOneBot11Adapter, message: OB11Message) => {
|
||||||
if (message.raw_message === 'ping') {
|
if (message.raw_message === 'ping') {
|
||||||
const ret = await action.get('send_group_msg')?.handle({ group_id: message.group_id, message: 'pong' }, adapter);
|
const ret = await new SendGroupMsg(obCore, core).handle({ group_id: String(message.group_id), message: 'pong' }, adapter);
|
||||||
console.log(ret);
|
console.log(ret);
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -111,7 +111,7 @@ export class NapCatOneBot11Adapter {
|
|||||||
|
|
||||||
// 注册Plugin
|
// 注册Plugin
|
||||||
this.networkManager.registerAdapter(
|
this.networkManager.registerAdapter(
|
||||||
new OB11PluginAdapter('plugin', this.core, this.actions)
|
new OB11PluginAdapter('plugin', this.core, this,this.actions)
|
||||||
);
|
);
|
||||||
for (const key of ob11Config.network.httpServers) {
|
for (const key of ob11Config.network.httpServers) {
|
||||||
if (key.enable) {
|
if (key.enable) {
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
import { IOB11NetworkAdapter, OB11EmitEventContent, OB11NetworkReloadType } from './index';
|
import { IOB11NetworkAdapter, OB11EmitEventContent, OB11NetworkReloadType } from './index';
|
||||||
import { OB11Message } from '@/onebot';
|
import { NapCatOneBot11Adapter, OB11Message } from '@/onebot';
|
||||||
import { NapCatCore } from '@/core';
|
import { NapCatCore } from '@/core';
|
||||||
import { ActionMap } from '../action';
|
import { ActionMap } from '../action';
|
||||||
import { AdapterConfig } from '../config/config';
|
import { AdapterConfig } from '../config/config';
|
||||||
@@ -12,6 +12,7 @@ export class OB11PluginAdapter implements IOB11NetworkAdapter {
|
|||||||
constructor(
|
constructor(
|
||||||
public name: string,
|
public name: string,
|
||||||
public core: NapCatCore,
|
public core: NapCatCore,
|
||||||
|
public obCore: NapCatOneBot11Adapter,
|
||||||
public actions: ActionMap,
|
public actions: ActionMap,
|
||||||
) {
|
) {
|
||||||
// 基础配置
|
// 基础配置
|
||||||
@@ -26,7 +27,7 @@ export class OB11PluginAdapter implements IOB11NetworkAdapter {
|
|||||||
|
|
||||||
onEvent<T extends OB11EmitEventContent>(event: T) {
|
onEvent<T extends OB11EmitEventContent>(event: T) {
|
||||||
if (event.post_type === 'message') {
|
if (event.post_type === 'message') {
|
||||||
plugin_onmessage(this.config.name, this.core, this.actions, event as OB11Message).then().catch();
|
plugin_onmessage(this.config.name, this.core, this.obCore, event as OB11Message).then().catch();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user