From 61f77636054e41dc29c5b90e573ff8f40115b9e4 Mon Sep 17 00:00:00 2001 From: Twentysix Date: Sun, 12 Jun 2016 01:51:38 +0200 Subject: [PATCH] Update to use the new bot.application_info() --- red.py | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/red.py b/red.py index 3f4c0573f..30c742b8b 100644 --- a/red.py +++ b/red.py @@ -130,14 +130,11 @@ def user_allowed(message): async def get_oauth_url(): - endpoint = "https://discordapp.com/api/oauth2/applications/@me" - if bot.headers.get('authorization') is None: - bot.headers['authorization'] = "Bot {}".format(settings.email) - - async with bot.session.get(endpoint, headers=bot.headers) as resp: - data = await resp.json() - - return discord.utils.oauth_url(data.get('id')) + try: + data = await bot.application_info() + except AttributeError: + return "Your discord.py is outdated. Couldn't retrieve invite link." + return discord.utils.oauth_url(data.id) def check_folders():