diff --git a/api/auth.py b/api/auth.py index 53e147fc..19d6bcee 100644 --- a/api/auth.py +++ b/api/auth.py @@ -32,3 +32,7 @@ def get_public_key(): """Returns the bot's public key in `runtimeconfig.json`, if it exists.""" if config["public_key"]: return config["public_key"] else: return "Public key has not been set." + +def get_mode() -> bool: + """Returns a boolean of the current runtime mode.\n\nReturns `True` if replit mode is active, returns `False` if replit mode is inactive.""" + return config["replit"] diff --git a/api/runtimeconfig.json b/api/runtimeconfig.json index 6341d307..e7c0a7a0 100644 --- a/api/runtimeconfig.json +++ b/api/runtimeconfig.json @@ -2,5 +2,6 @@ "token": "", "secret": "", "public_key": "", - "runtime_options": [] + "runtime_options": [], + "replit": true } diff --git a/main.py b/main.py index 2af20d26..7e4591b7 100644 --- a/main.py +++ b/main.py @@ -482,7 +482,12 @@ async def isocoin_shop(ctx: ApplicationContext): if cog_errors == 0: print(f"[main/Cogs] {colors.green}All cogs successfully loaded.{colors.end}") else: print(f"[main/Cogs] {colors.yellow}{cog_errors}/{len(active_cogs)} cogs failed to load.{colors.end}") print("--------------------") -client.run(api.auth.get_token()) +if api.auth.get_mode(): + print(f"[main/CLIENT] Starting client in {colors.cyan}Replit mode{colors.end}...") + client.run(os.getenv("TOKEN")) +else: + print(f"[main/CLIENT] Starting client in {colors.orange}local mode{colors.end}...") + client.run(api.auth.get_token())