| 
														
															@@ -1,4 +1,4 @@ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-import { App, Bot, segment, Session } from 'koishi'; 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+import { App, Bot, segment, Session, sleep } from 'koishi'; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import 'koishi-adapter-onebot'; 
														 | 
														
														 | 
														
															 import 'koishi-adapter-onebot'; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import { parseCmd, query, view } from './command'; 
														 | 
														
														 | 
														
															 import { parseCmd, query, view } from './command'; 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -28,7 +28,7 @@ export const Message = { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															   ellipseBase64: (msg: string) => msg.replace(/(?<=\[CQ:.*base64:\/\/).*?(,|\])/g, '...$1'), 
														 | 
														
														 | 
														
															   ellipseBase64: (msg: string) => msg.replace(/(?<=\[CQ:.*base64:\/\/).*?(,|\])/g, '...$1'), 
														 | 
													
												
											
												
													
														| 
														 | 
														
															   separateAttachment: (msg: string) => { 
														 | 
														
														 | 
														
															   separateAttachment: (msg: string) => { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     const attachments: string[] = []; 
														 | 
														
														 | 
														
															     const attachments: string[] = []; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    const message = msg.replace(/\[CQ:(image|video|record),.*?\]/g, code => { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    const message = msg.replace(/\[CQ:(video|record),.*?\]/g, code => { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															       attachments.push(code); 
														 | 
														
														 | 
														
															       attachments.push(code); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															       return ''; 
														 | 
														
														 | 
														
															       return ''; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     }); 
														 | 
														
														 | 
														
															     }); 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -193,9 +193,20 @@ count 与 since/until 并用时,取二者中实际查询结果较少者 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     }, true); 
														 | 
														
														 | 
														
															     }, true); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															   }; 
														 | 
														
														 | 
														
															   }; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+  private listen = async (logMsg = 'connecting to bot provider...'): Promise<void> => { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    logger.warn(logMsg); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    try { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+      await this.app.start(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    } catch (err) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+      logger.error(`error connecting to bot provider at ${this.app.options.server}, will retry in 2.5s...`); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+      await sleep(2500); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+      await this.listen('retry connecting...'); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+  }; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															   public connect = async () => { 
														 | 
														
														 | 
														
															   public connect = async () => { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     this.initBot(); 
														 | 
														
														 | 
														
															     this.initBot(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    await this.app.start(); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    await this.listen(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     this.bot = this.app.getBot('onebot'); 
														 | 
														
														 | 
														
															     this.bot = this.app.getBot('onebot'); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															   }; 
														 | 
														
														 | 
														
															   }; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 |