aboutsummaryrefslogtreecommitdiff
path: root/discord/user.py
diff options
context:
space:
mode:
authorsudosnok <[email protected]>2021-02-21 00:29:19 +0000
committerGitHub <[email protected]>2021-02-20 19:29:19 -0500
commit27c7fb6aed4b05fc9f5d9548c6cf371f884f9bed (patch)
tree776aa14cce11d3936ff246cb231c6ca9fe40ddfb /discord/user.py
parentUpdate issue templates for migration (diff)
downloaddiscord.py-27c7fb6aed4b05fc9f5d9548c6cf371f884f9bed.tar.xz
discord.py-27c7fb6aed4b05fc9f5d9548c6cf371f884f9bed.zip
Add User.mutual_guilds
Diffstat (limited to 'discord/user.py')
-rw-r--r--discord/user.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/discord/user.py b/discord/user.py
index dfdbb56e..c0095035 100644
--- a/discord/user.py
+++ b/discord/user.py
@@ -707,6 +707,18 @@ class User(BaseUser, discord.abc.Messageable):
"""
return self._state._get_private_channel_by_user(self.id)
+ @property
+ def mutual_guilds(self):
+ """List[:class:`Guild`]: The guilds that the user shares with the client.
+
+ .. note::
+
+ This will only return mutual guilds within the client's internal cache.
+
+ .. versionadded:: 1.7
+ """
+ return [guild for guild in self._state._guilds.values() if guild.get_member(self.id)]
+
async def create_dm(self):
"""Creates a :class:`DMChannel` with this user.