mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-04-21 00:07:51 +00:00
Add VoiceChannel.video_quality_mode
This commit is contained in:
parent
fed259a83b
commit
304229071f
@ -31,7 +31,7 @@ from typing import TYPE_CHECKING, Optional, Protocol, runtime_checkable
|
||||
|
||||
from .iterators import HistoryIterator
|
||||
from .context_managers import Typing
|
||||
from .enums import ChannelType
|
||||
from .enums import ChannelType, VideoQualityMode
|
||||
from .errors import InvalidArgument, ClientException
|
||||
from .mentions import AllowedMentions
|
||||
from .permissions import PermissionOverwrite, Permissions
|
||||
@ -266,6 +266,13 @@ class GuildChannel(Protocol):
|
||||
else:
|
||||
options['rtc_region'] = None if rtc_region is None else str(rtc_region)
|
||||
|
||||
try:
|
||||
video_quality_mode = options.pop('video_quality_mode')
|
||||
except KeyError:
|
||||
pass
|
||||
else:
|
||||
options['video_quality_mode'] = int(video_quality_mode)
|
||||
|
||||
lock_permissions = options.pop('sync_permissions', False)
|
||||
|
||||
try:
|
||||
|
@ -102,6 +102,12 @@ def _transform_overwrites(entry, data):
|
||||
|
||||
return overwrites
|
||||
|
||||
def _transform_voiceregion(entry, data):
|
||||
return enums.try_enum(enums.VoiceRegion, data)
|
||||
|
||||
def _transform_video_quality_mode(entry, data):
|
||||
return enums.try_enum(enums.VideoQualityMode, data)
|
||||
|
||||
class AuditLogDiff:
|
||||
def __len__(self):
|
||||
return len(self.__dict__)
|
||||
@ -134,6 +140,9 @@ class AuditLogChanges:
|
||||
'avatar_hash': ('avatar', None),
|
||||
'rate_limit_per_user': ('slowmode_delay', None),
|
||||
'default_message_notifications': ('default_notifications', _transform_default_notifications),
|
||||
'region': (None, _transform_voiceregion),
|
||||
'rtc_region': (None, _transform_voiceregion),
|
||||
'video_quality_mode': (None, _transform_video_quality_mode),
|
||||
}
|
||||
|
||||
def __init__(self, entry, data: List[AuditLogChangePayload]):
|
||||
|
@ -27,7 +27,7 @@ import asyncio
|
||||
|
||||
import discord.abc
|
||||
from .permissions import Permissions
|
||||
from .enums import ChannelType, try_enum, VoiceRegion
|
||||
from .enums import ChannelType, try_enum, VoiceRegion, VideoQualityMode
|
||||
from .mixins import Hashable
|
||||
from . import utils
|
||||
from .asset import Asset
|
||||
@ -541,7 +541,7 @@ class TextChannel(discord.abc.Messageable, discord.abc.GuildChannel, Hashable):
|
||||
class VocalGuildChannel(discord.abc.Connectable, discord.abc.GuildChannel, Hashable):
|
||||
__slots__ = ('name', 'id', 'guild', 'bitrate', 'user_limit',
|
||||
'_state', 'position', '_overwrites', 'category_id',
|
||||
'rtc_region')
|
||||
'rtc_region', 'video_quality_mode')
|
||||
|
||||
def __init__(self, *, state, guild, data):
|
||||
self._state = state
|
||||
@ -560,6 +560,7 @@ class VocalGuildChannel(discord.abc.Connectable, discord.abc.GuildChannel, Hasha
|
||||
self.rtc_region = data.get('rtc_region')
|
||||
if self.rtc_region:
|
||||
self.rtc_region = try_enum(VoiceRegion, self.rtc_region)
|
||||
self.video_quality_mode = try_enum(VideoQualityMode, data.get('video_quality_mode', 1))
|
||||
self.category_id = utils._get_as_snowflake(data, 'parent_id')
|
||||
self.position = data['position']
|
||||
self.bitrate = data.get('bitrate')
|
||||
@ -654,6 +655,10 @@ class VoiceChannel(VocalGuildChannel):
|
||||
A value of ``None`` indicates automatic voice region detection.
|
||||
|
||||
.. versionadded:: 1.7
|
||||
video_quality_mode: :class:`VideoQualityMode`
|
||||
The camera video quality for the voice channel's participants.
|
||||
|
||||
.. versionadded:: 2.0
|
||||
"""
|
||||
|
||||
__slots__ = ()
|
||||
@ -665,6 +670,7 @@ class VoiceChannel(VocalGuildChannel):
|
||||
('rtc_region', self.rtc_region),
|
||||
('position', self.position),
|
||||
('bitrate', self.bitrate),
|
||||
('video_quality_mode', self.video_quality_mode),
|
||||
('user_limit', self.user_limit),
|
||||
('category_id', self.category_id)
|
||||
]
|
||||
@ -720,6 +726,10 @@ class VoiceChannel(VocalGuildChannel):
|
||||
A value of ``None`` indicates automatic voice region detection.
|
||||
|
||||
.. versionadded:: 1.7
|
||||
video_quality_mode: :class:`VideoQualityMode`
|
||||
The camera video quality for the voice channel's participants.
|
||||
|
||||
.. versionadded:: 2.0
|
||||
|
||||
Raises
|
||||
------
|
||||
@ -778,6 +788,10 @@ class StageChannel(VocalGuildChannel):
|
||||
rtc_region: Optional[:class:`VoiceRegion`]
|
||||
The region for the stage channel's voice communication.
|
||||
A value of ``None`` indicates automatic voice region detection.
|
||||
video_quality_mode: :class:`VideoQualityMode`
|
||||
The camera video quality for the stage channel's participants.
|
||||
|
||||
.. versionadded:: 2.0
|
||||
"""
|
||||
__slots__ = ('topic',)
|
||||
|
||||
@ -789,6 +803,7 @@ class StageChannel(VocalGuildChannel):
|
||||
('rtc_region', self.rtc_region),
|
||||
('position', self.position),
|
||||
('bitrate', self.bitrate),
|
||||
('video_quality_mode', self.video_quality_mode),
|
||||
('user_limit', self.user_limit),
|
||||
('category_id', self.category_id)
|
||||
]
|
||||
@ -845,6 +860,10 @@ class StageChannel(VocalGuildChannel):
|
||||
rtc_region: Optional[:class:`VoiceRegion`]
|
||||
The new region for the stage channel's voice communication.
|
||||
A value of ``None`` indicates automatic voice region detection.
|
||||
video_quality_mode: :class:`VideoQualityMode`
|
||||
The camera video quality for the stage channel's participants.
|
||||
|
||||
.. versionadded:: 2.0
|
||||
|
||||
Raises
|
||||
------
|
||||
|
@ -46,6 +46,7 @@ __all__ = (
|
||||
'ExpireBehaviour',
|
||||
'ExpireBehavior',
|
||||
'StickerType',
|
||||
'VideoQualityMode',
|
||||
)
|
||||
|
||||
def _create_value_cls(name):
|
||||
@ -428,6 +429,13 @@ class InteractionType(Enum):
|
||||
ping = 1
|
||||
application_command = 2
|
||||
|
||||
class VideoQualityMode(Enum):
|
||||
auto = 1
|
||||
full = 2
|
||||
|
||||
def __int__(self):
|
||||
return self.value
|
||||
|
||||
T = TypeVar('T')
|
||||
|
||||
def create_unknown_value(cls: Type[T], val: Any) -> T:
|
||||
|
@ -867,6 +867,10 @@ class Guild(Hashable):
|
||||
A value of ``None`` indicates automatic voice region detection.
|
||||
|
||||
.. versionadded:: 1.7
|
||||
video_quality_mode: :class:`VideoQualityMode`
|
||||
The camera video quality for the voice channel's participants.
|
||||
|
||||
.. versionadded:: 2.0
|
||||
|
||||
Raises
|
||||
------
|
||||
|
@ -681,6 +681,7 @@ class HTTPClient:
|
||||
'rate_limit_per_user',
|
||||
'type',
|
||||
'rtc_region',
|
||||
'video_quality_mode',
|
||||
)
|
||||
payload = {k: v for k, v in options.items() if k in valid_keys}
|
||||
return self.request(r, reason=reason, json=payload)
|
||||
@ -705,6 +706,7 @@ class HTTPClient:
|
||||
'permission_overwrites',
|
||||
'rate_limit_per_user',
|
||||
'rtc_region',
|
||||
'video_quality_mode',
|
||||
)
|
||||
payload.update({k: v for k, v in options.items() if k in valid_keys and v is not None})
|
||||
|
||||
|
33
docs/api.rst
33
docs/api.rst
@ -1413,6 +1413,8 @@ of :class:`enum.Enum`.
|
||||
- :attr:`~AuditLogDiff.overwrites`
|
||||
- :attr:`~AuditLogDiff.topic`
|
||||
- :attr:`~AuditLogDiff.bitrate`
|
||||
- :attr:`~AuditLogDiff.rtc_region`
|
||||
- :attr:`~AuditLogDiff.video_quality_mode`
|
||||
|
||||
.. attribute:: channel_delete
|
||||
|
||||
@ -1945,6 +1947,20 @@ of :class:`enum.Enum`.
|
||||
|
||||
Represents a sticker with a lottie image.
|
||||
|
||||
.. class:: VideoQualityMode
|
||||
|
||||
Represents the camera video quality mode for voice channel participants.
|
||||
|
||||
.. versionadded:: 2.0
|
||||
|
||||
.. attribute:: auto
|
||||
|
||||
Represents auto camera video quality.
|
||||
|
||||
.. attribute:: full
|
||||
|
||||
Represents full camera video quality.
|
||||
|
||||
Async Iterator
|
||||
----------------
|
||||
|
||||
@ -2482,6 +2498,23 @@ AuditLogDiff
|
||||
|
||||
:type: :class:`int`
|
||||
|
||||
.. attribute:: rtc_region
|
||||
|
||||
The region for the voice channel’s voice communication.
|
||||
A value of ``None`` indicates automatic voice region detection.
|
||||
|
||||
See also :attr:`VoiceChannel.rtc_region`.
|
||||
|
||||
:type: :class:`VoiceRegion`
|
||||
|
||||
.. attribute:: video_quality_mode
|
||||
|
||||
The camera video quality for the voice channel's participants.
|
||||
|
||||
See also :attr:`VoiceChannel.video_quality_mode`.
|
||||
|
||||
:type: :class:`VideoQualityMode`
|
||||
|
||||
.. this is currently missing the following keys: reason and application_id
|
||||
I'm not sure how to about porting these
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user