diff options
| author | Nadir Chowdhury <[email protected]> | 2021-05-30 18:51:52 +0100 |
|---|---|---|
| committer | GitHub <[email protected]> | 2021-05-30 13:51:52 -0400 |
| commit | 9f98a9a87fa1f2cc2702b5dc536178a018a631eb (patch) | |
| tree | 2eafaf9d8b0c9b791396e1bf953c4adc4b6d8282 /discord/http.py | |
| parent | Fix potential KeyError when removing views (diff) | |
| download | discord.py-9f98a9a87fa1f2cc2702b5dc536178a018a631eb.tar.xz discord.py-9f98a9a87fa1f2cc2702b5dc536178a018a631eb.zip | |
Implement StageInstance
Diffstat (limited to 'discord/http.py')
| -rw-r--r-- | discord/http.py | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/discord/http.py b/discord/http.py index c14cc8d4..4dfea5da 100644 --- a/discord/http.py +++ b/discord/http.py @@ -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]]: |