diff options
| author | Nihaal Sangha <[email protected]> | 2021-03-28 11:33:24 +0100 |
|---|---|---|
| committer | GitHub <[email protected]> | 2021-03-28 06:33:24 -0400 |
| commit | a4d29e8cfdb91b5e120285b605e65be2c01f2c87 (patch) | |
| tree | 84487cd1f90d27f4b66fa6fc005f26d41287649f | |
| parent | [commands] allow arbitrary callables in cooldown (diff) | |
| download | discord.py-a4d29e8cfdb91b5e120285b605e65be2c01f2c87.tar.xz discord.py-a4d29e8cfdb91b5e120285b605e65be2c01f2c87.zip | |
Add scopes to utils.oauth_url
| -rw-r--r-- | discord/utils.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/discord/utils.py b/discord/utils.py index b99bd70b..51031485 100644 --- a/discord/utils.py +++ b/discord/utils.py @@ -126,7 +126,7 @@ def deprecated(instead=None): return decorated return actual_decorator -def oauth_url(client_id, permissions=None, guild=None, redirect_uri=None): +def oauth_url(client_id, permissions=None, guild=None, redirect_uri=None, scopes=None): """A helper function that returns the OAuth2 URL for inviting the bot into guilds. @@ -141,13 +141,18 @@ def oauth_url(client_id, permissions=None, guild=None, redirect_uri=None): The guild to pre-select in the authorization screen, if available. redirect_uri: :class:`str` An optional valid redirect URI. + scopes: Iterable[:class:`str`] + An optional valid list of scopes. Defaults to ``('bot',)``. + + .. versionadded:: 1.7 Returns -------- :class:`str` The OAuth2 URL for inviting the bot into guilds. """ - url = 'https://discord.com/oauth2/authorize?client_id={}&scope=bot'.format(client_id) + url = 'https://discord.com/oauth2/authorize?client_id={}'.format(client_id) + url = url + '&scope=' + '+'.join(scopes or ('bot',)) if permissions is not None: url = url + '&permissions=' + str(permissions.value) if guild is not None: |