Implement StageInstance
This commit is contained in:
@@ -44,7 +44,9 @@ if TYPE_CHECKING:
|
||||
from .types import (
|
||||
interactions,
|
||||
invite,
|
||||
stage_instance,
|
||||
)
|
||||
from .types.snowflake import Snowflake
|
||||
|
||||
T = TypeVar('T')
|
||||
Response = Coroutine[Any, Any, T]
|
||||
@@ -1080,6 +1082,33 @@ class HTTPClient:
|
||||
def move_member(self, user_id, guild_id, channel_id, *, reason=None):
|
||||
return self.edit_member(guild_id=guild_id, user_id=user_id, channel_id=channel_id, reason=reason)
|
||||
|
||||
# Stage instance management
|
||||
|
||||
def get_stage_instance(self, channel_id: Snowflake) -> Response[stage_instance.StageInstance]:
|
||||
return self.request(Route('GET', '/stage-instances/{channel_id}', channel_id=channel_id))
|
||||
|
||||
def create_stage_instance(self, **payload) -> Response[stage_instance.StageInstance]:
|
||||
valid_keys = (
|
||||
'channel_id',
|
||||
'topic',
|
||||
'privacy_level',
|
||||
)
|
||||
payload = {k: v for k, v in payload.items() if k in valid_keys}
|
||||
|
||||
return self.request(Route('POST', '/stage-instances'), json=payload)
|
||||
|
||||
def edit_stage_instance(self, channel_id: Snowflake, **payload) -> Response[None]:
|
||||
valid_keys = (
|
||||
'topic',
|
||||
'privacy_level',
|
||||
)
|
||||
payload = {k: v for k, v in payload.items() if k in valid_keys}
|
||||
|
||||
return self.request(Route('PATCH', '/stage-instances/{channel_id}', channel_id=channel_id), json=payload)
|
||||
|
||||
def delete_stage_instance(self, channel_id: Snowflake) -> Response[None]:
|
||||
return self.request(Route('DELETE', '/stage-instances/{channel_id}', channel_id=channel_id))
|
||||
|
||||
# Application commands (global)
|
||||
|
||||
def get_global_commands(self, application_id) -> Response[List[interactions.ApplicationCommand]]:
|
||||
|
||||
Reference in New Issue
Block a user