Skip to content
This repository has been archived by the owner on Oct 18, 2020. It is now read-only.

Commit

Permalink
add swapstream command
Browse files Browse the repository at this point in the history
  • Loading branch information
Wonderfall committed Apr 24, 2020
1 parent 7bc39be commit 2aee3d5
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
18 changes: 18 additions & 0 deletions bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -1151,6 +1151,24 @@ async def remove_stream(ctx, *args: int):
await ctx.message.add_reaction("✅")


### Interchanger 2 sets de la stream queue
@bot.command(name='swapstream', aliases=['sws'])
@commands.has_role(streamer_id)
@commands.check(tournament_is_underway_or_pending)
@commands.check(is_streaming)
async def swap_stream(ctx, arg1: int, arg2: int):
with open(stream_path, 'r+') as f: stream = json.load(f, object_pairs_hook=int_keys)

try:
x, y = stream[ctx.author.id]["queue"].index(arg1), stream[ctx.author.id]["queue"].index(arg2)
except ValueError:
await ctx.message.add_reaction("⚠️")
else:
stream[ctx.author.id]["queue"][y], stream[ctx.author.id]["queue"][x] = stream[ctx.author.id]["queue"][x], stream[ctx.author.id]["queue"][y]
with open(stream_path, 'w') as f: json.dump(stream, f, indent=4)
await ctx.message.add_reaction("✅")


### Infos stream
@bot.command(name='mystream', aliases=['ms'])
@commands.has_role(streamer_id)
Expand Down
1 change: 1 addition & 0 deletions utils/raw_texts.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
:white_small_square: `{bot_prefix}setstream` : mettre en place les codes d'accès au stream *(paramètres jeu-dépendant)*.
:white_small_square: `{bot_prefix}addstream` : ajouter un set à la stream queue *(paramètre : n° | liste de n°)*.
:white_small_square: `{bot_prefix}rmstream` : retirer un set de la stream queue *(paramètre : n° | liste de n°)*.
:white_small_square: `{bot_prefix}swapstream` : interchanger deux sets de la stream queue *(paramètres : n°1 | n°2)*.
"""

lag_text=f"""
Expand Down

0 comments on commit 2aee3d5

Please sign in to comment.