diff options
author | NatrixAeria <upezu@student.kit.edu> | 2020-10-15 21:33:14 +0200 |
---|---|---|
committer | NatrixAeria <upezu@student.kit.edu> | 2020-10-15 21:33:59 +0200 |
commit | 4c5f5101265238707c584979b25cdbd01bcf0d18 (patch) | |
tree | 6e7e35eca0dcefc62c39a363e32d29ea090feaf0 /commands.py | |
parent | 7a5778de58e371ff7f96f3dc1d2dc58854a3eb1d (diff) |
Add a panel for game members
Diffstat (limited to 'commands.py')
-rw-r--r-- | commands.py | 14 |
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) |