goober/modules/globalvars.py

81 lines
2.2 KiB
Python
Raw Normal View History

2025-06-20 23:48:10 +02:00
import os
2025-02-26 21:35:13 +01:00
import platform
2025-06-20 23:48:10 +02:00
import pathlib
import subprocess
from dotenv import load_dotenv
import discord
from discord import Colour, Embed, File, Interaction, Message
from discord.ext import commands
from discord import app_commands
from discord.abc import Messageable
2025-06-20 23:48:10 +02:00
env_path = pathlib.Path(__file__).parent.parent / '.env'
load_dotenv(dotenv_path=env_path)
# ANSI colors
ANSI = "\033["
RED = f"{ANSI}31m"
GREEN = f"{ANSI}32m"
YELLOW = f"{ANSI}33m"
PURPLE = f"{ANSI}35m"
DEBUG = f"{ANSI}1;30m"
RESET = f"{ANSI}0m"
2025-07-15 23:56:44 +02:00
VERSION_URL = "https://raw.githubusercontent.com/gooberinc/version/main"
UPDATE_URL = f"{VERSION_URL}/latest_version.json"
2025-07-15 23:56:44 +02:00
print(UPDATE_URL)
LOCAL_VERSION_FILE = "current_version.txt"
MEMORY_FILE = "memory.json"
MEMORY_LOADED_FILE = "MEMORY_LOADED" # used in markov module
local_version = "3.0.0"
latest_version = "0.0.0"
os.environ['gooberlocal_version'] = local_version
def get_git_branch() -> str | None:
try:
return subprocess.check_output(
["git", "rev-parse", "--abbrev-ref", "HEAD"],
stderr=subprocess.DEVNULL
).decode().strip()
except subprocess.CalledProcessError:
return None
branch = get_git_branch()
beta = branch != "main" if branch else True
2025-07-09 22:57:59 +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")
gooberTOKEN = os.getenv("GOOBERTOKEN")
splashtext = os.getenv("SPLASHTEXT")
ownerid = int(os.getenv("OWNERID", "0"))
status = os.getenv("STATUS")
2025-07-09 22:57:59 +02:00
showmemenabled = os.getenv("SHOWMEMENABLED")
BLACKLISTED_USERS = os.getenv("BLACKLISTEDUSERS", "").split(",")
USERTRAIN_ENABLED = os.getenv("USERTRAINENABLED", "true").lower() == "true"
2025-01-05 23:29:57 +01:00
NAME = os.getenv("NAME")
ALIVEPING = os.getenv("ALIVEPING")
2025-06-21 00:01:33 +02:00
AUTOUPDATE = os.getenv("AUTOUPDATE")
song = os.getenv("SONG")
2025-07-06 23:44:04 +02:00
REACT = os.getenv("REACT")
intents = discord.Intents.default()
intents.messages = True
intents.presences = True
intents.members = True
intents.message_content = True
bot = commands.Bot(
command_prefix=PREFIX,
intents=intents,
allowed_mentions=discord.AllowedMentions(
everyone=False, roles=False, users=False, replied_user=True
)
)
launched = False