-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
feat: Clans #9899
base: master
Are you sure you want to change the base?
feat: Clans #9899
Conversation
discord/http.py
Outdated
def create_clan(self, guild_id: int, **params: Any) -> Response[None]: | ||
valid_keys = ( | ||
'tag', | ||
'game_application_ids', | ||
'search_terms', | ||
'play_style', | ||
'description', | ||
'wildcard_descriptors', | ||
'badge', | ||
'badge_color_primary', | ||
'badge_color_secondary', | ||
'banner', | ||
'brand_color_primary', | ||
'brand_color_secondary', | ||
'verification_form', | ||
) | ||
payload = {k: v for k, v in params.items() if k in valid_keys} | ||
|
||
return self.request( | ||
Route( | ||
'POST', | ||
'/clan/{guild_id}', | ||
guild_id=guild_id, | ||
), | ||
json=payload, | ||
) | ||
|
||
def get_clan_settings(self, guild_id: int) -> Response[clan.ClanSettings]: | ||
return self.request( | ||
Route( | ||
'GET', | ||
'/clan/{guild_id}/settings', | ||
guild_id=guild_id, | ||
), | ||
) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These endpoints are not available for bots.
get_clan
andget_clans
are undocumented.
discord/guild.py
Outdated
async def create_clan( | ||
self, | ||
*, | ||
tag: str, | ||
games: Sequence[Snowflake], | ||
search_terms: List[str], | ||
play_style: ClanPlayStyle, | ||
description: str, | ||
wildcard_descriptors: List[str], | ||
badge_type: ClanBadgeType, | ||
badge_primary_colour: Colour = MISSING, | ||
badge_primary_color: Colour = MISSING, | ||
badge_secondary_colour: Colour = MISSING, | ||
badge_secondary_color: Colour = MISSING, | ||
banner_style: ClanBannerStyle, | ||
banner_primary_colour: Colour = MISSING, | ||
banner_primary_color: Colour = MISSING, | ||
banner_secondary_colour: Colour = MISSING, | ||
banner_secondary_color: Colour = MISSING, | ||
verification_form: MemberVerification, | ||
) -> None: | ||
"""|coro| | ||
|
||
Creates a new clan from this guild. | ||
|
||
Raises | ||
------ | ||
Forbidden | ||
You donnot have enough permissions to create a clan for this | ||
guild. | ||
HTTPException | ||
An error occurred while creating the guild clan. | ||
""" | ||
|
||
actual_badge_prim_col = badge_primary_colour or badge_primary_color | ||
actual_badge_sec_col = badge_secondary_colour or badge_secondary_color | ||
actual_banner_prim_col = banner_primary_colour or banner_primary_color | ||
actual_banner_sec_col = banner_secondary_colour or banner_secondary_color | ||
|
||
await self._state.http.create_clan( | ||
self.id, | ||
tag=tag, | ||
game_application_ids=[str(g.id) for g in games], | ||
search_terms=search_terms, | ||
description=description, | ||
play_style=play_style.value, | ||
wildcard_descriptors=wildcard_descriptors, | ||
badge=badge_type.value, | ||
banner=banner_style.value, | ||
badge_color_primary=actual_badge_prim_col, | ||
badge_color_secondary=actual_badge_sec_col, | ||
brand_color_primary=actual_banner_prim_col, | ||
brand_color_secondary=actual_banner_sec_col, | ||
verification_form=verification_form._to_dict() | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as HTTPClient.create_clan
discord/clan.py
Outdated
self.guild_id: int = int(data['identity_guild_id']) | ||
self.enabled: bool = data['identity_enabled'] | ||
self.tag: str = data['tag'] | ||
self._badge_hash: str = data['badge'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
identity_guild_id
, tag
, badge
all might be null
if identity_enabled
is false
Summary
WIP
Adds support for clans and member verification (clans join forms).
Checklist