diff options
| author | Rapptz <[email protected]> | 2017-02-08 22:47:52 -0500 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2017-02-08 22:47:52 -0500 |
| commit | 274e6af0dda9d73fd94faad2263190e18cf974b4 (patch) | |
| tree | 51732ea1d461523f70ced64d8e04e99d87eccd7e /discord/guild.py | |
| parent | Remove unused constants in HTTPClient (diff) | |
| download | discord.py-274e6af0dda9d73fd94faad2263190e18cf974b4.tar.xz discord.py-274e6af0dda9d73fd94faad2263190e18cf974b4.zip | |
Fix support for instant invites.
Diffstat (limited to 'discord/guild.py')
| -rw-r--r-- | discord/guild.py | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/discord/guild.py b/discord/guild.py index 5569c4c8..aeb4002b 100644 --- a/discord/guild.py +++ b/discord/guild.py @@ -729,7 +729,7 @@ class Guild(Hashable): Returns ------- - list of :class:`Invite` + List[:class:`Invite`] The list of invites that are currently active. """ @@ -744,6 +744,42 @@ class Guild(Hashable): return result @asyncio.coroutine + def create_invite(self, **fields): + """|coro| + + Creates an instant invite. + + Parameters + ------------ + max_age : int + How long the invite should last. If it's 0 then the invite + doesn't expire. Defaults to 0. + max_uses : int + How many uses the invite could be used for. If it's 0 then there + are unlimited uses. Defaults to 0. + temporary : bool + Denotes that the invite grants temporary membership + (i.e. they get kicked after they disconnect). Defaults to False. + unique: bool + Indicates if a unique invite URL should be created. Defaults to True. + If this is set to False then it will return a previously created + invite. + + Raises + ------- + HTTPException + Invite creation failed. + + Returns + -------- + :class:`Invite` + The invite that was created. + """ + + data = yield from self._state.http.create_invite(self.id, **fields) + return Invite.from_incomplete(data=data, state=self._state) + + @asyncio.coroutine def create_custom_emoji(self, *, name, image): """|coro| |