aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRapptz <[email protected]>2017-01-18 19:54:47 -0500
committerRapptz <[email protected]>2017-01-18 19:54:47 -0500
commitf465f88d817f9d88e626a09032def5a37d974d1a (patch)
tree00260fab831cc4826c4717319c9a1e537658f65f
parentFix bug with GuildChannel.edit and Role.edit with positions. (diff)
downloaddiscord.py-f465f88d817f9d88e626a09032def5a37d974d1a.tar.xz
discord.py-f465f88d817f9d88e626a09032def5a37d974d1a.zip
Reimplement Guild.me property without patching it in.
-rw-r--r--discord/guild.py14
-rw-r--r--discord/state.py2
2 files changed, 8 insertions, 8 deletions
diff --git a/discord/guild.py b/discord/guild.py
index 49caa69b..509d9066 100644
--- a/discord/guild.py
+++ b/discord/guild.py
@@ -64,9 +64,6 @@ class Guild(Hashable):
----------
name: str
The guild name.
- me: :class:`Member`
- Similar to :attr:`Client.user` except an instance of :class:`Member`.
- This is essentially used to get the member version of yourself.
roles
A list of :class:`Role` that the guild has available.
emojis
@@ -94,9 +91,6 @@ class Guild(Hashable):
Indicates if the guild is a 'large' guild. A large guild is defined as having
more than ``large_threshold`` count members, which for this library is set to
the maximum of 250.
- voice_client: Optional[:class:`VoiceClient`]
- The VoiceClient associated with this guild. A shortcut for the
- :meth:`Client.voice_client_in` call.
mfa_level: int
Indicates the guild's two factor authorisation level. If this value is 0 then
the guild does not require 2FA for their administrative members. If the value is
@@ -258,6 +252,14 @@ class Guild(Hashable):
return [ch for ch in self._channels.values() if isinstance(ch, VoiceChannel)]
@property
+ def me(self):
+ """Similar to :attr:`Client.user` except an instance of :class:`Member`.
+ This is essentially used to get the member version of yourself.
+ """
+ self_id = self._state.user.id
+ return self.get_member(self_id)
+
+ @property
def text_channels(self):
"""List[:class:`TextChannel`]: A list of text channels that belongs to this guild."""
return [ch for ch in self._channels.values() if isinstance(ch, TextChannel)]
diff --git a/discord/state.py b/discord/state.py
index 37ccd922..7f0c4eb9 100644
--- a/discord/state.py
+++ b/discord/state.py
@@ -188,8 +188,6 @@ class ConnectionState:
def _add_guild_from_data(self, guild):
guild = Guild(data=guild, state=self)
- Guild.me = property(lambda s: s.get_member(self.user.id))
- Guild.voice_client = property(lambda s: self._get_voice_client(s.id))
self._add_guild(guild)
return guild