[Core] Replaced JsonDB with Config (#770)

This commit is contained in:
Will
2017-05-27 22:28:59 -04:00
committed by Twentysix
parent a8745297dc
commit 3988fbbc09
23 changed files with 1298 additions and 380 deletions

View File

@@ -1,3 +1,4 @@
import argparse
import asyncio
@@ -19,7 +20,7 @@ def interactive_config(red, token_set, prefix_set):
print("That doesn't look like a valid token.")
token = ""
if token:
loop.run_until_complete(red.db.set_global("token", token))
loop.run_until_complete(red.db.set("token", token))
if not prefix_set:
prefix = ""
@@ -36,6 +37,50 @@ def interactive_config(red, token_set, prefix_set):
if not confirm("> "):
prefix = ""
if prefix:
loop.run_until_complete(red.db.set_global("prefix", [prefix]))
loop.run_until_complete(red.db.set("prefix", [prefix]))
return token
def parse_cli_flags():
parser = argparse.ArgumentParser(description="Red - Discord Bot")
parser.add_argument("--owner", help="ID of the owner. Only who hosts "
"Red should be owner, this has "
"security implications")
parser.add_argument("--prefix", "-p", action="append",
help="Global prefix. Can be multiple")
parser.add_argument("--no-prompt",
action="store_true",
help="Disables console inputs. Features requiring "
"console interaction could be disabled as a "
"result")
parser.add_argument("--no-cogs",
action="store_true",
help="Starts Red with no cogs loaded, only core")
parser.add_argument("--self-bot",
action='store_true',
help="Specifies if Red should log in as selfbot")
parser.add_argument("--not-bot",
action='store_true',
help="Specifies if the token used belongs to a bot "
"account.")
parser.add_argument("--dry-run",
action="store_true",
help="Makes Red quit with code 0 just before the "
"login. This is useful for testing the boot "
"process.")
parser.add_argument("--debug",
action="store_true",
help="Sets the loggers level as debug")
parser.add_argument("--dev",
action="store_true",
help="Enables developer mode")
args = parser.parse_args()
if args.prefix:
args.prefix = sorted(args.prefix, reverse=True)
else:
args.prefix = []
return args