Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions interactions/api/http/guild.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,17 @@ async def get_self_guilds(self) -> List[dict]:

return request

async def get_guild(self, guild_id: int) -> dict:
async def get_guild(self, guild_id: int, with_counts: bool = False) -> dict:
"""
Requests an individual guild from the API.

:param guild_id: The guild snowflake ID associated.
:param with_counts: Whether the approximate member count should be included
:return: The guild object associated, if any.
"""
request = await self._req.request(Route("GET", "/guilds/{guild_id}", guild_id=guild_id))
request = await self._req.request(
Route("GET", f"/guilds/{guild_id}{f'?{with_counts=}' if with_counts else ''}")
)
self.cache.guilds.add(Item(id=str(guild_id), value=Guild(**request, _client=self)))

return request
Expand Down
2 changes: 1 addition & 1 deletion interactions/api/http/guild.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class GuildRequest:
cache: Cache
def __init__(self) -> None: ...
async def get_self_guilds(self) -> List[dict]: ...
async def get_guild(self, guild_id: int) -> dict: ...
async def get_guild(self, guild_id: int, with_counts: bool = False) -> dict: ...
async def get_guild_preview(self, guild_id: int) -> dict: ...
async def modify_guild(
self, guild_id: int, payload: dict, reason: Optional[str] = None
Expand Down