From 4c5f5101265238707c584979b25cdbd01bcf0d18 Mon Sep 17 00:00:00 2001 From: NatrixAeria Date: Thu, 15 Oct 2020 21:33:14 +0200 Subject: Add a panel for game members --- commands.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'commands.py') 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) -- cgit v1.2.3-54-g00ecf