mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-12-06 01:12:33 -05:00
[Core] Replaced JsonDB with Config (#770)
This commit is contained in:
11
main.py
11
main.py
@@ -1,8 +1,7 @@
|
||||
from core.bot import Red, ExitCodes
|
||||
from core.global_checks import init_global_checks
|
||||
from core.events import init_events
|
||||
from core.settings import parse_cli_flags
|
||||
from core.cli import interactive_config, confirm
|
||||
from core.cli import interactive_config, confirm, parse_cli_flags
|
||||
from core.core_commands import Core
|
||||
from core.dev_commands import Dev
|
||||
import asyncio
|
||||
@@ -65,8 +64,8 @@ if __name__ == '__main__':
|
||||
if cli_flags.dev:
|
||||
red.add_cog(Dev())
|
||||
|
||||
token = os.environ.get("RED_TOKEN", red.db.get_global("token", None))
|
||||
prefix = cli_flags.prefix or red.db.get_global("prefix", [])
|
||||
token = os.environ.get("RED_TOKEN", red.db.token())
|
||||
prefix = cli_flags.prefix or red.db.prefix()
|
||||
|
||||
if token is None or not prefix:
|
||||
if cli_flags.no_prompt is False:
|
||||
@@ -89,11 +88,11 @@ if __name__ == '__main__':
|
||||
"a user account, remember that the --not-bot flag "
|
||||
"must be used. For self-bot functionalities instead, "
|
||||
"--self-bot")
|
||||
db_token = red.db.get_global("token")
|
||||
db_token = red.db.token()
|
||||
if db_token and not cli_flags.no_prompt:
|
||||
print("\nDo you want to reset the token? (y/n)")
|
||||
if confirm("> "):
|
||||
loop.run_until_complete(red.db.remove_global("token"))
|
||||
loop.run_until_complete(red.db.set("token", ""))
|
||||
print("Token has been reset.")
|
||||
except KeyboardInterrupt:
|
||||
log.info("Keyboard interrupt detected. Quitting...")
|
||||
|
||||
Reference in New Issue
Block a user