mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-12-05 17:02:32 -05:00
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:
@@ -28,7 +28,7 @@ from redbot import _early_init, __version__
|
||||
_early_init()
|
||||
|
||||
import redbot.logging
|
||||
from redbot.core.bot import Red, ExitCodes
|
||||
from redbot.core.bot import Red, ExitCodes, _NoOwnerSet
|
||||
from redbot.core.cli import interactive_config, confirm, parse_cli_flags
|
||||
from redbot.setup import get_data_dir, get_name, save_config
|
||||
from redbot.core import data_manager, drivers
|
||||
@@ -384,7 +384,7 @@ async def run_bot(red: Red, cli_flags: Namespace) -> None:
|
||||
await red.http.close()
|
||||
sys.exit(0)
|
||||
try:
|
||||
await red.start(token, bot=True, cli_flags=cli_flags)
|
||||
await red.start(token, bot=True)
|
||||
except discord.LoginFailure:
|
||||
log.critical("This token doesn't seem to be valid.")
|
||||
db_token = await red._config.token()
|
||||
@@ -403,6 +403,24 @@ async def run_bot(red: Red, cli_flags: Namespace) -> None:
|
||||
style="red",
|
||||
)
|
||||
sys.exit(1)
|
||||
except _NoOwnerSet:
|
||||
print(
|
||||
"Bot doesn't have any owner set!\n"
|
||||
"This can happen when your bot's application is owned by team"
|
||||
" as team members are NOT owners by default.\n\n"
|
||||
"Remember:\n"
|
||||
"ONLY the person who is hosting Red should be owner."
|
||||
" This has SERIOUS security implications."
|
||||
" The owner can access any data that is present on the host system.\n"
|
||||
"With that out of the way, depending on who you want to be considered as owner,"
|
||||
" you can:\n"
|
||||
"a) pass --team-members-are-owners when launching Red"
|
||||
" - in this case Red will treat all members of the bot application's team as owners\n"
|
||||
f"b) set owner manually with `redbot --edit {cli_flags.instance_name}`\n"
|
||||
"c) pass owner ID(s) when launching Red with --owner"
|
||||
" (and --co-owner if you need more than one) flag\n"
|
||||
)
|
||||
sys.exit(1)
|
||||
|
||||
return None
|
||||
|
||||
|
||||
Reference in New Issue
Block a user