Closed NegativeZero000 closed 6 years ago
In rewrite, it's written like this:
def __init__(self, value):
if not isinstance(value, int):
raise TypeError('Expected int parameter, received %s instead.' % value.__class__.__name__)
self.value = value
So it does do a type check before setting itself.
Only issue that would happen is if someone tried to manually change .value
itself directly, which I don't think is intended as far as i know?
Right this is fixed already.
Manually setting is unsupported however.
I don't know if this is a bug or status by design but I was trying to randomize embed colours and was passing string based hex values to
discord.colour
I had assumed that this was working fine since there was not error thrown at declaration. However using that code netted me a HTTP 400 error on submission. I have since changed it to
Which works exactly how I wanted it to. I would have done that in the first place if the data I passed it was rejected. I was reading http://discordpy.readthedocs.io/en/latest/api.html?highlight=colour#discord.Embed.colour which is why I thought about using
.Colour()
. FYI I am not great at Python but looking at colour.py I noticed this for the constructorYes, the docs for Colour support that it should be int. Should there not be some data validation there or no? I am told, in #help, that this is not an issue in the rewrite branch.