@@ -20,7 +20,8 @@ export class ChatGPTBot {
20
20
return this . cache . get ( email ) ;
21
21
}
22
22
const cmd = `poetry run python3 src/generate_session.py ${ email } ${ password } ` ;
23
- const { stdout, stderr, exitCode } = await execa ( `sh` , [ "-c" , cmd ] ) ;
23
+ const platform = process . platform ;
24
+ const { stdout, stderr, exitCode } = await execa ( platform === "win32" ?"powershell" :"sh" , [ platform === "win32" ?"/c" :"-c" , cmd ] ) ;
24
25
if ( exitCode !== 0 ) {
25
26
console . error ( stderr ) ;
26
27
return "" ;
@@ -102,7 +103,7 @@ export class ChatGPTBot {
102
103
async getGPTMessage ( text : string , talkerId : string ) : Promise < string > {
103
104
const conversation = this . getConversation ( talkerId ) ;
104
105
try {
105
- return await conversation . sendMessage ( text ) ;
106
+ return await conversation . sendMessage ( text , { timeoutMs : 2 * 60 * 1000 } ) ;
106
107
} catch ( e ) {
107
108
this . resetConversation ( talkerId ) ;
108
109
console . error ( e ) ;
@@ -127,7 +128,15 @@ export class ChatGPTBot {
127
128
}
128
129
async onMessage ( message : Message ) {
129
130
const talker = message . talker ( ) ;
130
- if ( talker . self ( ) || message . type ( ) > 10 || talker . name ( ) == "微信团队" ) {
131
+ if ( talker . self ( )
132
+ || message . type ( ) > 10
133
+ || talker . name ( ) == "微信团队"
134
+ // 语音(视频)消息
135
+ || message . text ( ) . includes ( "收到一条视频/语音聊天消息,请在手机上查看" )
136
+ // 红包消息
137
+ || message . text ( ) . includes ( "收到红包,请在手机上查看" )
138
+ // 位置消息
139
+ || message . text ( ) . includes ( "/cgi-bin/mmwebwx-bin/webwxgetpubliclinkimg" ) ) {
131
140
return ;
132
141
}
133
142
const text = message . text ( ) ;
0 commit comments