Stage instance
attrs
class
StageInstance (DiscordObject)
¶
Attr attributes:
Name | Type | Description |
---|---|---|
id |
int |
Discord unique snowflake ID |
Source code in naff/models/discord/stage_instance.py
@define
class StageInstance(DiscordObject):
topic: str = field()
privacy_level: StagePrivacyLevel = field()
discoverable_disabled: bool = field()
_guild_id: "Snowflake_Type" = field(converter=to_snowflake)
_channel_id: "Snowflake_Type" = field(converter=to_snowflake)
@property
def guild(self) -> "Guild":
return self._client.cache.get_guild(self._guild_id)
@property
def channel(self) -> "GuildStageVoice":
return self._client.cache.get_channel(self._channel_id)
async def delete(self, reason: Absent[Optional[str]] = MISSING) -> None:
"""
Delete this stage instance. Effectively closes the stage.
Args:
reason: The reason for this deletion, for the audit log
"""
await self._client.http.delete_stage_instance(self._channel_id, reason)
async
method
delete(self, reason)
¶
Delete this stage instance. Effectively closes the stage.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
reason |
Union[str, NoneType, naff.client.const.Missing] |
The reason for this deletion, for the audit log |
Missing |
Source code in naff/models/discord/stage_instance.py
async def delete(self, reason: Absent[Optional[str]] = MISSING) -> None:
"""
Delete this stage instance. Effectively closes the stage.
Args:
reason: The reason for this deletion, for the audit log
"""
await self._client.http.delete_stage_instance(self._channel_id, reason)
inherited
method
update_from_dict(self, data)
¶
Updates object attribute(s) with new json data received from discord api.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data |
The json data received from discord api. |
required |
Returns:
Type | Description |
---|---|
~T |
The updated object class instance. |
Source code in naff/models/discord/stage_instance.py
def update_from_dict(self, data) -> T:
data = self._process_dict(data, self._client)
for key, value in self._filter_kwargs(data, self._get_keys()).items():
# todo improve
setattr(self, key, value)
return self
inherited
property
readonly
created_at: models.Timestamp
¶
Returns a timestamp representing the date-time this discord object was created.
:Returns:
inherited
method
to_dict(self)
¶
Exports object into dictionary representation, ready to be sent to discord api.
Returns:
Type | Description |
---|---|
Dict[str, Any] |
The exported dictionary. |
Source code in naff/models/discord/stage_instance.py
def to_dict(self) -> Dict[str, Any]:
"""
Exports object into dictionary representation, ready to be sent to discord api.
Returns:
The exported dictionary.
"""
self._check_object()
return serializer.to_dict(self)