|
|
@ -24,15 +24,19 @@ DEALINGS IN THE SOFTWARE. |
|
|
|
|
|
|
|
from __future__ import annotations |
|
|
|
|
|
|
|
from typing import TYPE_CHECKING, Optional |
|
|
|
from typing import List, TYPE_CHECKING, Optional |
|
|
|
|
|
|
|
from . import utils |
|
|
|
from .asset import Asset |
|
|
|
|
|
|
|
if TYPE_CHECKING: |
|
|
|
from .guild import Guild |
|
|
|
from .types.appinfo import AppInfo as AppInfoPayload, PartialAppInfo as PartialAppInfoPayload |
|
|
|
|
|
|
|
from .types.appinfo import ( |
|
|
|
AppInfo as AppInfoPayload, |
|
|
|
PartialAppInfo as PartialAppInfoPayload, |
|
|
|
Team as TeamPayload, |
|
|
|
) |
|
|
|
from .user import User |
|
|
|
from .state import ConnectionState |
|
|
|
|
|
|
|
__all__ = ( |
|
|
@ -131,32 +135,32 @@ class AppInfo: |
|
|
|
'privacy_policy_url', |
|
|
|
) |
|
|
|
|
|
|
|
def __init__(self, state, data: AppInfoPayload): |
|
|
|
def __init__(self, state: ConnectionState, data: AppInfoPayload): |
|
|
|
from .team import Team |
|
|
|
|
|
|
|
self._state = state |
|
|
|
self.id = int(data['id']) |
|
|
|
self.name = data['name'] |
|
|
|
self.description = data['description'] |
|
|
|
self._icon = data['icon'] |
|
|
|
self.rpc_origins = data['rpc_origins'] |
|
|
|
self.bot_public = data['bot_public'] |
|
|
|
self.bot_require_code_grant = data['bot_require_code_grant'] |
|
|
|
self.owner = state.store_user(data['owner']) |
|
|
|
self._state: ConnectionState = state |
|
|
|
self.id: int = int(data['id']) |
|
|
|
self.name: str = data['name'] |
|
|
|
self.description: str = data['description'] |
|
|
|
self._icon: Optional[str] = data['icon'] |
|
|
|
self.rpc_origins: List[str] = data['rpc_origins'] |
|
|
|
self.bot_public: bool = data['bot_public'] |
|
|
|
self.bot_require_code_grant: bool = data['bot_require_code_grant'] |
|
|
|
self.owner: User = state.store_user(data['owner']) |
|
|
|
|
|
|
|
team = data.get('team') |
|
|
|
self.team = Team(state, team) if team else None |
|
|
|
team: Optional[TeamPayload] = data.get('team') |
|
|
|
self.team: Optional[Team] = Team(state, team) if team else None |
|
|
|
|
|
|
|
self.summary = data['summary'] |
|
|
|
self.verify_key = data['verify_key'] |
|
|
|
self.summary: str = data['summary'] |
|
|
|
self.verify_key: str = data['verify_key'] |
|
|
|
|
|
|
|
self.guild_id = utils._get_as_snowflake(data, 'guild_id') |
|
|
|
self.guild_id: Optional[int] = utils._get_as_snowflake(data, 'guild_id') |
|
|
|
|
|
|
|
self.primary_sku_id = utils._get_as_snowflake(data, 'primary_sku_id') |
|
|
|
self.slug = data.get('slug') |
|
|
|
self._cover_image = data.get('cover_image') |
|
|
|
self.terms_of_service_url = data.get('terms_of_service_url') |
|
|
|
self.privacy_policy_url = data.get('privacy_policy_url') |
|
|
|
self.primary_sku_id: Optional[int] = utils._get_as_snowflake(data, 'primary_sku_id') |
|
|
|
self.slug: Optional[str] = data.get('slug') |
|
|
|
self._cover_image: Optional[str] = data.get('cover_image') |
|
|
|
self.terms_of_service_url: Optional[str] = data.get('terms_of_service_url') |
|
|
|
self.privacy_policy_url: Optional[str] = data.get('privacy_policy_url') |
|
|
|
|
|
|
|
def __repr__(self) -> str: |
|
|
|
return ( |
|
|
@ -221,16 +225,16 @@ class PartialAppInfo: |
|
|
|
__slots__ = ('_state', 'id', 'name', 'description', 'rpc_origins', 'summary', 'verify_key', 'terms_of_service_url', 'privacy_policy_url', '_icon') |
|
|
|
|
|
|
|
def __init__(self, *, state: ConnectionState, data: PartialAppInfoPayload): |
|
|
|
self._state = state |
|
|
|
self.id = int(data['id']) |
|
|
|
self.name = data['name'] |
|
|
|
self._icon = data.get('icon') |
|
|
|
self.description = data['description'] |
|
|
|
self.rpc_origins = data.get('rpc_origins') |
|
|
|
self.summary = data['summary'] |
|
|
|
self.verify_key = data['verify_key'] |
|
|
|
self.terms_of_service_url = data.get('terms_of_service_url') |
|
|
|
self.privacy_policy_url = data.get('privacy_policy_url') |
|
|
|
self._state: ConnectionState = state |
|
|
|
self.id: int = int(data['id']) |
|
|
|
self.name: str = data['name'] |
|
|
|
self._icon: Optional[str] = data.get('icon') |
|
|
|
self.description: str = data['description'] |
|
|
|
self.rpc_origins: Optional[List[str]] = data.get('rpc_origins') |
|
|
|
self.summary: str = data['summary'] |
|
|
|
self.verify_key: str = data['verify_key'] |
|
|
|
self.terms_of_service_url: Optional[str] = data.get('terms_of_service_url') |
|
|
|
self.privacy_policy_url: Optional[str] = data.get('privacy_policy_url') |
|
|
|
|
|
|
|
def __repr__(self) -> str: |
|
|
|
return f'<{self.__class__.__name__} id={self.id} name={self.name!r} description={self.description!r}>' |
|
|
|