[Fix] Don't dispose streams in DefaultRestClient (#2652)
* Duplicate file streams before sending * Other code needs to dispose their objects * Another resource to dispose * Stop disposing and copying streams in SendAsync * Fix inverted boolean check Co-authored-by: Dmitry <dimson-n@users.noreply.github.com> * Await results for using statement to work --------- Co-authored-by: Dmitry <dimson-n@users.noreply.github.com>
This commit is contained in:
@@ -1558,11 +1558,11 @@ namespace Discord.WebSocket
|
||||
/// <returns>
|
||||
/// A task that represents the asynchronous creation operation. The task result contains the created sticker.
|
||||
/// </returns>
|
||||
public Task<SocketCustomSticker> CreateStickerAsync(string name, string path, IEnumerable<string> tags, string description = null,
|
||||
public async Task<SocketCustomSticker> CreateStickerAsync(string name, string path, IEnumerable<string> tags, string description = null,
|
||||
RequestOptions options = null)
|
||||
{
|
||||
var fs = File.OpenRead(path);
|
||||
return CreateStickerAsync(name, fs, Path.GetFileName(fs.Name), tags, description, options);
|
||||
using var fs = File.OpenRead(path);
|
||||
return await CreateStickerAsync(name, fs, Path.GetFileName(fs.Name), tags, description, options);
|
||||
}
|
||||
/// <summary>
|
||||
/// Creates a new sticker in this guild
|
||||
|
||||
Reference in New Issue
Block a user