From 0d19273844cdd4c0e414d8dcfe0b0849f9f12085 Mon Sep 17 00:00:00 2001 From: Rapptz Date: Thu, 26 Nov 2015 18:43:26 -0500 Subject: [PATCH] Client.accept_invite and Client.register now accept invite IDs. --- discord/client.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/discord/client.py b/discord/client.py index 005837d26..f44604d56 100644 --- a/discord/client.py +++ b/discord/client.py @@ -523,7 +523,7 @@ class Client(object): m = re.match(rx, invite) if m: return m.group(1) - return None + return invite def _resolve_destination(self, destination): if isinstance(destination, Channel) or isinstance(destination, PrivateChannel): @@ -854,7 +854,7 @@ class Client(object): if the request failed. :param str username: The username to register as. - :param invite: An invite URL or :class:`Invite` to register with. + :param invite: An invite URL, ID, or :class:`Invite` to register with. :param str fingerprint: Unknown API parameter, defaults to None """ @@ -1181,9 +1181,10 @@ class Client(object): return Invite(**data) def accept_invite(self, invite): - """Accepts an :class:`Invite` or a URL to an invite. + """Accepts an :class:`Invite`, URL or ID to an invite. - The URL must be a discord.gg URL. e.g. "http://discord.gg/codehere" + The URL must be a discord.gg URL. e.g. "http://discord.gg/codehere". + An ID for the invite is just the "codehere" portion of the invite URL. This function raises :exc:`HTTPException` if the request failed. If the invite is invalid, then :exc:`InvalidArgument` is raised.