mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-07-04 01:00:00 +00:00
Add __bool__ for flags
This commit is contained in:
parent
7da2048d1a
commit
747091d4a2
@ -145,6 +145,9 @@ class BaseFlags:
|
|||||||
max_value = -1 + (2**max_bits)
|
max_value = -1 + (2**max_bits)
|
||||||
return self._from_value(self.value ^ max_value)
|
return self._from_value(self.value ^ max_value)
|
||||||
|
|
||||||
|
def __bool__(self) -> bool:
|
||||||
|
return self.value != self.DEFAULT_VALUE
|
||||||
|
|
||||||
def __eq__(self, other: object) -> bool:
|
def __eq__(self, other: object) -> bool:
|
||||||
return isinstance(other, self.__class__) and self.value == other.value
|
return isinstance(other, self.__class__) and self.value == other.value
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user