Maxouille

tour_join.py

Apr 19th, 2021
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.79 KB | None | 0 0
  1. async def tour_join(self, battle_format, team):
  2. while True:
  3. msg = await self.receive_message()
  4. split_msg = msg.split('|')
  5. print(msg)
  6. if msg.startswith("|tournament|create|"):
  7. message = ["/tour join"]
  8. await self.send_message(self.room, message)
  9. format = split_msg[3]
  10. message = ["nouveau tournois en " + format]
  11. logger.debug(message)
  12. await self.send_message(self.room, message)
  13. await self.update_team(team)
  14. if msg.startswith("|tournament|update|"):
  15. if "challenged" in msg:
  16. oppo = json.loads(split_msg[3])
  17. username = str(oppo["challenged"])
  18. message = ["/tournament acceptchallenge " + username]
  19. await self.send_message(self.room, message)
  20. if "challenges" in msg:
  21. oppo = json.loads(split_msg[3])
  22. username = str(oppo["challenges"])
  23. message = ["/tour challenge " + username]
  24. await self.send_message(self.room, message)
  25. if "challengeBys" in msg:
  26. oppo = json.loads(split_msg[3])
  27. username = str(oppo["challengeBys"])
  28. message = ["/tournament challenge " + username]
  29. await self.send_message(self.room, message)
  30. message = ["/tournament acceptchallenge " + username]
  31. await self.send_message(self.room, message)
  32. if msg.startswith("|updatesearch|") and "battle" in msg:
  33. break
Advertisement
Add Comment
Please, Sign In to add comment