|
|
@ -29,7 +29,7 @@ from typing import Optional, TYPE_CHECKING |
|
|
|
from .utils import MISSING, cached_slot_property |
|
|
|
from .mixins import Hashable |
|
|
|
from .errors import InvalidArgument |
|
|
|
from .enums import StagePrivacyLevel, try_enum |
|
|
|
from .enums import PrivacyLevel, try_enum |
|
|
|
|
|
|
|
__all__ = ( |
|
|
|
'StageInstance', |
|
|
@ -71,7 +71,7 @@ class StageInstance(Hashable): |
|
|
|
The ID of the channel that the stage instance is running in. |
|
|
|
topic: :class:`str` |
|
|
|
The topic of the stage instance. |
|
|
|
privacy_level: :class:`StagePrivacyLevel` |
|
|
|
privacy_level: :class:`PrivacyLevel` |
|
|
|
The privacy level of the stage instance. |
|
|
|
discoverable_disabled: :class:`bool` |
|
|
|
Whether discoverability for the stage instance is disabled. |
|
|
@ -97,7 +97,7 @@ class StageInstance(Hashable): |
|
|
|
self.id: int = int(data['id']) |
|
|
|
self.channel_id: int = int(data['channel_id']) |
|
|
|
self.topic: str = data['topic'] |
|
|
|
self.privacy_level: StagePrivacyLevel = try_enum(StagePrivacyLevel, data['privacy_level']) |
|
|
|
self.privacy_level: PrivacyLevel = try_enum(PrivacyLevel, data.get('privacy_level', 2)) |
|
|
|
self.discoverable_disabled: bool = data.get('discoverable_disabled', False) |
|
|
|
|
|
|
|
def __repr__(self) -> str: |
|
|
@ -115,9 +115,9 @@ class StageInstance(Hashable): |
|
|
|
return self._state.get_channel(self.channel_id) # type: ignore |
|
|
|
|
|
|
|
def is_public(self) -> bool: |
|
|
|
return self.privacy_level is StagePrivacyLevel.public |
|
|
|
return self.privacy_level is PrivacyLevel.public |
|
|
|
|
|
|
|
async def edit(self, *, topic: str = MISSING, privacy_level: StagePrivacyLevel = MISSING, reason: Optional[str] = None) -> None: |
|
|
|
async def edit(self, *, topic: str = MISSING, privacy_level: PrivacyLevel = MISSING, reason: Optional[str] = None) -> None: |
|
|
|
"""|coro| |
|
|
|
|
|
|
|
Edits the stage instance. |
|
|
@ -129,7 +129,7 @@ class StageInstance(Hashable): |
|
|
|
----------- |
|
|
|
topic: :class:`str` |
|
|
|
The stage instance's new topic. |
|
|
|
privacy_level: :class:`StagePrivacyLevel` |
|
|
|
privacy_level: :class:`PrivacyLevel` |
|
|
|
The stage instance's new privacy level. |
|
|
|
reason: :class:`str` |
|
|
|
The reason the stage instance was edited. Shows up on the audit log. |
|
|
@ -149,7 +149,7 @@ class StageInstance(Hashable): |
|
|
|
payload['topic'] = topic |
|
|
|
|
|
|
|
if privacy_level is not MISSING: |
|
|
|
if not isinstance(privacy_level, StagePrivacyLevel): |
|
|
|
if not isinstance(privacy_level, PrivacyLevel): |
|
|
|
raise InvalidArgument('privacy_level field must be of type PrivacyLevel') |
|
|
|
|
|
|
|
payload['privacy_level'] = privacy_level.value |
|
|
|