Skip to content

Commit

Permalink
adjust slots
Browse files Browse the repository at this point in the history
  • Loading branch information
NeloBlivion authored Sep 10, 2024
1 parent 70d23ba commit 7b46217
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions discord/emoji.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,6 @@ class BaseEmoji(_EmojiTag, AssetMixin):
"managed",
"id",
"name",
"_roles",
"guild_id",
"application_id",
"_state",
"user",
"available",
Expand All @@ -75,7 +72,6 @@ def _from_data(self, emoji: EmojiPayload):
self.name: str = emoji["name"] # type: ignore
self.animated: bool = emoji.get("animated", False)
self.available: bool = emoji.get("available", True)
self._roles: SnowflakeList = SnowflakeList(map(int, emoji.get("roles", [])))
user = emoji.get("user")
self.user: User | None = User(state=self._state, data=user) if user else None

Expand Down Expand Up @@ -167,8 +163,14 @@ class GuildEmoji(BaseEmoji):
having the :attr:`~Permissions.manage_emojis` permission.
"""

__slots__: tuple[str, ...] = (
"_roles",
"guild_id",
)

def __init__(self, *, guild: Guild, state: ConnectionState, data: EmojiPayload):
self.guild_id: int = guild.id
self._roles: SnowflakeList = SnowflakeList(map(int, data.get("roles", [])))
super().__init__(state=state, data=data)

def __repr__(self) -> str:
Expand Down Expand Up @@ -336,6 +338,10 @@ class AppEmoji(BaseEmoji):
The user that created the emoji.
"""

__slots__: tuple[str, ...] = (
"application_id",
)

def __init__(
self, *, application_id: int, state: ConnectionState, data: EmojiPayload
):
Expand Down

0 comments on commit 7b46217

Please sign in to comment.