fix: 修复错误事件类型

This commit is contained in:
ningmengchongshui 2024-06-12 22:36:08 +08:00
parent d3c6a0048b
commit 14a23d5bf2
2 changed files with 68 additions and 13 deletions

View File

@ -72,11 +72,23 @@ export class Plugin {
name: PluginSuperType['name'] = 'your-plugin'
dsc: PluginSuperType['dsc'] = '无'
task: PluginSuperType['task'] = null
/**
*
*/
rule: PluginSuperType['rule'] = []
/**
*
*/
event: PluginSuperType['event'] = 'message'
/**
*
*/
priority: PluginSuperType['priority'] = 9999
namespace: PluginSuperType['namespace'] = null
handler: PluginSuperType['handler'] = null
/**
*
*/
e: EventType
/**
@ -159,7 +171,7 @@ export class Plugin {
* @returns
*/
conKey(isGroup = false) {
if (isGroup) {
if (isGroup && this.e.isGroup) {
return `${this.name}.${this.group_id || this.groupId || this.e.group_id}`
} else {
return `${this.name}.${this.user_id || this.userId || this.e.user_id}`

View File

@ -1,31 +1,74 @@
import { type GroupMessage } from 'icqq'
import { type GroupMessage, Client } from 'icqq'
import { PrivateMessage } from 'oicq'
/**
*
*/
export interface EventType extends GroupMessage {
interface EventTypeBase {
/**
*
*/
isMaster: boolean
isMaster: boolean;
/**
*
*
*/
group: {
recallMsg: (...arg) => any
}
isGroup: boolean;
/**
*
*/
msg: string
msg: string;
/**
*
* @param arg
* @returns
*/
reply: (...arg) => Promise<any>
reply: (...arg: any[]) => Promise<any>;
/**
* @deprecated
*/
file: any;
/**
* @deprecated
*/
bot: typeof Client.prototype;
/**
*
*/
approve: any;
/**
*
*/
member: any;
/**
*
*/
logText: any;
}
interface EventTypeGroup extends EventTypeBase, GroupMessage {
isGroup: true;
/**
*
*/
group_id: number;
/**
* @deprecated
*/
group: {
is_owner: any;
recallMsg: (...arg: any[]) => any;
getMemberMap: any;
quit: any;
};
/**
*
*/
atBot: any;
}
interface EventTypePrivate extends EventTypeBase, PrivateMessage {
isGroup: false;
}
export type EventType = EventTypeGroup | EventTypePrivate;
/**
*
*/