Skip to content

Commit

Permalink
style(pre-commit): auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
pre-commit-ci[bot] committed Oct 13, 2024
1 parent 6e2a371 commit af8e2b2
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions discord/role.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,20 +79,24 @@ class RoleTags:
"subscription_listing_id",
"_premium_subscriber",
"_available_for_purchase",
"_guild_connections"
"_guild_connections",
)

def __init__(self, data: RoleTagPayload):
self.bot_id: int | None = _get_as_snowflake(data, "bot_id")
self.integration_id: int | None = _get_as_snowflake(data, "integration_id")
self.subscription_listing_id: int | None = _get_as_snowflake(data, "subscription_listing_id")
self.subscription_listing_id: int | None = _get_as_snowflake(
data, "subscription_listing_id"
)
# NOTE: The API returns "null" for this if the following tags True, and doesn't return them at all if False.
# However, "null" corresponds to None.
# This is different from other fields where "null" means "not there".
# So in this case, a value of None is the same as True.
# Which means we would need a different sentinel.
self._premium_subscriber: Any | None = data.get("premium_subscriber", MISSING)
self._available_for_purchase: Any | None = data.get("available_for_purchase", MISSING)
self._available_for_purchase: Any | None = data.get(
"available_for_purchase", MISSING
)
self._guild_connections: Any | None = data.get("guild_connections", MISSING)

def is_bot_managed(self) -> bool:
Expand All @@ -110,14 +114,14 @@ def is_integration(self) -> bool:
def is_available_for_purchase(self) -> bool:
"""Whether the role is available for purchase.
.. versionadded:: 2.7
"""
.. versionadded:: 2.7
"""
return self._available_for_purchase is None

def is_guild_connections_role(self) -> bool:
"""Whether the role is a guild connections role.
.. versionadded:: 2.7
.. versionadded:: 2.7
"""
return self._guild_connections is None

Expand Down

0 comments on commit af8e2b2

Please sign in to comment.