Closed jonathan-f-gomez closed 1 year ago
If anyone has problems with this in the future. I had to create a class that derives from Block and add 2 properties that don't exist in the base class, then specify the Block.Type as "file".
public class FileBlock : Block
{
public string? source { get; set; }
public string? file_id { get; set; }
}
private static async Task AddFileBlock()
{
var path = "C:\\Text_Files\\Debug.txt";
var channels = new string[] { "#random" };
var fileResponse = await MyClient.UploadFileAsync(System.IO.File.ReadAllBytes(path), "Debug.txt", channels);
var block = new FileBlock();
block.type = "file";
block.source = "remote";
block.file_id = fileResponse.file.id;
Blocks.Add(block);
}
I have been trying to attach a simple text file a message and I cant get it to work properly. Is there an examples available that can show me how to attach these types of files?