Ejemplo n.º 1
0
 public static async Task <VoiceMessage> UploadVoiceAsync(UploadTarget target, string path)
 {                                                       // Mirai-CSharp 的根据路径上传忘了释放创建的流
     using FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read);
     return(await session.UploadVoiceAsync(target, fs)); // 直接返回 Task 会导致流提前释放
 }