Beispiel #1
0
async def clean_all_command(ctx, *args):
    async with ctx.channel.typing():
        excluded_groups = hpf.get_excluded_groups(*args)
        groups_to_be_cleaned = [group for group in hpf.all_existing_lab_groups(ctx.guild)
                                if hpf.get_lab_group_number(group.name) not in excluded_groups and is_open_group(ctx.guild, group)]
        for group in sorted(groups_to_be_cleaned, key=lambda c: c.name, reverse=False):
            await aux_clean_group(ctx, group.name)
async def aux_random_join(ctx, member_mention: discord.Member, *args):
    member = discord.utils.get(ctx.message.mentions, name=member_mention.name)
    excluded_groups = hpf.get_excluded_groups(*args)
    if not member:
        await ctx.send(btm.message_member_not_exists(member_mention.nick))
    elif not excluded_groups:
        await ctx.send("All extra arguments should be integers!")
    else:
        available_lab_groups = []
        for group in hpf.all_existing_lab_groups(ctx.guild):
            group_number = hpf.get_lab_group_number(group.name)
            if group_number and group not in excluded_groups and is_open_group(
                    ctx.guild, group):
                available_lab_groups.append(group)
        await random_assignment(ctx, member, available_lab_groups)
Beispiel #3
0
async def aux_random_join_all(ctx, *args):
    # Get excluded groups
    excluded_groups = hpf.get_excluded_groups(*args)
    #if not excluded_groups:
    #    await ctx.send("All extra arguments should be integers for excluded groups.")
    #    return
    # Get available groups
    available_lab_groups = []
    for group in hpf.all_existing_lab_groups(ctx.guild):
        group_number = hpf.get_lab_group_number(group.name)
        if group_number and group not in excluded_groups and is_open_group(
                ctx.guild, group):
            available_lab_groups.append(group)
    no_group_members = hpf.all_students_with_no_group(ctx.guild)
    # Assign groups
    for member in no_group_members:
        # if member.status == discord.Status.online:
        available_lab_groups = await random_assignment(ctx, member,
                                                       available_lab_groups)