Repository: hikari-py/hikari
Pull request #635 (2021-06-01 15:45:47)

Move helpful guild properties to the Guild object
### Checklist
<!-- Make sure to tick all the following boxes by putting an `x` in between (like this `[x]`) -->
- [x] I have run `nox` and all the pipelines have passed.
- [x] I have made unittests according to the code I have added/modified/deleted.



Patch:
diff --git a/docs/config.mako b/docs/config.mako
index 862f850f..25ecb004 100644
--- a/docs/config.mako
+++ b/docs/config.mako
@@ -35,9 +35,9 @@
 
     hljs_style = "atom-one-dark"
 
+    # Doesnt really do anything, just enables lurn_search
     lunr_search = {"fuzziness": 0}
 
-
     site_accent = "#ff029a"
     site_logo_name = "logo.png"
     site_logo_url = "https://hikari-py.github.io/hikari/logo.png"
diff --git a/docs/documentation.mako b/docs/documentation.mako
index b0d4303f..ea0413d4 100644
--- a/docs/documentation.mako
+++ b/docs/documentation.mako
@@ -880,7 +880,7 @@
                             %>
 
                             ## Purposely using one item per list for layout reasons.
-                            <li class="monospaced">
+                            <li class="monospaced text-truncate">
                                 ${link(c, with_prefixes=True, css_classes="sidebar-nav-pill", dotted=False, simple_names=True)}
 
                                 <ul class="list-unstyled nested text-truncate">
diff --git a/hikari/events/message_events.py b/hikari/events/message_events.py
index 930c2a09..303e39c4 100644
--- a/hikari/events/message_events.py
+++ b/hikari/events/message_events.py
@@ -220,17 +220,27 @@ class GuildMessageCreateEvent(MessageCreateEvent):
     # <<inherited docstring from ShardEvent>>
 
     @property
-    def author(self) -> guilds.Member:
+    def author(self) -> users.User:
+        """User object of the user that sent the message.
+
+        Returns
+        -------
+        hikari.users.User
+            The user object of the user that sent the message.
+        """
+        return self.message.author
+
+    @property
+    def member(self) -> typing.Optional[guilds.Member]:
         """Member object of the user that sent the message.
 
         Returns
         -------
-        hikari.guilds.Member
-            The member object of the user that sent the message.
+        typing.Optional[hikari.guilds.Member]
+            The member object of the user that sent the message or
+            `builtins.None` if sent by a webhook.
         """
-        member = self.message.member
-        assert member is not None, "no member given for guild message create event!"
-        return member
+        return self.message.member
 
     @property
     def channel(self) -> typing.Union[None, channels.GuildTextChannel, channels.GuildNewsChannel]:
@@ -476,18 +486,34 @@ class GuildMessageUpdateEvent(MessageUpdateEvent):
 
     @property
     def author(self) -> typing.Optional[users.User]:
-        """Member or user that sent the message.
+        """User that sent the message.
 
         Returns
         -------
         typing.Union[builtins.None, hikari.users.User, hikari.guilds.Member]
-            The user that sent the message. If the member is cached
+            The user that sent the message.
+
+            This will be `builtins.None` in some cases, such as when Discord
+            updates a message with an embed for a URL preview or if the message
+            was sent by a webhook.
+        """
+        return self.message.author
+
+    @property
+    def member(self) -> typing.Optional[guilds.Member]:
+        """Member that sent the message.
+
+        Returns
+        -------
+        typing.Optional[hikari.guilds.Member]
+            The member that sent the message. If the member is cached
             (the intents are enabled), then this will be the corresponding
             member object instead (which is a specialization of the
             user object you should otherwise expect).
 
             This will be `builtins.None` in some cases, such as when Discord
-            updates a message with an embed for a URL preview.
+            updates a message with an embed for a URL preview or if the message
+            was sent by a webhook.
         """
         member = self.message.member
         if member is not None:
@@ -501,7 +527,7 @@ def author(self) -> typing.Optional[users.User]:
             if member is not None:
                 return member
 
-        return author
+        return None
 
     @property
     def channel(self) -> typing.Union[None, channels.GuildTextChannel, channels.GuildNewsChannel]:
diff --git a/hikari/files.py b/hikari/files.py
index 9bde1893..2b17562f 100644
--- a/hikari/files.py
+++ b/hikari/files.py
@@ -180,7 +180,7 @@ def ensure_resource(url_or_resource: Resourceish, /) -> Resource[AsyncReader]:
     if isinstance(url_or_resource, RAWISH_TYPES):
         data = unwrap_bytes(url_or_resource)
         filename = generate_filename_from_details(mimetype=None, extension=None, data=data)
-        return typing.cast("Resource[AsyncReader]", Bytes(url_or_resource, filename))
+        return typing.cast("Resource[AsyncReader]", Bytes(data, filename))
 
     if isinstance(url_or_resource, Resource):
         return url_or_resource
diff --git a/hikari/guilds.py b/hikari/guilds.py
index ca3f1349..bc0537ea 100644
--- a/hikari/guilds.py
+++ b/hikari/guilds.py
@@ -1220,6 +1220,61 @@ def discovery_splash_url(self) -> typing.Optional[files.URL]:
         """Discovery splash URL for the guild, if set."""
         return self.make_discovery_splash_url()
 
+    @property
+    def members(self) -> typing.Mapping[snowflakes.Snowflake, Member]:
+        """Get the members cached for the guild.
+
+        typing.Mapping[hikari.snowflakes.Snowflake, Member]
+            A mapping of user IDs to objects of the members cached for the guild.
+        """
+        if not isinstance(self.app, traits.CacheAware):
+            return {}
+
+        return self.app.cache.get_members_view_for_guild(self.id)
+
+    @property
+    def presences(self) -> typing.Mapping[snowflakes.Snowflake, presences_.MemberPresence]:
+        """Get the presences cached for the guild.
+
+        typing.Mapping[hikari.snowflakes.Snowflake, hikari.presences.MemberPresence]
+            A mapping of user IDs to objects of the presences cached for the
+            guild.
+        """
+        if not isinstance(self.app, traits.CacheAware):
+            return {}
+
+        return self.app.cache.get_presences_view_for_guild(self.id)
+
+    @property
+    def channels(self) -> typing.Mapping[snowflakes.Snowflake, channels_.GuildChannel]:
+        """Get the channels cached for the guild.
+
+        Returns
+        -------
+        typing.Mapping[hikari.snowflakes.Snowflake, hikari.channels.GuildChannel]
+            A mapping of channel IDs to objects of the channels cached for the
+            guild.
+        """
+        if not isinstance(self.app, traits.CacheAware):
+            return {}
+
+        return self.app.cache.get_guild_channels_view_for_guild(self.id)
+
+    @property
+    def voice_states(self) -> typing.Mapping[snowflakes.Snowflake, voices_.VoiceState]:
+        """Get the voice states cached for the guild.
+
+        Returns
+        -------
+        typing.Mapping[hikari.snowflakes.Snowflake, hikari.voices.VoiceState]
+            A mapping of user IDs to objects of the voice states cached for the
+            guild.
+        """
+        if not isinstance(self.app, traits.CacheAware):
+            return {}
+
+        return self.app.cache.get_voice_states_view_for_guild(self.id)
+
     @property
     @abc.abstractmethod
     def emojis(self) -> typing.Mapping[snowflakes.Snowflake, emojis_.KnownCustomEmoji]:
@@ -1346,6 +1401,102 @@ def make_splash_url(self, *, ext: str = "png", size: int = 4096) -> typing.Optio
             file_format=ext,
         )
 
+    def get_channel(
+        self,
+        channel: snowflakes.SnowflakeishOr[channels_.PartialChannel],
+    ) -> typing.Optional[channels_.GuildChannel]:
+        """Get a cached channel that belongs to the guild by it's ID or object.
+
+        Parameters
+        ----------
+        channel : hikari.snowflakes.SnowflakeishOr[hikari.channels.PartialChannel]
+            The object or ID of the guild channel to get from the cache.
+
+        Returns
+        -------
+        typing.Optional[hikari.channels.GuildChannel]
+            The object of the guild channel found in cache or `builtins.None.
+        """
+        if not isinstance(self.app, traits.CacheAware):
+            return None
+
+        return self.app.cache.get_guild_channel(channel)
+
+    def get_member(self, user: snowflakes.SnowflakeishOr[users.PartialUser]) -> typing.Optional[Member]:
+        """Get a cached member that belongs to the guild by it's user ID or object.
+
+        Parameters
+        ----------
+        user : hikari.snowflakes.SnowflakeishOr[hikari.users.PartialUser]
+            The object or ID of the user to get the cached member for.
+
+        Returns
+        -------
+        typing.Optional[Member]
+            The cached member object if found, else `builtins.None`.
+        """
+        if not isinstance(self.app, traits.CacheAware):
+            return None
+
+        return self.app.cache.get_member(self.id, user)
+
+    def get_my_member(self) -> typing.Optional[Member]:
+        """Return the cached member for the bot user in this guild, if known.
+
+        Returns
+        -------
+        typing.Optional[Member]
+            The cached member for this guild, or `builtins.None` if not known.
+        """
+        if not isinstance(self.app, traits.ShardAware):
+            return None
+
+        me = self.app.me
+        if me is None:
+            return None
+
+        return self.get_member(me.id)
+
+    def get_presence(
+        self, user: snowflakes.SnowflakeishOr[users.PartialUser]
+    ) -> typing.Optional[presences_.MemberPresence]:
+        """Get a cached presence that belongs to the guild by it's user ID or object.
+
+        Parameters
+        ----------
+        user : hikari.snowflakes.SnowflakeishOr[hikari.users.PartialUser]
+            The object or ID of the user to get the cached presence for.
+
+        Returns
+        -------
+        typing.Optional[hikari.presences.MemberPresence]
+            The cached presence object if found, else `builtins.None`.
+        """
+        if not isinstance(self.app, traits.CacheAware):
+            return None
+
+        return self.app.cache.get_presence(self.id, user)
+
+    def get_voice_state(
+        self, user: snowflakes.SnowflakeishOr[users.PartialUser]
+    ) -> typing.Optional[voices_.VoiceState]:
+        """Get a cached voice state that belongs to the guild by it's user.
+
+        Parameters
+        ----------
+        user : hikari.snowflakes.SnowflakeishOr[hikari.users.PartialUser]
+            The object or ID of the user to get the cached voice state for.
+
+        Returns
+        -------
+        typing.Optional[hikari.voices.VoiceState]
+            The cached voice state object if found, else `builtins.None`.
+        """
+        if not isinstance(self.app, traits.CacheAware):
+            return None
+
+        return self.app.cache.get_voice_state(self.id, user)
+
     @abc.abstractmethod
     def get_emoji(
         self, emoji: snowflakes.SnowflakeishOr[emojis_.CustomEmoji]
@@ -1441,21 +1592,6 @@ class GatewayGuild(Guild):
     `builtins.None`.
     """
 
-    @property
-    def channels(self) -> typing.Mapping[snowflakes.Snowflake, channels_.GuildChannel]:
-        """Get the channels cached for the guild.
-
-        Returns
-        -------
-        typing.Mapping[hikari.snowflakes.Snowflake, hikari.channels.GuildChannel]
-            A mapping of channel IDs to objects of the channels cached for the
-            guild.
-        """
-        if not isinstance(self.app, traits.CacheAware):
-            return {}
-
-        return self.app.cache.get_guild_channels_view_for_guild(self.id)
-
     @property
     def emojis(self) -> typing.Mapping[snowflakes.Snowflake, emojis_.KnownCustomEmoji]:
         # <<inherited docstring from Guild>>.
@@ -1464,31 +1600,6 @@ def emojis(self) -> typing.Mapping[snowflakes.Snowflake, emojis_.KnownCustomEmoj
 
         return self.app.cache.get_emojis_view_for_guild(self.id)
 
-    @property
-    def members(self) -> typing.Mapping[snowflakes.Snowflake, Member]:
-        """Get the members cached for the guild.
-
-        typing.Mapping[hikari.snowflakes.Snowflake, Member]
-            A mapping of user IDs to objects of the members cached for the guild.
-        """
-        if not isinstance(self.app, traits.CacheAware):
-            return {}
-
-        return self.app.cache.get_members_view_for_guild(self.id)
-
-    @property
-    def presences(self) -> typing.Mapping[snowflakes.Snowflake, presences_.MemberPresence]:
-        """Get the presences cached for the guild.
-
-        typing.Mapping[hikari.snowflakes.Snowflake, hikari.presences.MemberPresence]
-            A mapping of user IDs to objects of the presences cached for the
-            guild.
-        """
-        if not isinstance(self.app, traits.CacheAware):
-            return {}
-
-        return self.app.cache.get_presences_view_for_guild(self.id)
-
     @property
     def roles(self) -> typing.Mapping[snowflakes.Snowflake, Role]:
         # <<inherited docstring from Guild>>.
@@ -1497,42 +1608,6 @@ def roles(self) -> typing.Mapping[snowflakes.Snowflake, Role]:
 
         return self.app.cache.get_roles_view_for_guild(self.id)
 
-    @property
-    def voice_states(self) -> typing.Mapping[snowflakes.Snowflake, voices_.VoiceState]:
-        """Get the voice states cached for the guild.
-
-        Returns
-        -------
-        typing.Mapping[hikari.snowflakes.Snowflake, hikari.voices.VoiceState]
-            A mapping of user IDs to objects of the voice states cached for the
-            guild.
-        """
-        if not isinstance(self.app, traits.CacheAware):
-            return {}
-
-        return self.app.cache.get_voice_states_view_for_guild(self.id)
-
-    def get_channel(
-        self,
-        channel: snowflakes.SnowflakeishOr[channels_.PartialChannel],
-    ) -> typing.Optional[channels_.GuildChannel]:
-        """Get a cached channel that belongs to the guild by it's ID or object.
-
-        Parameters
-        ----------
-        channel : hikari.snowflakes.SnowflakeishOr[hikari.channels.PartialChannel]
-            The object or ID of the guild channel to get from the cache.
-
-        Returns
-        -------
-        typing.Optional[hikari.channels.GuildChannel]
-            The object of the guild channel found in cache or `builtins.None.
-        """
-        if not isinstance(self.app, traits.CacheAware):
-            return None
-
-        return self.app.cache.get_guild_channel(channel)
-
     def get_emoji(
         self, emoji: snowflakes.SnowflakeishOr[emojis_.CustomEmoji]
     ) -> typing.Optional[emojis_.KnownCustomEmoji]:
@@ -1554,61 +1629,6 @@ def get_emoji(
 
         return self.app.cache.get_emoji(emoji)
 
-    def get_member(self, user: snowflakes.SnowflakeishOr[users.PartialUser]) -> typing.Optional[Member]:
-        """Get a cached member that belongs to the guild by it's user ID or object.
-
-        Parameters
-        ----------
-        user : hikari.snowflakes.SnowflakeishOr[hikari.users.PartialUser]
-            The object or ID of the user to get the cached member for.
-
-        Returns
-        -------
-        typing.Optional[Member]
-            The cached member object if found, else `builtins.None`.
-        """
-        if not isinstance(self.app, traits.CacheAware):
-            return None
-
-        return self.app.cache.get_member(self.id, user)
-
-    def get_my_member(self) -> typing.Optional[Member]:
-        """Return the cached member for the bot user in this guild, if known.
-
-        Returns
-        -------
-        typing.Optional[Member]
-            The cached member for this guild, or `builtins.None` if not known.
-        """
-        if not isinstance(self.app, traits.ShardAware):
-            return None
-
-        me = self.app.me
-        if me is None:
-            return None
-
-        return self.get_member(me.id)
-
-    def get_presence(
-        self, user: snowflakes.SnowflakeishOr[users.PartialUser]
-    ) -> typing.Optional[presences_.MemberPresence]:
-        """Get a cached presence that belongs to the guild by it's user ID or object.
-
-        Parameters
-        ----------
-        user : hikari.snowflakes.SnowflakeishOr[hikari.users.PartialUser]
-            The object or ID of the user to get the cached presence for.
-
-        Returns
-        -------
-        typing.Optional[hikari.presences.MemberPresence]
-            The cached presence object if found, else `builtins.None`.
-        """
-        if not isinstance(self.app, traits.CacheAware):
-            return None
-
-        return self.app.cache.get_presence(self.id, user)
-
     def get_role(self, role: snowflakes.SnowflakeishOr[PartialRole]) -> typing.Optional[Role]:
         """Get a cached role that belongs to the guild by it's ID or object.
 
@@ -1626,23 +1646,3 @@ def get_role(self, role: snowflakes.SnowflakeishOr[PartialRole]) -> typing.Optio
             return None
 
         return self.app.cache.get_role(role)
-
-    def get_voice_state(
-        self, user: snowflakes.SnowflakeishOr[users.PartialUser]
-    ) -> typing.Optional[voices_.VoiceState]:
-        """Get a cached voice state that belongs to the guild by it's user.
-
-        Parameters
-        ----------
-        user : hikari.snowflakes.SnowflakeishOr[hikari.users.PartialUser]
-            The object or ID of the user to get the cached voice state for.
-
-        Returns
-        -------
-        typing.Optional[hikari.voices.VoiceState]
-            The cached voice state object if found, else `builtins.None`.
-        """
-        if not isinstance(self.app, traits.CacheAware):
-            return None
-
-        return self.app.cache.get_voice_state(self.id, user)
diff --git a/hikari/messages.py b/hikari/messages.py
index 9b8b680f..cdb3376f 100644
--- a/hikari/messages.py
+++ b/hikari/messages.py
@@ -542,8 +542,8 @@ class PartialMessage(snowflakes.Unique):
     If the message is not in a guild, this will be `builtins.None`.
 
     This will also be `builtins.None` in some cases such as when Discord updates
-    a message with an embed URL preview or in messages fetched from the
-    REST API.
+    a message with an embed URL preview, in messages fetched from the
+    REST API or messages sent by discord.
     """
 
     content: undefined.UndefinedNoneOr[str] = attr.field(hash=False, eq=False, repr=False)


Test patch:
diff --git a/tests/hikari/events/test_message_events.py b/tests/hikari/events/test_message_events.py
index 0a0a8f6c..7b6af2ba 100644
--- a/tests/hikari/events/test_message_events.py
+++ b/tests/hikari/events/test_message_events.py
@@ -24,7 +24,6 @@
 import pytest
 
 from hikari import channels
-from hikari import guilds
 from hikari import messages
 from hikari import snowflakes
 from hikari import undefined
@@ -207,7 +206,10 @@ def test_guild_property(self, event):
         event.app.cache.get_guild.assert_called_once_with(342123123)
 
     def test_author_property(self, event):
-        assert event.author is event.message.member
+        assert event.author is event.message.author
+
+    def test_member_property(self, event):
+        assert event.member is event.message.member
 
 
 class TestGuildMessageUpdateEvent:
@@ -224,37 +226,46 @@ def event(self):
             shard=mock.Mock(),
         )
 
-    def test_author_property_when_member_defined(self, event):
-        event.message.member = mock.Mock(spec_set=guilds.Member)
+    def test_author_property(self, event):
+        assert event.author is event.message.author
+
+    def test_member_property(self, event):
+        assert event.member is event.message.member
+
+    def test_member_property_when_member_defined(self, event):
+        event.message.member = mock.Mock()
         event.message.author = undefined.UNDEFINED
 
-        assert event.author is event.message.member
+        assert event.member is event.message.member
 
-    def test_author_property_when_member_none_but_cached(self, event):
+    def test_member_property_when_member_none_but_cached(self, event):
         event.message.member = None
-        event.message.author = mock.Mock(spec_set=users.User, id=1234321)
+        event.message.author = mock.Mock(id=1234321)
         event.message.guild_id = snowflakes.Snowflake(696969)
-        real_member = mock.Mock(spec_set=guilds.Member)
+        real_member = mock.Mock()
         event.app.cache.get_member = mock.Mock(return_value=real_member)
 
-        assert event.author is real_member
+        assert event.member is real_member
 
         event.app.cache.get_member.assert_called_once_with(696969, 1234321)
 
-    def test_author_property_when_member_none_but_author_also_none(self, event):
+    def test_member_property_when_member_none_and_author_none(self, event):
         event.message.author = None
         event.message.member = None
 
-        assert event.author is None
+        assert event.member is None
 
         event.app.cache.get_member.assert_not_called()
 
-    def test_author_property_when_member_none_and_uncached_but_author_defined(self, event):
+    def test_member_property_when_member_none_and_uncached(self, event):
         event.message.member = None
+        event.message.author = mock.Mock(id=1234321)
+        event.message.guild_id = snowflakes.Snowflake(696969)
         event.app.cache.get_member = mock.Mock(return_value=None)
-        event.message.author = mock.Mock(spec_set=users.User)
 
-        assert event.author is event.message.author
+        assert event.member is None
+
+        event.app.cache.get_member.assert_called_once_with(696969, 1234321)
 
     def test_guild_id_property(self, event):
         assert event.guild_id == snowflakes.Snowflake(54123123123)
diff --git a/tests/hikari/test_guilds.py b/tests/hikari/test_guilds.py
index 47c630c3..2d565bea 100644
--- a/tests/hikari/test_guilds.py
+++ b/tests/hikari/test_guilds.py
@@ -482,6 +482,38 @@ def model(self, mock_app):
             system_channel_flags=guilds.GuildSystemChannelFlag.SUPPRESS_PREMIUM_SUBSCRIPTION,
         )
 
+    def test_channels(self, model):
+        assert model.channels is model.app.cache.get_guild_channels_view_for_guild.return_value
+        model.app.cache.get_guild_channels_view_for_guild.assert_called_once_with(123)
+
+    def test_channels_when_no_cache_trait(self, model):
+        model.app = object()
+        assert model.channels == {}
+
+    def test_members(self, model):
+        assert model.members is model.app.cache.get_members_view_for_guild.return_value
+        model.app.cache.get_members_view_for_guild.assert_called_once_with(123)
+
+    def test_members_when_no_cache_trait(self, model):
+        model.app = object()
+        assert model.members == {}
+
+    def test_presences(self, model):
+        assert model.presences is model.app.cache.get_presences_view_for_guild.return_value
+        model.app.cache.get_presences_view_for_guild.assert_called_once_with(123)
+
+    def test_presences_when_no_cache_trait(self, model):
+        model.app = object()
+        assert model.presences == {}
+
+    def test_voice_states(self, model):
+        assert model.voice_states is model.app.cache.get_voice_states_view_for_guild.return_value
+        model.app.cache.get_voice_states_view_for_guild.assert_called_once_with(123)
+
+    def test_voice_states_when_no_cache_trait(self, model):
+        model.app = object()
+        assert model.voice_states == {}
+
     def test_splash_url(self, model):
         splash = object()
 
@@ -558,6 +590,54 @@ def test_make_banner_url_when_no_hash(self, model):
         model.banner_hash = None
         assert model.make_banner_url(ext="png", size=2048) is None
 
+    def test_get_channel(self, model):
+        assert model.get_channel(456) is model.app.cache.get_guild_channel.return_value
+        model.app.cache.get_guild_channel.assert_called_once_with(456)
+
+    def test_get_channel_when_no_cache_trait(self, model):
+        model.app = object()
+        assert model.get_channel(456) is None
+
+    def test_get_member(self, model):
+        assert model.get_member(456) is model.app.cache.get_member.return_value
+        model.app.cache.get_member.assert_called_once_with(123, 456)
+
+    def test_get_member_when_no_cache_trait(self, model):
+        model.app = object()
+        assert model.get_member(456) is None
+
+    def test_get_presence(self, model):
+        assert model.get_presence(456) is model.app.cache.get_presence.return_value
+        model.app.cache.get_presence.assert_called_once_with(123, 456)
+
+    def test_get_presence_when_no_cache_trait(self, model):
+        model.app = object()
+        assert model.get_presence(456) is None
+
+    def test_get_voice_state(self, model):
+        assert model.get_voice_state(456) is model.app.cache.get_voice_state.return_value
+        model.app.cache.get_voice_state.assert_called_once_with(123, 456)
+
+    def test_get_voice_state_when_no_cache_trait(self, model):
+        model.app = object()
+        assert model.get_voice_state(456) is None
+
+    def test_get_my_member_when_not_shardaware(self, model):
+        model.app = object()
+        assert model.get_my_member() is None
+
+    def test_get_my_member_when_no_me(self, model):
+        model.app.me = None
+        assert model.get_my_member() is None
+
+    def test_get_my_member(self, model):
+        model.app.me = mock.Mock(id=123)
+
+        with mock.patch.object(guilds.Guild, "get_member") as get_member:
+            assert model.get_my_member() is get_member.return_value
+
+        get_member.assert_called_once_with(123)
+
 
 class TestRestGuild:
     @pytest.fixture()
@@ -651,14 +731,6 @@ def model(self, mock_app):
             nsfw_level=guilds.GuildNSFWLevel.AGE_RESTRICTED,
         )
 
-    def test_channels(self, model):
-        assert model.channels is model.app.cache.get_guild_channels_view_for_guild.return_value
-        model.app.cache.get_guild_channels_view_for_guild.assert_called_once_with(123)
-
-    def test_channels_when_no_cache_trait(self, model):
-        model.app = object()
-        assert model.channels == {}
-
     def test_emojis(self, model):
         assert model.emojis is model.app.cache.get_emojis_view_for_guild.return_value
         model.app.cache.get_emojis_view_for_guild.assert_called_once_with(123)
@@ -667,22 +739,6 @@ def test_emojis_when_no_cache_trait(self, model):
         model.app = object()
         assert model.emojis == {}
 
-    def test_members(self, model):
-        assert model.members is model.app.cache.get_members_view_for_guild.return_value
-        model.app.cache.get_members_view_for_guild.assert_called_once_with(123)
-
-    def test_members_when_no_cache_trait(self, model):
-        model.app = object()
-        assert model.members == {}
-
-    def test_presences(self, model):
-        assert model.presences is model.app.cache.get_presences_view_for_guild.return_value
-        model.app.cache.get_presences_view_for_guild.assert_called_once_with(123)
-
-    def test_presences_when_no_cache_trait(self, model):
-        model.app = object()
-        assert model.presences == {}
-
     def test_roles(self, model):
         assert model.roles is model.app.cache.get_roles_view_for_guild.return_value
         model.app.cache.get_roles_view_for_guild.assert_called_once_with(123)
@@ -691,22 +747,6 @@ def test_roles_when_no_cache_trait(self, model):
         model.app = object()
         assert model.roles == {}
 
-    def test_voice_states(self, model):
-        assert model.voice_states is model.app.cache.get_voice_states_view_for_guild.return_value
-        model.app.cache.get_voice_states_view_for_guild.assert_called_once_with(123)
-
-    def test_voice_states_when_no_cache_trait(self, model):
-        model.app = object()
-        assert model.voice_states == {}
-
-    def test_get_channel(self, model):
-        assert model.get_channel(456) is model.app.cache.get_guild_channel.return_value
-        model.app.cache.get_guild_channel.assert_called_once_with(456)
-
-    def test_get_channel_when_no_cache_trait(self, model):
-        model.app = object()
-        assert model.get_channel(456) is None
-
     def test_get_emoji(self, model):
         assert model.get_emoji(456) is model.app.cache.get_emoji.return_value
         model.app.cache.get_emoji.assert_called_once_with(456)
@@ -715,22 +755,6 @@ def test_get_emoji_when_no_cache_trait(self, model):
         model.app = object()
         assert model.get_emoji(456) is None
 
-    def test_get_member(self, model):
-        assert model.get_member(456) is model.app.cache.get_member.return_value
-        model.app.cache.get_member.assert_called_once_with(123, 456)
-
-    def test_get_member_when_no_cache_trait(self, model):
-        model.app = object()
-        assert model.get_member(456) is None
-
-    def test_get_presence(self, model):
-        assert model.get_presence(456) is model.app.cache.get_presence.return_value
-        model.app.cache.get_presence.assert_called_once_with(123, 456)
-
-    def test_get_presence_when_no_cache_trait(self, model):
-        model.app = object()
-        assert model.get_presence(456) is None
-
     def test_get_role(self, model):
         assert model.get_role(456) is model.app.cache.get_role.return_value
         model.app.cache.get_role.assert_called_once_with(456)
@@ -738,27 +762,3 @@ def test_get_role(self, model):
     def test_get_role_when_no_cache_trait(self, model):
         model.app = object()
         assert model.get_role(456) is None
-
-    def test_get_voice_state(self, model):
-        assert model.get_voice_state(456) is model.app.cache.get_voice_state.return_value
-        model.app.cache.get_voice_state.assert_called_once_with(123, 456)
-
-    def test_get_voice_state_when_no_cache_trait(self, model):
-        model.app = object()
-        assert model.get_voice_state(456) is None
-
-    def test_get_my_member_when_not_shardaware(self, model):
-        model.app = object()
-        assert model.get_my_member() is None
-
-    def test_get_my_member_when_no_me(self, model):
-        model.app.me = None
-        assert model.get_my_member() is None
-
-    def test_get_my_member(self, model):
-        model.app.me = mock.Mock(id=123)
-
-        with mock.patch.object(guilds.GatewayGuild, "get_member") as get_member:
-            assert model.get_my_member() is get_member.return_value
-
-        get_member.assert_called_once_with(123)