mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-06 03:08:55 -05:00
[V3 Launcher] Use existing logic, fix bugs (#1168)
This commit is contained in:
parent
73d68e926d
commit
bc8b9d32db
@ -1,25 +1,16 @@
|
||||
# pylint: disable=missing-docstring
|
||||
from __future__ import print_function
|
||||
|
||||
import getpass
|
||||
import json
|
||||
import os
|
||||
import platform
|
||||
import subprocess
|
||||
import sys
|
||||
import argparse
|
||||
import appdirs
|
||||
from pathlib import Path
|
||||
|
||||
import pkg_resources
|
||||
from redbot.setup import basic_setup
|
||||
from redbot.setup import basic_setup, load_existing_config
|
||||
|
||||
if sys.platform == "linux":
|
||||
import distro
|
||||
|
||||
config_dir = Path(appdirs.AppDirs("Red-DiscordBot").user_config_dir)
|
||||
config_file = config_dir / 'config.json'
|
||||
|
||||
PYTHON_OK = sys.version_info >= (3, 5)
|
||||
INTERACTIVE_MODE = not len(sys.argv) > 1 # CLI flags = non-interactive
|
||||
|
||||
@ -35,8 +26,7 @@ def parse_cli_args():
|
||||
parser = argparse.ArgumentParser(
|
||||
description="Red - Discord Bot's launcher (V3)", allow_abbrev=False
|
||||
)
|
||||
with config_file.open("r") as fin:
|
||||
instances = json.loads(fin.read())
|
||||
instances = load_existing_config()
|
||||
parser.add_argument("instancename", metavar="instancename", type=str,
|
||||
nargs="?", help="The instance to run", choices=list(instances.keys()))
|
||||
parser.add_argument("--start", "-s",
|
||||
@ -206,8 +196,7 @@ def cli_flag_getter():
|
||||
|
||||
|
||||
def instance_menu():
|
||||
with config_file.open("r") as fin:
|
||||
instances = json.loads(fin.read())
|
||||
instances = load_existing_config()
|
||||
if not instances:
|
||||
print("No instances found!")
|
||||
return None
|
||||
@ -260,7 +249,6 @@ def extras_selector():
|
||||
def debug_info():
|
||||
pyver = sys.version
|
||||
redver = pkg_resources.get_distribution("Red-DiscordBot").version
|
||||
osver = ""
|
||||
if IS_WINDOWS:
|
||||
os_info = platform.uname()
|
||||
osver = "{} {} (version {}) {}".format(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user