:fix: use team role as input everywhere
This commit is contained in:
parent
20eac4a4a7
commit
03653e48b3
|
@ -89,9 +89,14 @@ class TeamsCog(Cog, name="Teams"):
|
||||||
reason="Creation of a new team",
|
reason="Creation of a new team",
|
||||||
)
|
)
|
||||||
tournoi = get(guild.roles, name=team.tournoi)
|
tournoi = get(guild.roles, name=team.tournoi)
|
||||||
|
participant = get(guild.roles, name=Role.PARTICIPANT)
|
||||||
|
|
||||||
await ctx.author.add_roles(
|
await ctx.author.add_roles(
|
||||||
team_role, captain_role, tournoi, reason="Creation of team " + trigram
|
team_role,
|
||||||
|
captain_role,
|
||||||
|
tournoi,
|
||||||
|
participant,
|
||||||
|
reason="Creation of team " + trigram,
|
||||||
)
|
)
|
||||||
|
|
||||||
await ctx.send(
|
await ctx.send(
|
||||||
|
@ -131,10 +136,12 @@ class TeamsCog(Cog, name="Teams"):
|
||||||
else:
|
else:
|
||||||
the_team = author_teams[0]
|
the_team = author_teams[0]
|
||||||
tournoi = get(ctx.guild.roles, name=the_team[0].tournoi)
|
tournoi = get(ctx.guild.roles, name=the_team[0].tournoi)
|
||||||
|
participant = get(ctx.guild.roles, name=Role.PARTICIPANT)
|
||||||
|
|
||||||
await member.add_roles(
|
await member.add_roles(
|
||||||
the_team[1],
|
the_team[1],
|
||||||
tournoi,
|
tournoi,
|
||||||
|
participant,
|
||||||
reason=f"{ctx.author.name} l'a ajouté à son équipe",
|
reason=f"{ctx.author.name} l'a ajouté à son équipe",
|
||||||
)
|
)
|
||||||
await ctx.send(
|
await ctx.send(
|
||||||
|
|
|
@ -163,15 +163,16 @@ class Tirage(yaml.YAMLObject):
|
||||||
+-----+---------+---------+---------+---------+
|
+-----+---------+---------+---------+---------+
|
||||||
| {0.name} | Déf | | Rap | Opp |
|
| {0.name} | Déf | | Rap | Opp |
|
||||||
+-----+---------+---------+---------+---------+
|
+-----+---------+---------+---------+---------+
|
||||||
| {0.name} | Opp | Déf | | Rap |
|
| {1.name} | Opp | Déf | | Rap |
|
||||||
+-----+---------+---------+---------+---------+
|
+-----+---------+---------+---------+---------+
|
||||||
| {0.name} | Rap | Opp | Déf | |
|
| {2.name} | Rap | Opp | Déf | |
|
||||||
+-----+---------+---------+---------+---------+
|
+-----+---------+---------+---------+---------+
|
||||||
| {0.name} | | Rap | Opp | Déf |
|
| {3.name} | | Rap | Opp | Déf |
|
||||||
+-----+---------+---------+---------+---------+
|
+-----+---------+---------+---------+---------+
|
||||||
```"""
|
```"""
|
||||||
Record = namedtuple("Record", ["name", "pb", "penalite"])
|
Record = namedtuple("Record", ["name", "pb", "penalite"])
|
||||||
|
|
||||||
|
await ctx.send(msg)
|
||||||
for round in (0, 1):
|
for round in (0, 1):
|
||||||
records = [
|
records = [
|
||||||
Record(
|
Record(
|
||||||
|
@ -182,11 +183,10 @@ class Tirage(yaml.YAMLObject):
|
||||||
for team in in_passage_order(self.teams, round)
|
for team in in_passage_order(self.teams, round)
|
||||||
]
|
]
|
||||||
|
|
||||||
msg += f"\n\n**{ROUND_NAMES[round].capitalize()}**:\n"
|
msg = f"\n\n**{ROUND_NAMES[round].capitalize()}**:\n"
|
||||||
msg += table.format(*records) + "\n"
|
msg += table.format(*records) + "\n"
|
||||||
for team in self.teams:
|
for team in self.teams:
|
||||||
msg += team.details(round)
|
msg += team.details(round)
|
||||||
|
|
||||||
await ctx.send(msg)
|
await ctx.send(msg)
|
||||||
|
|
||||||
|
|
||||||
|
@ -287,7 +287,7 @@ class OrderPhase(Phase):
|
||||||
if len(teams) > 1:
|
if len(teams) > 1:
|
||||||
re_do.extend(teams)
|
re_do.extend(teams)
|
||||||
|
|
||||||
teams_str = ", ".join(team.role.mention for team in re_do)
|
teams_str = ", ".join(team.mention for team in re_do)
|
||||||
await ctx.send(
|
await ctx.send(
|
||||||
f"Les equipes {teams_str} ont fait le même résultat "
|
f"Les equipes {teams_str} ont fait le même résultat "
|
||||||
"et doivent relancer un dé. "
|
"et doivent relancer un dé. "
|
||||||
|
@ -471,7 +471,7 @@ class TiragePhase(Phase):
|
||||||
|
|
||||||
await asyncio.sleep(1.5)
|
await asyncio.sleep(1.5)
|
||||||
await ctx.send(
|
await ctx.send(
|
||||||
f"{self.current_team.mention} à toi l'honneur! "
|
f"{self.current_team.mention} à toi l'honneur ! "
|
||||||
f"Lance `!random-problem` quand tu veux."
|
f"Lance `!random-problem` quand tu veux."
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -87,7 +87,7 @@ class TirageCog(Cog, name="Tirages"):
|
||||||
if channel in self.tirages:
|
if channel in self.tirages:
|
||||||
await self.tirages[channel].accept(ctx, False)
|
await self.tirages[channel].accept(ctx, False)
|
||||||
else:
|
else:
|
||||||
await ctx.send(f"{ctx.author.mention} nie tout en block !")
|
await ctx.send(f"{ctx.author.mention} nie tout en bloc !")
|
||||||
|
|
||||||
# ---------- Commandes du groupe draw ----------- #
|
# ---------- Commandes du groupe draw ----------- #
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,7 @@ class Role:
|
||||||
ORGA = "Orga"
|
ORGA = "Orga"
|
||||||
BENEVOLE = "Bénévole"
|
BENEVOLE = "Bénévole"
|
||||||
CAPTAIN = "Capitaine"
|
CAPTAIN = "Capitaine"
|
||||||
|
PARTICIPANT = "Participant"
|
||||||
|
|
||||||
|
|
||||||
ROUND_NAMES = ["premier tour", "deuxième tour"]
|
ROUND_NAMES = ["premier tour", "deuxième tour"]
|
||||||
|
|
Loading…
Reference in New Issue