Add auto prefix to name

This commit is contained in:
Midgard 2021-03-11 15:23:01 +01:00
parent 9f20ebd44b
commit 7dec09250b
Signed by: midgard
GPG key ID: 511C112F1331BBB4

View file

@ -109,7 +109,7 @@ class Lobby:
return r return r
def join_lobby(self): def join(self):
own_player_data = self._post(f"/join", { own_player_data = self._post(f"/join", {
"name": self.bot_name, "name": self.bot_name,
"token": self.token, "token": self.token,
@ -165,10 +165,10 @@ def main():
lobby = Lobby.from_lobby_url( lobby = Lobby.from_lobby_url(
lobby_url, lobby_url,
bot_name, "🚗 " + bot_name,
bot_token bot_token
) )
lobby.join_lobby() lobby.join()
def can_answer(proposal): def can_answer(proposal):
return proposal["status"] == "pending" and any( return proposal["status"] == "pending" and any(
@ -236,6 +236,9 @@ def main():
lobby.create_proposal(map_name, 500, [lobby.own_player_id, p2]) lobby.create_proposal(map_name, 500, [lobby.own_player_id, p2])
except (KeyboardInterrupt, EOFError): except (KeyboardInterrupt, EOFError):
print(" Quitting") print(" Quitting")
finally:
# Remove auto prefix from name
Lobby.from_lobby_url(lobby_url, bot_name, bot_token).join()
if __name__ == "__main__": if __name__ == "__main__":