Browse Source

Add support for setting voice channel status

pull/10109/head
Andrin 1 year ago
committed by dolfies
parent
commit
e51efa8039
  1. 7
      discord/abc.py
  2. 6
      discord/channel.py
  3. 7
      discord/http.py

7
discord/abc.py

@ -762,6 +762,13 @@ class GuildChannel:
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)

6
discord/channel.py

@ -1494,6 +1494,7 @@ class VoiceChannel(VocalGuildChannel):
rtc_region: Optional[str] = ...,
video_quality_mode: VideoQualityMode = ...,
slowmode_delay: int = ...,
status: Optional[str] = ...,
reason: Optional[str] = ...,
) -> VoiceChannel:
...
@ -1553,6 +1554,11 @@ class VoiceChannel(VocalGuildChannel):
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
------

7
discord/http.py

@ -1528,6 +1528,13 @@ class HTTPClient:
) -> Response[channel.Channel]:
return self.request(Route('PATCH', '/channels/{channel_id}', channel_id=channel_id), reason=reason, json=fields)
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,

Loading…
Cancel
Save