cogs/color/assignment.py
async def color_server(self, ctx, *, color: utils.ColorConverter = None):
        """Gather all of the uncolored users and assigns them a color"""

        output_suppressed = ctx.guild.id in cfg.suppress_output
        colors = db.get(ctx.guild.id, "colors")  # Fetch colors

        if not colors:
            raise CommandError("There are no active colors")

        cfg.heavy_command_active.add(ctx.guild.id)  # begin heavy command

        # get uncolored members
        uncolored = [member for member in ctx.guild.members
                     if not utils.find_user_color(member, colors)]

        # Send working message
        if not output_suppressed:
            embed = discord.Embed(title=f"Creating Roles {loading_emoji()}")
            msg = await ctx.send(embed=embed)

        # color generator for splashing
        colors = [color] if color else colors  # One color needed if color arg
        index = random.randrange(len(colors))  # random index in colors
        sliced_colors = colors[index:] + colors[:index]

        # Loop over all colors that will be applied and create roles
        for color in sliced_colors[:len(uncolored)]:
            if not color["role"]:
                role = await self.create_role(ctx.guild, color)
                color["role"] = role.id

        # Send progress update
        if not output_suppressed:
            embed = discord.Embed(
                title=f"Coloring {len(uncolored)} People {loading_emoji()}",
                description=f"This will take around {len(uncolored)} seconds"
            )
            await msg.edit(embed=embed)

        # Loop and color every member sleeping a bit inbetween
        for color, member in zip(cycle(sliced_colors), uncolored):
            await self.color(member, color)
            await asyncio.sleep(1)

        cfg.heavy_command_active.discard(ctx.guild.id)

        # Send success message
        if not output_suppressed:
            embed = discord.Embed(
                title=f"Colored {len(uncolored)} members {check_emoji()}",
                color=discord.Color.green()
            )
            await msg.edit(embed=embed)
Gather all of the uncolored users and assigns them a color
Gather all of the uncolored users and assigns them a color
Gather all of the uncolored users and assigns them a color
async def color_server(self, ctx, *, color: utils.ColorConverter = None):
        output_suppressed = ctx.guild.id in cfg.suppress_output
        colors = db.get(ctx.guild.id, "colors")  
        if not colors:
            raise CommandError("There are no active colors")
        cfg.heavy_command_active.add(ctx.guild.id)  
        uncolored = [member for member in ctx.guild.members
                     if not utils.find_user_color(member, colors)]
        if not output_suppressed:
            embed = discord.Embed(title=f"Creating Roles {loading_emoji()}")
            msg = await ctx.send(embed=embed)
        colors = [color] if color else colors  
        index = random.randrange(len(colors))  
        sliced_colors = colors[index:] + colors[:index]
        for color in sliced_colors[:len(uncolored)]:
            if not color["role"]:
                role = await self.create_role(ctx.guild, color)
                color["role"] = role.id
        if not output_suppressed:
            embed = discord.Embed(
                title=f"Coloring {len(uncolored)} People {loading_emoji()}",
                description=f"This will take around {len(uncolored)} seconds"
            )
            await msg.edit(embed=embed)
        for color, member in zip(cycle(sliced_colors), uncolored):
            await self.color(member, color)
            await asyncio.sleep(1)
        cfg.heavy_command_active.discard(ctx.guild.id)
        if not output_suppressed:
            embed = discord.Embed(
                title=f"Colored {len(uncolored)} members {check_emoji()}",
                color=discord.Color.green()
            )
            await msg.edit(embed=embed)
async def color_server ( self , ctx , * , color : utils . ColorConverter = None ) : output_suppressed = ctx . guild . id in cfg . suppress_output colors = db . get ( ctx . guild . id , "colors" ) if not colors : raise CommandError ( "There are no active colors" ) cfg . heavy_command_active . add ( ctx . guild . id ) uncolored = [ member for member in ctx . guild . members if not utils . find_user_color ( member , colors ) ] if not output_suppressed : embed = discord . Embed ( title = f"Creating Roles {loading_emoji()}" ) msg = await ctx . send ( embed = embed ) colors = [ color ] if color else colors index = random . randrange ( len ( colors ) ) sliced_colors = colors [ index : ] + colors [ : index ] for color in sliced_colors [ : len ( uncolored ) ] : if not color [ "role" ] : role = await self . create_role ( ctx . guild , color ) color [ "role" ] = role . id if not output_suppressed : embed = discord . Embed ( title = f"Coloring {len(uncolored)} People {loading_emoji()}" , description = f"This will take around {len(uncolored)} seconds" ) await msg . edit ( embed = embed ) for color , member in zip ( cycle ( sliced_colors ) , uncolored ) : await self . color ( member , color ) await asyncio . sleep ( 1 ) cfg . heavy_command_active . discard ( ctx . guild . id ) if not output_suppressed : embed = discord . Embed ( title = f"Colored {len(uncolored)} members {check_emoji()}" , color = discord . Color . green ( ) ) await msg . edit ( embed = embed )
Gather all of the uncolored users and assigns them a color
Gather all of the uncolored users and assigns them a color
"""Gather all of the uncolored users and assigns them a color""" # Fetch colors # begin heavy command # get uncolored members # Send working message # color generator for splashing # One color needed if color arg # random index in colors # Loop over all colors that will be applied and create roles # Send progress update # Loop and color every member sleeping a bit inbetween # Send success message
self
ctx
color
utils.ColorConverter