32 lines
892 B
Python
32 lines
892 B
Python
|
from dataclasses import asdict, dataclass
|
||
|
from typing import Optional, Union
|
||
|
|
||
|
|
||
|
@dataclass
|
||
|
class PycordGuildChannels:
|
||
|
__slots__ = ("captcha", "logging", "welcome")
|
||
|
captcha: Union[int, None]
|
||
|
logging: Union[int, None]
|
||
|
welcome: Union[int, None]
|
||
|
|
||
|
def __init__(
|
||
|
self,
|
||
|
captcha: Optional[int] = None,
|
||
|
logging: Optional[int] = None,
|
||
|
welcome: Optional[int] = None,
|
||
|
) -> None:
|
||
|
self.captcha = captcha
|
||
|
self.logging = logging
|
||
|
self.welcome = welcome
|
||
|
|
||
|
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.captcha and self.logging and self.welcome)
|