Allow creating NSFW voice/stage channels

This commit is contained in:
Soheab 2025-06-20 21:07:23 +02:00 committed by GitHub
parent 6af9de0c39
commit 7fe1102841
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1560,6 +1560,7 @@ class Guild(Hashable):
rtc_region: Optional[str] = MISSING,
video_quality_mode: VideoQualityMode = MISSING,
overwrites: Mapping[Union[Role, Member, Object], PermissionOverwrite] = MISSING,
nsfw: bool = MISSING,
) -> VoiceChannel:
"""|coro|
@ -1597,6 +1598,10 @@ class Guild(Hashable):
The camera video quality for the voice channel's participants.
.. versionadded:: 2.0
nsfw: :class:`bool`
To mark the channel as NSFW or not.
.. versionadded:: 2.6
reason: Optional[:class:`str`]
The reason for creating this channel. Shows up on the audit log.
@ -1632,6 +1637,9 @@ class Guild(Hashable):
raise TypeError('video_quality_mode must be of type VideoQualityMode')
options['video_quality_mode'] = video_quality_mode.value
if nsfw is not MISSING:
options['nsfw'] = nsfw
data = await self._create_channel(
name, overwrites=overwrites, channel_type=ChannelType.voice, category=category, reason=reason, **options
)
@ -1653,6 +1661,7 @@ class Guild(Hashable):
rtc_region: Optional[str] = MISSING,
video_quality_mode: VideoQualityMode = MISSING,
overwrites: Mapping[Union[Role, Member, Object], PermissionOverwrite] = MISSING,
nsfw: bool = MISSING,
) -> StageChannel:
"""|coro|
@ -1696,6 +1705,10 @@ class Guild(Hashable):
The camera video quality for the voice channel's participants.
.. versionadded:: 2.2
nsfw: :class:`bool`
To mark the channel as NSFW or not.
.. versionadded:: 2.6
reason: Optional[:class:`str`]
The reason for creating this channel. Shows up on the audit log.
@ -1732,6 +1745,9 @@ class Guild(Hashable):
raise TypeError('video_quality_mode must be of type VideoQualityMode')
options['video_quality_mode'] = video_quality_mode.value
if nsfw is not MISSING:
options['nsfw'] = nsfw
data = await self._create_channel(
name, overwrites=overwrites, channel_type=ChannelType.stage_voice, category=category, reason=reason, **options
)