blob: e2625bcb977c3db0e71780d85d89a0e4dcecb97d (
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
|
from discord.flags import get_flags, Flags
from discord.premium_type import PremiumType
class User:
_id: str
_username: str
_discriminator: str
_avatar: str
_bot: bool
_system: bool
_mfa_enabled: bool
_banner: str
_accent_color: int
_locale: str
_verified: bool
_email: str
_pronouns: str
_bio: str
_flags: list[Flags]
_premium_type: PremiumType
_public_flags: list[Flags]
@property
def id(self):
"""The user's ID."""
return self._id
@property
def username(self):
"""The user's username. This is not unique."""
return self._username
@property
def discriminator(self):
"""The user's 4-digit tag."""
return self._discriminator
@property
def avatar(self):
"""The user's avatar hash."""
return self._avatar
@property
def bot(self):
"""Whether the user is a bot."""
return self._bot
@property
def pronouns(self):
"""The user's pronouns (not yet implemented into Discord frontend)."""
return self._pronouns
@property
def bio(self):
"""The contents of the user's About Me section."""
return self._bio
@property
def system(self):
"""Whether the user is an Official Discord System user (for urgent messages)."""
return self._system
@property
def mfa_enabled(self):
"""Whether the user has 2FA set up."""
return self._mfa_enabled
@property
def banner(self):
"""The user's banner hash."""
return self._banner
@property
def accent_color(self):
"""The user's banner color."""
return self._accent_color
@property
def locale(self):
"""The user's chosen language."""
return self._locale
@property
def verified(self):
"""Whether the email on the user's account is verified."""
return self._verified
@property
def email(self):
"""The user's email."""
return self._email
@property
def flags(self):
"""The flags on the user's account."""
return self._flags
@property
def premium_type(self):
"""The type of Nitro subscription on a user's account."""
return self._premium_type
@property
def public_flags(self):
"""The public flags on a user's account."""
return self._public_flags
def __init__(self, data: dict):
for k in data:
if k == "flags" or k == "public_flags":
setattr(self, f"_{k}", get_flags(data[k]))
elif k == "premium_type":
setattr(self, f"_{k}", PremiumType(data[k]))
else:
setattr(self, f"_{k}", data[k])
def __repr__(self) -> str:
return f"<User id={self.id} username={self.username} discriminator={self.discriminator}>"
|