--- name: discord-server-ctrl description: Complete A-Z Discord server administration. Channel/role/member management, AutoMod, webhooks, templates, audit logs, scheduled events, threads, and full server control via CLI. --- # Discord Server Admin (Pro) A complete, enterprise-grade Discord server management skill. Everything a real server admin needs — from basic moderation to AutoMod, webhooks, templates, audit logs, and beyond. --- ## 🚀 Quick Start ```bash # Set your bot token export DISCORD_BOT_TOKEN="your-bot-token" # Make script executable chmod +x discord-admin.sh # View all commands ./discord-admin.sh --help ``` --- ## 📋 Command Reference ### 1. Server Intelligence ```bash # Full server overview ./discord-admin.sh server-info # Server vanity URL (if enabled) ./discord-admin.sh vanity-get # Set vanity URL (requires DISCOVERABLE + boosts) ./discord-admin.sh vanity-set # Server template operations ./discord-admin.sh template-list # List templates ./discord-admin.sh template-create # Create template ./discord-admin.sh template-use # Create server from template ``` ### 2. Channel Management (All Types) ```bash # List ALL channels (organized by category) ./discord-admin.sh channel-list # Create channels ./discord-admin.sh channel-create text # Text ./discord-admin.sh channel-create voice # Voice ./discord-admin.sh channel-create category # Category ./discord-admin.sh channel-create forum # Forum ./discord-admin.sh channel-create stage # Stage ./discord-admin.sh channel-create announcements # Announcement # Edit channel (all settings) ./discord-admin.sh channel-edit name: topic: ./discord-admin.sh channel-edit nsfw:true rateLimit:60 # Channel permissions ./discord-admin.sh channel-perms # View perms ./discord-admin.sh channel-perms-set allow: deny: ./discord-admin.sh channel-perms-overwrite allow: deny: # Delete channel ./discord-admin.sh channel-delete # Bulk operations ./discord-admin.sh channel-prune # Delete unused channels ``` ### 3. Role Management (Advanced) ```bash # List all roles with hierarchy ./discord-admin.sh role-list # Create role with full permissions ./discord-admin.sh role-create color:#FF5500 permissions:ADMINISTRATOR ./discord-admin.sh role-create permissions:MANAGE_CHANNELS,KICK_MEMBERS,BAN_MEMBERS # Edit role ./discord-admin.sh role-edit name: color: ./discord-admin.sh role-edit hoist:true mentionable:true ./discord-admin.sh role-edit permissions:+MANAGE_MESSAGES,-ADMINISTRATOR # Position management (hierarchy matters!) ./discord-admin.sh role-position # Delete role ./discord-admin.sh role-delete # Bulk role operations ./discord-admin.sh role-assign-bulk ./discord-admin.sh role-remove-bulk # Role permission constants (comma-separated): # ADMINISTRATOR, VIEW_AUDIT_LOG, VIEW_GUILD_INSIGHTS, MANAGE_GUILD, MANAGE_ROLES, MANAGE_CHANNELS, KICK_MEMBERS, BAN_MEMBERS, CREATE_INSTANT_INVITE, CHANGE_NICKNAME, MANAGE_NICKNAMES, MANAGE_EMOJIS, MANAGE_WEBHOOKS, MANAGE_GUILD_EXPRESSIONS, USE_APPLICATION_COMMANDS, MANAGE_EVENTS, MODERATE_MEMBERS ``` ### 4. Member Management ```bash # Member info ./discord-admin.sh member-info # Nickname management ./discord-admin.sh member-nick ./discord-admin.sh member-nick-reset # Timeout (mute) - Discord native ./discord-admin.sh member-timeout ./discord-admin.sh member-untimeout # Kick ./discord-admin.sh member-kick [reason] # Ban (with options) ./discord-admin.sh member-ban [reason] [deleteMessageDays:0-7] ./discord-admin.sh member-ban-temp [reason] # Unban ./discord-admin.sh member-unban [reason] # Bulk moderation ./discord-admin.sh ban-list # List all bans ./discord-admin.sh kick-bulk [reason] ./discord-admin.sh ban-bulk [reason] # Avatar management ./discord-admin.sh member-avatar-set ``` ### 5. AutoMod (Pro Feature) ```bash # List AutoMod rules ./discord-admin.sh automod-list # Create AutoMod rule ./discord-admin.sh automod-create \ keyword:badword,spam,scam \ presets:SLUR,SEXUAL,PROFANITY \ actions:BLOCK_MESSAGE,ALERT, timeout:60s # Keyword filters ./discord-admin.sh automod-keyword add:badword,offensive ./discord-admin.sh automod-keyword remove:badword ./discord-admin.sh automod-keyword clear:true # Preset filters (Discord-provided) ./discord-admin.sh automod-preset SLUR,SEXUAL,PROFANITY,VIOLENCE # Regex patterns ./discord-admin.sh automod-regex pattern:'(?i)(https?://\S+)' # Block lists ./discord-admin.sh automod-blocklist add:custom_blocklist_name # Actions configuration ./discord-admin.sh automod-actions \ ALERT \ BLOCK_MESSAGE \ timeout:60s \ timeoutDuration:300 \ channelId:123456789 # Edit/delete rules ./discord-admin.sh automod-edit enabled:false ./discord-admin.sh automod-delete ``` ### 6. Message Management ```bash # Send messages ./discord-admin.sh msg-send ./discord-admin.sh msg-embed '{"title":"Hello","description":"World","color":65280}' # Send with attachments ./discord-admin.sh msg-send-file [message] # Edit messages ./discord-admin.sh msg-edit # Delete messages ./discord-admin.sh msg-delete ./discord-admin.sh msg-delete-bulk ./discord-admin.sh msg-delete-range [limit:100] # Bulk delete (14-day limit) ./discord-admin.sh msg-prune [days:7] # Search messages ./discord-admin.sh msg-search [channelId] ./discord-admin.sh msg-search-user [limit:100] # Pin/Unpin ./discord-admin.sh msg-pin ./discord-admin.sh msg-unpin ./discord-admin.sh msg-pins # Get message history ./discord-admin.sh msg-history [limit:100] ``` ### 7. Webhooks (Advanced) ```bash # List webhooks ./discord-admin.sh webhook-list [channelId] ./discord-admin.sh webhook-list # Create webhook ./discord-admin.sh webhook-create [avatarUrl] # Get webhook info ./discord-admin.sh webhook-info # Edit webhook ./discord-admin.sh webhook-edit name: channel: ./discord-admin.sh webhook-edit avatar: # Execute webhook (send as webhook) ./discord-admin.sh webhook-execute ./discord-admin.sh webhook-execute username: avatar: ./discord-admin.sh webhook-execute tts:true ./discord-admin.sh webhook-execute embed:'{"title":"Embed","description":"内容"}' # Delete webhook ./discord-admin.sh webhook-delete ``` ### 8. Emojis & Stickers ```bash # List emojis ./discord-admin.sh emoji-list # Create emoji (from URL or base64) ./discord-admin.sh emoji-create ./discord-admin.sh emoji-create # Delete emoji ./discord-admin.sh emoji-delete # Modify emoji ./discord-admin.sh emoji-edit # List stickers ./discord-admin.sh sticker-list # Create sticker ./discord-admin.sh sticker-create # Edit sticker ./discord-admin.sh sticker-edit name: tags: # Delete sticker ./discord-admin.sh sticker-delete ``` ### 9. Soundboard (Beta) ```bash # List soundboard sounds ./discord-admin.sh soundboard-list # Play sound (triggers in voice channel) ./discord-admin.sh soundboard-play [volume:100] # Default sounds ./discord-admin.sh soundboard-defaults ``` ### 10. Scheduled Events ```bash # List events ./discord-admin.sh event-list # Create event ./discord-admin.sh event-create endTime: channel: ./discord-admin.sh event-create "Gaming Night" "Join us!" 2024-12-31T20:00:00Z channel:123456789 entityType:VOICE # Event types: VOICE, STAGE_INSTANCE, EXTERNAL # Edit event ./discord-admin.sh event-edit name: description: ./discord-admin.sh event-edit status:SCHEDULED|ACTIVE|COMPLETED|CANCELED # Delete event ./discord-admin.sh event-delete ``` ### 11. Invites ```bash # List invites ./discord-admin.sh invite-list # Create invite ./discord-admin.sh invite-create [maxUses:0] [maxAge:86400] [temporary:true] ./discord-admin.sh invite-create maxUses:100 maxAge:3600 unique:true # Get invite info ./discord-admin.sh invite-info # Delete invite ./discord-admin.sh invite-delete # Vanity URL (server setting) ./discord-admin.sh vanity-get ./discord-admin.sh vanity-set ``` ### 12. Audit Logs ```bash # Get audit logs ./discord-admin.sh audit-logs [limit:100] ./discord-admin.sh audit-logs user: ./discord-admin.sh audit-logs action:CHANNEL_CREATE,BAN,KICK # Audit action types: # GUILD_UPDATE, CHANNEL_CREATE, CHANNEL_UPDATE, CHANNEL_DELETE, CHANNEL_OVERWRITE_CREATE, CHANNEL_OVERWRITE_UPDATE, CHANNEL_OVERWRITE_DELETE, MEMBER_KICK, MEMBER_PRUNE, BAN_ADD, BAN_REMOVE, MEMBER_UPDATE, MEMBER_ROLE_UPDATE, ROLE_CREATE, ROLE_UPDATE, ROLE_DELETE, INVITE_CREATE, INVITE_UPDATE, INVITE_DELETE, WEBHOOK_CREATE, WEBHOOK_UPDATE, WEBHOOK_DELETE, EMOJI_CREATE, EMOJI_UPDATE, EMOJI_DELETE, MESSAGE_DELETE, MESSAGE_BULK_DELETE, MESSAGE_PIN, MESSAGE_UNPIN, STAGE_INSTANCE_CREATE, STAGE_INSTANCE_UPDATE, STAGE_INSTANCE_DELETE, THREAD_CREATE, THREAD_UPDATE, THREAD_DELETE ``` ### 13. Thread Management ```bash # List threads ./discord-admin.sh thread-list ./discord-admin.sh thread-list # Create thread ./discord-admin.sh thread-create [autoArchive:1440] ./discord-admin.sh thread-create autoArchive:4320 # Edit thread ./discord-admin.sh thread-edit name: archived:true ./discord-admin.sh thread-edit locked:true autoArchive:10080 # Delete thread ./discord-admin.sh thread-delete # Join/Leave thread ./discord-admin.sh thread-join ./discord-admin.sh thread-leave ``` ### 14. Stage Channels ```bash # Create stage instance ./discord-admin.sh stage-create [topic:"Open Mic"] # Edit stage ./discord-admin.sh stage-edit topic: privacyLevel:GUILD_ONLY ./discord-admin.sh stage-edit scheduledStart: # Close stage ./discord-admin.sh stage-close ``` ### 15. Integration Management ```bash # List integrations (bots, apps) ./discord-admin.sh integration-list # Integration operations ./discord-admin.sh integration-sync ./discord-admin.sh integration-delete ``` ### 16. Guild Settings ```bash # Edit server settings ./discord-admin.sh guild-edit name: ./discord-admin.sh guild-edit icon: ./discord-admin.sh guild-edit splash: ./discord-admin.sh guild-edit region: ./discord-admin.sh guild-edit afkChannel: afkTimeout:900 ./discord-admin.sh guild-edit systemChannel: notifications:ALL_MESSAGES ./discord-admin.sh guild-edit explicitContentFilter:ALL_MEMBERS ./discord-admin.sh guild-edit mfaLevel:ELEVATED ./discord-admin.sh guild-edit verificationLevel:HIGH ./discord-admin.sh guild-edit defaultNotifications:ALL_MESSAGES # Community features ./discord-admin.sh guild-enable-community ./discord-admin.sh guild-disable-community # Server merge/transfer ./discord-admin.sh guild-transfer ``` ### 17. Widget Management ```bash # Widget settings ./discord-admin.sh widget-get ./discord-admin.sh widget-edit enabled:true channel: ``` ### 18. Moderation Logging ```bash # Setup moderation log ./discord-admin.sh modlog-set ./discord-admin.sh modlog-get ./discord-admin.sh modlog-disable # Configuration ./discord-admin.sh modlog-config \ kicks:true \ bans:true \ messages:true \ nickname:true \ roles:true \ invites:true ``` ### 19. Bulk/Mass Operations ```bash # Mass ban ./discord-admin.sh mass-ban [reason] # Mass kick ./discord-admin.sh mass-kick [reason] # Mass role assignment ./discord-admin.sh mass-role # Channel sync (copy permissions) ./discord-admin.sh channel-sync-perms # Role sync (copy all settings) ./discord-admin.sh role-clone ``` ### 20. Template Operations ```bash # Templates ./discord-admin.sh template-list ./discord-admin.sh template-create [description] ./discord-admin.sh template-sync ./discord-admin.sh template-delete # Create server from template ./discord-admin.sh template-use ``` --- ## ⚙️ Configuration ### Environment Variables ```bash export DISCORD_BOT_TOKEN="your-bot-token" export DISCORD_GUILD_ID="default-guild-id" export DISCORD_DEFAULT_TIMEOUT=60 # API timeout in seconds export DISCORD_MAX_RETRIES=3 # Retry on rate limit export DISCORD_OUTPUT_FORMAT="json" # json, pretty, minimal ``` ### Required Permissions **Option A: Administrator (easiest)** - Requires: `ADMINISTRATOR` permission **Option B: Granular permissions** ``` MANAGE_CHANNELS MANAGE_ROLES KICK_MEMBERS BAN_MEMBERS MANAGE_MESSAGES MANAGE_GUILD VIEW_AUDIT_LOG MANAGE_EMOJIS MANAGE_WEBHOOKS MANAGE_GUILD_EXPRESSIONS MANAGE_EVENTS MODERATE_MEMBERS ``` ### Rate Limiting The script handles Discord's rate limits automatically: - 1 req/1s per channel for message sends - 50 req/10s for other operations - Exponential backoff on 429 errors - Global rate limit detection --- ## 📊 Examples ### Complete Server Setup ```bash #!/bin/bash # Setup a new community server from scratch GUILD="123456789" TOKEN="your-token" # 1. Create roles ./discord-admin.sh role-create $GUILD "Admin" color:#FF0000 permissions:ADMINISTRATOR ./discord-admin.sh role-create $GUILD "Moderator" color:#FFA500 permissions:KICK_MEMBERS,BAN_MEMBERS,MANAGE_MESSAGES ./discord-admin.sh role-create $GUILD "Member" color:#00FF00 permissions:CREATE_INSTANT_INVITE # 2. Create channels ./discord-admin.sh channel-create $GUILD "general" text ./discord-admin.sh channel-create $GUILD "announcements" announcements ./discord-admin.sh channel-create $GUILD "Voice Channels" category # 3. Setup AutoMod ./discord-admin.sh automod-create $GUILD "Anti-Spam" keyword:scam,free,nitro actions:BLOCK_MESSAGE,ALERT # 4. Create invite INVITE=$(./discord-admin.sh invite-create 123456789 maxUses:100 unique:true | jq -r '.code') echo "Server invite: discord.gg/$INVITE" # 5. Setup mod log ./discord-admin.sh modlog-set $GUILD 987654321 ``` ### Daily Moderation Routine ```bash #!/bin/bash # Daily server maintenance GUILD="123456789" TOKEN="your-token" # Check audit logs for suspicious activity ./discord-admin.sh audit-logs $GUILD action:BAN_ADD --format pretty # Check mod log ./discord-admin.sh audit-logs $GUILD user:BOT_USER_ID --format pretty # List recent bans ./discord-admin.sh audit-logs $GUILD action:BAN_ADD limit:50 --format pretty # Prune old inactive members ./discord-admin.sh member-prune $GUILD 30 # Check for spammers ./discord-admin.sh automod-list $GUILD ``` --- ## 🔧 Troubleshooting ### Common Errors | Error | Solution | |-------|----------| | `401: Unauthorized` | Check your bot token | | `403: Forbidden` | Bot lacks permissions | | `404: Not Found` | Invalid channel/guild/role ID | | `429: Too Many Requests` | Wait, script handles this | | `50013: Missing Permissions` | Bot role is below target role | | `50001: Missing Access` | Bot can't see the channel | ### Debug Mode ```bash ./discord-admin.sh --debug ``` --- ## 📝 Notes - **14-day limit**: Bulk delete only works on messages from the last 14 days - **Role hierarchy**: Bot role must be higher than target roles - **Ownership**: Some operations require server owner - **Vanity URLs**: Require `DISCOVERABLE` feature and boosts - **Templates**: Only available to users with `MANAGE_GUILD` - **Audit logs**: Only viewable by bots with `VIEW_AUDIT_LOG`, retention is 90 days --- ## 🤖 Supported API Endpoints - Guilds & Guild Members - Channels & Threads - Roles & Permissions - Messages & Reactions - AutoModeration Rules - Webhooks - Invites & Vanity URLs - Guild Templates - Emojis & Stickers - Guild Scheduled Events - Stage Instances - Soundboard Sounds - Audit Logs - Integrations - Guild Widgets - Application Commands (partial)