fix: 修复错误事件类型
This commit is contained in:
		
							parent
							
								
									d3c6a0048b
								
							
						
					
					
						commit
						14a23d5bf2
					
				|  | @ -72,11 +72,23 @@ export class Plugin { | ||||||
|   name: PluginSuperType['name'] = 'your-plugin' |   name: PluginSuperType['name'] = 'your-plugin' | ||||||
|   dsc: PluginSuperType['dsc'] = '无' |   dsc: PluginSuperType['dsc'] = '无' | ||||||
|   task: PluginSuperType['task'] = null |   task: PluginSuperType['task'] = null | ||||||
|  |   /** | ||||||
|  |    * 指令集 | ||||||
|  |    */ | ||||||
|   rule: PluginSuperType['rule'] = [] |   rule: PluginSuperType['rule'] = [] | ||||||
|  |   /** | ||||||
|  |    * 事件 | ||||||
|  |    */ | ||||||
|   event: PluginSuperType['event'] = 'message' |   event: PluginSuperType['event'] = 'message' | ||||||
|  |   /** | ||||||
|  |    * 优先级 | ||||||
|  |    */ | ||||||
|   priority: PluginSuperType['priority'] = 9999 |   priority: PluginSuperType['priority'] = 9999 | ||||||
|   namespace: PluginSuperType['namespace'] = null |   namespace: PluginSuperType['namespace'] = null | ||||||
|   handler: PluginSuperType['handler'] = null |   handler: PluginSuperType['handler'] = null | ||||||
|  |   /** | ||||||
|  |    * 事件 | ||||||
|  |    */ | ||||||
|   e: EventType |   e: EventType | ||||||
| 
 | 
 | ||||||
|   /** |   /** | ||||||
|  | @ -159,7 +171,7 @@ export class Plugin { | ||||||
|    * @returns |    * @returns | ||||||
|    */ |    */ | ||||||
|   conKey(isGroup = false) { |   conKey(isGroup = false) { | ||||||
|     if (isGroup) { |     if (isGroup && this.e.isGroup) { | ||||||
|       return `${this.name}.${this.group_id || this.groupId || this.e.group_id}` |       return `${this.name}.${this.group_id || this.groupId || this.e.group_id}` | ||||||
|     } else { |     } else { | ||||||
|       return `${this.name}.${this.user_id || this.userId || this.e.user_id}` |       return `${this.name}.${this.user_id || this.userId || this.e.user_id}` | ||||||
|  |  | ||||||
|  | @ -1,31 +1,74 @@ | ||||||
| import { type GroupMessage } from 'icqq' | import { type GroupMessage, Client } from 'icqq' | ||||||
|  | import { PrivateMessage } from 'oicq' | ||||||
| 
 | 
 | ||||||
| /** | interface EventTypeBase { | ||||||
|  * 机器人事件类型 |  | ||||||
|  */ |  | ||||||
| export interface EventType extends GroupMessage { |  | ||||||
|   /** |   /** | ||||||
|    * 是否是主人 |    * 是否是主人 | ||||||
|    */ |    */ | ||||||
|   isMaster: boolean |   isMaster: boolean; | ||||||
|   /** |   /** | ||||||
|    * 群聊 |    * 是否是群里 | ||||||
|    */ |    */ | ||||||
|   group: { |   isGroup: boolean; | ||||||
|     recallMsg: (...arg) => any |  | ||||||
|   } |  | ||||||
|   /** |   /** | ||||||
|    * 用户消息 |    * 用户消息 | ||||||
|    */ |    */ | ||||||
|   msg: string |   msg: string; | ||||||
|   /** |   /** | ||||||
|    * 消息发送 |    * 消息发送 | ||||||
|    * @param arg |    * @param arg | ||||||
|    * @returns |    * @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; | ||||||
|  | 
 | ||||||
| /** | /** | ||||||
|  * 函数式回调类型 |  * 函数式回调类型 | ||||||
|  */ |  */ | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue