Pre-fetch app owners and fail early on no owners (#4926)

* Pre-fetch app owners and fail early on no owners

* Improve command mention in error message

* Further change the order of startup actions
This commit is contained in:
jack1142
2021-10-20 12:13:07 +02:00
committed by GitHub
parent 6db5c866af
commit 7abc9bdcf1
3 changed files with 59 additions and 50 deletions

View File

@@ -70,19 +70,7 @@ def init_events(bot, cli_flags):
guilds = len(bot.guilds)
users = len(set([m for m in bot.get_all_members()]))
app_info = await bot.application_info()
if app_info.team:
if bot._use_team_features:
bot.owner_ids.update(m.id for m in app_info.team.members)
elif bot._owner_id_overwrite is None:
bot.owner_ids.add(app_info.owner.id)
bot._app_owners_fetched = True
try:
invite_url = discord.utils.oauth_url(app_info.id)
except:
invite_url = "Could not fetch invite url"
invite_url = discord.utils.oauth_url(bot._app_info.id)
prefixes = cli_flags.prefix or (await bot._config.prefix())
lang = await bot._config.locale()
@@ -200,10 +188,6 @@ def init_events(bot, cli_flags):
if rich_outdated_message:
rich_console.print(rich_outdated_message)
if not bot.owner_ids:
# we could possibly exit here in future
log.warning("Bot doesn't have any owner set!")
bot._color = discord.Colour(await bot._config.color())
bot._red_ready.set()
if outdated_red_message: