8000 feat: add rating filtering for incoming challenges by farhadzaidi · Pull Request #1190 · lichess-bot-devs/lichess-bot · GitHub
[go: up one dir, main page]

Skip to content

feat: add rating filtering for incoming challenges#1190

Open
farhadzaidi wants to merge 2 commits intolichess-bot-devs:masterfrom
farhadzaidi:incoming-challenge-rating-filter
Open

feat: add rating filtering for incoming challenges#1190
farhadzaidi wants to merge 2 commits intolichess-bot-devs:masterfrom
farhadzaidi:incoming-challenge-rating-filter

Conversation

@farhadzaidi
Copy link

Type of pull request:

  • Bug fix
  • Feature
  • Other

Description:

Add min_rating, max_rating, and rating_difference options to the challenge config 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:

  • I have read and followed the contribution guidelines.
  • I have added necessary documentation (if applicable).
  • The changes pass all existing tests.

Screenshots/logs (if applicable):

N/A

@farhadzaidi farhadzaidi changed the title Add rating filtering for incoming challenges feat: add rating filtering for incoming challenges Mar 8, 2026
@farhadzaidi farhadzaidi force-pushed the incoming-challenge-rating-filter branch from 60d7287 to f0e0173 Compare March 9, 2026 16:34
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]:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is the type annotation UserProfileType | None instead of UserProfileType? Every call to is_supported() has a user_profile parameter.

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")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the type of user_profile is UserProfileType, then the or {} can be removed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

0