diff --git a/.env.example b/.env.example
index c2eae4ad28..c9c0079da8 100644
--- a/.env.example
+++ b/.env.example
@@ -1,70 +1,24 @@
-# Copy this file to .env and replace placeholder values.
+# =============================================
+# R.E.D.T.I.E - Superuser Discord Intelligence
+# =============================================
-# Discord Bot Configuration
+# Discord Bot
DISCORD_TOKEN=your_discord_bot_token_here
CLIENT_ID=your_discord_client_id_here
-# Your server ID (used in the setup tutorial; slash commands register globally via CLIENT_ID).
GUILD_ID=your_discord_guild_id_here
-OWNER_IDS=your_discord_id_here (optional)
-# Bot Runtime Configuration
-NODE_ENV=production
-LOG_LEVEL=warn
-LOG_TO_FILE=false
-SENTRY_DSN=
-
-# Web/API Configuration
-PORT=3000
-WEB_HOST=0.0.0.0
-PORT_RETRY_ATTEMPTS=5
-CORS_ORIGIN=*
-
-# PostgreSQL Configuration (Primary Database)
-# Railway: use the private POSTGRES_URL / DATABASE_URL variable (includes SSL).
-# Public proxy logs showing "invalid length of startup packet" or "SSL without ALPN"
-# are usually internet scanners — not your bot.
-POSTGRES_URL=postgresql://postgres:yourpassword@localhost:5432/titanbot
-POSTGRES_SSL=
-POSTGRES_HOST=localhost
-POSTGRES_PORT=5432
-POSTGRES_DB=titanbot
-POSTGRES_USER=postgres
-POSTGRES_PASSWORD=yourpassword
+# Database (Supabase or PostgreSQL)
+SUPABASE_URL=your_supabase_url
+SUPABASE_KEY=your_supabase_anon_key
+POSTGRES_URL=postgresql://user:password@localhost:5432/redtie
-# PostgreSQL Pool/Timeout Settings
-POSTGRES_MAX_CONNECTIONS=20
-POSTGRES_MIN_CONNECTIONS=2
-POSTGRES_CONNECTION_TIMEOUT=10000
-POSTGRES_IDLE_TIMEOUT=30000
-POSTGRES_RETRIES=3
-POSTGRES_BACKOFF_BASE=100
-POSTGRES_BACKOFF_MULTIPLIER=2
+# AI Services
+GROQ_API_KEY=your_groq_api_key_here
+HF_TOKEN=your_huggingface_token_here
-# Migration & Schema Settings
-AUTO_MIGRATE=true
-POSTGRES_MIGRATION_TABLE=schema_migrations
-SCHEMA_VERSION=1
-SCHEMA_VERSION_LABEL=baseline-v1
+# Lavalink Music
+LAVALINK_NODES=[{"host":"lava.link","port":80,"password":"password","secure":false}]
-# Backup/Restore Script Settings
-BACKUP_DIR=./backups
-BACKUP_RETENTION_DAYS=14
-POSTGRES_RESTORE_URL=
-
-# Music (Lavalink + Riffy) — requires Lavalink v4 nodes
-# Default: loads public v4 SSL nodes from lavalink/nodes.json
-# Source: https://lavalink.darrennathanael.com/SSL/Lavalink-SSL/
-# LAVALINK_NODES_FILE=lavalink/nodes.json
-# Optional: override nodes as JSON array (takes priority over nodes file)
-# LAVALINK_NODES=[{"host":"lavalink","port":2333,"password":"youshallnotpass","secure":false,"name":"Main"}]
-# Self-hosted single node fallback (used only if nodes file/env array are absent):
-# LAVALINK_HOST=localhost
-# LAVALINK_PORT=2333
-# LAVALINK_PASSWORD=youshallnotpass
-# LAVALINK_SECURE=false
-# LAVALINK_NAME=Main
-LAVALINK_SEARCH_PLATFORM=ytmsearch
-LAVALINK_REST_VERSION=v4
-
-# Optional Feature/API Keys
-TMDB_API_KEY=
+# Optional
+NODE_ENV=production
+LOG_LEVEL=warn
\ No newline at end of file
diff --git a/README.md b/README.md
index 700ac20739..77e1e6bc96 100644
--- a/README.md
+++ b/README.md
@@ -1,286 +1,54 @@
-# TitanBot - Ultimate Discord Bot
+# R.E.D.T.I.E - Superuser Discord Intelligence
-**TitanBot** is a powerful, feature-rich Discord bot designed to enhance your server experience with comprehensive moderation tools, engaging economy systems, utility features, and much more. Built with modern Discord.js v14 and PostgreSQL for optimal performance and data persistence.
+R.E.D.T.I.E è un layer intelligente che potenzia MEE6, non lo sostituisce.
+MEE6 gestisce XP, livelli e moderazione base. R.E.D.T.I.E aggiunge cervello, automazione e controllo totale.
-[](https://discord.gg/8kJBYhTGW9)
-[](https://www.npmjs.com/package/discord.js)
-
+> Built with discord.js v14, Supabase, Lavalink v4, Groq & HuggingFace.
-## Table of Contents
+### Core Concept: MEE6 + R.E.D.T.I.E
-- [Features Overview](#features-overview)
-- [Quick Setup](#quick-setup)
-- [Manual Installation Steps](#manual-installation-steps)
-- [Support Server](https://discord.gg/QnWNz2dKCE)
-- [Required Bot Intents](#bot-intents)
-- [Contributing](CONTRIBUTING.md)
+- **MEE6** = operaio (fa il lavoro sporco)
+- **R.E.D.T.I.E** = manager (controlla, migliora, automatizza)
-
-## Features Overview
+### Funzionalità
-TitanBot offers a complete suite of tools for Discord server management and community engagement:
+#### 1. Staff Oversight
+Monitora Helper, Sr Mod, Admin (escluso Owner). Logga timeout, kick, ban, warn via Audit Log. Traccia attività, tempi di risposta ticket, assenze. Sistema di flag L1/L2/L3 con report solo Owner/Admin.
-
-
-|
+#### 2. Gestione Ticket Avanzata (MEE6 Integrated)
+Intercetta i ticket creati da MEE6, legge il motivo di apertura e risponde con IA (Groq). Escalation automatica a staff umano solo se serve. Traccia tempi di risposta.
-### Moderation & Administration
-- **Mass Actions** - Bulk ban/kick capabilities
-- **User Notes** - Keep detailed moderation records
-- **Case Management** - View and track all mod actions
+#### 3. Messaggi Intelligenti
+`/say #canale messaggio anon:true` -> manda come bot senza mostrare lo staffer.
+`/schedule #canale 20:00 messaggio repeat:daily` -> messaggi programmati che sopravvivono al restart.
-### Economy System
-- **Shop & Inventory** - Buy and manage items
-- **Gambling** - Risk it for rewards
-- **Pay System** - Transfer money between users
+#### 4. Server Health & Rules
+`/server audit` -> ti dice cosa non va: canali morti, ruoli con permessi pericolosi, configurazioni errate.
+`/rules generate` -> genera regolamento con IA in base al server.
-### Fun & Entertainment
-- **Random Facts** - Learn something new
-- **Wanted Poster** - Create fun wanted images
-- **Text Reversal** - Reverse any text
+#### 5. Animazione Community
+Se la chat è morta, propone in #staff-ideas eventi: giveaway, trivia, Q&A. Genera annunci con immagini IA (HuggingFace).
-### Advanced Ticket System
-- **Claim & Priority** - Staff ticket management
-- **Ticket Limits** - Prevent spam
-- **Transcript System** - Save ticket history
+#### 6. Agente IA Centrale
+`/redtie ask domanda` -> cervello con memoria a lungo termine su Supabase Vector (ticket, staff, attività).
+Risponde se taggato nei messaggi.
-### Server Stats
-- **Member Counter** - Live member count channels
-- **Voice Counters** - Track voice stats
-- **Dynamic Updates** - Real-time channel updates
+#### 7. Musica 24/7
+Lavalink v4 con supporto Spotify, YouTube, Deezer, Apple Music. Comandi `/play`, `/join`, `/queue`, bottoni interattivi.
-### Reaction Roles
-- **Role Assignment** - Self-assignable roles
-- **Emoji Selection** - Reaction-based system
-- **Multi-role Support** - Multiple role options
+### Setup
- |
-
+1. `cp .env.example .env` -> inserisci DISCORD_TOKEN, CLIENT_ID, SUPABASE_URL, SUPABASE_KEY, GROQ_API_KEY, HF_TOKEN
+2. `npm install`
+3. Su Supabase lancia `supabase/migrations.sql`
+4. `docker compose up -d --build` o `npm start`
-### Leveling & XP System
-- **XP Tracking** - Automatic message-based XP
-- **Level Roles** - Auto-assign roles by level
-- **Custom Configuration** - Personalize leveling
+### Env Richiesti
-### Giveaways & Events
-- **Multiple Winners** - Support multi-winner giveaways
-- **Auto Picking** - Automatic winner selection
-- **Reroll System** - Pick new winners if needed
-
-### Birthday System
-- **Birthday Tracking** - Never miss a birthday
-- **Auto Announcements** - Celebrate automatically
-- **Timezone Support** - Accurate worldwide tracking
-
-### Utility Tools
-- **Report System** - Report issues to staff
-- **Todo Lists** - Personal task management
-- **First Message** - Jump to channel's first message
-
-### Welcome System
-- **Welcome Messages** - Greet new members
-- **Auto Roles** - Assign roles on join
-- **Custom Embeds** - Personalized messages
-
-### Music
-- **24/7 Mode** - Play music 24/7
-- **Interative Button System** - Manage music through buttons
-- **Supports EVERY platform** - Supports spotify, deezer, youtube, apple music
-
- |
-
-
-
-
-## Quick Setup (Recommended for non-coders)
-
-### Video Tutorial
-For a detailed step-by-step setup guide, watch our comprehensive video tutorial:
-[**TitanBot Setup Tutorial**](https://www.youtube.com/@TouchDisc)
-
-## Docker Deployment (Recommended)
-
-TitanBot is fully containerized for easy deployment.
-
-1. **Clone the repository:**
- ```bash
- git clone https://github.com/codebymitch/TitanBot.git
- cd TitanBot
- ```
-
-2. **Configure environment variables:**
- ```bash
- cp .env.example .env
- ```
- Set at minimum `DISCORD_TOKEN`, `CLIENT_ID`, and `GUILD_ID`. Docker Compose also reads `POSTGRES_USER`, `POSTGRES_PASSWORD`, and `POSTGRES_DB` from `.env` (defaults: `titanbot` / `password` / `titanbot`).
-
-3. **Build and start the containers:**
- ```bash
- docker compose up -d --build
- ```
-
-4. **Check status:**
- ```bash
- docker compose ps
- curl http://localhost:3000/health
- ```
-
-This starts the bot and PostgreSQL. The compose file sets `POSTGRES_SSL=false` and `AUTO_MIGRATE=true` for the bundled database. Music uses public Lavalink v4 nodes from `lavalink/nodes.json` by default.
-
-### Music
-
-Music uses [Lavalink v4](https://github.com/lavalink-devs/Lavalink) via [Riffy](https://github.com/riffy-rb/riffy), similar to [Musicify](https://github.com/codebymitch/Musicify).
-
-1. By default, the bot loads multiple public v4 SSL nodes from [`lavalink/nodes.json`](lavalink/nodes.json) (sourced from [lavalink.darrennathanael.com](https://lavalink.darrennathanael.com/SSL/Lavalink-SSL/)). Edit that file to add or remove nodes.
-2. To self-host Lavalink instead, run `docker compose --profile local-lavalink up -d` and set single-node env vars in `.env`:
- ```env
- LAVALINK_HOST=lavalink
- LAVALINK_PORT=2333
- LAVALINK_PASSWORD=youshallnotpass
- LAVALINK_SECURE=false
- ```
- Remove or rename `lavalink/nodes.json` so the bot falls back to those env vars.
-3. Override nodes inline with `LAVALINK_NODES` (JSON array) or point at another file with `LAVALINK_NODES_FILE`.
-4. Use `/play ` from a voice channel, or `/join` to connect without playing. Prefix shortcuts: `join`, `np`, `leave`, `pause`, `resume`, `skip`, `stop`, `volume <0-100>`, or `music `. Use `/nowplaying` and `/queue` for status; `/music` for loop, shuffle, seek, and other controls.
-
-### Using GitHub Container Registry
-
-The bot is automatically published to GitHub Container Registry on every push to main.
-
-```bash
-docker pull ghcr.io/codebymitch/titanbot:main
-```
-
-
-## Manual Installation Steps
-
-### Prerequisites
-- Node.js 20.10.0 or higher
-- PostgreSQL server (recommended) or memory storage fallback
-- Discord bot application with proper intents
-
-1. **Clone the Repository**
- ```bash
- git clone https://github.com/codebymitch/TitanBot.git
- cd TitanBot
- ```
-
-2. **Install Dependencies**
- ```bash
- npm install
- ```
-
-3. **Configure Environment Variables**
- ```bash
- cp .env.example .env
- ```
- Edit `.env` with your configuration (only the following variables require configuration, leave remaining variables as default):
- ```env
- # Discord Bot Configuration
- DISCORD_TOKEN=your_discord_bot_token_here
- CLIENT_ID=your_discord_client_id_here
- GUILD_ID=your_discord_guild_id_here
-
- # PostgreSQL Configuration (Primary Database)
- POSTGRES_URL=postgresql://postgres:yourpassword@localhost:5432/titanbot
- POSTGRES_HOST=localhost
- POSTGRES_PORT=5432
- POSTGRES_DB=titanbot
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=yourpassword
- ```
-
- Production note:
- - `NODE_ENV=production`
- - `LOG_LEVEL=warn` for a clean production console (critical issues + startup status)
- - `LOG_LEVEL=info` if you want more detailed operational logs
- - If your chosen `PORT` is already used, TitanBot automatically tries the next port(s)
-
- Environment options reference:
- - `NODE_ENV`: `development`, `production`, `test` (any non-`production` value is treated as non-production)
- - `LOG_LEVEL`: `error`, `warn`, `info`, `http`, `verbose`, `debug`, `silly`
- - Accepted aliases for `LOG_LEVEL` in this bot: `warns`, `warning`, `warnings` → `warn`
-
- Recommended production `.env` (easy mode + default mode):
- ```env
- NODE_ENV=production
- LOG_LEVEL=warn
- WEB_HOST=0.0.0.0
- PORT=3000
- PORT_RETRY_ATTEMPTS=5
- ```
- This gives clear startup/online status messages while keeping logs simple for non-technical operators.
- If port `3000` is busy, the bot tries the next available ports automatically (up to `PORT_RETRY_ATTEMPTS`).
-
-### Multiple servers
-
-Slash commands are registered **globally** on startup (via `CLIENT_ID`), so the bot works in every server it is invited to. `GUILD_ID` stays in the tutorial `.env` for setup steps but is not used for command registration.
-
-Notes:
-- Global slash commands may take up to about an hour to propagate on first deploy
-- Each server has **isolated** data: config, economy, tickets, leveling, dashboards, warnings, etc. (all keys are scoped as `guild:{guildId}:...`)
-- In the [Discord Developer Portal](https://discord.com/developers/applications), ensure your bot is not restricted to a single guild if you plan to invite it elsewhere
-- Generate an OAuth2 invite URL from the [Discord Developer Portal](https://discord.com/developers/applications) (OAuth2 → URL Generator, scopes: `bot` and `applications.commands`)
-
-4. **Setup PostgreSQL Database** (Optional but recommended)
- ```bash
- # Create database and user
- createdb titanbot
- createuser titanbot
- psql -c "ALTER USER titanbot PASSWORD 'yourpassword';"
- psql -c "GRANT ALL PRIVILEGES ON DATABASE titanbot TO titanbot;"
- ```
-
-5. **Verify Database Setup**
- ```bash
- npm run migrate:check
- ```
-
-6. **Start the Bot**
- ```bash
- npm start
- ```
-
-> **Note on database migrations:** Schema tables and legacy key migrations run
-> **automatically on startup**, so` managed hosts like **Railway** need no manual
-> migration step — just deploy/restart. To disable auto-migration set
-> `AUTO_MIGRATE=false`. You can still run a manual key migration locally with
-> `node scripts/migrate-keys.js --dry-run` (preview) or `node scripts/migrate-keys.js`.
-
-
-## Required Bot Intents
-TitanBot requires the following Discord intents:
-- **Guilds**
-- **Guild Messages**
-- **Message Content**
-- **Guild Members**
-- **Guild Message Reactions**
-- **Guild Voice States**
-- **Direct Messages**
-- **Bot**
-- **Applications.commands**
-
-### Required Permissions
-- **View Channels**
-- **Send Messages**
-- **Embed Links**
-- **Attach Files**
-- **Read Message History**
-- **Manage Messages**
-- **Manage Channels**
-- **Manage Roles**
-- **Kick Members**
-- **Manage Messages**
-- **Ban Members**
-- **Moderate Members**
-- **Connect**
-
-## License
-
-TitanBot is released under the MIT License. See [LICENSE](LICENSE) for details.
-
-## Thank You
-
-Thank you for choosing TitanBot for your Discord server! We're constantly working to improve and add new features based on community feedback.
-
-*Last updated: May 2026*
+DISCORD_TOKEN=
+CLIENT_ID=
+GUILD_ID=
+SUPABASE_URL=
+SUPABASE_KEY=
+GROQ_API_KEY=
+HF_TOKEN=
\ No newline at end of file
diff --git a/package.json b/package.json
index 2430aec17b..fad8decf9e 100644
--- a/package.json
+++ b/package.json
@@ -1,19 +1,13 @@
{
- "name": "titanbot",
- "version": "2.1.0",
- "description": "Modular Ultimate Community Bot by Touchpoint Support",
+ "name": "redtie",
+ "version": "2.1.0-superuser",
+ "description": "R.E.D.T.I.E - Superuser Discord Intelligence layer for MEE6",
+ "author": "zema-tech",
"main": "src/app.js",
"type": "module",
"scripts": {
"start": "node src/app.js",
- "migrate": "node scripts/migrate.js apply",
- "migrate:check": "node scripts/migrate.js check",
- "migrate:status": "node scripts/migrate.js status",
- "migrate:keys": "node scripts/migrate-keys.js",
- "migrate:keys:dry": "node scripts/migrate-keys.js --dry-run",
- "backup:db": "node scripts/backup.js",
- "restore:db": "node scripts/restore.js",
- "backup:drill": "node scripts/restore-drill.js"
+ "migrate": "node scripts/migrate.js apply"
},
"dependencies": {
"@discordjs/rest": "^2.6.1",
@@ -21,18 +15,16 @@
"discord.js": "^14.26.4",
"dotenv": "^17.2.3",
"express": "^5.1.0",
+ "groq-sdk": "^0.5.0",
+ "@huggingface/inference": "^2.0.0",
"node-cron": "^4.2.1",
"pg": "^8.11.3",
"winston": "^3.19.0",
- "winston-daily-rotate-file": "^5.0.0",
"zod": "^3.25.76",
"riffy": "1.0.12"
},
"engines": {
"node": ">=20.10.0"
},
- "overrides": {
- "form-data": "^4.0.6",
- "undici": "^6.27.0"
- }
-}
+ "keywords": ["redtie", "mee6", "superuser", "discord-bot", "groq", "ai", "automation"]
+}
\ No newline at end of file
diff --git a/supabase/migrations.sql b/supabase/migrations.sql
new file mode 100644
index 0000000000..3844f1a925
--- /dev/null
+++ b/supabase/migrations.sql
@@ -0,0 +1,57 @@
+-- Supabase schema for R.E.D.T.I.E Superuser modules
+
+-- Staff Oversight
+CREATE TABLE IF NOT EXISTS staff_logs (
+ id SERIAL PRIMARY KEY,
+ staff_id TEXT NOT NULL,
+ action TEXT NOT NULL,
+ target_id TEXT NOT NULL,
+ reason TEXT,
+ timestamp TIMESTAMP DEFAULT CURRENT_TIMESTAMP
+);
+
+CREATE TABLE IF NOT EXISTS staff_activity (
+ staff_id TEXT PRIMARY KEY,
+ last_activity TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
+ ticket_response_time_avg INTERVAL,
+ flags_level INT DEFAULT 0
+);
+
+-- Tickets
+CREATE TABLE IF NOT EXISTS tickets_log (
+ ticket_id TEXT PRIMARY KEY,
+ opener_id TEXT NOT NULL,
+ reason TEXT,
+ ai_handled BOOLEAN DEFAULT TRUE,
+ staff_responder TEXT,
+ open_time TIMESTAMP,
+ first_response_time TIMESTAMP
+);
+
+-- Scheduler
+CREATE TABLE IF NOT EXISTS scheduled_messages (
+ id SERIAL PRIMARY KEY,
+ channel_id TEXT NOT NULL,
+ message TEXT NOT NULL,
+ scheduled_time TIMESTAMP NOT NULL,
+ repeat TEXT DEFAULT 'once', -- once, daily
+ created_by TEXT NOT NULL,
+ active BOOLEAN DEFAULT TRUE
+);
+
+-- Core Brain Memory
+CREATE TABLE IF NOT EXISTS server_memory (
+ id SERIAL PRIMARY KEY,
+ guild_id TEXT NOT NULL,
+ key TEXT NOT NULL,
+ value TEXT NOT NULL,
+ embedding VECTOR(1536), -- for vector search if using pgvector
+ timestamp TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
+ UNIQUE(guild_id, key)
+);
+
+-- Indexes
+CREATE INDEX IF NOT EXISTS idx_staff_logs_staff ON staff_logs(staff_id);
+CREATE INDEX IF NOT EXISTS idx_tickets_opener ON tickets_log(opener_id);
+CREATE INDEX IF NOT EXISTS idx_scheduled_time ON scheduled_messages(scheduled_time) WHERE active = true;
+CREATE INDEX IF NOT EXISTS idx_server_memory_guild ON server_memory(guild_id);
\ No newline at end of file