Skip to content

Commit

Permalink
Implement IDisposable for FileAttachment in WordleModule
Browse files Browse the repository at this point in the history
This change ensures that the FileAttachment object in the WordleModule.cs is properly disposed following its use. This enhancement is made by utilizing the 'using' keyword to automatically manage resources, thus reducing the likelihood of memory leaks.
  • Loading branch information
EpicOfficer committed Apr 10, 2024
1 parent 918d0a6 commit f3ef7b2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Blink3.Bot/Modules/WordleModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ await RespondErrorAsync("No game in progress",

using MemoryStream image = new();
await wordleGameService.GenerateImageAsync(guess, image);
FileAttachment attachment = new(image, $"{guess.Word}.png");
using FileAttachment attachment = new(image, $"{guess.Word}.png");

ComponentBuilder? component = new ComponentBuilder().WithButton("Define", $"blink-define-word_{guess.Word}");

Expand Down

0 comments on commit f3ef7b2

Please sign in to comment.