Update to use the new bot.application_info()

This commit is contained in:
Twentysix 2016-06-12 01:51:38 +02:00
parent 242d5bf63b
commit 61f7763605

13
red.py
View File

@ -130,14 +130,11 @@ def user_allowed(message):
async def get_oauth_url(): async def get_oauth_url():
endpoint = "https://discordapp.com/api/oauth2/applications/@me" try:
if bot.headers.get('authorization') is None: data = await bot.application_info()
bot.headers['authorization'] = "Bot {}".format(settings.email) except AttributeError:
return "Your discord.py is outdated. Couldn't retrieve invite link."
async with bot.session.get(endpoint, headers=bot.headers) as resp: return discord.utils.oauth_url(data.id)
data = await resp.json()
return discord.utils.oauth_url(data.get('id'))
def check_folders(): def check_folders():