예제 #1
0
    async def matchsetup(self, ctx, team_a_name: str, team_b_name: str,
                         server_name: str):
        """`{prefix}matchsetup <CT team name> <T team name> <server name>`

        **Requires**: Captain permissions or higher for the server
        **Example**: `{prefix}matchsetup ct_team t_team rush`
        """
        if not await check_perm_captain(ctx, server_name):
            return
        before = datetime.now()
        teams = [aliases.get_team(team_a_name), aliases.get_team(team_b_name)]
        embed = discord.Embed()
        for team in teams:
            embed.add_field(name=f"{team.name} members",
                            value=team.member_repr(),
                            inline=False)
        await ctx.send(embed=embed)

        for index, team in enumerate(teams):
            for member in team.members:
                await exec_server_command(
                    ctx, server_name, f"SwitchTeam {member.unique_id} {index}")
                await asyncio.sleep(RCON_COMMAND_PAUSE)

        await ctx.send(embed=discord.Embed(
            description=
            f"Teams set up. Resetting SND in {MATCH_DELAY_RESETSND} seconds."))
        await asyncio.sleep(MATCH_DELAY_RESETSND)
        await exec_server_command(ctx, server_name, "ResetSND")
        embed = discord.Embed(description="Reset SND. Good luck!")
        embed.set_footer(text=f"Execution time: {datetime.now() - before}")
        await ctx.send(embed=embed)
예제 #2
0
 async def reset(self, ctx, team_name: str):
     """`{prefix}ringers reset <team_name>`
     
     **Examples**: `{prefix}ringers reset team_a`"""
     if not await check_perm_captain(ctx, global_check=True):
         return
     team = aliases.get_team(team_name)
     team.ringers_reset()
     await ctx.send(embed=discord.Embed(
         description=f"Ringers for team {team.name} reset."))
예제 #3
0
    async def add(self, ctx, player_arg: str, team_name: str):
        """`{prefix}ringers add <unique_id or alias> <team_name>`

        **Examples**: `{prefix}ringers add maku team_a`"""
        if not await check_perm_captain(ctx, global_check=True):
            return
        team = aliases.get_team(team_name)
        player = SteamPlayer.convert(player_arg)
        team.ringer_add(player)
        await ctx.send(embed=discord.Embed(
            description=f"Ringer {player.name} added to team {team.name}."))
예제 #4
0
파일: teams.py 프로젝트: makupi/pavlov-bot
    async def teamsetup(self, ctx, players_arg: str, team_name: str):
        """`{prefix}teamsetup <comma seperated list of unique_id or alias> <team_name>`

        **Examples**: `{prefix}teamsetup maku,invicta team_a`"""
        if not await check_perm_captain(ctx, global_check=True):
            return
        team = aliases.get_team(team_name)
        team.ringers_reset()
        players = players_arg.split(',')
        for player in players:
            player = SteamPlayer.convert(player)
            team.ringer_add(player)
        await ctx.send(embed=discord.Embed(
            description=f"Player list {players_arg} added to team {team.name}."
        ))
예제 #5
0
    async def teams(self, ctx, team_name: str = None):
        """`{prefix}teams [team_name]`

        team_name is optional. Without it will list all possible teams."""
        if not team_name:
            teams = aliases.get_teams_list()
            embed = discord.Embed(title="Teams")
            desc = ""
            for team in teams:
                desc += f"- {team.name}\n"
            embed.description = desc
            embed.set_footer(
                text=
                f"Use {config.prefix}teams [team_name] for more infos about a team."
            )
        else:
            team = aliases.get_team(team_name)
            embed = discord.Embed(title=team.name,
                                  description=team.member_repr())
        await ctx.send(embed=embed)