Discord moderation bot with prefix commands (default: &).
&pb: deletes bot/webhook messages from the most recent 20 messages in the current channel.&pba: deletes all bot/webhook messages from the current channel.&clear <amount>: bulk deletes recent messages.&bulkdelete <#channel> <amount>: bulk deletes messages in a specific channel.&kick,&ban,&unban&mute,&unmute(Discord timeout based)&lock,&unlock,&slowmode&warn,&warnings,&clearwarns(stored indata/warnings.json)&automod <on|off|toggle|status>(moderators can control AutoMod per server)&setgenderroles <@male_role> <@female_role>for per-serveraicrushmapping&genderroles,&cleargenderroles- Auto moderation:
- blocked words from
data/bad_words.txt - link blocking
- spam detection + automatic timeout
- blocked words from
- Mod-log channel support:
&setmodlog [#channel]&clearmodlog- logs both manual moderation actions and automod actions
&reloadbadwordsto reload bad word entries without restarting the bot- Utility/fun commands:
&ping&avatar [@member]&userinfo [@member]&serverinfo&poll Question | Option 1 | Option 2&snipe&remind <minutes> <text>- DM the bot with
remove timeoutto remove your active timeout (if bot has permission)
- AI commands:
&ai <prompt>or&ask <prompt>&aisummary [count]&catchup [hours]&catchupchannel <#channel> [hours]&serverinsights [hours](Manage Server permission required)&aireset&aimodel&aimodels [limit]&roast @user [soft|friendly|brutal]&serverlore&aicrush @user&analyze @user&lie_detector @user <message>&futureme&rizzcoach [smooth|funny|mysterious] <message>&argument <topic>&debate @user <topic>
- Business Empire commands:
&balance,&dailyclaim,&portfolio,&networth&stocks,&market [symbol],&buy <symbol> <qty>,&sell <symbol> <qty>&commodities,&buycommodity <symbol> <qty>,&sellcommodity <symbol> <qty>&crypto,&buycrypto <symbol> <qty>,&sellcrypto <symbol> <qty>&plots,&buyplot <plot_id>,&upgrade <property_id>,&properties&sellproperty <id> <price>,&buyproperty <id>&loan,&takeloan <amount>,&repay <amount>,&debts&startbiz <type> <name>,&mybiz,&bizhire <id> <count>,&bizfire <id> <count>,&bizexpand <id>&salary,&taxes,&filetax [amount],&credit,&markethalt,&economystatus&trade ...,&trade_accept <id>,&trade_decline <id>&auction_start ...,&bid <auction_id> <amount>,&auctions&bizleaderboard [cash|networth|income],&bizprofile [@user],&marketnews,&ledger [@user]&bizadmin ...(moderator-only economy controls)
- Vibe commands:
&myvibe [count]&vibe @user [count]&vibecheck @user
- Music commands:
&join,&leave&play <youtube/spotify link or search>&skip,&pause,&resume,&stop&queue,&nowplaying- Spotify playlist links are supported
&help
Most new AI fun commands are hybrid, so you can use both prefix (&...) and slash (/...) after command sync.
- Create and activate a virtual environment (recommended).
- Install dependencies:
pip install -r requirements.txt
- Copy
.env.exampleto.envand setDISCORD_BOT_TOKEN. - If using AI features, set one provider:
- OpenRouter:
AI_PROVIDER=openrouterOPENROUTER_API_KEY=...
- Groq:
AI_PROVIDER=groqGROQ_API_KEY=...
- OpenRouter:
- If using music features:
- Make sure
ffmpegis installed on your host. - For Spotify links/playlists, set:
SPOTIFY_CLIENT_ID=...SPOTIFY_CLIENT_SECRET=...
- Make sure
- Enable bot intents in Discord Developer Portal:
MESSAGE CONTENT INTENTSERVER MEMBERS INTENT
- Run:
python bot.py
MOD_LOG_CHANNEL_ID=fallback mod-log channel id if&setmodlogis not used.BOT_ACTIVITY_TEXT=with your crushAUTOMOD_ENABLED=falseAUTOMOD_BLOCK_LINKS=trueAUTOMOD_SPAM_MSG_THRESHOLD=6AUTOMOD_SPAM_INTERVAL_SECONDS=8AUTOMOD_SPAM_TIMEOUT_MINUTES=5OPENROUTER_API_KEY=OPENROUTER_MODEL=google/gemma-3-4b-it:freeOPENROUTER_API_URL=https://openrouter.ai/api/v1/chat/completionsOPENROUTER_MODELS_URL=https://openrouter.ai/api/v1/modelsOPENROUTER_APP_NAME=Discord Mod BotOPENROUTER_HTTP_REFERER=AI_PROVIDER=openrouterGROQ_API_KEY=GROQ_MODEL=llama-3.1-8b-instantGROQ_API_URL=https://api.groq.com/openai/v1/chat/completionsGROQ_MODELS_URL=https://api.groq.com/openai/v1/modelsAI_MAX_HISTORY=4AI_MAX_TOKENS=260AI_SUMMARY_MAX_TOKENS=320AI_CATCHUP_MAX_TOKENS=360AI_INSIGHTS_MAX_TOKENS=420AI_TIMEOUT_SECONDS=45SYNC_SLASH_COMMANDS=trueVIBE_DEFAULT_MESSAGE_COUNT=200VIBE_MAX_MESSAGE_COUNT=800VIBE_MIN_REQUIRED_MESSAGES=25VIBE_MAX_PROMPT_MESSAGES=80VIBE_MAX_PROMPT_CHARS=12000AICRUSH_SCAN_PER_CHANNEL=450(used when full-history scan is disabled)AICRUSH_MAX_CHANNELS=0(0means scan all visible text channels)AICRUSH_FULL_HISTORY_SCAN=trueAICRUSH_MAX_CONTEXT_CHARS=16000AICRUSH_MAX_HISTORY_MESSAGES=12000(per-run safety cap)AICRUSH_SCAN_PAUSE_EVERY=260(small pacing interval)AICRUSH_SCAN_PAUSE_SECONDS=0.12(sleep duration for pacing)AICRUSH_CACHE_SECONDS=900(reuse recent result to avoid repeated scans)BUSINESS_ENABLED=trueBUSINESS_STATE_FLUSH_SECONDS=30BUSINESS_GLOBAL_MODE=trueBUSINESS_STARTER_CASH=10000BUSINESS_DAILY_CLAIM=1500BUSINESS_DAILY_CLAIM_STREAK_BONUS=250BUSINESS_HOURLY_INTEREST_RATE=0.0012BUSINESS_LOAN_GRACE_HOURS=24BUSINESS_MAX_DEBT_TO_NETWORTH=1.8BUSINESS_STOCK_COUNT=16BUSINESS_MARKET_EVENT_CHANCE=0.18BUSINESS_TRANSACTION_FEE_RATE=0.01BUSINESS_PROPERTY_MAINTENANCE_RATE=0.004BUSINESS_PROPERTY_TAX_RATE=0.006BUSINESS_AUCTION_SNIPING_WINDOW_SECONDS=30BUSINESS_AUCTION_SNIPING_EXTEND_SECONDS=60BUSINESS_MAX_OPEN_TRADES=5BUSINESS_MAX_OPEN_AUCTIONS=3BUSINESS_COMMAND_COOLDOWN_SECONDS=3BUSINESS_LEDGER_MAX_ENTRIES=50000BUSINESS_AI_PERSONALIZATION_ENABLED=trueBUSINESS_AI_TUNING_ENABLED=trueBUSINESS_AI_MAX_TOKENS=140BUSINESS_AI_PERSONALIZATION_CACHE_SECONDS=900BUSINESS_AI_DIRECTOR_INTERVAL_HOURS=3BUSINESS_SCHEMA_VERSION=2BUSINESS_MARKET_TICK_MINUTES=15BUSINESS_WORLD_EVENT_INTERVAL_MINUTES=120BUSINESS_WEEKLY_CYCLE_DAYS=7BUSINESS_EVENT_MAX_PER_DAY=6BUSINESS_ENABLE_COMMODITIES=trueBUSINESS_ENABLE_CRYPTO=trueBUSINESS_ENABLE_PRIVATE_BUSINESSES=trueBUSINESS_CIRCUIT_BREAKER_DROP_PCT=25BUSINESS_MARKET_HALT_DROP_PCT=15BUSINESS_CAPITAL_GAINS_SHORT_RATE=0.15BUSINESS_CAPITAL_GAINS_LONG_RATE=0.10BUSINESS_CAPITAL_GAINS_LONG_HOLD_DAYS=7BUSINESS_INCOME_TAX_ENABLED=trueMALE_ROLE_IDS=(comma-separated role IDs for strict aicrush gender detection)FEMALE_ROLE_IDS=(comma-separated role IDs for strict aicrush gender detection)MALE_ROLE_HINTS=(optional extra keywords)FEMALE_ROLE_HINTS=(optional extra keywords)VOICE_CONNECT_RETRIES=4VOICE_CONNECT_TIMEOUT=25VOICE_INTERNAL_RECONNECT=falseWELCOME_DM_ENABLED=trueWELCOME_MAX_CHANNEL_SUGGESTIONS=5CATCHUP_DEFAULT_HOURS=24CATCHUP_MAX_HOURS=168CATCHUP_MAX_MESSAGES=180INSIGHTS_DEFAULT_HOURS=48INSIGHTS_MAX_HOURS=168INSIGHTS_MAX_CHANNELS=10INSIGHTS_MAX_MESSAGES_PER_CHANNEL=350INSIGHTS_CHANNEL_SCAN_LIMIT=30ROAST_CONTEXT_TARGET_MESSAGES=220ROAST_CONTEXT_MIN_MESSAGES=35ROAST_CHANNEL_SCAN_LIMIT=14ROAST_HISTORY_PER_CHANNEL=280ROAST_CACHE_MAX_MESSAGES=1400OPENROUTER_FALLBACK_MODELS=google/gemma-3-4b-it:free,qwen/qwen3-4b:free,deepseek/deepseek-r1-0528:freeGROQ_FALLBACK_MODELS=llama-3.1-8b-instant,gemma2-9b-itFFMPEG_PATH=ffmpegMUSIC_MAX_PLAYLIST_ITEMS=50SPOTIFY_CLIENT_ID=SPOTIFY_CLIENT_SECRET=
Depending on which commands you use:
- Manage Messages
- Kick Members
- Ban Members
- Moderate Members
- Manage Channels
- Read Message History
&pbchecks only the latest 20 messages and removes bot/webhook messages there.&pbascans full channel history and may take time on very large channels due to API rate limits.data/bad_words.txtis auto-created at first run; add one blocked word per line.- AI commands work after provider key is set (
OPENROUTER_API_KEYorGROQ_API_KEY). - If your selected model becomes unavailable, bot auto-falls back to another free model.
- For fastest replies, use smaller models and lower
AI_MAX_TOKENS. - Spotify links require Spotify API credentials; otherwise only YouTube/search playback works.
- Spotify playlists must be Public when using client credentials (
SPOTIFY_CLIENT_ID/SECRET). - If hosted voice keeps failing with websocket
4006, this is usually host/node UDP/network routing. Try another node/provider. - Vibe reports are fun-only and may be inaccurate.
- Vibe output is paragraph-style and considers both the user’s messages and replies they receive (in the same channel window).
- Vibe analysis reads recent messages on-demand in the current channel; it does not store long-term message archives.
- New members can receive an optional AI onboarding DM with channel suggestions.
&catchupsummarizes missed conversation from recent hours without scanning full history.&serverinsightsgenerates channel-level engagement insights for moderators.- Roast now uses cached + bounded guild-wide message context for faster, more specific results.
- Business economy is persisted in
data/business_state.jsonand shared globally across servers where the bot is present. - Economy uses fast buckets: market tick every 15 minutes, world event tick every 2 hours, and weekly settlement cycle every 7 days.
- Stocks + commodities + crypto now share risk controls (cost basis, gains tax, temporary asset halts, market-wide halts).
- Private businesses settle in weekly cycles with payroll/maintenance/debt pressure and controlled liquidation on prolonged stress.
- Optional LLM market director can safely nudge economy values (market bias, event chance, small tax/fee shifts) within bounded ranges.
- Optional LLM advisor adds personalized one-line strategy tips in business commands with cache to avoid lag.
- If vibe AI times out, the bot falls back to a local heuristic narrative summary.