We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8326578 commit 2ea5bf1Copy full SHA for 2ea5bf1
Tools/BiblioTech/Options/CommandContext.cs
@@ -51,12 +51,19 @@ await Command.ModifyOriginalResponseAsync(m =>
51
52
public async Task SendFile(string fileContent)
53
{
54
- using var stream = new MemoryStream();
55
- using var writer = new StreamWriter(stream);
+ var stream = new MemoryStream();
+ var writer = new StreamWriter(stream);
56
writer.Write(fileContent);
57
- stream.Position = 0;
58
59
await Command.RespondWithFileAsync(stream, "CheckFile.txt", ephemeral: true);
+
60
+ // Detached task for cleaning up the stream resources.
61
+ _ = Task.Run(() =>
62
+ {
63
+ Thread.Sleep(TimeSpan.FromSeconds(30));
64
+ writer.Dispose();
65
+ stream.Dispose();
66
+ });
67
}
68
69
private string FormatChunk(string[] chunk)
0 commit comments