mirror of
https://github.com/MelisaDev/melisa.git
synced 2024-11-11 19:07:28 +03:00
opps
This commit is contained in:
parent
f8fb32df94
commit
03b67640a3
2 changed files with 29 additions and 39 deletions
|
@ -2,11 +2,10 @@ from __future__ import annotations
|
||||||
|
|
||||||
from enum import IntEnum
|
from enum import IntEnum
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
|
from typing import Optional
|
||||||
|
|
||||||
from ...utils.api_object import APIObjectBase
|
from ...utils.api_object import APIObjectBase
|
||||||
from ...utils.snowflake import Snowflake
|
from ...utils.snowflake import Snowflake
|
||||||
from ...utils.types import MISSING
|
|
||||||
from ...utils.types import APINullable
|
|
||||||
|
|
||||||
|
|
||||||
class PremiumTypes(IntEnum):
|
class PremiumTypes(IntEnum):
|
||||||
|
@ -26,6 +25,9 @@ class PremiumTypes(IntEnum):
|
||||||
NITRO_CLASSIC = 1
|
NITRO_CLASSIC = 1
|
||||||
NITRO = 2
|
NITRO = 2
|
||||||
|
|
||||||
|
def __int__(self):
|
||||||
|
return self.value
|
||||||
|
|
||||||
|
|
||||||
class UserFlags(IntEnum):
|
class UserFlags(IntEnum):
|
||||||
"""Profile Icons
|
"""Profile Icons
|
||||||
|
@ -80,6 +82,8 @@ class UserFlags(IntEnum):
|
||||||
CERTIFIED_MODERATOR = 1 << 18
|
CERTIFIED_MODERATOR = 1 << 18
|
||||||
BOT_HTTP_INTERACTIONS = 1 << 19
|
BOT_HTTP_INTERACTIONS = 1 << 19
|
||||||
|
|
||||||
|
def __int__(self):
|
||||||
|
return self.value
|
||||||
|
|
||||||
class VisibilityTypes(IntEnum):
|
class VisibilityTypes(IntEnum):
|
||||||
"""The type of connection visibility.
|
"""The type of connection visibility.
|
||||||
|
@ -95,6 +99,8 @@ class VisibilityTypes(IntEnum):
|
||||||
NONE = 0
|
NONE = 0
|
||||||
EVERYONE = 1
|
EVERYONE = 1
|
||||||
|
|
||||||
|
def __int__(self):
|
||||||
|
return self.value
|
||||||
|
|
||||||
@dataclass(repr=False)
|
@dataclass(repr=False)
|
||||||
class User(APIObjectBase):
|
class User(APIObjectBase):
|
||||||
|
@ -134,36 +140,36 @@ class User(APIObjectBase):
|
||||||
the public flags on a user's account
|
the public flags on a user's account
|
||||||
"""
|
"""
|
||||||
|
|
||||||
id: APINullable[Snowflake] = MISSING
|
id: Optional[Snowflake] = None
|
||||||
username: APINullable[str] = MISSING
|
username: Optional[str] = None
|
||||||
discriminator: APINullable[str] = MISSING
|
discriminator: Optional[str] = None
|
||||||
avatar: APINullable[str] = MISSING
|
avatar: Optional[str] = None
|
||||||
bot: APINullable[bool] = MISSING
|
bot: Optional[bool] = None
|
||||||
system: APINullable[bool] = MISSING
|
system: Optional[bool] = None
|
||||||
mfa_enabled: APINullable[bool] = MISSING
|
mfa_enabled: Optional[bool] = None
|
||||||
banner: APINullable[str] = MISSING
|
banner: Optional[str] = None
|
||||||
accent_color = APINullable[int] = MISSING
|
accent_color: Optional[int] = None
|
||||||
local = APINullable[str] = MISSING
|
local: Optional[str] = None
|
||||||
verified = APINullable[bool] = MISSING
|
verified: Optional[bool] = None
|
||||||
email = APINullable[str] = MISSING
|
email: Optional[str] = None
|
||||||
flags = APINullable[int] = MISSING
|
flags: Optional[int] = None
|
||||||
premium_type = APINullable[int] = MISSING
|
premium_type: Optional[int] = None
|
||||||
public_flags = APINullable[int] = MISSING
|
public_flags: Optional[int] = None
|
||||||
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def premium(self) -> APINullable[PremiumTypes]:
|
def premium(self) -> Optional[PremiumTypes]:
|
||||||
return (
|
return (
|
||||||
MISSING
|
None
|
||||||
if self.premium_type is MISSING
|
if self.premium_type is None
|
||||||
else PremiumTypes(self.premium_type)
|
else PremiumTypes(self.premium_type)
|
||||||
)
|
)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def flags(self) -> APINullable[UserFlags]:
|
def flags(self) -> Optional[UserFlags]:
|
||||||
return(
|
return(
|
||||||
MISSING
|
None
|
||||||
if self.flags is MISSING
|
if self.flags is None
|
||||||
else UserFlags(self.flags)
|
else UserFlags(self.flags)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -3,22 +3,6 @@ from __future__ import annotations
|
||||||
from typing import TypeVar, Callable, Coroutine, Any, Union
|
from typing import TypeVar, Callable, Coroutine, Any, Union
|
||||||
|
|
||||||
|
|
||||||
class MissingType:
|
|
||||||
|
|
||||||
def __repr__(self):
|
|
||||||
return "<MISSING>"
|
|
||||||
|
|
||||||
def __bool__(self) -> bool:
|
|
||||||
return False
|
|
||||||
|
|
||||||
def __eq__(self, __o: object) -> bool:
|
|
||||||
return __o is MISSING
|
|
||||||
|
|
||||||
def __hash__(self) -> int:
|
|
||||||
return hash(None)
|
|
||||||
|
|
||||||
MISSING = MissingType()
|
|
||||||
|
|
||||||
T = TypeVar("T")
|
T = TypeVar("T")
|
||||||
|
|
||||||
Coro = TypeVar("Coro", bound=Callable[..., Coroutine[Any, Any, Any]])
|
Coro = TypeVar("Coro", bound=Callable[..., Coroutine[Any, Any, Any]])
|
||||||
|
|
Loading…
Reference in a new issue