@@ -39,7 +39,7 @@ public async Task<string> GroupFSDownload(long groupUin, string fileId)
3939
4040 public async Task GroupFSDelete ( long groupUin , string fileId ) => await context . EventContext . SendEvent < GroupFSDeleteEventResp > ( new GroupFSDeleteEventReq ( groupUin , fileId ) ) ;
4141
42- public async Task < bool > SendFriendFile ( long targetUin , Stream fileStream , string ? fileName )
42+ public async Task < ( int , DateTime ) > SendFriendFile ( long targetUin , Stream fileStream , string ? fileName )
4343 {
4444 fileName = ResolveFileName ( fileStream , fileName ) ;
4545
@@ -94,15 +94,15 @@ public async Task<bool> SendFriendFile(long targetUin, Stream fileStream, string
9494 } ;
9595
9696 bool success = await context . HighwayContext . UploadFile ( fileStream , 95 , ProtoHelper . Serialize ( ext ) ) ;
97- if ( ! success ) return false ;
97+ if ( ! success ) throw new OperationException ( - 1 , "File upload failed" ) ;
9898 }
9999
100100 int sequence = Random . Shared . Next ( 10000 , 99999 ) ;
101101 uint random = ( uint ) Random . Shared . Next ( ) ;
102102 var sendResult = await context . EventContext . SendEvent < SendMessageEventResp > ( new SendFriendFileEventReq ( friend , request , result , sequence , random ) ) ;
103103 if ( sendResult . Result != 0 ) throw new OperationException ( sendResult . Result ) ;
104104
105- return true ;
105+ return ( sequence , DateTimeOffset . FromUnixTimeSeconds ( sendResult . SendTime ) . UtcDateTime ) ;
106106 }
107107
108108 private static string ResolveFileName ( Stream fileStream , string ? fileName )
0 commit comments