Skip to content

add support for clan/server tags #10190

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

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

Conversation

eepyfemboi
Copy link

Summary

adds support for clan/server tags

Checklist

  • If code changes were made then they have been tested.
    • I have updated the documentation to reflect the changes.
  • This PR fixes an issue.
  • This PR adds something new (e.g. new method or parameters).
  • This PR is a breaking change (e.g. methods or parameters removed/renamed)
  • This PR is not a code change (e.g. documentation, README, ...)

i only bothered to add this bcuz i needed to use it in one of my bots and i was surprised that it hasnt been added yet
this is a super hacky fix and im honestly surprised i got it to work, but it would probably be a good idea to clean it up a bit
why did i spend 3 hours on this what am i doing with my life

Copy link
Contributor

@dolfies dolfies left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clan is deprecated

@DA-344
Copy link
Contributor

DA-344 commented May 19, 2025

And also, this is undocumented in discord's side.

def __init__(self, data: ClanTagPayload):
self.identity_guild_id: Optional[int] = (int(data["identity_guild_id"]) if data.get("identity_guild_id") is not None else None)
self.identity_enabled: bool = data.get("identity_enabled", False)
self.tag: Optional[str] = data.get("tag", "null")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will not make this optional, just use data.get

self.identity_guild_id: Optional[int] = (int(data["identity_guild_id"]) if data.get("identity_guild_id") is not None else None)
self.identity_enabled: bool = data.get("identity_enabled", False)
self.tag: Optional[str] = data.get("tag", "null")
self.badge: Optional[str] = data.get("badge", "null")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as mentioned on self.tag

Comment on lines +26 to +34
from typing import TypedDict, Optional
from .types.snowflake import Snowflake


class ClanTagPayload(TypedDict):
identity_guild_id: Snowflake
identity_enabled: bool
tag: str
badge: str
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All of this should be on its discord/types file, not here.

__slots__ = ("identity_guild_id", "identity_enabled", "tag", "badge")

def __init__(self, data: ClanTagPayload):
self.identity_guild_id: Optional[int] = (int(data["identity_guild_id"]) if data.get("identity_guild_id") is not None else None)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use utils._get_as_snowflake

@@ -25,6 +25,7 @@
from .snowflake import Snowflake
from typing import Literal, Optional, TypedDict
from typing_extensions import NotRequired
from ..clantag import ClanTagPayload
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as mentioned on the TypedDict

@@ -39,6 +40,8 @@ class PartialUser(TypedDict):
avatar: Optional[str]
global_name: Optional[str]
avatar_decoration_data: NotRequired[AvatarDecorationData]
clan: NotRequired[ClanTagPayload]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clan is deprecated, as dolphies said

Comment on lines +132 to +133
if clan_data:
self.clan_tag: Optional[ClanTag] = ClanTag(clan_data)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will raise an attribute error if the clan data is None

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants