Skip to content

Commit 426bb6a

Browse files
authored
Update guild.py
Signed-off-by: Lumabots <[email protected]>
1 parent 51e2e49 commit 426bb6a

File tree

1 file changed

+133
-3
lines changed

1 file changed

+133
-3
lines changed

discord/guild.py

Lines changed: 133 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1130,6 +1130,8 @@ async def create_text_channel(
11301130
slowmode_delay: int = MISSING,
11311131
nsfw: bool = MISSING,
11321132
overwrites: dict[Role | Member, PermissionOverwrite] = MISSING,
1133+
default_thread_slowmode_delay: int | None = MISSING,
1134+
default_auto_archive_duration: int = MISSING,
11331135
) -> TextChannel:
11341136
"""|coro|
11351137
@@ -1172,6 +1174,16 @@ async def create_text_channel(
11721174
reason: Optional[:class:`str`]
11731175
The reason for creating this channel. Shows up on the audit log.
11741176
1177+
default_thread_slowmode_delay: Optional[:class:`int`]
1178+
The initial slowmode delay to set on newly created threads in this channel.
1179+
1180+
.. versionadded:: 2.7
1181+
1182+
default_auto_archive_duration: :class:`int`
1183+
The default auto archive duration in minutes for threads created in this channel.
1184+
1185+
.. versionadded:: 2.7
1186+
11751187
Returns
11761188
-------
11771189
:class:`TextChannel`
@@ -1219,6 +1231,12 @@ async def create_text_channel(
12191231

12201232
if nsfw is not MISSING:
12211233
options["nsfw"] = nsfw
1234+
1235+
if default_thread_slowmode_delay is not MISSING:
1236+
options["default_thread_slowmode_delay"] = default_thread_slowmode_delay
1237+
1238+
if default_auto_archive_duration is not MISSING:
1239+
options["default_auto_archive_duration"] = default_auto_archive_duration
12221240

12231241
data = await self._create_channel(
12241242
name,
@@ -1246,6 +1264,8 @@ async def create_voice_channel(
12461264
rtc_region: VoiceRegion | None = MISSING,
12471265
video_quality_mode: VideoQualityMode = MISSING,
12481266
overwrites: dict[Role | Member, PermissionOverwrite] = MISSING,
1267+
slowmode_delay: int = MISSING,
1268+
nsfw: bool = MISSING,
12491269
) -> VoiceChannel:
12501270
"""|coro|
12511271
@@ -1280,6 +1300,17 @@ async def create_voice_channel(
12801300
reason: Optional[:class:`str`]
12811301
The reason for creating this channel. Shows up on the audit log.
12821302
1303+
slowmode_delay: :class:`int`
1304+
Specifies the slowmode rate limit for user in this channel, in seconds.
1305+
The maximum value possible is `21600`.
1306+
1307+
.. versionadded:: 2.7
1308+
1309+
nsfw: :class:`bool`
1310+
To mark the channel as NSFW or not.
1311+
1312+
.. versionadded:: 2.7
1313+
12831314
Returns
12841315
-------
12851316
:class:`VoiceChannel`
@@ -1310,6 +1341,12 @@ async def create_voice_channel(
13101341
if video_quality_mode is not MISSING:
13111342
options["video_quality_mode"] = video_quality_mode.value
13121343

1344+
if slowmode_delay is not MISSING:
1345+
options["rate_limit_per_user"] = slowmode_delay
1346+
1347+
if nsfw is not MISSING:
1348+
options["nsfw"] = nsfw
1349+
13131350
data = await self._create_channel(
13141351
name,
13151352
overwrites=overwrites,
@@ -1333,6 +1370,12 @@ async def create_stage_channel(
13331370
overwrites: dict[Role | Member, PermissionOverwrite] = MISSING,
13341371
category: CategoryChannel | None = None,
13351372
reason: str | None = None,
1373+
bitrate: int = MISSING,
1374+
user_limit: int = MISSING,
1375+
rtc_region: VoiceRegion | None = MISSING,
1376+
video_quality_mode: VideoQualityMode = MISSING,
1377+
slowmode_delay: int = MISSING,
1378+
nsfw: bool = MISSING,
13361379
) -> StageChannel:
13371380
"""|coro|
13381381
@@ -1358,6 +1401,39 @@ async def create_stage_channel(
13581401
reason: Optional[:class:`str`]
13591402
The reason for creating this channel. Shows up on the audit log.
13601403
1404+
1405+
bitrate: :class:`int`
1406+
The channel's preferred audio bitrate in bits per second.
1407+
1408+
.. versionadded:: 2.7
1409+
1410+
user_limit: :class:`int`
1411+
The channel's limit for number of members that can be in a voice channel.
1412+
1413+
.. versionadded:: 2.7
1414+
1415+
rtc_region: Optional[:class:`VoiceRegion`]
1416+
The region for the voice channel's voice communication.
1417+
A value of ``None`` indicates automatic voice region detection.
1418+
1419+
.. versionadded:: 2.7
1420+
1421+
video_quality_mode: :class:`VideoQualityMode`
1422+
The camera video quality for the voice channel's participants.
1423+
1424+
.. versionadded:: 2.7
1425+
1426+
slowmode_delay: :class:`int`
1427+
Specifies the slowmode rate limit for user in this channel, in seconds.
1428+
The maximum value possible is `21600`.
1429+
1430+
.. versionadded:: 2.7
1431+
1432+
nsfw: :class:`bool`
1433+
To mark the channel as NSFW or not.
1434+
1435+
.. versionadded:: 2.7
1436+
13611437
Returns
13621438
-------
13631439
:class:`StageChannel`
@@ -1379,6 +1455,24 @@ async def create_stage_channel(
13791455
if position is not MISSING:
13801456
options["position"] = position
13811457

1458+
if bitrate is not MISSING:
1459+
options["bitrate"] = bitrate
1460+
1461+
if user_limit is not MISSING:
1462+
options["user_limit"] = user_limit
1463+
1464+
if rtc_region is not MISSING:
1465+
options["rtc_region"] = None if rtc_region is None else str(rtc_region)
1466+
1467+
if video_quality_mode is not MISSING:
1468+
options["video_quality_mode"] = video_quality_mode.value
1469+
1470+
if slowmode_delay is not MISSING:
1471+
options["rate_limit_per_user"] = slowmode_delay
1472+
1473+
if nsfw is not MISSING:
1474+
options["nsfw"] = nsfw
1475+
13821476
data = await self._create_channel(
13831477
name,
13841478
overwrites=overwrites,
@@ -1405,6 +1499,10 @@ async def create_forum_channel(
14051499
nsfw: bool = MISSING,
14061500
overwrites: dict[Role | Member, PermissionOverwrite] = MISSING,
14071501
default_reaction_emoji: GuildEmoji | int | str = MISSING,
1502+
available_tags: list[ForumTag] = MISSING,
1503+
default_sort_order: SortOrder | None = MISSING,
1504+
default_thread_slowmode_delay: int | None = MISSING,
1505+
default_auto_archive_duration: int = MISSING,
14081506
) -> ForumChannel:
14091507
"""|coro|
14101508
@@ -1453,6 +1551,26 @@ async def create_forum_channel(
14531551
14541552
.. versionadded:: v2.5
14551553
1554+
available_tags: List[:class:`ForumTag`]
1555+
The set of tags that can be used in a forum channel.
1556+
1557+
.. versionadded:: 2.7
1558+
1559+
default_sort_order: Optional[:class:`SortOrder`]
1560+
The default sort order type used to order posts in this channel.
1561+
1562+
.. versionadded:: 2.7
1563+
1564+
default_thread_slowmode_delay: Optional[:class:`int`]
1565+
The initial slowmode delay to set on newly created threads in this channel.
1566+
1567+
.. versionadded:: 2.7
1568+
1569+
default_auto_archive_duration: :class:`int`
1570+
The default auto archive duration in minutes for threads created in this channel.
1571+
1572+
.. versionadded:: 2.7
1573+
14561574
Returns
14571575
-------
14581576
:class:`ForumChannel`
@@ -1491,15 +1609,27 @@ async def create_forum_channel(
14911609
options = {}
14921610
if position is not MISSING:
14931611
options["position"] = position
1494-
1612+
14951613
if topic is not MISSING:
14961614
options["topic"] = topic
1497-
1615+
14981616
if slowmode_delay is not MISSING:
14991617
options["rate_limit_per_user"] = slowmode_delay
1500-
1618+
15011619
if nsfw is not MISSING:
15021620
options["nsfw"] = nsfw
1621+
1622+
if available_tags is not MISSING:
1623+
options["available_tags"] = [tag.to_dict() for tag in available_tags]
1624+
1625+
if default_sort_order is not MISSING:
1626+
options["default_sort_order"] = default_sort_order.value if default_sort_order else None
1627+
1628+
if default_thread_slowmode_delay is not MISSING:
1629+
options["default_thread_slowmode_delay"] = default_thread_slowmode_delay
1630+
1631+
if default_auto_archive_duration is not MISSING:
1632+
options["default_auto_archive_duration"] = default_auto_archive_duration
15031633

15041634
if default_reaction_emoji is not MISSING:
15051635
if isinstance(

0 commit comments

Comments
 (0)