lichess-bot-devs / lichess-bot

A bridge between Lichess bots and chess engines
GNU Affero General Public License v3.0
745 stars 440 forks source link

TypeError: '>=' not supported between instances of 'datetime.timedelta' and 'int' #808

Closed TheYoBots closed 1 year ago

TheYoBots commented 1 year ago

This is the error:

[08/12/23 19:18:08] ERROR    Error while checking challenge
                             WUE9ITRq:                                          
                             Traceback (most recent call last):                 
                               File "/lichess/model.py", line 91, in is_supported                                       
                                 or self.decline_due_to(self.is_supported_recent(config, recent_bot_challenges), "later"))                                          
                                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                               
                               File "/lichess/model.py", line 58, in is_supported_recent                                
                                 recent_bot_challenges[self.challenger.name] = [timer for timer                        
                                                                                ^^^^^^^^^^^^^^^^                        
                               File "/lichess/model.py", line 60, in <listcomp>                                         
                                 if not timer.is_expired()]                     
                                        ^^^^^^^^^^^^^^^^^^                      
                               File "/lichess/timer.py", line 85, in is_expired                                         
                                 return self.time_since_reset() >= self.duration                                      
                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                       
                             TypeError: '>=' not supported between instances of 'datetime.timedelta' and 'int'

I think this commit caused this error.

MarkZH commented 1 year ago

In line 537 of lichess-bot.py, the time_window value needs to be converted to seconds().

TheYoBots commented 1 year ago

Thanks! This works!