commit
						ab08ea8775
					
				|  | @ -213,8 +213,12 @@ class PluginsLoader { | ||||||
|         ...plugin.getContext(false, true), |         ...plugin.getContext(false, true), | ||||||
|       } |       } | ||||||
|       if (!lodash.isEmpty(context)) { |       if (!lodash.isEmpty(context)) { | ||||||
|         for (const fnc in context) |         let ret | ||||||
|           plugin[fnc](context[fnc]) |         for (const fnc in context) { | ||||||
|  |           ret ||= await plugin[fnc](context[fnc]) | ||||||
|  |         } | ||||||
|  |         // 返回continue时,继续响应后续插件
 | ||||||
|  |         if (ret === 'continue') continue | ||||||
|         return |         return | ||||||
|       } |       } | ||||||
|     } |     } | ||||||
|  | @ -250,8 +254,7 @@ class PluginsLoader { | ||||||
|       if (plugin.rule) for (const v of plugin.rule) { |       if (plugin.rule) for (const v of plugin.rule) { | ||||||
|         /** 判断事件 */ |         /** 判断事件 */ | ||||||
|         if (v.event && !this.filtEvent(e, v)) continue |         if (v.event && !this.filtEvent(e, v)) continue | ||||||
|         /** 加入多行匹配符号 */ |         if (!new RegExp(v.reg).test(e.msg)) continue | ||||||
|         if (!new RegExp(v.reg, 'sg').test(e.msg)) continue |  | ||||||
|         e.logFnc = `[${plugin.name}][${v.fnc}]` |         e.logFnc = `[${plugin.name}][${v.fnc}]` | ||||||
| 
 | 
 | ||||||
|         if (v.log !== false) |         if (v.log !== false) | ||||||
|  |  | ||||||
|  | @ -83,15 +83,16 @@ export default class plugin { | ||||||
|    * @param type 执行方法 |    * @param type 执行方法 | ||||||
|    * @param isGroup 是否群聊 |    * @param isGroup 是否群聊 | ||||||
|    * @param time 操作时间,默认120秒 |    * @param time 操作时间,默认120秒 | ||||||
|  |    * @param reply 超时时回复的内容,false则不回复 | ||||||
|    */ |    */ | ||||||
|   setContext(type, isGroup, time = 120) { |   setContext(type, isGroup, time = 120, reply = "操作超时已取消") { | ||||||
|     const key = this.conKey(isGroup) |     const key = this.conKey(isGroup) | ||||||
|     if (!stateArr[key]) stateArr[key] = {} |     if (!stateArr[key]) stateArr[key] = {} | ||||||
|     stateArr[key][type] = this.e |     stateArr[key][type] = this.e | ||||||
|     if (time) stateArr[key][type].timeout = setTimeout(() => { |     if (time) stateArr[key][type].timeout = setTimeout(() => { | ||||||
|       if (stateArr[key][type]) { |       if (stateArr[key][type]) { | ||||||
|         delete stateArr[key][type] |         delete stateArr[key][type] | ||||||
|         this.reply("操作超时已取消", true) |         this.reply(reply, true) | ||||||
|       } |       } | ||||||
|     }, time * 1000) |     }, time * 1000) | ||||||
|   } |   } | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue