Closed quiet23 closed 1 year ago
Seems like adding 1 sec. delay between opening bot game state connection and sending message makes it reliably appear. 0.2 sec. delay didn't help.
I cannot reproduce using this code:
class Req:
def __init__(self) -> None:
http = requests.Session()
http.mount("https://", ADAPTER)
http.mount("http://", ADAPTER)
self.http = http
print("streaming events")
r = self.http.get("http://localhost:9663/api/stream/event",
headers = {"Authorization": f"Bearer {TOKEN}"}, stream=True)
for line in r.iter_lines():
print(line)
if line:
event = json.loads(line)
if event["type"] == "gameStart":
gameId = event["game"]["id"]
break
print("sending chat")
r = self.http.post(f"http://localhost:9663/api/bot/game/{gameId}/chat",
headers = {"Authorization": f"Bearer {TOKEN}"},
data={"room": "player", "text": "message as soon as the game started!"})
print(r.status_code)
print(r)
Considering the age of the issue closing as completed for now
Hi,
if my bot sends a message to the chat before the first move is made in the game, the message does not appear in the chat, despite the chatLine event with the message echoes back in the Bot game state API connection.
Log from the bot:
After the game finishes this message is sent, and it appears in the chat, so seems like only messages before the first move are lost: