Reimplement Guild.me property without patching it in.
This commit is contained in:
parent
f4cadaf0cc
commit
f465f88d81
@ -64,9 +64,6 @@ class Guild(Hashable):
|
|||||||
----------
|
----------
|
||||||
name: str
|
name: str
|
||||||
The guild name.
|
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
|
roles
|
||||||
A list of :class:`Role` that the guild has available.
|
A list of :class:`Role` that the guild has available.
|
||||||
emojis
|
emojis
|
||||||
@ -94,9 +91,6 @@ class Guild(Hashable):
|
|||||||
Indicates if the guild is a 'large' guild. A large guild is defined as having
|
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
|
more than ``large_threshold`` count members, which for this library is set to
|
||||||
the maximum of 250.
|
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
|
mfa_level: int
|
||||||
Indicates the guild's two factor authorisation level. If this value is 0 then
|
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
|
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."""
|
"""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)]
|
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
|
@property
|
||||||
def text_channels(self):
|
def text_channels(self):
|
||||||
"""List[:class:`TextChannel`]: A list of text channels that belongs to this guild."""
|
"""List[:class:`TextChannel`]: A list of text channels that belongs to this guild."""
|
||||||
|
@ -188,8 +188,6 @@ class ConnectionState:
|
|||||||
|
|
||||||
def _add_guild_from_data(self, guild):
|
def _add_guild_from_data(self, guild):
|
||||||
guild = Guild(data=guild, state=self)
|
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)
|
self._add_guild(guild)
|
||||||
return guild
|
return guild
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user