aboutsummaryrefslogtreecommitdiff
path: root/discord/guild.py
diff options
context:
space:
mode:
authorNadir Chowdhury <[email protected]>2021-04-10 07:55:10 +0100
committerGitHub <[email protected]>2021-04-10 02:55:10 -0400
commit1efdef3ac34ebed98d643a6a1c273f3b176e8837 (patch)
treee835ade2564fe61dead5dee5ad67d67cca569c18 /discord/guild.py
parentAdd typings for audit logs, integrations, and webhooks (diff)
downloaddiscord.py-1efdef3ac34ebed98d643a6a1c273f3b176e8837.tar.xz
discord.py-1efdef3ac34ebed98d643a6a1c273f3b176e8837.zip
Add typings for invites, templates, and bans
Diffstat (limited to 'discord/guild.py')
-rw-r--r--discord/guild.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/discord/guild.py b/discord/guild.py
index a3343686..c5ba0d1a 100644
--- a/discord/guild.py
+++ b/discord/guild.py
@@ -24,6 +24,7 @@ DEALINGS IN THE SOFTWARE.
import copy
from collections import namedtuple
+from typing import List, TYPE_CHECKING
from . import utils
from .role import Role
@@ -48,6 +49,11 @@ __all__ = (
'Guild',
)
+if TYPE_CHECKING:
+ from .types.guild import (
+ Ban as BanPayload
+ )
+
BanEntry = namedtuple('BanEntry', 'reason user')
_GuildLimit = namedtuple('_GuildLimit', 'emoji bitrate filesize')
@@ -1429,7 +1435,7 @@ class Guild(Hashable):
:class:`BanEntry`
The :class:`BanEntry` object for the specified user.
"""
- data = await self._state.http.get_ban(user.id, self.id)
+ data: BanPayload = await self._state.http.get_ban(user.id, self.id)
return BanEntry(
user=User(state=self._state, data=data['user']),
reason=data['reason']
@@ -1456,7 +1462,7 @@ class Guild(Hashable):
A list of :class:`BanEntry` objects.
"""
- data = await self._state.http.get_bans(self.id)
+ data: List[BanPayload] = await self._state.http.get_bans(self.id)
return [BanEntry(user=User(state=self._state, data=e['user']),
reason=e['reason'])
for e in data]
@@ -1606,7 +1612,7 @@ class Guild(Hashable):
data = await self._state.http.estimate_pruned_members(self.id, days, roles)
return data['pruned']
- async def invites(self):
+ async def invites(self) -> List[Invite]:
"""|coro|
Returns a list of all active instant invites from the guild.
@@ -2056,7 +2062,7 @@ class Guild(Hashable):
"""
await self._state.http.unban(user.id, self.id, reason=reason)
- async def vanity_invite(self):
+ async def vanity_invite(self) -> Invite:
"""|coro|
Returns the guild's special vanity invite.