Skip to content

fix: address issues with tag usage for guild forums #1499

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 23, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions interactions/models/discord/channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -2420,7 +2420,7 @@ async def create_post(
self,
name: str,
content: str | None,
applied_tags: Optional[List[Union["Snowflake_Type", "ThreadTag", str]]] = MISSING,
applied_tags: Absent[List[Union["Snowflake_Type", "ThreadTag", str]]] = MISSING,
*,
auto_archive_duration: AutoArchiveDuration = AutoArchiveDuration.ONE_DAY,
rate_limit_per_user: Absent[int] = MISSING,
Expand Down Expand Up @@ -2463,7 +2463,7 @@ async def create_post(
Returns:
A GuildForumPost object representing the created post.
"""
if applied_tags != MISSING:
if applied_tags is not MISSING:
processed = []
for tag in applied_tags:
if isinstance(tag, ThreadTag):
Expand Down Expand Up @@ -2568,12 +2568,13 @@ def get_tag(self, value: str | Snowflake_Type, *, case_insensitive: bool = False
Returns:
A ThreadTag object representing the tag.
"""
value = str(value)

def maybe_insensitive(string: str) -> str:
return string.lower() if case_insensitive else string

def predicate(tag: ThreadTag) -> Optional["ThreadTag"]:
if str(tag.id) == str(value):
if str(tag.id) == value:
return tag
if maybe_insensitive(tag.name) == maybe_insensitive(value):
return tag
Expand Down