diff options
| author | Rapptz <[email protected]> | 2015-09-05 00:57:39 -0400 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2015-09-05 00:57:52 -0400 |
| commit | eed4b428aaf75d4b94687fa8cae83ed3c96bd49b (patch) | |
| tree | 3c400111b2eb904b12db718051a449a8cf779284 /discord/client.py | |
| parent | Add on_error event for doing something about uncaught exceptions. (diff) | |
| download | discord.py-eed4b428aaf75d4b94687fa8cae83ed3c96bd49b.tar.xz discord.py-eed4b428aaf75d4b94687fa8cae83ed3c96bd49b.zip | |
Add the ability to accept invites.
Diffstat (limited to 'discord/client.py')
| -rw-r--r-- | discord/client.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/discord/client.py b/discord/client.py index 8b7965bb..5789482c 100644 --- a/discord/client.py +++ b/discord/client.py @@ -748,3 +748,14 @@ class Client(object): return Invite(**data) return None + + def accept_invite(self, invite): + """Accepts an :class:`Invite`. + + :param invite: The :class:`Invite` to accept. + :returns: True if the invite was successfully accepted, False otherwise. + """ + + url = '{0}/invite/{1.id}'.format(endpoints.API_BASE, invite) + response = requests.post(url, headers=self.headers) + return response.status_code in (200, 201) |