Make invite URL part of public API (#5424)

* Make invite URL public API

* Add doc and RPC

* Lint

* Update redbot/core/core_commands.py

Co-authored-by: Matt <psykzz@users.noreply.github.com>

* Update redbot/core/bot.py

Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>

* RPC handling,

* Fix appinfo

* Change docs

* Fix docs

* Change docs

* Update redbot/core/core_commands.py

Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>

* Docstring changes

* nit

Co-authored-by: Matt <psykzz@users.noreply.github.com>
Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>
This commit is contained in:
Stonedestroyer
2021-12-25 22:08:32 +01:00
committed by GitHub
parent d27dbded8a
commit 6297bfcab6
2 changed files with 33 additions and 8 deletions

View File

@@ -362,13 +362,7 @@ class CoreLogic:
str
Invite URL.
"""
app_info = await self.bot.application_info()
data = await self.bot._config.all()
commands_scope = data["invite_commands_scope"]
scopes = ("bot", "applications.commands") if commands_scope else None
perms_int = data["invite_perm"]
permissions = discord.Permissions(perms_int)
return discord.utils.oauth_url(app_info.id, permissions, scopes=scopes)
return await self.bot.get_invite_url()
@staticmethod
async def _can_get_invite_url(ctx):
@@ -1465,7 +1459,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
- `[p]invite`
"""
try:
await ctx.author.send(await self._invite_url())
await ctx.author.send(await self.bot.get_invite_url())
await ctx.tick()
except discord.errors.Forbidden:
await ctx.send(