2025-06-20 23:48:10 +02:00
import os
2025-02-26 21:35:13 +01:00
import platform
2025-07-23 16:58:21 +02:00
from typing import Callable , List
from dotenv import load_dotenv
2025-06-20 23:48:10 +02:00
import pathlib
2025-07-23 13:38:09 +02:00
import subprocess
2025-06-28 16:56:05 -04:00
2025-07-23 16:58:21 +02:00
def get_git_branch ( ) :
try :
branch = (
subprocess . check_output (
[ " git " , " rev-parse " , " --abbrev-ref " , " HEAD " ] , stderr = subprocess . DEVNULL
)
. decode ( " utf-8 " )
. strip ( )
)
return branch
except subprocess . CalledProcessError :
return None
env_path = pathlib . Path ( __file__ ) . parent . parent / " .env "
2025-06-20 23:48:10 +02:00
load_dotenv ( dotenv_path = env_path )
2025-07-23 13:38:09 +02:00
2025-07-23 16:58:21 +02:00
available_cogs : Callable [ [ ] , List [ str ] ] = lambda : [
file [ : - 3 ] for file in os . listdir ( " assets/cogs " ) if file . endswith ( " .py " )
]
2025-06-28 16:56:05 -04:00
ANSI = " \033 [ "
RED = f " { ANSI } 31m "
GREEN = f " { ANSI } 32m "
YELLOW = f " { ANSI } 33m "
2025-07-08 17:02:10 +03:00
PURPLE = f " { ANSI } 35m "
2025-07-23 16:58:21 +02:00
DEBUG = f " { ANSI } 90m "
2025-06-28 16:56:05 -04:00
RESET = f " { ANSI } 0m "
2025-07-23 13:38:09 +02:00
2025-07-15 23:56:44 +02:00
VERSION_URL = " https://raw.githubusercontent.com/gooberinc/version/main "
2025-07-23 16:58:21 +02:00
UPDATE_URL = VERSION_URL + " /latest_version.json "
2025-07-15 23:56:44 +02:00
print ( UPDATE_URL )
2025-07-23 13:38:09 +02:00
LOCAL_VERSION_FILE = " current_version.txt "
2025-07-23 16:58:21 +02:00
# TOKEN = os.getenv("DISCORDBOTTOKEN", "0")
# PREFIX = os.getenv("BOTPREFIX", "g.")
# PING_LINE = os.getenv("PINGLINE")
# CHECKS_DISABLED = os.getenv("CHECKSDISABLED")
# LOCALE = os.getenv("LOCALE", "en")
# BLACKLISTED_USERS = os.getenv("BLACKLISTEDUSERS", "").split(",")
# USERTRAIN_ENABLED = os.getenv("USERTRAINENABLED", "true").lower() == "true"
# NAME = os.getenv("NAME")
# MEMORY_FILE = "memory.json"
# MEMORY_LOADED_FILE = "MEMORY_LOADED" # is this still even used?? okay just checked its used in the markov module
# ALIVEPING = os.getenv("ALIVEPING")
# AUTOUPDATE = os.getenv("AUTOUPDATE")
# REACT = os.getenv("REACT")
2025-07-23 13:38:09 +02:00
2025-07-23 16:58:21 +02:00
# gooberTOKEN = os.getenv("GOOBERTOKEN")
# splashtext = os.getenv("SPLASHTEXT")
# ownerid = int(os.getenv("OWNERID", "0"))
# showmemenabled = os.getenv("SHOWMEMENABLED")
2025-07-23 13:38:09 +02:00
2025-07-23 16:58:21 +02:00
# IGNOREWARNING = False # is this either??? i don't think so?
# song = os.getenv("song")
arch = platform . machine ( )
slash_commands_enabled = True # 100% broken, its a newer enough version so its probably enabled by default.... fix this at somepoint or hard code it in goober central code
2025-07-23 13:38:09 +02:00
launched = False
2025-07-23 16:58:21 +02:00
latest_version = " 0.0.0 "
local_version = " 3.0.0 "
os . environ [ " gooberlocal_version " ] = local_version
beta = get_git_branch ( ) == " dev "