Close filestream in SendFile(filePath) after sending
This commit is contained in:
@@ -357,8 +357,11 @@ namespace Discord
|
|||||||
return msg;
|
return msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task<Message> SendFile(string filePath)
|
public async Task<Message> SendFile(string filePath)
|
||||||
=> SendFile(Path.GetFileName(filePath), File.OpenRead(filePath));
|
{
|
||||||
|
using (var stream = File.OpenRead(filePath))
|
||||||
|
return await SendFile(Path.GetFileName(filePath), stream);
|
||||||
|
}
|
||||||
public async Task<Message> SendFile(string filename, Stream stream)
|
public async Task<Message> SendFile(string filename, Stream stream)
|
||||||
{
|
{
|
||||||
if (filename == null) throw new ArgumentNullException(nameof(filename));
|
if (filename == null) throw new ArgumentNullException(nameof(filename));
|
||||||
|
|||||||
Reference in New Issue
Block a user