Browse Source

Change default oauth_url scopes to include application.commands

pull/7587/head
Rapptz 3 years ago
parent
commit
8213603822
  1. 4
      discord/utils.py
  2. 1
      docs/migrating.rst

4
discord/utils.py

@ -295,7 +295,7 @@ def oauth_url(
redirect_uri: :class:`str` redirect_uri: :class:`str`
An optional valid redirect URI. An optional valid redirect URI.
scopes: Iterable[:class:`str`] scopes: Iterable[:class:`str`]
An optional valid list of scopes. Defaults to ``('bot',)``. An optional valid list of scopes. Defaults to ``('bot', 'application.commands')``.
.. versionadded:: 1.7 .. versionadded:: 1.7
disable_guild_select: :class:`bool` disable_guild_select: :class:`bool`
@ -309,7 +309,7 @@ def oauth_url(
The OAuth2 URL for inviting the bot into guilds. The OAuth2 URL for inviting the bot into guilds.
""" """
url = f'https://discord.com/oauth2/authorize?client_id={client_id}' url = f'https://discord.com/oauth2/authorize?client_id={client_id}'
url += '&scope=' + '+'.join(scopes or ('bot',)) url += '&scope=' + '+'.join(scopes or ('bot', 'application.commands'))
if permissions is not MISSING: if permissions is not MISSING:
url += f'&permissions={permissions.value}' url += f'&permissions={permissions.value}'
if guild is not MISSING: if guild is not MISSING:

1
docs/migrating.rst

@ -1039,6 +1039,7 @@ The following changes have been made:
- :func:`on_socket_raw_send` is now only called if ``enable_debug_events`` is set on :class:`Client`. - :func:`on_socket_raw_send` is now only called if ``enable_debug_events`` is set on :class:`Client`.
- The documented return type for :meth:`Guild.fetch_channels` changed to Sequence[:class:`abc.GuildChannel`]. - The documented return type for :meth:`Guild.fetch_channels` changed to Sequence[:class:`abc.GuildChannel`].
- :func:`utils.resolve_invite` now returns a :class:`ResolvedInvite` class. - :func:`utils.resolve_invite` now returns a :class:`ResolvedInvite` class.
- :func:`utils.oauth_url` now defaults to ``bot`` and ``application.commands`` scopes when not given instead of just ``bot``.
- :meth:`abc.Messageable.typing` can no longer be used as a regular (non-async) context manager. - :meth:`abc.Messageable.typing` can no longer be used as a regular (non-async) context manager.
- :attr:`Intents.emojis` is now an alias of :attr:`Intents.emojis_and_stickers`. - :attr:`Intents.emojis` is now an alias of :attr:`Intents.emojis_and_stickers`.

Loading…
Cancel
Save