mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-12-03 14:02:19 +00:00
Add with_counts support for Client.fetch_guild
Co-authored-by: Stocker <44980366+StockerMC@users.noreply.github.com> Co-authored-by: Danny <Rapptz@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
bfaee44b1f
commit
e69428a841
@@ -1307,7 +1307,7 @@ class Client:
|
||||
data = await self.http.get_template(code)
|
||||
return Template(data=data, state=self._connection) # type: ignore
|
||||
|
||||
async def fetch_guild(self, guild_id: int, /) -> Guild:
|
||||
async def fetch_guild(self, guild_id: int, /, *, with_counts: bool = True) -> Guild:
|
||||
"""|coro|
|
||||
|
||||
Retrieves a :class:`.Guild` from an ID.
|
||||
@@ -1325,6 +1325,13 @@ class Client:
|
||||
|
||||
``guild_id`` parameter is now positional-only.
|
||||
|
||||
with_counts: Optional[:class:`bool`]
|
||||
Whether to include count information in the guild. This fills the
|
||||
:attr:`.Guild.approximate_member_count` and :attr:`.Guild.approximate_presence_count`
|
||||
attributes without needing any privileged intents. Defaults to ``True``.
|
||||
|
||||
.. versionadded:: 2.0
|
||||
|
||||
Parameters
|
||||
-----------
|
||||
guild_id: :class:`int`
|
||||
@@ -1342,7 +1349,7 @@ class Client:
|
||||
:class:`.Guild`
|
||||
The guild from the ID.
|
||||
"""
|
||||
data = await self.http.get_guild(guild_id)
|
||||
data = await self.http.get_guild(guild_id, with_counts=with_counts)
|
||||
return Guild(data=data, state=self._connection)
|
||||
|
||||
async def create_guild(
|
||||
|
||||
Reference in New Issue
Block a user