Skip to content

Commit 0df1e19

Browse files
authored
feat: add moderated for create_tag methods (#1612)
1 parent 5518474 commit 0df1e19

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

interactions/api/http/http_requests/channels.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -585,6 +585,7 @@ async def create_tag(
585585
name: str,
586586
emoji_id: Optional["Snowflake_Type"] = None,
587587
emoji_name: Optional[str] = None,
588+
moderated: bool = False,
588589
) -> discord_typings.ChannelData:
589590
"""
590591
Create a new tag.
@@ -594,6 +595,7 @@ async def create_tag(
594595
name: The name of the tag
595596
emoji_id: The ID of the emoji to use for the tag
596597
emoji_name: The name of the emoji to use for the tag
598+
moderated: whether this tag can only be added to or removed from threads by a member with the MANAGE_THREADS permission
597599
598600
!!! note
599601
Can either have an `emoji_id` or an `emoji_name`, but not both.
@@ -603,6 +605,7 @@ async def create_tag(
603605
"name": name,
604606
"emoji_id": int(emoji_id) if emoji_id else None,
605607
"emoji_name": emoji_name or None,
608+
"moderated": moderated,
606609
}
607610
payload = dict_filter_none(payload)
608611

interactions/models/discord/channel.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2581,13 +2581,16 @@ def predicate(tag: ThreadTag) -> Optional["ThreadTag"]:
25812581

25822582
return next((tag for tag in self.available_tags if predicate(tag)), None)
25832583

2584-
async def create_tag(self, name: str, emoji: Union["models.PartialEmoji", dict, str, None] = None) -> "ThreadTag":
2584+
async def create_tag(
2585+
self, name: str, emoji: Union["models.PartialEmoji", dict, str, None] = None, moderated: bool = False
2586+
) -> "ThreadTag":
25852587
"""
25862588
Create a tag for this forum.
25872589
25882590
Args:
25892591
name: The name of the tag
25902592
emoji: The emoji to use for the tag
2593+
moderated: whether this tag can only be added to or removed from threads by a member with the MANAGE_THREADS permission
25912594
25922595
!!! note
25932596
If the emoji is a custom emoji, it must be from the same guild as the channel.
@@ -2596,7 +2599,7 @@ async def create_tag(self, name: str, emoji: Union["models.PartialEmoji", dict,
25962599
The created tag object.
25972600
25982601
"""
2599-
payload = {"channel_id": self.id, "name": name}
2602+
payload = {"channel_id": self.id, "name": name, "moderated": moderated}
26002603

26012604
if emoji:
26022605
if isinstance(emoji, str):

0 commit comments

Comments
 (0)