diff options
| author | Khazhismel Kumykov <[email protected]> | 2016-04-15 20:44:37 -0400 |
|---|---|---|
| committer | Khazhismel Kumykov <[email protected]> | 2016-04-15 21:04:33 -0400 |
| commit | a2a5dc59972b86c9c0b6d4cb13a641b50f3d452b (patch) | |
| tree | 465be57b3258cd60e077593d6f4c0890332ccfd6 /discord/utils.py | |
| parent | Add a None check when setting status in Client.change_status. (diff) | |
| download | discord.py-a2a5dc59972b86c9c0b6d4cb13a641b50f3d452b.tar.xz discord.py-a2a5dc59972b86c9c0b6d4cb13a641b50f3d452b.zip | |
Add optional server parameter to utils.oauth_url
Diffstat (limited to 'discord/utils.py')
| -rw-r--r-- | discord/utils.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/discord/utils.py b/discord/utils.py index 11dcb3f0..a097cfe7 100644 --- a/discord/utils.py +++ b/discord/utils.py @@ -75,7 +75,7 @@ def parse_time(timestamp): return None -def oauth_url(client_id, permissions=None): +def oauth_url(client_id, permissions=None, server=None): """A helper function that returns the OAuth2 URL for inviting the bot into servers. @@ -86,10 +86,14 @@ def oauth_url(client_id, permissions=None): permissions : :class:`Permissions` The permissions you're requesting. If not given then you won't be requesting any permissions. + server : :class:`Server` + The server to pre-select in the authorization screen, if available. """ - url = 'https://discordapp.com/oauth2/authorize?&client_id={}&scope=bot'.format(client_id) + url = 'https://discordapp.com/oauth2/authorize?client_id={}&scope=bot'.format(client_id) if permissions is not None: url = url + '&permissions=' + str(permissions.value) + if server is not None: + url = url + "&guild_id=" + server.id return url |