mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-04-19 15:36:02 +00:00
Update create_stage_channel to support more parameters
This commit is contained in:
parent
4e09c34bbb
commit
2cde1133f9
@ -1400,6 +1400,8 @@ class Guild(Hashable):
|
||||
options['rtc_region'] = None if rtc_region is None else rtc_region
|
||||
|
||||
if video_quality_mode is not MISSING:
|
||||
if not isinstance(video_quality_mode, VideoQualityMode):
|
||||
raise TypeError('video_quality_mode must be of type VideoQualityMode')
|
||||
options['video_quality_mode'] = video_quality_mode.value
|
||||
|
||||
data = await self._create_channel(
|
||||
@ -1415,11 +1417,14 @@ class Guild(Hashable):
|
||||
self,
|
||||
name: str,
|
||||
*,
|
||||
topic: str,
|
||||
position: int = MISSING,
|
||||
overwrites: Mapping[Union[Role, Member], PermissionOverwrite] = MISSING,
|
||||
category: Optional[CategoryChannel] = None,
|
||||
reason: Optional[str] = None,
|
||||
category: Optional[CategoryChannel] = None,
|
||||
position: int = MISSING,
|
||||
bitrate: int = MISSING,
|
||||
user_limit: int = MISSING,
|
||||
rtc_region: Optional[str] = MISSING,
|
||||
video_quality_mode: VideoQualityMode = MISSING,
|
||||
overwrites: Mapping[Union[Role, Member], PermissionOverwrite] = MISSING,
|
||||
) -> StageChannel:
|
||||
"""|coro|
|
||||
|
||||
@ -1435,8 +1440,6 @@ class Guild(Hashable):
|
||||
-----------
|
||||
name: :class:`str`
|
||||
The channel's name.
|
||||
topic: :class:`str`
|
||||
The new channel's topic.
|
||||
overwrites: Dict[Union[:class:`Role`, :class:`Member`], :class:`PermissionOverwrite`]
|
||||
A :class:`dict` of target (either a role or a member) to
|
||||
:class:`PermissionOverwrite` to apply upon creation of a channel.
|
||||
@ -1448,6 +1451,23 @@ class Guild(Hashable):
|
||||
position: :class:`int`
|
||||
The position in the channel list. This is a number that starts
|
||||
at 0. e.g. the top channel is position 0.
|
||||
bitrate: :class:`int`
|
||||
The channel's preferred audio bitrate in bits per second.
|
||||
|
||||
.. versionadded:: 2.2
|
||||
user_limit: :class:`int`
|
||||
The channel's limit for number of members that can be in a voice channel.
|
||||
|
||||
.. versionadded:: 2.2
|
||||
rtc_region: Optional[:class:`str`]
|
||||
The region for the voice channel's voice communication.
|
||||
A value of ``None`` indicates automatic voice region detection.
|
||||
|
||||
.. versionadded:: 2.2
|
||||
video_quality_mode: :class:`VideoQualityMode`
|
||||
The camera video quality for the voice channel's participants.
|
||||
|
||||
.. versionadded:: 2.2
|
||||
reason: Optional[:class:`str`]
|
||||
The reason for creating this channel. Shows up on the audit log.
|
||||
|
||||
@ -1466,12 +1486,24 @@ class Guild(Hashable):
|
||||
The channel that was just created.
|
||||
"""
|
||||
|
||||
options: Dict[str, Any] = {
|
||||
'topic': topic,
|
||||
}
|
||||
options = {}
|
||||
if position is not MISSING:
|
||||
options['position'] = position
|
||||
|
||||
if bitrate is not MISSING:
|
||||
options['bitrate'] = bitrate
|
||||
|
||||
if user_limit is not MISSING:
|
||||
options['user_limit'] = user_limit
|
||||
|
||||
if rtc_region is not MISSING:
|
||||
options['rtc_region'] = None if rtc_region is None else rtc_region
|
||||
|
||||
if video_quality_mode is not MISSING:
|
||||
if not isinstance(video_quality_mode, VideoQualityMode):
|
||||
raise TypeError('video_quality_mode must be of type VideoQualityMode')
|
||||
options['video_quality_mode'] = video_quality_mode.value
|
||||
|
||||
data = await self._create_channel(
|
||||
name, overwrites=overwrites, channel_type=ChannelType.stage_voice, category=category, reason=reason, **options
|
||||
)
|
||||
@ -1911,7 +1943,6 @@ class Guild(Hashable):
|
||||
fields['system_channel_flags'] = system_channel_flags.value
|
||||
|
||||
if any(feat is not MISSING for feat in (community, discoverable, invites_disabled)):
|
||||
|
||||
features = set(self.features)
|
||||
|
||||
if community is not MISSING:
|
||||
@ -3261,7 +3292,6 @@ class Guild(Hashable):
|
||||
|
||||
role_positions = []
|
||||
for role, position in positions.items():
|
||||
|
||||
payload: RolePositionUpdatePayload = {'id': role.id, 'position': position}
|
||||
|
||||
role_positions.append(payload)
|
||||
|
Loading…
x
Reference in New Issue
Block a user