1
0
mirror of https://gitlab.com/ddorn/tfjm-discord-bot.git synced 2024-12-25 17:42:23 +00:00

:fix: show order of tirage

This commit is contained in:
ddorn 2020-04-25 20:41:43 +02:00
parent cc5b31b9d6
commit 98b66858c3

View File

@ -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