Skip to content

Commit

Permalink
Fix id being None
Browse files Browse the repository at this point in the history
  • Loading branch information
Cryptex-github committed Aug 23, 2021
1 parent 9bdc9c5 commit f0eb29c
Show file tree
Hide file tree
Showing 7 changed files with 6 additions and 10 deletions.
2 changes: 1 addition & 1 deletion ferris/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
__author__ = 'Cryptex & jay3332'
__version__ = '0.0a1.dev3'
__version__ = '0.0a1.post0'
# 0.1.0 for the finished release


Expand Down
8 changes: 4 additions & 4 deletions ferris/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,18 @@
class SnowflakeObject(ABC):
"""An abstract base class representing objects that have a snowflake ID."""

__slots__ = ('__id',)
__slots__ = ('_id',)

def __init__(self, /) -> None:
self.__id: int = None
self._id: int = None

def _store_snowflake(self, id: Snowflake, /) -> None:
self.__id = id
self._id = id

@property
def id(self, /) -> int:
"""int: The snowflake ID of this object."""
return self.__id
return self._id


class BaseObject(SnowflakeObject, ABC):
Expand Down
1 change: 0 additions & 1 deletion ferris/channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ class Channel(BaseObject):
def __init__(self, connection: Connection, data: Data, /) -> None:
self._connection: Connection = connection
self._process_data(data)
super().__init__()

def _process_data(self, data: Data, /) -> None:
self._store_snowflake(cast(int, data.get('id')))
Expand Down
2 changes: 1 addition & 1 deletion ferris/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ async def fetch_guild(
A guild with the given ID was not found.
"""
g = await self._connection.api.guilds(id).get(
params={'members': fetch_members, 'channels': fetch_channels}
params={'members': str(fetch_members).lower(), 'channels': str(fetch_channels).lower()}
)
return Guild(self._connection, g)

Expand Down
1 change: 0 additions & 1 deletion ferris/guild.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ class Guild(BaseObject):
def __init__(self, connection: Connection, data: Data, /) -> None:
self._connection: Connection = connection
self._process_data(data)
super().__init__()

def _process_data(self, data: Data, /) -> None:
from .channel import Channel
Expand Down
1 change: 0 additions & 1 deletion ferris/member.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ class Member(BaseObject):
def __init__(self, connection: Connection, data: Data, /) -> None:
self._connection: Connection = connection
self._process_data(data)
super().__init__()

def _process_data(self, data: Data, /) -> None:
self._store_snowflake(cast(int, data.get('user_id')))
Expand Down
1 change: 0 additions & 1 deletion ferris/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ class Message(BaseObject):
def __init__(self, connection: Connection, data: Data, /) -> None:
self._connection: Connection = connection
self._process_data(data)
super().__init__()

def _process_data(self, data: Data, /) -> None:
self._store_snowflake(cast(int, data.get('id')))
Expand Down

0 comments on commit f0eb29c

Please sign in to comment.