mirror of
https://github.com/logos-storage/logos-storage-nim-cs-dist-tests.git
synced 2026-01-10 17:33:13 +00:00
attempt to fix discord file sending
This commit is contained in:
parent
8326578006
commit
2ea5bf1c5d
@ -51,12 +51,19 @@ namespace BiblioTech.Options
|
||||
|
||||
public async Task SendFile(string fileContent)
|
||||
{
|
||||
using var stream = new MemoryStream();
|
||||
using var writer = new StreamWriter(stream);
|
||||
var stream = new MemoryStream();
|
||||
var writer = new StreamWriter(stream);
|
||||
writer.Write(fileContent);
|
||||
stream.Position = 0;
|
||||
|
||||
await Command.RespondWithFileAsync(stream, "CheckFile.txt", ephemeral: true);
|
||||
|
||||
// Detached task for cleaning up the stream resources.
|
||||
_ = Task.Run(() =>
|
||||
{
|
||||
Thread.Sleep(TimeSpan.FromSeconds(30));
|
||||
writer.Dispose();
|
||||
stream.Dispose();
|
||||
});
|
||||
}
|
||||
|
||||
private string FormatChunk(string[] chunk)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user