99
1010# Custom modules
1111from utils .json_hooks import dateconverter , dateparser , int_keys
12- from utils .command_checks import tournament_is_pending , tournament_is_underway , tournament_is_underway_or_pending , in_channel , is_streaming
12+ from utils .command_checks import tournament_is_pending , tournament_is_underway , tournament_is_underway_or_pending , in_channel , is_streaming , is_owner_or_to
1313from utils .stream import is_on_stream , is_queued_for_stream
1414from utils .rounds import is_top8 , nom_round
1515from utils .game_specs import get_access_stream
@@ -139,7 +139,7 @@ async def init_tournament(url_or_id):
139139
140140### Ajouter un tournoi
141141@bot .command (name = 'setup' )
142- @commands .has_role ( to_id )
142+ @commands .check ( is_owner_or_to )
143143async def setup_tournament (ctx , arg ):
144144
145145 if re .compile (r"^(https?\:\/\/)?(challonge.com)\/.+$" ).match (arg ):
@@ -218,7 +218,7 @@ async def auto_setup_tournament():
218218
219219### Démarrer un tournoi
220220@bot .command (name = 'start' )
221- @commands .has_role ( to_id )
221+ @commands .check ( is_owner_or_to )
222222@commands .check (tournament_is_pending )
223223async def start_tournament (ctx ):
224224 with open (tournoi_path , 'r+' ) as f : tournoi = json .load (f , object_hook = dateparser )
@@ -280,7 +280,7 @@ async def start_tournament(ctx):
280280
281281### Terminer un tournoi
282282@bot .command (name = 'end' )
283- @commands .has_role ( to_id )
283+ @commands .check ( is_owner_or_to )
284284@commands .check (tournament_is_underway )
285285async def end_tournament (ctx ):
286286 with open (tournoi_path , 'r+' ) as f : tournoi = json .load (f , object_hook = dateparser )
@@ -747,7 +747,7 @@ async def flipcoin(ctx):
747747
748748### Ajout manuel
749749@bot .command (name = 'add' )
750- @commands .has_role ( to_id )
750+ @commands .check ( is_owner_or_to )
751751@commands .check (tournament_is_pending )
752752async def add_inscrit (ctx ):
753753 for member in ctx .message .mentions :
@@ -757,7 +757,7 @@ async def add_inscrit(ctx):
757757
758758### Suppression/DQ manuel
759759@bot .command (name = 'rm' )
760- @commands .has_role ( to_id )
760+ @commands .check ( is_owner_or_to )
761761@commands .check (tournament_is_underway_or_pending )
762762async def remove_inscrit (ctx ):
763763 for member in ctx .message .mentions :
@@ -1624,7 +1624,7 @@ async def send_help(ctx):
16241624
16251625### Set preference
16261626@bot .command (name = 'set' , aliases = ['turn' ])
1627- @commands .has_role ( to_id )
1627+ @commands .check ( is_owner_or_to )
16281628async def set_preference (ctx , arg1 , arg2 ):
16291629 with open (preferences_path , 'r+' ) as f : preferences = yaml .full_load (f )
16301630
@@ -1655,7 +1655,7 @@ async def set_preference(ctx, arg1, arg2):
16551655
16561656### See preferences
16571657@bot .command (name = 'settings' , aliases = ['preferences' , 'config' ])
1658- @commands .has_role ( to_id )
1658+ @commands .check ( is_owner_or_to )
16591659async def check_settings (ctx ):
16601660 with open (preferences_path , 'r+' ) as f : preferences = yaml .full_load (f )
16611661
0 commit comments