mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-06 11:18:54 -05:00
[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
This commit is contained in:
parent
0debc0a4d3
commit
f3da10ec98
26
redbot/core/utils/embed.py
Normal file
26
redbot/core/utils/embed.py
Normal file
@ -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
|
||||||
Loading…
x
Reference in New Issue
Block a user