diff options
| author | NCPlayz <[email protected]> | 2019-03-15 19:39:15 +0000 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2019-03-19 09:22:48 -0400 |
| commit | 8a30a4cac0651df5a24cb744fc104ced90a4cf3a (patch) | |
| tree | f211cab296d0aa43a6df3aa7f55c3771d34909c9 /discord/guild.py | |
| parent | Expose Metadata (diff) | |
| download | discord.py-8a30a4cac0651df5a24cb744fc104ced90a4cf3a.tar.xz discord.py-8a30a4cac0651df5a24cb744fc104ced90a4cf3a.zip | |
Add support for guild widget
Diffstat (limited to 'discord/guild.py')
| -rw-r--r-- | discord/guild.py | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/discord/guild.py b/discord/guild.py index e2d704b3..9e7f1796 100644 --- a/discord/guild.py +++ b/discord/guild.py @@ -42,6 +42,7 @@ from .user import User from .invite import Invite from .iterators import AuditLogIterator from .webhook import Webhook +from .widget import Widget VALID_ICON_FORMATS = {"jpeg", "jpg", "webp", "png"} @@ -1475,3 +1476,28 @@ class Guild(Hashable): return AuditLogIterator(self, before=before, after=after, limit=limit, reverse=reverse, user_id=user, action_type=action) + + async def widget(self): + """|coro| + + Returns the widget of the guild. + + .. note:: + + The guild must have the widget enabled to get this information. + + Raises + ------- + Forbidden + The widget for this guild is disabled. + HTTPException + Retrieving the widget failed. + + Returns + -------- + :class:`Widget` + The guild's widget. + """ + data = await self._state.http.get_widget(self.id) + + return Widget(state=self._state, data=data) |