Files
matrix/matrixbot/config.py
T
jared 21a64174e6
Lint / Shell (shellcheck) (push) Successful in 9s
Lint / JS (eslint) (push) Successful in 7s
Lint / Python (ruff) (push) Successful in 5s
Lint / Python deps (pip-audit) (push) Successful in 1m27s
Lint / Secret scan (gitleaks) (push) Successful in 7s
8ball: fix substring pronoun bug, switch to 3B model
- Fix about_jared/about_wynter using substring match — "they" matched
  "he", "theme" matched "he", etc., routing Wynter's questions to the
  wrong branch. Now uses \b word boundaries via re.search.
- Switch BALL_MODEL default from sadiq-bd 1B uncensored to
  llama3.2:latest (3B) — the 1B model hallucinates, ignores persona
  instructions, and mentions Jared randomly. GPU is now working on
  Arc A380 at ~25 tok/s so the larger model is practical.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-21 00:21:42 -04:00

48 lines
1.5 KiB
Python

import os
from dotenv import load_dotenv
load_dotenv()
# Required
MATRIX_HOMESERVER = os.getenv("MATRIX_HOMESERVER", "https://matrix.lotusguild.org")
MATRIX_USER_ID = os.getenv("MATRIX_USER_ID", "@lotusbot:matrix.lotusguild.org")
MATRIX_ACCESS_TOKEN = os.getenv("MATRIX_ACCESS_TOKEN", "")
MATRIX_DEVICE_ID = os.getenv("MATRIX_DEVICE_ID", "")
MATRIX_PASSWORD = os.getenv("MATRIX_PASSWORD", "")
# Bot settings
BOT_PREFIX = os.getenv("BOT_PREFIX", "!")
ADMIN_USERS = [u.strip() for u in os.getenv("ADMIN_USERS", "").split(",") if u.strip()]
LOG_LEVEL = os.getenv("LOG_LEVEL", "INFO")
# Integrations
OLLAMA_URL = os.getenv("OLLAMA_URL", "http://10.10.10.157:11434")
OLLAMA_MODEL = os.getenv("OLLAMA_MODEL", "llama3.2:latest")
BALL_MODEL = os.getenv("BALL_MODEL", "llama3.2:latest")
ASK_MODEL = os.getenv("ASK_MODEL", "llama3.2:latest")
MINECRAFT_RCON_HOST = os.getenv("MINECRAFT_RCON_HOST", "10.10.10.67")
MINECRAFT_RCON_PORT = int(os.getenv("MINECRAFT_RCON_PORT", "25575"))
MINECRAFT_RCON_PASSWORD = os.getenv("MINECRAFT_RCON_PASSWORD", "")
# Constants
MAX_INPUT_LENGTH = 500
MAX_DICE_SIDES = 100
MAX_DICE_COUNT = 20
COOLDOWN_SECONDS = int(os.getenv("COOLDOWN_SECONDS", "120"))
RCON_TIMEOUT = 5.0
MIN_USERNAME_LENGTH = 3
MAX_USERNAME_LENGTH = 16
class ConfigValidator:
REQUIRED = ["MATRIX_HOMESERVER", "MATRIX_USER_ID"]
@classmethod
def validate(cls):
errors = []
for var in cls.REQUIRED:
if not os.getenv(var):
errors.append(f"Missing required: {var}")
return errors