diff options
author | Noah <mounderfod@gmail.com> | 2022-07-09 14:14:06 +0100 |
---|---|---|
committer | Noah <mounderfod@gmail.com> | 2022-07-09 14:14:06 +0100 |
commit | 0c7a520aa0368b9940ba3b0a2b1003456e25b04d (patch) | |
tree | f32aa25f6eae508020381e68995c160eca2d3b35 /discord/flags.py | |
parent | 5275621a5586a19a74616b69269455cc8ce5a226 (diff) | |
download | discobra-0c7a520aa0368b9940ba3b0a2b1003456e25b04d.tar.gz |
refactor(client): Use REST for `Client.user`, add enums for flags and premium type
Diffstat (limited to 'discord/flags.py')
-rw-r--r-- | discord/flags.py | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/discord/flags.py b/discord/flags.py new file mode 100644 index 0000000..65a9253 --- /dev/null +++ b/discord/flags.py @@ -0,0 +1,35 @@ +from enum import Enum, unique + + +@unique +class Flags(Enum): + STAFF = 1 + PARTNER = 2 + HYPESQUAD = 4 + BUG_HUNTER_LEVEL_1 = 8 + HYPESQUAD_ONLINE_HOUSE_1 = 64 + HYPESQUAD_ONLINE_HOUSE_2 = 128 + HYPESQUAD_ONLINE_HOUSE_3 = 256 + TEAM_PSUEDO_USER = 1024 + BUG_HUNTER_LEVEL_2 = 16384 + VERIFIED_BOT = 65536 + VERIFIED_DEVELOPER = 131072 + CERTIFIED_MODERATOR = 262144 + BOT_HTTP_INTERACTIONS = 524288 + + +def get_number(flags: list[Flags]): + number = 1 + for i in flags: + number += i.value + return number + +def get_flags(number: int): + flags = [] + while number != 0: + for i in Flags: + if number >= i.value: + flags.append(i) + number -= i.value + return flags + |