fix !missing for older clients

This commit is contained in:
Fabian Dill 2020-06-15 22:07:43 +02:00
parent 7353b489ce
commit 3fbb959622
1 changed files with 8 additions and 2 deletions

View File

@ -309,7 +309,6 @@ async def countdown(ctx: Context, timer):
await asyncio.sleep(1)
ctx.notify_all(f'[Server]: GO')
async def missing(ctx: Context, client: Client, locations: list):
await ctx.send_msgs(client, [['Missing', {
'locations': json.dumps(locations)
@ -655,13 +654,20 @@ class ClientMessageProcessor(CommandProcessor):
def _cmd_missing(self) -> bool:
"""List all missing location checks from the server's perspective"""
locations = []
for location_id, location_name in Regions.lookup_id_to_name.items(): # cheat console is -1, keep in mind
if location_id != -1 and location_id not in self.ctx.location_checks[self.client.team, self.client.slot]:
locations.append(location_name)
if len(locations) > 0:
asyncio.create_task(missing(self.ctx, self.client, locations))
if self.client.version < [2, 3, 0]:
buffer = ""
for location in locations:
buffer += f'Missing: {location}\n'
self.output(buffer + f"Found {len(locations)} missing location checks")
else:
asyncio.create_task(missing(self.ctx, self.client, locations))
else:
self.output("No missing location checks found.")
return True