From 8a30a4cac0651df5a24cb744fc104ced90a4cf3a Mon Sep 17 00:00:00 2001 From: NCPlayz Date: Fri, 15 Mar 2019 19:39:15 +0000 Subject: Add support for guild widget --- discord/guild.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'discord/guild.py') 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) -- cgit v1.2.3