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