43 lines
1.1 KiB
Python
43 lines
1.1 KiB
Python
from dataclasses import asdict, dataclass
|
|
from typing import Optional, Union
|
|
|
|
|
|
@dataclass
|
|
class PycordGuildRoles:
|
|
__slots__ = (
|
|
"moderator",
|
|
"verified",
|
|
"failed",
|
|
"additional",
|
|
)
|
|
|
|
moderator: Union[int, None]
|
|
verified: Union[int, None]
|
|
failed: Union[int, None]
|
|
additional: Union[int, None]
|
|
|
|
def __init__(
|
|
self,
|
|
moderator: Optional[int] = None,
|
|
verified: Optional[int] = None,
|
|
failed: Optional[int] = None,
|
|
additional: Optional[int] = None,
|
|
) -> None:
|
|
self.moderator = moderator
|
|
self.verified = verified
|
|
self.failed = failed
|
|
self.additional = additional
|
|
|
|
def dict(self):
|
|
return {key: value for key, value in asdict(self).items()}
|
|
|
|
def is_valid(self) -> bool:
|
|
"""Check if all attributes are not `None` and return boolean of that.
|
|
|
|
### Returns:
|
|
* `bool`: `True` if all attributes are there and `False` if not
|
|
"""
|
|
return bool(
|
|
self.moderator and self.verified and self.failed and self.additional
|
|
)
|