From 747091d4a21256c946aea3be7fce189ff0c9ed5e Mon Sep 17 00:00:00 2001 From: Rapptz Date: Wed, 10 Aug 2022 22:49:49 -0400 Subject: [PATCH] Add __bool__ for flags --- discord/flags.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/discord/flags.py b/discord/flags.py index 1c2a3046e..28bdc4e9c 100644 --- a/discord/flags.py +++ b/discord/flags.py @@ -145,6 +145,9 @@ class BaseFlags: max_value = -1 + (2**max_bits) return self._from_value(self.value ^ max_value) + def __bool__(self) -> bool: + return self.value != self.DEFAULT_VALUE + def __eq__(self, other: object) -> bool: return isinstance(other, self.__class__) and self.value == other.value