So basically I'm trying to get the image's bytes from an URL. This seems to work, now I need to convert it to stream so I can send it through Discord.
using (var httpClient = new HttpClient())
{
var imageContent = await httpClient.GetByteArrayAsync(response.Url);
using (var imageBuffer = new MemoryStream(imageContent))
{
await new DiscordMessageBuilder().AddFile("image.png", imageBuffer, false).SendAsync(commandContext.Channel);
}
}
But this throw me the follow exception when trying new MemoryStream(imageContent);
System.InvalidOperationException: Timeouts are not supported on this stream. at System.IO.Stream.get_ReadTimeout();
Any idea? Also, it seems the AddFiles method only accepts FileStream, can I send it a Stream without having the file itself saved on my storage?
