diff options
| author | Io Mintz <[email protected]> | 2020-04-20 14:59:58 -0500 |
|---|---|---|
| committer | GitHub <[email protected]> | 2020-04-20 14:59:58 -0500 |
| commit | a8baf0c9f0a23e169a094fe0dfa0e587dd9dfe94 (patch) | |
| tree | 709713a653fc9399c07d5bb06d6df8fb80de5ceb /discord/flags.py | |
| parent | Convert id parameter of Object into int or raise TypeError on failure (diff) | |
| download | discord.py-a8baf0c9f0a23e169a094fe0dfa0e587dd9dfe94.tar.xz discord.py-a8baf0c9f0a23e169a094fe0dfa0e587dd9dfe94.zip | |
flags: support accessing flag value instances on the class
Fixes #4023
Diffstat (limited to 'discord/flags.py')
| -rw-r--r-- | discord/flags.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/discord/flags.py b/discord/flags.py index 62460098..ff0c10c1 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 '<flag_value flag={.flag!r}>'.format(self) + def fill_with_flags(*, inverted=False): def decorator(cls): cls.VALID_FLAGS = { |