@@ -105,14 +105,15 @@ export abstract class OneBotWsBase extends OneBotCore {
105105 timeout : number = this . _options . timeout
106106 ) : Promise < OneBotApi [ T ] [ 'response' ] > {
107107 const echo = ( ++ this . echo ) . toString ( )
108- const request = JSON . stringify ( { echo, action, params } )
108+ const realAction = this . _formatAction ( action )
109+ const request = JSON . stringify ( { echo, action : realAction , params } )
109110
110111 return new Promise ( ( resolve , reject ) => {
111112 const timeoutId = setTimeout ( ( ) => {
112- reject ( this . _formatApiError ( action , request , '请求超时' ) )
113+ reject ( this . _formatApiError ( realAction , request , '请求超时' ) )
113114 } , timeout * 1000 )
114115
115- this . emit ( OneBotEventKey . SEND_API , { echo, action, params, request } )
116+ this . emit ( OneBotEventKey . SEND_API , { echo, action : realAction , params, request } )
116117 this . _socket . send ( request )
117118 this . once ( `echo:${ echo } ` , data => {
118119 /** 停止监听器 */
@@ -121,10 +122,10 @@ export abstract class OneBotWsBase extends OneBotCore {
121122 if ( data . status === 'ok' ) {
122123 resolve ( data . data as OneBotApi [ T ] [ 'response' ] )
123124 } else {
124- reject ( this . _formatApiError ( action , request , data ) )
125+ reject ( this . _formatApiError ( realAction , request , data ) )
125126 }
126127
127- this . emit ( OneBotEventKey . RESPONSE , { echo, action, params, request, data } )
128+ this . emit ( OneBotEventKey . RESPONSE , { echo, action : realAction , params, request, data } )
128129 } )
129130 } )
130131 }
0 commit comments