From f465f88d817f9d88e626a09032def5a37d974d1a Mon Sep 17 00:00:00 2001 From: Rapptz Date: Wed, 18 Jan 2017 19:54:47 -0500 Subject: Reimplement Guild.me property without patching it in. --- discord/guild.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'discord/guild.py') 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 @@ -257,6 +251,14 @@ class Guild(Hashable): """List[:class:`VoiceChannel`]: A list of voice channels that belongs to this guild.""" 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.""" -- cgit v1.2.3