AeThex-Bot-Master/replit.md
sirpiglr 49f6c9fe13 Add voice channel XP tracking and configuration options
Introduce voice XP tracking with interval-based awarding, configurable XP amounts, cooldowns, and enable/disable toggles via slash commands.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: aed2e46d-25bb-4b73-81a1-bb9e8437c261
Replit-Commit-Checkpoint-Type: intermediate_checkpoint
Replit-Commit-Event-Id: a6df7c57-9848-41f4-b6cc-ef4096c91cf9
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/3bdfff67-975a-46ad-9845-fbb6b4a4c4b5/aed2e46d-25bb-4b73-81a1-bb9e8437c261/ZjyNKqu
Replit-Helium-Checkpoint-Created: true
2025-12-08 21:13:14 +00:00

13 KiB

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
  • Role Panels: Button-based self-assignable roles
  • Giveaways: Automated giveaway system with entries
  • Auto-Moderation: Link/spam/badwords/invite filtering
  • Scheduled Messages: Timed announcements

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 (6 templates)
│   ├── auditlog.js             # /auditlog - admin action history
│   ├── automod.js              # /automod - auto-moderation settings
│   ├── 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
│   ├── embed.js                # /embed - custom embed builder with modal
│   ├── federation.js           # /federation link|unlink|list
│   ├── foundation.js           # /foundation - foundation stats
│   ├── giveaway.js             # /giveaway - giveaway system
│   ├── help.js                 # /help - categorized command list with dropdown
│   ├── kick.js                 # /kick - kick users
│   ├── leaderboard.js          # /leaderboard - top contributors with medals
│   ├── modlog.js               # /modlog - user mod history
│   ├── poll.js                 # /poll - community polls
│   ├── post.js                 # /post - community feed posts
│   ├── profile.js              # /profile - card-style profile with XP bar
│   ├── rank.js                 # /rank - view level and XP
│   ├── refresh-roles.js        # /refresh-roles - sync roles
│   ├── rolepanel.js            # /rolepanel - button role panels
│   ├── schedule.js             # /schedule - timed announcements
│   ├── serverinfo.js           # /serverinfo - rich 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
│   └── xp-settings.js          # /xp-settings - configure XP per server
├── events/
│   └── messageCreate.js        # Message event handler
├── listeners/
│   ├── automod.js              # Auto-moderation listener
│   ├── feedSync.js             # Community feed sync
│   ├── welcome.js              # Rich welcome messages + auto-role
│   ├── goodbye.js              # Rich goodbye messages
│   ├── xpTracker.js            # XP tracking on messages
│   ├── reactionXp.js           # XP tracking for reactions
│   ├── voiceXp.js              # XP tracking for voice channels
│   └── 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 (37 Total)

Community Commands

Command Description
/verify Link your Discord account to AeThex
/unlink Disconnect your Discord from AeThex
/profile View your linked AeThex profile (card-style with XP bar)
/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 (with medal rankings)
/post Create a community feed post
/help View categorized commands with dropdown menu

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
/automod Configure auto-moderation (links, spam, badwords, invites, mentions)

Utility

Command Description
/userinfo [@user] View user information
/serverinfo View rich server statistics (boost level, features)
/avatar [@user] Get user's avatar
/embed Create custom embeds with modal builder

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 announcements (6 template types)
/poll [question] [options] Create community poll
/auditlog View admin action history
/rolepanel Create/manage button role panels
/giveaway Create/end/reroll giveaways
/schedule Schedule timed messages

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, configurable)
  • Reaction XP: +3 XP for receiving reactions, +1 XP for giving (30s cooldown, configurable)
  • Voice Chat XP: +2 XP per minute in voice channels (60s cooldown, configurable)
  • Daily Claims: +50 XP base + streak bonus (up to +100)
  • Platform Activity: Posts, likes, comments on AeThex sites

Level formula: level = floor(sqrt(xp / base)) where base is 50 (easy), 100 (normal), or 200 (hard)

XP Configuration (/xp-settings)

  • message-xp - Set XP per message (1-50)
  • cooldown - Set message XP cooldown (10-300s)
  • reaction-xp - Set XP for giving/receiving reactions
  • reaction-cooldown - Set reaction XP cooldown (5-120s)
  • reaction-toggle - Enable/disable reaction XP
  • voice-xp - Set XP per minute in voice channels (1-20)
  • voice-cooldown - Set voice XP cooldown (30-300s)
  • voice-toggle - Enable/disable voice XP
  • multiplier-role - Add role-based XP multipliers
  • bonus-channel - Add channel-based XP bonuses
  • level-curve - Set leveling difficulty (easy/normal/hard)
  • toggle - Enable/disable XP system

Supabase Tables Required

-- 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)
);

-- Role panels (NEW)
CREATE TABLE role_panels (
  message_id TEXT PRIMARY KEY,
  channel_id TEXT,
  guild_id TEXT,
  title TEXT,
  description TEXT,
  color TEXT,
  roles JSONB DEFAULT '[]',
  created_by TEXT,
  created_at TIMESTAMPTZ DEFAULT NOW()
);

-- Giveaways (NEW)
CREATE TABLE giveaways (
  message_id TEXT PRIMARY KEY,
  channel_id TEXT,
  guild_id TEXT,
  prize TEXT,
  winners_count INTEGER DEFAULT 1,
  required_role TEXT,
  host_id TEXT,
  end_time TIMESTAMPTZ,
  entries JSONB DEFAULT '[]',
  status TEXT DEFAULT 'active',
  created_at TIMESTAMPTZ DEFAULT NOW()
);

-- Scheduled messages (NEW)
CREATE TABLE scheduled_messages (
  id TEXT PRIMARY KEY,
  guild_id TEXT,
  channel_id TEXT,
  type TEXT,
  content TEXT,
  embed_data JSONB,
  send_time TIMESTAMPTZ,
  created_by TEXT,
  status TEXT DEFAULT 'pending',
  created_at TIMESTAMPTZ DEFAULT NOW()
);

-- Auto-mod config (NEW)
CREATE TABLE automod_config (
  guild_id TEXT PRIMARY KEY,
  links_enabled BOOLEAN DEFAULT FALSE,
  links_action TEXT DEFAULT 'delete',
  spam_enabled BOOLEAN DEFAULT FALSE,
  spam_threshold INTEGER DEFAULT 5,
  badwords JSONB DEFAULT '[]',
  invites_enabled BOOLEAN DEFAULT FALSE,
  mentions_enabled BOOLEAN DEFAULT FALSE,
  mentions_limit INTEGER DEFAULT 5,
  exempt_roles JSONB DEFAULT '[]',
  updated_at TIMESTAMPTZ DEFAULT NOW()
);

-- 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

cd aethex-bot
npm install
npm start

Current Status

  • Bot running as AeThex#9389
  • 36 commands loaded
  • Unified XP system active
  • Welcome/goodbye system active (rich embeds)
  • Moderation suite active
  • Auto-moderation system ready
  • Role panels with button interactions
  • Giveaway system active
  • Scheduled messages active
  • Cross-platform integration ready

Workflow

  • Name: AeThex Unified Bot
  • Command: cd aethex-bot && npm start
  • Runtime: Node.js 20
  • Status: Running