From 98b66858c354dedc1cf1ed6663984184b84c1ef3 Mon Sep 17 00:00:00 2001 From: ddorn Date: Sat, 25 Apr 2020 20:41:43 +0200 Subject: [PATCH] :fix: show order of tirage --- tfjm-discord-bot.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tfjm-discord-bot.py b/tfjm-discord-bot.py index c897140..62f9da1 100644 --- a/tfjm-discord-bot.py +++ b/tfjm-discord-bot.py @@ -4,6 +4,7 @@ import os import sys import traceback from collections import defaultdict +from operator import attrgetter from time import sleep from typing import List, Dict @@ -130,6 +131,15 @@ class OrderPhase(Phase): orders = [team.tirage_order for team in self.teams] if len(set(orders)) == len(orders): # All dice are different: good + # We sort the teams so all tirages are in this order + self.tirage.teams = sorted(self.teams, key=attrgetter("tirage_order")) + await ctx.send( + "L'ordre des tirages pour ce tour est donc :\n" + " - " + + "\n - ".join( + f"{team.role.mention} ({team.tirage_order})" for team in self.teams + ) + ) return self.NEXT else: # Find dice that are the same