mirror of
				https://gitlab.com/ddorn/tfjm-discord-bot.git
				synced 2025-11-04 14:32:20 +01:00 
			
		
		
		
	:fix: use team role as input everywhere
This commit is contained in:
		@@ -89,9 +89,14 @@ class TeamsCog(Cog, name="Teams"):
 | 
			
		||||
                reason="Creation of a new team",
 | 
			
		||||
            )
 | 
			
		||||
            tournoi = get(guild.roles, name=team.tournoi)
 | 
			
		||||
            participant = get(guild.roles, name=Role.PARTICIPANT)
 | 
			
		||||
 | 
			
		||||
            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(
 | 
			
		||||
@@ -131,10 +136,12 @@ class TeamsCog(Cog, name="Teams"):
 | 
			
		||||
        else:
 | 
			
		||||
            the_team = author_teams[0]
 | 
			
		||||
            tournoi = get(ctx.guild.roles, name=the_team[0].tournoi)
 | 
			
		||||
            participant = get(ctx.guild.roles, name=Role.PARTICIPANT)
 | 
			
		||||
 | 
			
		||||
            await member.add_roles(
 | 
			
		||||
                the_team[1],
 | 
			
		||||
                tournoi,
 | 
			
		||||
                participant,
 | 
			
		||||
                reason=f"{ctx.author.name} l'a ajouté à son équipe",
 | 
			
		||||
            )
 | 
			
		||||
            await ctx.send(
 | 
			
		||||
 
 | 
			
		||||
@@ -163,15 +163,16 @@ class Tirage(yaml.YAMLObject):
 | 
			
		||||
    +-----+---------+---------+---------+---------+
 | 
			
		||||
    | {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"])
 | 
			
		||||
 | 
			
		||||
        await ctx.send(msg)
 | 
			
		||||
        for round in (0, 1):
 | 
			
		||||
            records = [
 | 
			
		||||
                Record(
 | 
			
		||||
@@ -182,12 +183,11 @@ class Tirage(yaml.YAMLObject):
 | 
			
		||||
                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"
 | 
			
		||||
            for team in self.teams:
 | 
			
		||||
                msg += team.details(round)
 | 
			
		||||
 | 
			
		||||
        await ctx.send(msg)
 | 
			
		||||
            await ctx.send(msg)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class Phase:
 | 
			
		||||
@@ -287,7 +287,7 @@ class OrderPhase(Phase):
 | 
			
		||||
                if len(teams) > 1:
 | 
			
		||||
                    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(
 | 
			
		||||
                f"Les equipes {teams_str} ont fait le même résultat "
 | 
			
		||||
                "et doivent relancer un dé. "
 | 
			
		||||
@@ -471,7 +471,7 @@ class TiragePhase(Phase):
 | 
			
		||||
 | 
			
		||||
        await asyncio.sleep(1.5)
 | 
			
		||||
        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."
 | 
			
		||||
        )
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -87,7 +87,7 @@ class TirageCog(Cog, name="Tirages"):
 | 
			
		||||
        if channel in self.tirages:
 | 
			
		||||
            await self.tirages[channel].accept(ctx, False)
 | 
			
		||||
        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 ----------- #
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -31,6 +31,7 @@ class Role:
 | 
			
		||||
    ORGA = "Orga"
 | 
			
		||||
    BENEVOLE = "Bénévole"
 | 
			
		||||
    CAPTAIN = "Capitaine"
 | 
			
		||||
    PARTICIPANT = "Participant"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
ROUND_NAMES = ["premier tour", "deuxième tour"]
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user