11import discord
22from discord .ext import commands
3- from discord import app_commands
3+ from discord import app_commands
44import bacore
55
66
@@ -23,18 +23,16 @@ async def ping(self, ctx):
2323 match_group = app_commands .Group (name = 'match' , description = 'Match Management' )
2424
2525 @match_group .command (name = 'add' ,description = 'Add a match' )
26- async def match_add (self , interaction : discord .Interaction , series_count : int , team_name1 : str , team_name2 : str , team1_pbids : str , team2_pbids : str ):
27- try :
28- team1_players = team1_pbids .split (',' )
29- team2_players = team2_pbids .split (',' )
30- if len (team1_players ) or len (team2_players ) < 4 :
31- await interaction .response .send_message ("Enter equal players **4** in both teams" )
32- else :
33- match = {"series" : series_count , "team1" : [team_name1 , team1_players ], "team2" : [team_name2 , team2_players ]}
34- bacore .tournament .insert (match )
35- await interaction .response .send_message ("Match Appointed" )
36- except Exception as e :
37- await interaction .response .send_message (e )
26+ async def match_add (self , interaction : discord .Interaction , series_count : int , team_name1 : str , team_name2 : str , team1_players : list [str ], team2_players : list [str ]):
27+ try :
28+ if len (team1_players ) or len (team2_players ) < 1 :
29+ await interaction .response .send_message ("Every team must have atleast a single player" )
30+ else :
31+ match = {"series" : series_count , "team1" : {team_name1 : team1_players }, "team2" : {team_name2 : team2_players }}
32+ bacore .tournament .insert (match )
33+ await interaction .response .send_message ("Match Appointed" )
34+ except Exception as e :
35+ await interaction .response .send_message (e )
3836 pass
3937
4038def main ():
0 commit comments