Skip to content

Commit b4e65e8

Browse files
committed
added stage to manual match create
1 parent cdd4cbd commit b4e65e8

File tree

2 files changed

+20
-19
lines changed

2 files changed

+20
-19
lines changed

plugins/tournament/README.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -211,17 +211,17 @@ final is reached, where two squadrons play together for the win.
211211
The tournament ends if all matches were played and only one winning squadron succeeded.
212212

213213
## Discord Commands
214-
| Command | Parameter | Channel | Role | Description |
215-
|----------------------|----------------------------------------------|------------------|----------------|-------------------------------------------------------------------|
216-
| /tournament create | campaign rounds num_players | admin-channel | Admin | Creates a new tournament, based on a campaign. |
217-
| /tournament delete | tournament | admin-channel | Admin | Deletes the tournament and all its underlying data! |
218-
| /tournament signup | tournament squadron | any | Squadron Admin | Signs up this squadron to this tournament. |
219-
| /tournament withdraw | tournament squadron | any | Squadron Admin | Withdraws this squadron from this tournament. |
220-
| /tournament verify | tournament squadron | admin-channel | GameMaster | Accept or reject a squadron for this tournament. |
221-
| /tournament bracket | tournament | admin-channel | GameMaster | Generate a bracket Excel file. |
222-
| /match generate | tournament <group\|eliminate> [num_groups] | admin-channel | GameMaster | Auto-generates matches for each stage of the tournament. |
223-
| /match create | tournament server squadron_blue squadron_red | admin-channel | GameMaster | Creates a match manually. |
224-
| /match list | tournament | any | DCS | List all matches of a specific tournament. |
225-
| /match start | tournament match [mission] [round_number] | admin-channel | GameMaster | Starts a match. Prepares and starts the DCS server. |
226-
| /match edit | tournament match [winner_squadron_id] | admin-channel | GameMaster | Edit the results of a match. |
227-
| /match customize | | squadron channel | Squadron Admin | Customize the next mission for the next round of a running match. |
214+
| Command | Parameter | Channel | Role | Description |
215+
|----------------------|----------------------------------------------------|------------------|----------------|-------------------------------------------------------------------|
216+
| /tournament create | campaign rounds num_players | admin-channel | Admin | Creates a new tournament, based on a campaign. |
217+
| /tournament delete | tournament | admin-channel | Admin | Deletes the tournament and all its underlying data! |
218+
| /tournament signup | tournament squadron | any | Squadron Admin | Signs up this squadron to this tournament. |
219+
| /tournament withdraw | tournament squadron | any | Squadron Admin | Withdraws this squadron from this tournament. |
220+
| /tournament verify | tournament squadron | admin-channel | GameMaster | Accept or reject a squadron for this tournament. |
221+
| /tournament bracket | tournament | admin-channel | GameMaster | Generate a bracket Excel file. |
222+
| /match generate | tournament <group\|eliminate> [num_groups] | admin-channel | GameMaster | Auto-generates matches for each stage of the tournament. |
223+
| /match create | tournament stage server squadron_blue squadron_red | admin-channel | GameMaster | Creates a match manually. |
224+
| /match list | tournament | any | DCS | List all matches of a specific tournament. |
225+
| /match start | tournament match [mission] [round_number] | admin-channel | GameMaster | Starts a match. Prepares and starts the DCS server. |
226+
| /match edit | tournament match [winner_squadron_id] | admin-channel | GameMaster | Edit the results of a match. |
227+
| /match customize | | squadron channel | Squadron Admin | Customize the next mission for the next round of a running match. |

plugins/tournament/commands.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -792,19 +792,20 @@ async def generate(self, interaction: discord.Interaction, tournament_id: int,
792792
@match.command(description='Create a manual match')
793793
@app_commands.guild_only()
794794
@app_commands.rename(tournament_id="tournament")
795+
@app_commands.describe(stage=_("The level of your match. If all matches on one level are finished, increase the level by one."))
795796
@app_commands.autocomplete(tournament_id=active_tournament_autocomplete)
796797
@app_commands.autocomplete(server_name=server_autocomplete)
797798
@app_commands.autocomplete(squadron_blue=valid_squadron_autocomplete)
798799
@app_commands.autocomplete(squadron_red=valid_squadron_autocomplete)
799800
@utils.app_has_role('GameMaster')
800-
async def create(self, interaction: discord.Interaction, tournament_id: int, server_name: str,
801-
squadron_blue: int, squadron_red: int):
801+
async def create(self, interaction: discord.Interaction, tournament_id: int, stage: app_commands.Range[int, 1, 7],
802+
server_name: str, squadron_blue: int, squadron_red: int):
802803
async with self.apool.connection() as conn:
803804
async with conn.transaction():
804805
await conn.execute("""
805-
INSERT INTO tm_matches(tournament_id, server_name, squadron_red, squadron_blue)
806-
VALUES (%s, %s, %s, %s)
807-
""", (tournament_id, server_name, squadron_red, squadron_blue))
806+
INSERT INTO tm_matches(tournament_id, stage, server_name, squadron_red, squadron_blue)
807+
VALUES (%s, %s, %s, %s, %s)
808+
""", (tournament_id, stage, server_name, squadron_red, squadron_blue))
808809

809810
tournament = await self.get_tournament(tournament_id)
810811
blue = utils.get_squadron(self.node, squadron_id=squadron_blue)

0 commit comments

Comments
 (0)