feat: add rating filtering for incoming challenges#1190
Open
farhadzaidi wants to merge 2 commits intolichess-bot-devs:masterfrom
Open
feat: add rating filtering for incoming challenges#1190farhadzaidi wants to merge 2 commits intolichess-bot-devs:masterfrom
farhadzaidi wants to merge 2 commits intolichess-bot-devs:masterfrom
Conversation
60d7287 to
f0e0173
Compare
AttackingOrDefending
approved these changes
Mar 10, 2026
MarkZH
reviewed
Mar 12, 2026
| def is_supported(self, config: Configuration, recent_bot_challenges: defaultdict[str, list[Timer]], | ||
| opponent_engagements: Counter[str], online_block_list: OnlineBlocklist) -> tuple[bool, str]: | ||
| opponent_engagements: Counter[str], online_block_list: OnlineBlocklist, | ||
| user_profile: UserProfileType | None = None) -> tuple[bool, str]: |
Collaborator
There was a problem hiding this comment.
Why is the type annotation UserProfileType | None instead of UserProfileType? Every call to is_supported() has a user_profile parameter.
MarkZH
reviewed
Mar 12, 2026
| or self.decline_due_to(self.is_supported_time_control(config), "timeControl") | ||
| or self.decline_due_to(self.is_supported_variant(config), "variant") | ||
| or self.decline_due_to(self.is_supported_mode(config), "casual" if self.rated else "rated") | ||
| or self.decline_due_to(self.is_supported_rating(config, user_profile or {}), "generic") |
Collaborator
There was a problem hiding this comment.
If the type of user_profile is UserProfileType, then the or {} can be removed.
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.
Type of pull request:
Description:
Add
min_rating,max_rating, andrating_differenceoptions to thechallengeconfig section, allowing bots to filter incoming challenges by the challenger's rating. This mirrors the existing rating filtering available for outgoing matchmaking challenges.Related Issues:
N/A
Checklist:
Screenshots/logs (if applicable):
N/A