summaryrefslogtreecommitdiff
path: root/commands.py
diff options
context:
space:
mode:
Diffstat (limited to 'commands.py')
-rw-r--r--commands.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/commands.py b/commands.py
index 5bef7fa..2739445 100644
--- a/commands.py
+++ b/commands.py
@@ -36,6 +36,7 @@ async def init(ctx: commands.Context):
@commands.command(help=f'destruct all {config.NAME} channels', aliases=('kill', 'desctruction', 'genocide', '-'))
async def destroy(ctx: commands.Context):
+ await stop(ctx)
futures = []
meta_channel = ctx.bot.get_meta_channel(ctx)
for channel in (ctx.bot.get_lobby_channel(ctx, meta_channel), meta_channel):
@@ -70,7 +71,18 @@ async def shuffle(ctx: commands.Context, channel_size=2):
for i, _ in enumerate(ctx.bot.pair_channels):
slots.extend([i] * channel_size)
random.shuffle(slots)
- futures = [members.pop().move_to(ctx.bot.pair_channels[slot]) for slot in slots]
+ futures = []
+ group_members = [[] for _ in ctx.bot.pair_channels]
+ slot_members = []
+ for slot in slots:
+ member = members.pop()
+ channel = ctx.bot.pair_channels[slot]
+ futures.append(member.move_to(channel))
+ group_members[slot].append(member)
+ slot_members.append(member)
+ for member, slot in zip(slot_members, slots):
+ group = group_members[slot]
+ await ctx.bot.send_panel(ctx, member, group)
if members:
await answer(ctx, 'warning: not all members got shuffeled')
await await_n(futures)