Initial commit: Miku Discord Bot

This commit is contained in:
2025-12-07 17:15:09 +02:00
commit 8c74ad5260
206 changed files with 50125 additions and 0 deletions

57
bot/globals.py Normal file
View File

@@ -0,0 +1,57 @@
# globals.py
import os
from collections import defaultdict, deque
import discord
from apscheduler.schedulers.asyncio import AsyncIOScheduler
scheduler = AsyncIOScheduler()
GUILD_SETTINGS = {}
# Stores last 5 exchanges per user (as deque)
conversation_history = defaultdict(lambda: deque(maxlen=5))
DISCORD_BOT_TOKEN = os.getenv("DISCORD_BOT_TOKEN")
# Autonomous V2 Debug Mode (set to True to see detailed decision logging)
AUTONOMOUS_DEBUG = os.getenv("AUTONOMOUS_DEBUG", "false").lower() == "true"
# Llama.cpp server settings (via llama-swap)
LLAMA_URL = os.getenv("LLAMA_URL", "http://llama-swap:8080")
TEXT_MODEL = os.getenv("TEXT_MODEL", "llama3.1")
VISION_MODEL = os.getenv("VISION_MODEL", "vision")
OWNER_USER_ID = int(os.getenv("OWNER_USER_ID", "209381657369772032")) # Bot owner's Discord user ID for reports
# Fish.audio TTS settings
FISH_API_KEY = os.getenv("FISH_API_KEY", "478d263d8c094e0c8993aae3e9cf9159")
MIKU_VOICE_ID = os.getenv("MIKU_VOICE_ID", "b28b79555e8c4904ac4d048c36e716b7")
# Set up Discord client
intents = discord.Intents.default()
intents.message_content = True
intents.members = True
intents.presences = True
client = discord.Client(intents=intents)
# Note: llama-swap handles model loading/unloading automatically
# No need to track current_model anymore
KINDNESS_KEYWORDS = [
"thank you", "love you", "luv u", "you're the best", "so cute",
"adorable", "amazing", "sweet", "kind", "great job", "well done",
"precious", "good girl", "cutie", "angel", "my favorite", "so helpful"
]
HEART_REACTIONS = ["💙", "💝", "💖", "💕", "💜", "❤️‍🔥", "☺️"]
kindness_reacted_messages = set()
# DM Mood System (simple, auto-rotating only)
DM_MOOD = "neutral"
DM_MOOD_DESCRIPTION = "I'm feeling neutral and balanced today."
AVAILABLE_MOODS = [
"bubbly", "sleepy", "curious", "shy", "serious", "excited", "silly",
"melancholy", "flirty", "romantic", "irritated", "angry", "neutral", "asleep"
]
BOT_USER = None
LAST_FULL_PROMPT = ""