Hi, has anyone had any luck sending a challenge to a bot and having the bot auto accept? The following function works fine against players (I’ve tested it with a second account) but it doesn’t seem to work with a bot (I tested it with amybot-beginner), I get a game ID but when I go to it the page looks like this:
https://imgur.com/a/hKmK0Mc
I tried matching the game settings as best I could, but maybe I’m missing something specific that prevents the bot from starting the game? Thanks for any help!
def challenge_player(access_token: str, player_id: int, game_name: str) →
Union[None, Tuple[int, int]]:
url = f"https://online-go.com/api/v1/players/{player_id}/challenge/"
headers = {‘Authorization’: f"Bearer {access_token}", ‘Content-Type’: ‘application/json’}
# Initialize game portion of the request
game = {
'name': game_name,
'private': False,
'rules': 'chinese',
'ranked': False,
'handicap': 0,
'speed': 'correspondence',
'time_control': 'fischer',
"time_control_parameters": {
'system': 'fischer',
"time_control": "fischer",
"initial_time": 259200,
"max_time": 604800,
"time_increment": 86400
},
'pause_on_weekends': True,
'width': 9,
'height': 9,
'disable_analysis': False
}
data = {'game': game, 'challenger_color': 'automatic', 'min_ranking': -1000, 'max_ranking': 1000, 'initialized': False,
'aga_ranked': False}
resp = requests.post(url=url, json=data, headers=headers)
if resp.status_code != 200:
print(f"Error creating challenge: {resp.status_code} {resp.text}", file=stderr)
return None
resp_data = resp.json()
return resp_data['challenge'], resp_data['game']