AeThex-Bot-Master/replit.md
sirpiglr ca07d17417 Add new commands and improve bot functionality
Introduce several new slash commands including ban, kick, timeout, and userinfo. Enhance existing commands like config and rank with new features and configurations. Add new listeners for welcome and goodbye messages. Implement XP tracking for user leveling and integrate it with role rewards. Update documentation to reflect these changes.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: aed2e46d-25bb-4b73-81a1-bb9e8437c261
Replit-Commit-Checkpoint-Type: intermediate_checkpoint
Replit-Commit-Event-Id: 1be8d824-5029-4875-bed8-0bd1d810892d
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/3bdfff67-975a-46ad-9845-fbb6b4a4c4b5/aed2e46d-25bb-4b73-81a1-bb9e8437c261/SQxsvtx
Replit-Helium-Checkpoint-Created: true
2025-12-08 04:09:56 +00:00

264 lines
9.3 KiB
Markdown

# AeThex Unified Bot
A complete Discord bot combining AeThex community features, Sentinel enterprise security, and multi-purpose server management in one instance.
## Overview
AeThex Unified Bot handles community features, security, AND general server management:
- **Community Features**: User verification, profile linking, realm selection, leaderboards, community posts
- **Sentinel Security**: Anti-nuke protection with RAM-based heat tracking
- **Federation Sync**: Cross-server role synchronization across 5 realms
- **Ticket System**: Support tickets with automatic channel creation
- **Moderation**: Full moderation suite (warn, kick, ban, timeout)
- **Leveling System**: Unified XP across Discord and AeThex platform
- **Cross-Platform**: Integration with AeThex.studio and AeThex.foundation
## Tech Stack
- **Runtime**: Node.js 20
- **Framework**: discord.js v14
- **Database**: Supabase (for verification, XP, moderation logs)
- **Health Endpoint**: HTTP server on port 8080
## Project Structure
```
aethex-bot/
├── bot.js # Main entry point
├── package.json
├── public/
│ └── dashboard.html # Web dashboard
├── commands/
│ ├── admin.js # /admin status|heat|servers|threats|federation
│ ├── announce.js # /announce - cross-server announcements
│ ├── auditlog.js # /auditlog - admin action history
│ ├── avatar.js # /avatar - get user avatar
│ ├── badges.js # /badges - view earned badges
│ ├── ban.js # /ban - ban users
│ ├── config.js # /config - server settings
│ ├── daily.js # /daily - claim daily XP
│ ├── federation.js # /federation link|unlink|list
│ ├── foundation.js # /foundation - foundation stats
│ ├── help.js # /help - command list
│ ├── kick.js # /kick - kick users
│ ├── leaderboard.js # /leaderboard - top contributors
│ ├── modlog.js # /modlog - user mod history
│ ├── poll.js # /poll - community polls
│ ├── post.js # /post - community feed posts
│ ├── profile.js # /profile - view linked profile
│ ├── rank.js # /rank - view level and XP
│ ├── refresh-roles.js # /refresh-roles - sync roles
│ ├── serverinfo.js # /serverinfo - server stats
│ ├── set-realm.js # /set-realm - choose primary realm
│ ├── stats.js # /stats - user statistics
│ ├── status.js # /status - network overview
│ ├── studio.js # /studio - studio profile
│ ├── ticket.js # /ticket create|close
│ ├── timeout.js # /timeout - timeout users
│ ├── unlink.js # /unlink - disconnect account
│ ├── userinfo.js # /userinfo - user details
│ ├── verify-role.js # /verify-role - check roles
│ ├── verify.js # /verify - link account
│ └── warn.js # /warn - warn users
├── events/
│ └── messageCreate.js # Message event handler
├── listeners/
│ ├── feedSync.js # Community feed sync
│ ├── welcome.js # Welcome messages + auto-role
│ ├── goodbye.js # Goodbye messages
│ ├── xpTracker.js # XP tracking on messages
│ └── sentinel/
│ ├── antiNuke.js # Channel delete monitor
│ ├── roleDelete.js # Role delete monitor
│ ├── memberBan.js # Mass ban detection
│ └── memberKick.js # Mass kick detection
└── scripts/
└── register-commands.js # Slash command registration
```
## Commands (29 Total)
### Community Commands
| Command | Description |
|---------|-------------|
| `/verify` | Link your Discord account to AeThex |
| `/unlink` | Disconnect your Discord from AeThex |
| `/profile` | View your linked AeThex profile |
| `/set-realm` | Choose your primary realm |
| `/verify-role` | Check your assigned Discord roles |
| `/refresh-roles` | Sync roles based on AeThex profile |
| `/stats` | View your AeThex statistics |
| `/leaderboard` | View top contributors |
| `/post` | Create a community feed post |
| `/help` | View all bot commands |
### Leveling & Engagement
| Command | Description |
|---------|-------------|
| `/rank` | View your level and unified XP |
| `/daily` | Claim daily XP bonus |
| `/badges` | View earned badges across platforms |
### Moderation
| Command | Description |
|---------|-------------|
| `/warn @user [reason]` | Warn a user |
| `/kick @user [reason]` | Kick a user |
| `/ban @user [reason]` | Ban a user |
| `/timeout @user [minutes] [reason]` | Timeout a user |
| `/modlog @user` | View moderation history |
### Utility
| Command | Description |
|---------|-------------|
| `/userinfo [@user]` | View user information |
| `/serverinfo` | View server statistics |
| `/avatar [@user]` | Get user's avatar |
### Admin & Config
| Command | Description |
|---------|-------------|
| `/config view` | View server configuration |
| `/config welcome #channel` | Set welcome channel |
| `/config goodbye #channel` | Set goodbye channel |
| `/config modlog #channel` | Set mod log channel |
| `/config levelup #channel` | Set level-up announcement channel |
| `/config autorole @role` | Set auto-role for new members |
| `/config levelrole @role [level]` | Add level-based role reward |
| `/announce [title] [message]` | Send cross-server announcement |
| `/poll [question] [options]` | Create community poll |
| `/auditlog` | View admin action history |
### Cross-Platform
| Command | Description |
|---------|-------------|
| `/studio [@user]` | View AeThex Studio profile |
| `/foundation [@user]` | View Foundation contributions |
### Sentinel Security
| Command | Description |
|---------|-------------|
| `/admin status` | View bot status and statistics |
| `/admin heat @user` | Check heat level of a user |
| `/admin servers` | View all connected servers |
| `/admin threats` | View active threat monitor |
| `/federation link @role` | Link a role for cross-server sync |
| `/federation unlink @role` | Remove a role from sync |
| `/federation list` | List all linked roles |
| `/ticket create [reason]` | Create a support ticket |
| `/ticket close` | Close the current ticket |
| `/status` | View network status |
## Unified XP System
XP is earned across all platforms and stored in a single profile:
- **Discord Messages**: +5 XP per message (60s cooldown)
- **Daily Claims**: +50 XP base + streak bonus (up to +100)
- **Platform Activity**: Posts, likes, comments on AeThex sites
Level formula: `level = floor(sqrt(xp / 100))`
## Supabase Tables Required
```sql
-- Server configuration
CREATE TABLE server_config (
guild_id TEXT PRIMARY KEY,
welcome_channel TEXT,
goodbye_channel TEXT,
modlog_channel TEXT,
level_up_channel TEXT,
auto_role TEXT,
updated_at TIMESTAMPTZ DEFAULT NOW()
);
-- Warnings
CREATE TABLE warnings (
id SERIAL PRIMARY KEY,
guild_id TEXT NOT NULL,
user_id TEXT NOT NULL,
user_tag TEXT,
moderator_id TEXT NOT NULL,
moderator_tag TEXT,
reason TEXT,
created_at TIMESTAMPTZ DEFAULT NOW()
);
-- Moderation actions
CREATE TABLE mod_actions (
id SERIAL PRIMARY KEY,
guild_id TEXT NOT NULL,
action TEXT NOT NULL,
user_id TEXT NOT NULL,
user_tag TEXT,
moderator_id TEXT NOT NULL,
moderator_tag TEXT,
reason TEXT,
duration_minutes INTEGER,
created_at TIMESTAMPTZ DEFAULT NOW()
);
-- Level roles
CREATE TABLE level_roles (
guild_id TEXT NOT NULL,
role_id TEXT NOT NULL,
level_required INTEGER NOT NULL,
PRIMARY KEY (guild_id, role_id)
);
-- Add to user_profiles (if not exists)
ALTER TABLE user_profiles ADD COLUMN IF NOT EXISTS xp INTEGER DEFAULT 0;
ALTER TABLE user_profiles ADD COLUMN IF NOT EXISTS daily_streak INTEGER DEFAULT 0;
ALTER TABLE user_profiles ADD COLUMN IF NOT EXISTS last_daily TIMESTAMPTZ;
ALTER TABLE user_profiles ADD COLUMN IF NOT EXISTS badges JSONB DEFAULT '[]';
```
## Environment Variables
### Required
- `DISCORD_BOT_TOKEN` - Bot token from Discord Developer Portal
- `DISCORD_CLIENT_ID` - Application ID
### Optional - Supabase
- `SUPABASE_URL` - Supabase project URL
- `SUPABASE_SERVICE_ROLE` - Supabase service role key
### Optional - Federation
- `HUB_GUILD_ID`, `LABS_GUILD_ID`, `GAMEFORGE_GUILD_ID`, `CORP_GUILD_ID`, `FOUNDATION_GUILD_ID`
### Optional - Security
- `WHITELISTED_USERS` - Comma-separated user IDs to skip heat tracking
- `ALERT_CHANNEL_ID` - Channel for security alerts
- `EXTRA_WHITELISTED_GUILDS` - Additional whitelisted server IDs
## Health Endpoints
**GET /health** - Bot health status
**GET /stats** - Server statistics
**GET /dashboard** - Web dashboard
## Running the Bot
```bash
cd aethex-bot
npm install
npm start
```
## Current Status
- Bot running as AeThex#9389
- 29 commands loaded
- Unified XP system active
- Welcome/goodbye system active
- Moderation suite active
- Cross-platform integration ready
## Workflow
- **Name**: AeThex Unified Bot
- **Command**: `cd aethex-bot && npm start`
- **Runtime**: Node.js 20
- **Status**: Running