aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRapptz <[email protected]>2015-11-26 18:43:26 -0500
committerRapptz <[email protected]>2015-11-26 18:43:26 -0500
commit0d19273844cdd4c0e414d8dcfe0b0849f9f12085 (patch)
treeb5cce35d09fb96fb437a69e3e153780e491ecaf3
parentHandle TYPING_START event. (diff)
downloaddiscord.py-0d19273844cdd4c0e414d8dcfe0b0849f9f12085.tar.xz
discord.py-0d19273844cdd4c0e414d8dcfe0b0849f9f12085.zip
Client.accept_invite and Client.register now accept invite IDs.
-rw-r--r--discord/client.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/discord/client.py b/discord/client.py
index 005837d2..f44604d5 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.