Thibault Duplessis commited on
Commit
f745924
·
1 Parent(s): 3aa63bf

setting to decline bot challenges

Browse files
Files changed (2) hide show
  1. config.yml.default +1 -0
  2. model.py +4 -1
config.yml.default CHANGED
@@ -32,6 +32,7 @@ xboardoptions:
32
  max_concurrent_games: 1 # number of games to play simultaneously
33
  sort_challenges_by: "best" # possible values: "best", "first"
34
  abort_time: 20 # time to abort a game in seconds when there is no activity
 
35
 
36
  supported_variants: # chess variants to accept (http://lichess.org/variant)
37
  - standard
 
32
  max_concurrent_games: 1 # number of games to play simultaneously
33
  sort_challenges_by: "best" # possible values: "best", "first"
34
  abort_time: 20 # time to abort a game in seconds when there is no activity
35
+ accept_bot_challenges: true # accepts challenges coming from other bots
36
 
37
  supported_variants: # chess variants to accept (http://lichess.org/variant)
38
  - standard
model.py CHANGED
@@ -11,7 +11,8 @@ class Challenge():
11
  self.speed = c_info["speed"]
12
  self.challenger = c_info.get("challenger")
13
  self.challenger_title = self.challenger.get("title") if self.challenger else None
14
- self.challenger_master_title = self.challenger_title if self.challenger_title != "BOT" else None
 
15
  self.challenger_name = self.challenger["name"] if self.challenger else "Anonymous"
16
  self.challenger_rating_int = self.challenger["rating"] if self.challenger else 0
17
  self.challenger_rating = self.challenger_rating_int or "?"
@@ -26,6 +27,8 @@ class Challenge():
26
  return "rated" in supported if self.rated else "casual" in supported
27
 
28
  def is_supported(self, config):
 
 
29
  variants = config["supported_variants"]
30
  tc = config["supported_tc"]
31
  modes = config["supported_modes"]
 
11
  self.speed = c_info["speed"]
12
  self.challenger = c_info.get("challenger")
13
  self.challenger_title = self.challenger.get("title") if self.challenger else None
14
+ self.challenger_is_bot = self.challenger_title == "BOT"
15
+ self.challenger_master_title = self.challenger_title if not self.challenger_is_bot else None
16
  self.challenger_name = self.challenger["name"] if self.challenger else "Anonymous"
17
  self.challenger_rating_int = self.challenger["rating"] if self.challenger else 0
18
  self.challenger_rating = self.challenger_rating_int or "?"
 
27
  return "rated" in supported if self.rated else "casual" in supported
28
 
29
  def is_supported(self, config):
30
+ if not config.get("accept_bot_challenges", true) and self.challenger_is_bot:
31
+ return false
32
  variants = config["supported_variants"]
33
  tc = config["supported_tc"]
34
  modes = config["supported_modes"]