about summary refs log tree commit diff stats
path: root/discord/flags.py
blob: 65a9253e999b34a6c7d37f7453d88f4d415d1251 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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