diff options
| author | 2019-04-03 15:28:14 +0100 | |
|---|---|---|
| committer | 2019-04-03 15:28:14 +0100 | |
| commit | 87a2c0fcd6919cb236645df6da284c8b4e8fe6dc (patch) | |
| tree | 118b230efe090a77dab2546e28d631dd167c0212 | |
| parent | Apply suggestions from code review (diff) | |
More suggestions from code review
Co-Authored-By: scragly <[email protected]>
Diffstat (limited to '')
| -rw-r--r-- | bot/seasons/easter/egg_decorating.py | 17 | 
1 files changed, 9 insertions, 8 deletions
diff --git a/bot/seasons/easter/egg_decorating.py b/bot/seasons/easter/egg_decorating.py index fbbd09f5..b5f3e428 100644 --- a/bot/seasons/easter/egg_decorating.py +++ b/bot/seasons/easter/egg_decorating.py @@ -56,14 +56,15 @@ class EggDecorating(commands.Cog):              return await ctx.send("You must include at least 2 colours!")          invalid = [] -        converted = [] -        for c in colours: -            try: -                colour = await commands.ColourConverter().convert(ctx, c) -                # Attempts to convert the arguments into discord.Colour -                converted.append(colour) -            except commands.BadArgument: -                invalid.append(c) +        colours = list(colours) +        for idx, colour in enumerate(colours): +            if isinstance(colour, discord.Colour): +                continue +            value = self.replace_invalid(colour) +            if value: +                colours[idx] = discord.Colour(value) +            else: +                invalid.append(colour)          if len(invalid) > 1:              return await ctx.send(f"Sorry, I don't know these colours: {' '.join(invalid)}")  |