@@ -2898,6 +2898,57 @@ async def tourney_progress(interaction: discord.Interaction):
28982898 embed .set_footer (text = f"Matcherino ID: { m_id } | Staff: { interaction .user .name } " )
28992899 await interaction .followup .send (embed = embed )
29002900
2901+ @app_commands .command (
2902+ name = "active-matches" ,
2903+ description = "Show all currently active match scores grouped by round." ,
2904+ )
2905+ async def active_matches (interaction : discord .Interaction ):
2906+ if not is_staff (interaction .user ):
2907+ await interaction .response .send_message (
2908+ "❌ Permission denied." , ephemeral = True
2909+ )
2910+ return
2911+
2912+ await interaction .response .defer ()
2913+ session = await get_active_tourney_session ()
2914+ if not session or not session .get ("matcherino_id" ):
2915+ await interaction .followup .send ("❌ No active session found." )
2916+ return
2917+
2918+ m_id = session ["matcherino_id" ]
2919+ bracket_url = f"https://matcherino.com/tournaments/{ m_id } /bracket"
2920+
2921+ from .matcherino import fetch_bracket_progress
2922+
2923+ data = fetch_bracket_progress (bracket_url )
2924+ if data .get ("status" ) != "success" :
2925+ await interaction .followup .send (f"❌ **Error:** { data .get ('error' )} " )
2926+ return
2927+
2928+ matches = data .get ("active_matches" , [])
2929+ if not matches :
2930+ await interaction .followup .send ("✅ No active matches right now." )
2931+ return
2932+
2933+ rounds : dict [int , list ] = {}
2934+ for m in matches :
2935+ rounds .setdefault (m ["round" ], []).append (m )
2936+
2937+ embed = discord .Embed (
2938+ title = "⚔️ Active Matches" ,
2939+ description = f"`{ len (matches )} ` matches currently active" ,
2940+ color = discord .Color .blue (),
2941+ )
2942+
2943+ for round_num in sorted (rounds ):
2944+ lines = ""
2945+ for m in sorted (rounds [round_num ], key = lambda x : x ["id" ]):
2946+ lines += f"**#{ m ['id' ]} ** | { m ['team_a' ]} vs { m ['team_b' ]} ({ m ['score_a' ]} -{ m ['score_b' ]} )\n "
2947+ embed .add_field (name = f"Round { round_num } " , value = lines , inline = False )
2948+
2949+ embed .set_footer (text = f"Matcherino ID: { m_id } | Staff: { interaction .user .name } " )
2950+ await interaction .followup .send (embed = embed )
2951+
29012952 # --- Start the Dashboard Task ---
29022953 if bot .get_cog ("QueueDashboard" ) is None :
29032954 asyncio .create_task (bot .add_cog (QueueDashboard (bot )))
@@ -2922,6 +2973,7 @@ async def tourney_progress(interaction: discord.Interaction):
29222973 bot .tree .add_command (match_history )
29232974 bot .tree .add_command (set_ticket_match )
29242975 bot .tree .add_command (tourney_progress )
2976+ bot .tree .add_command (active_matches )
29252977 bot .tree .add_command (BlacklistGroup (bot ))
29262978
29272979 async def background_stats_update ():
0 commit comments