From a8baf0c9f0a23e169a094fe0dfa0e587dd9dfe94 Mon Sep 17 00:00:00 2001 From: Io Mintz Date: Mon, 20 Apr 2020 14:59:58 -0500 Subject: [PATCH] flags: support accessing flag value instances on the class Fixes #4023 --- discord/flags.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/discord/flags.py b/discord/flags.py index 624600983..ff0c10c12 100644 --- a/discord/flags.py +++ b/discord/flags.py @@ -35,11 +35,16 @@ class flag_value: self.__doc__ = func.__doc__ def __get__(self, instance, owner): + if instance is None: + return self return instance._has_flag(self.flag) def __set__(self, instance, value): instance._set_flag(self.flag, value) + def __repr__(self): + return ''.format(self) + def fill_with_flags(*, inverted=False): def decorator(cls): cls.VALID_FLAGS = {