diff --git a/crimsobot/cogs/utilities.py b/crimsobot/cogs/utilities.py index 30dd2895..e6e3fd55 100644 --- a/crimsobot/cogs/utilities.py +++ b/crimsobot/cogs/utilities.py @@ -1,6 +1,7 @@ import asyncio import logging from datetime import datetime +from random import randint from typing import List, Optional, Tuple import discord @@ -169,9 +170,11 @@ async def ping(self, ctx: commands.Context) -> None: await msg.edit(content='<:ping:569954524932997122>...{:d}ms'.format(int(ping))) @commands.command() - async def color(self, ctx: commands.Context, hex_value: discord.Colour) -> None: - """Get color sample from hex value.""" + async def color(self, ctx: commands.Context, hex_value: Optional[discord.Colour] = None) -> None: + """Get color sample from hex value, or generate random color if not given input.""" + if hex_value is None: + hex_value = '#%06x' % randint(0, 0xFFFFFF) fp = imagetools.make_color_img(str(hex_value)) await ctx.send( '**' + str(hex_value) + '**',