Conversation
This commit resolves the `KeyNotFoundException` encountered during the scheduled free game collection process. The issue was caused by an attempt to access a non-existent key in the bot dictionary, as reported in issue #70. Changes include: - Added a check in `ASFFreeGamesPlugin.cs` to ensure there are viable bots before proceeding with the free game collection command. - Modified `FreeGamesCommand.cs` to handle bot collections more robustly, trimming bot names to prevent whitespace issues and using `GetValueOrDefault` to avoid exceptions when a bot name is not found. - Updated the `HandleInternalCollectCommand` method to return a more informative response, indicating the number of collected games and the bots involved in the operation. These updates aim to enhance the stability and reliability of the free game collection feature in ASF.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
This pull request addresses the
KeyNotFoundExceptionduring the scheduled free game collection process and implements enhancements to bot handling. The changes are a direct response to the issue reported in #70.Changes
GetValueOrDefaultfor safer retrieval of bot instances, thereby avoiding potential exceptions.HandleInternalCollectCommandmethod now provides a more detailed response, clearly stating the total number of games collected and enumerating the bots that participated in the operation.Impact
These improvements are expected to significantly increase the stability and reliability of the free game collection feature within ASF, ensuring smoother operations and better user experience.
Additional Notes