@@ -46,7 +46,7 @@ bot.on('socket.connecting', function (wsType, attempts) {
4646 console . log ( new Date ( ) . toLocaleString ( ) + ' 第%d次连接[%s]成功! ( = v =)b' , attempts , wsType ) ;
4747 if ( config . bot . admin > 0 && wsType === '/api' ) {
4848 setTimeout ( ( ) => {
49- console . log ( `APIKey: ${ config . bot . Apikey } \n聊天限制次数: ${ config . bot . PerQQLimit } /QQ\n是否需要@: ${ config . bot . needAt ? '是' : '否' } ` ) ;
49+ console . log ( `APIKey: ${ config . bot . Apikey } \n聊天限制次数: ${ config . bot . PerQQLimit } /QQ\n是否需要@: ${ config . bot . needAt ? '是' : '否' } \ndebug模式: ${ config . bot . debug ? '是' : '否' } ` ) ;
5050 bot ( 'send_private_msg' , {
5151 user_id : config . bot . admin ,
5252 message : `${ config . bot . greet } `
@@ -88,6 +88,8 @@ function GetMsg(e, context) {
8888 Msg . userInfo . groupId = context . group_id ;
8989 } else if ( context . discuss_id ) {
9090 Msg . userInfo . groupId = context . discuss_id ;
91+ } else {
92+ Msg . userInfo . groupId = "" ;
9193 }
9294
9395 Msg . userInfo . userId = context . user_id ;
@@ -96,21 +98,29 @@ function GetMsg(e, context) {
9698 //判断消息类型
9799 if ( isImg ( message ) ) {
98100 Msg . reqType = 1 ;
101+ Msg . perception . inputText . text = "" ;
99102 Msg . perception . inputImage . url = message . substring ( 58 , message . length - 1 ) ;
100103 } else {
101104 Msg . reqType = 0 ;
102105 Msg . perception . inputText . text = message ;
106+ Msg . perception . inputImage . url = "" ;
103107 }
104108
105109 //调用API
106110 Axios . post ( url , Msg
107111 ) . then ( function HandleMsg ( response ) {
108112 var GotMsg ;
113+ //debug模式
114+ if ( config . bot . debug ) {
115+ console . log ( `\n发送消息:` ) ;
116+ console . log ( Msg ) ;
117+ console . log ( `接收消息:` ) ;
118+ console . log ( response . data . results ) ;
119+ }
109120 if ( response . data . results . length == 1 ) {
110121 GotMsg = response . data . results [ 0 ] . values . text ;
111122 } else {
112123 GotMsg = `${ response . data . results [ 1 ] . values . text } \n${ response . data . results [ 0 ] . values . url } ` ;
113- Msg . perception . inputImage = '' ; //清空图片URL
114124 }
115125 SendMsg ( context , GotMsg ) ;
116126 } ) ;
@@ -134,7 +144,6 @@ function SendMsg(context, SendMsg) {
134144 message : msg ,
135145 } ) ;
136146 console . log ( `${ new Date ( ) . toLocaleString ( ) } 回复${ gd } 群, ${ user } 者:\n${ SendMsg } ` ) ;
137- Msg . userInfo . groupId = '' ; //清空群组信息
138147 } else if ( context . discuss_id ) {
139148 var msg = `[CQ:at,qq=${ id } ]${ SendMsg } ` ;
140149 var gd = context . discuss_id ;
@@ -143,7 +152,6 @@ function SendMsg(context, SendMsg) {
143152 message : msg ,
144153 } ) ;
145154 console . log ( `${ new Date ( ) . toLocaleString ( ) } 回复${ gd } 讨论组, ${ user } 者:\n${ SendMsg } ` ) ;
146- Msg . userInfo . groupId = '' ; //清空群组信息
147155 } else {
148156 bot ( 'send_private_msg' , {
149157 user_id : context . user_id ,
0 commit comments