AttackingOrDefending / lidraughts-bot

A bridge between Lidraughts API and draughts engines
GNU Affero General Public License v3.0
5 stars 10 forks source link

Error while accepting challenges #93

Closed ttBOT-on-Lichess closed 12 months ago

ttBOT-on-Lichess commented 1 year ago

Hi! My bot (ttBOT) can't accept challenges because of an error:

[09/24/23 21:40:45] ERROR    Error while checking challenge:                                                              model.py:65
                             Traceback (most recent call last):
                               File "C:\Users\emman\Documents\Timothee\Echecs\BOT\lidBOT\BOT\model.py", line 53, in
                             is_supported
                                 if not self.is_supported_time_control(config):
                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                               File "C:\Users\emman\Documents\Timothee\Echecs\BOT\lidBOT\BOT\model.py", line 39, in
                             is_supported_time_control
                                 and increment_min <= self.increment <= increment_max
                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                             TypeError: '<=' not supported between instances of 'int' and 'NoneType'

What must I do? Thx in advance

AttackingOrDefending commented 12 months ago

Can you send the config.yml with the token removed? Was this game a correspondence game? Try running lidraughts-bot with python lidraughts-bot.py -v -l log.txt and then upload log.txt.

ttBOT-on-Lichess commented 12 months ago
token: "xxxxxxxxxxxxxxxxx"    # Lidraughts OAuth2 Token.
url: "https://lidraughts.org/"  # Lidraughts base URL.

engine:                      # Engine settings.
  dir: C:/Users/emman/Documents/Timothee/Echecs/BOT/Scan/scan        # Directory containing the engine. This can be an absolute path or one relative to lidraughts-bot/.
  name: "scan.exe"        # Binary name of the engine to use.
  engine_argument: "hub"
  working_dir: "C:/Users/emman/Documents/Timothee/Echecs/BOT/Scan/scan"  # Directory where the draughts engine will read and write files. If blank or missing, the current directory is used.
  protocol: "hub"            # "hub", "dxp", "cb" (checkerboard) or "homemade"
  ponder: true               # Think on opponent's time.
  draw_or_resign:
    resign_enabled: false
    resign_score: -1000      # If the score is less than or equal to this value, the bot resigns (in cp).
    resign_moves: 3          # How many moves in a row the score has to be below the resign value.
    offer_draw_enabled: false
    offer_draw_score: 0      # If the absolute value of the score is less than or equal to this value, the bot offers/accepts draw (in cp).
    offer_draw_moves: 5      # How many moves in a row the absolute value of the score has to be below the draw value.
    offer_draw_pieces: 10    # Only if the pieces on board are less than or equal to this value, the bot offers/accepts draw.
# engine_options:            # Any custom command line params to pass to the engine.
#   cpuct: 3.1
  homemade_options:
#   Hash: 256
  hub_options:               # Arbitrary Hub options passed to the engine.
    book-ply: 20
    tt-size: 23
    bb-size: 'auto'          # 'auto' changes bb depending on the variant
#   go_commands:             # Additional options to pass to the Hub go command.
#     nodes: 1               # Search so many nodes only.
#     depth: 5               # Search depth ply only.
#     movetime: 1000         # Integer. Search exactly movetime milliseconds.
  dxp_options:
    engine-opened: true
  cb_options:
    divide-time-by: 40
  silence_stderr: false      # Some engines (yes you, Leela) are very noisy.

abort_time: 20               # Time to abort a game in seconds when there is no activity.
fake_think_time: false       # Artificially slow down the bot to pretend like it's thinking.
rate_limiting_delay: 0       # Time (in ms) to delay after sending a move to prevent "Too Many Requests" errors.
move_overhead: 2000          # Increase if your bot flags games too often.
move_overhead_inc: 100       # Increase if your bot flags games too often.

correspondence:
  move_time: 60            # Time in seconds to search in correspondence games.
  checkin_period: 180      # How often to check for opponent moves in correspondence games after disconnecting.
  disconnect_time: 120     # Time before disconnecting from a correspondence game.
  ponder: false            # Ponder in correspondence games the bot is connected to.

challenge:                   # Incoming challenges.
  concurrency: 1             # Number of games to play simultaneously.
  sort_by: "best"            # Possible values: "best" and "first".
  accept_bot: false          # Accepts challenges coming from other bots.
  only_bot: false            # Accept challenges by bots only.
  max_increment:          # Maximum amount of increment to accept a challenge. The max is 180. Set to 0 for no increment.
  min_increment: 0           # Minimum amount of increment to accept a challenge.
  max_base: 180        # Maximum amount of base time to accept a challenge. The max is 315360000 (10 years).
  min_base: 0                # Minimum amount of base time to accept a challenge.
  variants:                  # Draughts variants to accept (https://lidraughts.org/variant).
    - standard
#   - fromPosition
    - breakthrough
    - antidraughts
    - frisian
    - frysk
#   - brazilian
#   - russian
  time_controls:             # Time controls to accept.
    - ultraBullet
    - bullet
    - blitz
#   - rapid
#   - classical
#   - correspondence
  modes:                     # Game modes to accept.
    - casual                 # Unrated games.
    - rated                  # Rated games - must comment if the engine doesn't try to win.

greeting:
  # Optional substitution keywords (include curly braces):
  #   {opponent} to insert opponent's name
  #   {me} to insert bot's name
  # Any other words in curly braces will be removed.
  hello: "Hi! I'm {me}. Good luck! Type !help for a list of commands I can respond to." # Message to send to opponent chat at the start of a game
  goodbye: "Good game!" # Message to send to opponent chat at the end of a game
  hello_spectators: "Hi! I'm {me}. Type !help for a list of commands I can respond to." # Message to send to spectator chat at the start of a game
  goodbye_spectators: "Thanks for watching!" # Message to send to spectator chat at the end of a game

# pgn_directory: "game_records" # A directory where PDN-format records of the bot's games are kept

No, I've challenge ttbot at a ultrabullet game, then to blitz and a lot but i've got this same error all the time

ttBOT-on-Lichess commented 12 months ago

And here is the log.txt

2023-09-26 17:16:12,283 __main__ INFO 
    .   _/|
    .  // o\
    .  || ._)  lidraughts-bot 1.2.0
    .  //__\
    .  )___(   Play on Lidraughts with a bot

2023-09-26 17:16:12,330 urllib3.connectionpool DEBUG Starting new HTTPS connection (1): lidraughts.org:443
2023-09-26 17:16:12,957 urllib3.connectionpool DEBUG https://lidraughts.org:443 "GET /api/account HTTP/1.1" 200 None
2023-09-26 17:16:12,957 __main__ INFO Welcome ttBOT!
2023-09-26 17:16:12,973 __main__ INFO You're now connected to https://lidraughts.org/ and awaiting challenges.
2023-09-26 17:16:13,918 urllib3.connectionpool DEBUG https://lidraughts.org:443 "GET /api/account/playing HTTP/1.1" 200 None
2023-09-26 17:17:00,589 __main__ DEBUG Event: {'type': 'challenge', 'challenge': {'id': 'Xv6TeDcL', 'url': 'https://lidraughts.org/Xv6TeDcL', 'status': 'created', 'challenger': {'id': 'tititogepi', 'name': 'tititogepi', 'title': None, 'rating': 2036, 'online': True, 'lag': 4}, 'destUser': {'id': 'ttbot', 'name': 'ttBOT', 'title': 'BOT', 'rating': 2279, 'provisional': True, 'online': True, 'lag': 4}, 'variant': {'key': 'standard', 'name': 'Standard', 'short': 'Std', 'gameType': 20, 'board': {'key': '100', 'size': [10, 10]}}, 'rated': False, 'speed': 'ultraBullet', 'timeControl': {'type': 'clock', 'limit': 15, 'increment': 0, 'show': ' +0'}, 'color': 'random', 'perf': {'icon': '{', 'name': 'UltraBullet'}}}
2023-09-26 17:17:00,605 model ERROR Error while checking challenge:
Traceback (most recent call last):
  File "C:\Users\emman\Documents\Timothee\Echecs\BOT\lidBOT\BOT\model.py", line 53, in is_supported
    if not self.is_supported_time_control(config):
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\emman\Documents\Timothee\Echecs\BOT\lidBOT\BOT\model.py", line 39, in is_supported_time_control
    and increment_min <= self.increment <= increment_max
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: '<=' not supported between instances of 'int' and 'NoneType'
2023-09-26 17:17:00,684 urllib3.connectionpool DEBUG https://lidraughts.org:443 "POST /api/challenge/Xv6TeDcL/decline HTTP/1.1" 200 None
AttackingOrDefending commented 12 months ago

max_increment is empty in config.yml under the challenge section. Change it to max_increment: 180.

ttBOT-on-Lichess commented 12 months ago

Oh thank you a lot!