Change dict value views into lists.
This commit is contained in:
parent
c205eb3528
commit
2c50c18ca3
@ -114,13 +114,13 @@ class Client:
|
|||||||
-----------
|
-----------
|
||||||
user : Optional[:class:`User`]
|
user : Optional[:class:`User`]
|
||||||
Represents the connected client. None if not logged in.
|
Represents the connected client. None if not logged in.
|
||||||
voice_clients : iterable of :class:`VoiceClient`
|
voice_clients: List[:class:`VoiceClient`]
|
||||||
Represents a list of voice connections. To connect to voice use
|
Represents a list of voice connections. To connect to voice use
|
||||||
:meth:`join_voice_channel`. To query the voice connection state use
|
:meth:`join_voice_channel`. To query the voice connection state use
|
||||||
:meth:`is_voice_connected`.
|
:meth:`is_voice_connected`.
|
||||||
guilds : iterable of :class:`Guild`
|
guilds: List[:class:`Guild`]
|
||||||
The guilds that the connected client is a member of.
|
The guilds that the connected client is a member of.
|
||||||
private_channels : iterable of :class:`PrivateChannel`
|
private_channels: List[:class:`abc.PrivateChannel`]
|
||||||
The private channels that the connected client is participating on.
|
The private channels that the connected client is participating on.
|
||||||
messages
|
messages
|
||||||
A deque_ of :class:`Message` that the client has received from all
|
A deque_ of :class:`Message` that the client has received from all
|
||||||
|
@ -67,7 +67,7 @@ class Guild(Hashable):
|
|||||||
roles
|
roles
|
||||||
A list of :class:`Role` that the guild has available.
|
A list of :class:`Role` that the guild has available.
|
||||||
emojis
|
emojis
|
||||||
A list of :class:`Emoji` that the guild owns.
|
A tuple of :class:`Emoji` that the guild owns.
|
||||||
region: :class:`GuildRegion`
|
region: :class:`GuildRegion`
|
||||||
The region the guild belongs on. There is a chance that the region
|
The region the guild belongs on. There is a chance that the region
|
||||||
will be a ``str`` if the value is not recognised by the enumerator.
|
will be a ``str`` if the value is not recognised by the enumerator.
|
||||||
@ -75,10 +75,6 @@ class Guild(Hashable):
|
|||||||
The timeout to get sent to the AFK channel.
|
The timeout to get sent to the AFK channel.
|
||||||
afk_channel: :class:`Channel`
|
afk_channel: :class:`Channel`
|
||||||
The channel that denotes the AFK channel. None if it doesn't exist.
|
The channel that denotes the AFK channel. None if it doesn't exist.
|
||||||
members
|
|
||||||
An iterable of :class:`Member` that are currently on the guild.
|
|
||||||
channels
|
|
||||||
An iterable of :class:`Channel` that are currently on the guild.
|
|
||||||
icon: str
|
icon: str
|
||||||
The guild's icon.
|
The guild's icon.
|
||||||
id: int
|
id: int
|
||||||
@ -128,14 +124,6 @@ class Guild(Hashable):
|
|||||||
self._state = state
|
self._state = state
|
||||||
self._from_data(data)
|
self._from_data(data)
|
||||||
|
|
||||||
@property
|
|
||||||
def channels(self):
|
|
||||||
return self._channels.values()
|
|
||||||
|
|
||||||
def get_channel(self, channel_id):
|
|
||||||
"""Returns a :class:`Channel` with the given ID. If not found, returns None."""
|
|
||||||
return self._channels.get(channel_id)
|
|
||||||
|
|
||||||
def _add_channel(self, channel):
|
def _add_channel(self, channel):
|
||||||
self._channels[channel.id] = channel
|
self._channels[channel.id] = channel
|
||||||
|
|
||||||
@ -145,14 +133,6 @@ class Guild(Hashable):
|
|||||||
def _voice_state_for(self, user_id):
|
def _voice_state_for(self, user_id):
|
||||||
return self._voice_states.get(user_id)
|
return self._voice_states.get(user_id)
|
||||||
|
|
||||||
@property
|
|
||||||
def members(self):
|
|
||||||
return self._members.values()
|
|
||||||
|
|
||||||
def get_member(self, user_id):
|
|
||||||
"""Returns a :class:`Member` with the given ID. If not found, returns None."""
|
|
||||||
return self._members.get(user_id)
|
|
||||||
|
|
||||||
def _add_member(self, member):
|
def _add_member(self, member):
|
||||||
self._members[member.id] = member
|
self._members[member.id] = member
|
||||||
|
|
||||||
@ -285,6 +265,34 @@ class Guild(Hashable):
|
|||||||
|
|
||||||
self._add_channel(channel)
|
self._add_channel(channel)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def channels(self):
|
||||||
|
"""List[:class:`abc.GuildChannel`]: A list of channels that belongs to this guild."""
|
||||||
|
return list(self._channels.values())
|
||||||
|
|
||||||
|
@property
|
||||||
|
def voice_channels(self):
|
||||||
|
"""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 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)]
|
||||||
|
|
||||||
|
def get_channel(self, channel_id):
|
||||||
|
"""Returns a :class:`Channel` with the given ID. If not found, returns None."""
|
||||||
|
return self._channels.get(channel_id)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def members(self):
|
||||||
|
"""List[:class:`Member`]: A list of members that belongs to this guild."""
|
||||||
|
return list(self._members.values())
|
||||||
|
|
||||||
|
def get_member(self, user_id):
|
||||||
|
"""Returns a :class:`Member` with the given ID. If not found, returns None."""
|
||||||
|
return self._members.get(user_id)
|
||||||
|
|
||||||
@utils.cached_slot_property('_default_role')
|
@utils.cached_slot_property('_default_role')
|
||||||
def default_role(self):
|
def default_role(self):
|
||||||
"""Gets the @everyone role that all members have by default."""
|
"""Gets the @everyone role that all members have by default."""
|
||||||
|
@ -114,7 +114,7 @@ class ConnectionState:
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def voice_clients(self):
|
def voice_clients(self):
|
||||||
return self._voice_clients.values()
|
return list(self._voice_clients.values())
|
||||||
|
|
||||||
def _get_voice_client(self, guild_id):
|
def _get_voice_client(self, guild_id):
|
||||||
return self._voice_clients.get(guild_id)
|
return self._voice_clients.get(guild_id)
|
||||||
@ -148,7 +148,7 @@ class ConnectionState:
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def guilds(self):
|
def guilds(self):
|
||||||
return self._guilds.values()
|
return list(self._guilds.values())
|
||||||
|
|
||||||
def _get_guild(self, guild_id):
|
def _get_guild(self, guild_id):
|
||||||
return self._guilds.get(guild_id)
|
return self._guilds.get(guild_id)
|
||||||
@ -161,7 +161,7 @@ class ConnectionState:
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def private_channels(self):
|
def private_channels(self):
|
||||||
return self._private_channels.values()
|
return list(self._private_channels.values())
|
||||||
|
|
||||||
def _get_private_channel(self, channel_id):
|
def _get_private_channel(self, channel_id):
|
||||||
return self._private_channels.get(channel_id)
|
return self._private_channels.get(channel_id)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user