Skip to content

Commit

Permalink
Move message cache methods to cache rather than mutable cache (#386)
Browse files Browse the repository at this point in the history
  • Loading branch information
FasterSpeeding authored Dec 8, 2020
1 parent 5a95ea2 commit ac70db5
Showing 1 changed file with 25 additions and 25 deletions.
50 changes: 25 additions & 25 deletions hikari/api/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,31 @@ def get_members_view_for_guild(
The view of user IDs to the members cached for the specified guild.
"""

@abc.abstractmethod
def get_message(self, message_id: snowflakes.Snowflake, /) -> typing.Optional[messages.Message]:
"""Get a message object from the cache.
Parameters
----------
message_id : hikari.snowflakes.Snowflake
The ID of the message to get from the cache.
Returns
-------
typing.Optional[hikari.messages.Message]
The object of the message found in the cache or `builtins.None`.
"""

@abc.abstractmethod
def get_messages_view(self) -> CacheView[snowflakes.Snowflake, messages.Message]:
"""Get a view of all the message objects in the cache.
Returns
-------
CacheView[hikari.snowflakes.Snowflake, hikari.messages.Message]
A view of message objects found in the cache.
"""

@abc.abstractmethod
def get_presence(
self, guild_id: snowflakes.Snowflake, user_id: snowflakes.Snowflake, /
Expand Down Expand Up @@ -1622,31 +1647,6 @@ def delete_message(self, message_id: snowflakes.Snowflake, /) -> typing.Optional
When called on a stateless cache implementation.
"""

@abc.abstractmethod
def get_message(self, message_id: snowflakes.Snowflake, /) -> typing.Optional[messages.Message]:
"""Get a message object from the cache.
Parameters
----------
message_id : hikari.snowflakes.Snowflake
The ID of the message to get from the cache.
Returns
-------
typing.Optional[hikari.messages.Message]
The object of the message found in the cache or `builtins.None`.
"""

@abc.abstractmethod
def get_messages_view(self) -> CacheView[snowflakes.Snowflake, messages.Message]:
"""Get a view of all the message objects in the cache.
Returns
-------
CacheView[hikari.snowflakes.Snowflake, hikari.messages.Message]
A view of message objects found in the cache.
"""

@abc.abstractmethod
def set_message(self, message: messages.Message, /) -> None:
"""Add a message object to the cache.
Expand Down

0 comments on commit ac70db5

Please sign in to comment.