Skip to content

Commit

Permalink
Add support for setting voice channel status
Browse files Browse the repository at this point in the history
  • Loading branch information
codeofandrin authored Dec 26, 2023
1 parent d25b574 commit 9ce7333
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
7 changes: 7 additions & 0 deletions discord/abc.py
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,13 @@ async def _edit(self, options: Dict[str, Any], reason: Optional[str]) -> Optiona
raise TypeError('type field must be of type ChannelType')
options['type'] = ch_type.value

try:
status = options.pop('status')
except KeyError:
pass
else:
await self._state.http.edit_voice_channel_status(status, channel_id=self.id, reason=reason)

if options:
return await self._state.http.edit_channel(self.id, reason=reason, **options)

Expand Down
6 changes: 6 additions & 0 deletions discord/channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -1370,6 +1370,7 @@ async def edit(
rtc_region: Optional[str] = ...,
video_quality_mode: VideoQualityMode = ...,
slowmode_delay: int = ...,
status: Optional[str] = ...,
reason: Optional[str] = ...,
) -> VoiceChannel:
...
Expand Down Expand Up @@ -1429,6 +1430,11 @@ async def edit(self, *, reason: Optional[str] = None, **options: Any) -> Optiona
The camera video quality for the voice channel's participants.
.. versionadded:: 2.0
status: Optional[:class:`str`]
The new voice channel status. It can be up to 500 characters.
Can be ``None`` to remove the status.
.. versionadded:: 2.4
Raises
------
Expand Down
7 changes: 7 additions & 0 deletions discord/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -1163,6 +1163,13 @@ def edit_channel(
payload = {k: v for k, v in options.items() if k in valid_keys}
return self.request(r, reason=reason, json=payload)

def edit_voice_channel_status(
self, status: Optional[str], *, channel_id: int, reason: Optional[str] = None
) -> Response[None]:
r = Route('PUT', '/channels/{channel_id}/voice-status', channel_id=channel_id)
payload = {'status': status}
return self.request(r, reason=reason, json=payload)

def bulk_channel_update(
self,
guild_id: Snowflake,
Expand Down

0 comments on commit 9ce7333

Please sign in to comment.