From f3da10ec9867cda0c304fc1dbdaee97e67da4f54 Mon Sep 17 00:00:00 2001 From: palmtree5 <3577255+palmtree5@users.noreply.github.com> Date: Sun, 17 Dec 2017 16:45:08 -0900 Subject: [PATCH] [V3 Utils] add embed utils with a random_colour function (#1164) * [V3 Utils] add embed utils with a random_colour function * [V3 Utils] random_colour -> randomize_colour + make it take an embed * [V3 Utils] decomplicate the random color selection --- redbot/core/utils/embed.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 redbot/core/utils/embed.py diff --git a/redbot/core/utils/embed.py b/redbot/core/utils/embed.py new file mode 100644 index 000000000..ede53c780 --- /dev/null +++ b/redbot/core/utils/embed.py @@ -0,0 +1,26 @@ +import discord + +import random + + +def randomize_colour(embed: discord.Embed) -> discord.Embed: + """ + Gives the provided embed a random color. + There is an alias for this called randomize_color + + Parameters + ---------- + embed : discord.Embed + The embed to add a color to + + Returns + ------- + discord.Embed + The embed with the color set to a random color + + """ + embed.colour = discord.Color(value=random.randint(0x000000, 0xFFFFFF)) + return embed + + +randomize_color = randomize_colour