This commit is contained in:
iDutchy 2020-10-01 21:53:49 +00:00
parent 1c228f9548
commit 0860df8fa5

View File

@ -285,15 +285,19 @@ class Client:
@embed_color.setter @embed_color.setter
def embed_color(self, value): def embed_color(self, value):
HEX = re.compile(r'^(0x)[A-Fa-f0-9]{6}$')
if isinstance(value, (Color, Colour)): if isinstance(value, (Color, Colour)):
self._embed_color = hex(value) self._embed_color = str(value)
os.environ['DEFAULT_EMBED_COLOR'] = str(hex(value))
elif HEX.match(str(value)):
self._embed_color = value
os.environ['DEFAULT_EMBED_COLOR'] = str(value) os.environ['DEFAULT_EMBED_COLOR'] = str(value)
else: else:
raise TypeError('embed_color must be an instance of discord.Colour or a valid 0x****** hex value.') try:
HEX = re.compile(r'^(#)[A-Fa-f0-9]{6}$')
col = str(Color(value))
if HEX.match(col):
self._embed_color = col
os.environ['DEFAULT_EMBED_COLOR'] = str(col)
except:
raise TypeError('embed_color must be an instance of discord.Colour or a valid 0x****** hex value.')
@property @property
def latency(self): def latency(self):