| id | ailey-soc-discord |
| name | Discord Bot Integration Manager |
| description | Comprehensive Discord bot with intent detection, slash commands, event handlers, and moderation tools. Automatically detects Gateway intent level and adapts features. Includes verification guidance for 75+ server bots. |
| keywords | ["discord","bot","gateway","intents","slash-commands","moderation","events","verification"] |
| tools | ["discord.js","Gateway API","slash commands","webhooks"] |
Discord Bot Integration Manager
Comprehensive Discord bot skill with intelligent Gateway intent detection, slash commands, real-time event handling, and moderation capabilities. Automatically adapts to your bot's intent configuration and provides upgrade guidance.
Overview
This skill provides:
- Gateway Intent Detection: Automatically detects enabled intents (GUILD_MEMBERS, GUILD_PRESENCES, MESSAGE_CONTENT)
- 5 Intent Levels: BASIC โ PRIVILEGED_MEMBERS โ PRIVILEGED_PRESENCE โ PRIVILEGED_CONTENT โ PRIVILEGED_ALL
- Feature Gating: Shows only available features based on current intent level
- Upgrade Documentation: Step-by-step guides to enable privileged intents
- Verification Guidance: Complete 75+ server verification process documentation
- Slash Commands: Modern interaction-based commands
- Event Handlers: Real-time events (messages, members, voice, reactions)
- Moderation Tools: Content filtering, timeouts, kicks, bans
- Voice Support: Voice channel management
- Rich Interactions: Buttons, select menus, modals
When to Use
- Building Discord bots for community management
- Automating server moderation and content filtering
- Creating interactive slash commands and tools
- Tracking member joins, roles, and activities
- Monitoring voice channels and presence
- Managing large-scale Discord communities
- Need intelligent intent detection and upgrade guidance
- Preparing for 75+ server verification
Installation
cd .github/skills/ailey-soc-discord
npm install
Quick Start
npm run discord setup
npm run discord test
npm run discord detect
npm run discord register-commands
npm run bot
Workflows
Workflow 1: Initial Setup
Configure Discord Application:
npm run discord setup
cp .env.example .env
npm run discord test
Expected Output:
โ Connection successful!
Your Discord Bot:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Username: MyBot#1234
Bot ID: 123456789012345678
Servers: 3
Intent Level: Basic Bot
๐ก Enable privileged intents for more features
Register Slash Commands:
npm run discord register-commands
npm run discord register-commands -- --guild YOUR_GUILD_ID
Verify Commands:
- Go to Discord server
- Type
/ in any channel
- You should see: /ping, /serverinfo, /userinfo
Workflow 2: Intent Detection
Check Current Intent Level:
npm run discord detect
Example Output - Basic Bot:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
DISCORD BOT INTENT DETECTION
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ฏ Intent Level: BASIC BOT
Servers: 5
Enabled Intents:
โ
GUILDS
โ
GUILD_MESSAGES
โ
GUILD_MESSAGE_REACTIONS
โ
GUILD_VOICE_STATES
โ
DIRECT_MESSAGES
Missing Privileged Intents:
โ MESSAGE_CONTENT
โ GUILD_MEMBERS
โ GUILD_PRESENCES
Available Capabilities:
โ Read message content (requires MESSAGE_CONTENT)
โ Track member joins/leaves (requires GUILD_MEMBERS)
โ See member status/activities (requires GUILD_PRESENCES)
โ
Moderation commands
Enabled Features:
โข Slash commands
โข Send messages
โข Manage roles/channels
โข Voice channels
โข Reactions
โข DM handling
๐ Unlock More Features:
Enable privileged intents to unlock:
โข Read message content (content moderation)
โข Track member joins/leaves
โข See member status and activities
Run "npm run discord setup" for enablement instructions.
Example Output - Full Bot (75+ servers):
๐ฏ Intent Level: PRIVILEGED ALL
Servers: 127
Enabled Intents:
โ
GUILDS
โ
GUILD_MESSAGES
โญ MESSAGE_CONTENT (privileged)
โญ GUILD_MEMBERS (privileged)
โญ GUILD_PRESENCES (privileged)
Available Capabilities:
โ
Read message content
โ
Track member joins/leaves
โ
See member status/activities
โ
Moderation commands
โ ๏ธ VERIFICATION REQUIRED:
Your bot is in 127 servers with privileged intents.
You must verify your bot to continue using privileged intents.
Steps:
1. Go to Developer Portal
2. Submit for verification
3. Provide privacy policy and ToS
4. Wait for approval (1-2 weeks)
Run "npm run discord setup" for detailed verification guide.
Check Specific Features:
npm run discord features
Shows granular feature availability (read messages, track members, moderation, etc.)
Workflow 3: Enable Privileged Intents (< 75 Servers)
Enable MESSAGE_CONTENT Intent:
-
Go to Discord Developer Portal:
-
Enable Intent:
- Go to "Bot" tab
- Scroll to "Privileged Gateway Intents"
- Toggle "MESSAGE CONTENT INTENT" to ON
- Click "Save Changes"
-
Update Configuration:
DISCORD_INTENT_MESSAGE_CONTENT=true
-
Restart Bot:
npm run discord detect
Expected Output:
๐ฏ Intent Level: PRIVILEGED CONTENT
Enabled Intents:
โ
GUILDS
โ
GUILD_MESSAGES
โญ MESSAGE_CONTENT (privileged)
Available Capabilities:
โ
Read message content
โ
Moderation commands
Enable All Privileged Intents:
# .env
DISCORD_INTENT_MEMBERS=true
DISCORD_INTENT_PRESENCES=true
DISCORD_INTENT_MESSAGE_CONTENT=true
Developer Portal: Enable all three intents โ Save Changes
Workflow 4: Bot Verification (75+ Servers)
When Verification Required:
- Bot reaches 75 servers
- AND has any privileged intent enabled
- Privileged intents stop working until verified
Prepare Documentation:
Before applying, create:
-
Privacy Policy (required):
- Hosted on public URL
- Explain data collection, usage, protection
- User rights (deletion, access)
- Can use template or create your own
-
Terms of Service (required):
- Hosted on public URL
- Bot usage terms
- User responsibilities
Submit Verification:
-
Go to Developer Portal:
- You'll see "Verification Required" banner
- Click "Submit for Verification"
-
Complete Form:
Bot Information:
- Bot name: "MyBot"
- Purpose: "Community management and moderation"
- Functionality: "Automated moderation, member tracking, content filtering"
- Target audience: "Discord server administrators"
- Primary language/region
Privileged Intent Justification:
MESSAGE_CONTENT:
Our bot needs to read message content for automated content moderation:
- Filter profanity and spam
- Detect and prevent harassment
- Auto-moderate malicious links
- Ensure safe server environment
Data handling: Messages are not stored permanently. Only flagged content
is logged for moderation review with 30-day retention.
GUILD_MEMBERS:
Our bot needs member tracking for:
- Send welcome messages to new members
- Track member count analytics (privacy-safe aggregates)
- Member verification system
Data handling: Only store user IDs and join dates. No personal information
is retained beyond what's necessary for verification.
GUILD_PRESENCES:
Our bot needs presence data for:
- Activity-based role assignment (e.g., "Active Member" role)
- Track streaming status for community events
- Member engagement analytics (aggregated, not individual tracking)
Data handling: Presence data is processed in real-time and not stored.
Only aggregate statistics are retained.
Data Handling:
- Storage: "Minimal data storage - only user IDs, message flags for moderation"
- Retention: "30 days for moderation logs, indefinite for server configuration"
- Security: "Encrypted database, access controls, regular security audits"
- Compliance: "GDPR compliant - users can request data deletion"
URLs:
-
Submit
-
Wait for Review:
- Typical timeline: 1-2 weeks
- Discord may request clarification
- Respond promptly to follow-ups
-
After Approval:
- Receive email confirmation
- Privileged intents remain enabled
- No need to reapply unless suspended
Tips for Approval:
โ
Clear, specific use cases
โ
Legitimate privacy policy and ToS
โ
Emphasis on user privacy
โ
Professional presentation
โ
Responsive to Discord's questions
โ Vague justifications
โ Requesting unused intents
โ Ignoring follow-up requests
Workflow 5: Running the Bot
Start Bot:
npm run bot
Expected Output:
๐ Starting Discord Bot...
Connecting to Discord Gateway...
๐ค Bot is ready!
Logged in as: MyBot#1234
Bot ID: 123456789012345678
Servers: 5
Intent Level: Privileged Content
Bot is listening for events...
Press Ctrl+C to stop
Bot Events:
The bot automatically handles:
Guild Events:
โ
Joined server: MyServer (123456789012345678)
Members: 1,234
โ Left server: OldServer (987654321098765432)
Member Events (requires GUILD_MEMBERS):
๐ Member joined: User#1234 in MyServer
๐ Member left: User#5678 from MyServer
Message Events (requires MESSAGE_CONTENT for content):
๐จ Message: User#1234: Hello, this is a test message...
Voice Events:
๐ User#1234 joined voice: General Voice
๐ User#5678 left voice: General Voice
Presence Events (requires GUILD_PRESENCES):
๐ข Presence update: User#1234 โ online
Slash Command Events:
โ
/ping command executed by User#1234
โ
/serverinfo command executed by User#5678
Graceful Shutdown:
^C
Shutting down bot...
Bot stopped.
Workflow 6: Slash Commands
Default Commands:
/ping
Usage: /ping
Returns: Bot latency in milliseconds
Example:
User: /ping
Bot: ๐ Pong! Latency: 42ms
/serverinfo
Usage: /serverinfo
Returns: Server details (name, ID, members, created date, channels, roles)
Example:
User: /serverinfo
Bot: [Embed with server information]
โข Server ID: 123456789012345678
โข Owner: @Admin#1234
โข Members: 1,234
โข Created: Jan 1, 2020
โข Channels: 50
โข Roles: 20
/userinfo [user]
Usage: /userinfo [user]
Options:
user (optional): User to get info about (defaults to yourself)
Returns: User details (ID, created date, joined date, roles, status)
Example:
User: /userinfo @Friend#5678
Bot: [Embed with user information]
โข User ID: 987654321098765432
โข Account Created: Mar 15, 2019
โข Joined Server: Jun 20, 2023
โข Status: online (if GUILD_PRESENCES enabled)
โข Roles: Member, Helper
Test Commands in Discord:
- Open Discord server
- Type
/ in any channel
- Select command from dropdown
- Fill options (if any)
- Press Enter
Workflow 7: Custom Slash Commands
Add New Command:
Edit discord-client.ts:
export function getDefaultCommands(): CommandData[] {
return [
{
name: 'roll',
description: 'Roll a dice',
options: [
{
name: 'sides',
description: 'Number of sides (default 6)',
type: 4,
required: false
}
]
}
];
}
Implement Handler:
Edit bot.ts:
bot.client.on('interactionCreate', async (interaction) => {
if (!interaction.isChatInputCommand()) return;
const { commandName } = interaction;
switch (commandName) {
case 'roll':
const sides = interaction.options.getInteger('sides') || 6;
const result = Math.floor(Math.random() * sides) + 1;
await interaction.reply(`๐ฒ You rolled: **${result}** (d${sides})`);
break;
}
});
Register:
npm run discord register-commands
Test:
User: /roll sides:20
Bot: ๐ฒ You rolled: **15** (d20)
Workflow 8: Content Moderation (Requires MESSAGE_CONTENT)
Enable MESSAGE_CONTENT Intent:
- Developer Portal โ Bot โ Privileged Gateway Intents
- Toggle "MESSAGE CONTENT INTENT" to ON
- Update .env:
DISCORD_INTENT_MESSAGE_CONTENT=true
- Restart bot
Add Moderation Handler:
Edit bot.ts:
bot.client.on('messageCreate', async (message) => {
if (message.author.bot) return;
const intents = await bot.detectIntentLevel();
if (!intents.canReadMessages) {
return;
}
const badWords = ['badword1', 'badword2'];
const content = message.content.toLowerCase();
if (badWords.some(word => content.includes(word))) {
await message.delete();
await message.channel.send(`${message.author}, please watch your language!`);
console.log(`Deleted message from ${message.author.tag} (profanity)`);
}
if (content.includes('http://') || content.includes('https://')) {
const member = message.member;
if (!member?.permissions.has('ManageMessages')) {
await message.delete();
await message.channel.send(`${message.author}, you don't have permission to post links.`);
}
}
});
Moderation Commands:
case 'timeout':
const user = interaction.options.getUser('user', true);
const duration = interaction.options.getInteger('duration', true);
const member = interaction.guild?.members.cache.get(user.id);
if (member) {
await member.timeout(duration * 60 * 1000, 'Moderator timeout');
await interaction.reply(`Timed out ${user.tag} for ${duration} minutes.`);
}
break;
case 'kick':
const kickUser = interaction.options.getUser('user', true);
const kickMember = interaction.guild?.members.cache.get(kickUser.id);
if (kickMember) {
await kickMember.kick('Moderator action');
await interaction.reply(`Kicked ${kickUser.tag}.`);
}
break;
case 'ban':
const banUser = interaction.options.getUser('user', true);
await interaction.guild?.members.ban(banUser.id, { reason: 'Moderator action' });
await interaction.reply(`Banned ${banUser.tag}.`);
break;
Workflow 9: Member Tracking (Requires GUILD_MEMBERS)
Enable GUILD_MEMBERS Intent:
- Developer Portal โ Bot โ Enable "SERVER MEMBERS INTENT"
- Update .env:
DISCORD_INTENT_MEMBERS=true
- Restart bot
Welcome Messages:
bot.client.on('guildMemberAdd', async (member) => {
console.log(`๐ Member joined: ${member.user.tag} in ${member.guild.name}`);
const systemChannel = member.guild.systemChannel;
if (systemChannel && systemChannel.isTextBased()) {
await systemChannel.send(
`Welcome to ${member.guild.name}, ${member}! ๐\n` +
`You are member #${member.guild.memberCount}!`
);
}
const welcomeRole = member.guild.roles.cache.find(r => r.name === 'Member');
if (welcomeRole) {
await member.roles.add(welcomeRole);
}
});
Member Leave:
bot.client.on('guildMemberRemove', async (member) => {
console.log(`๐ Member left: ${member.user.tag} from ${member.guild.name}`);
const systemChannel = member.guild.systemChannel;
if (systemChannel && systemChannel.isTextBased()) {
await systemChannel.send(`${member.user.tag} has left the server. ๐`);
}
});
Member Count Analytics:
case 'membercount':
const guild = interaction.guild;
if (!guild) return;
const total = guild.memberCount;
const bots = guild.members.cache.filter(m => m.user.bot).size;
const humans = total - bots;
await interaction.reply({
embeds: [{
title: 'Member Statistics',
fields: [
{ name: 'Total Members', value: total.toString(), inline: true },
{ name: 'Humans', value: humans.toString(), inline: true },
{ name: 'Bots', value: bots.toString(), inline: true }
]
}]
});
break;
Workflow 10: Presence Tracking (Requires GUILD_PRESENCES)
Enable GUILD_PRESENCES Intent:
- Developer Portal โ Bot โ Enable "PRESENCE INTENT"
- Update .env:
DISCORD_INTENT_PRESENCES=true
- Restart bot
Track Status Changes:
bot.client.on('presenceUpdate', (oldPresence, newPresence) => {
const user = newPresence.user;
if (!user) return;
const oldStatus = oldPresence?.status || 'offline';
const newStatus = newPresence.status;
if (oldStatus !== newStatus) {
console.log(`๐ข ${user.tag} changed status: ${oldStatus} โ ${newStatus}`);
}
const activities = newPresence.activities;
if (activities.length > 0) {
const activity = activities[0];
console.log(`๐ฎ ${user.tag} is ${activity.type}: ${activity.name}`);
}
});
Activity-Based Roles:
bot.client.on('presenceUpdate', async (oldPresence, newPresence) => {
const member = newPresence.member;
if (!member) return;
const streamingRole = member.guild.roles.cache.find(r => r.name === 'Streaming');
if (!streamingRole) return;
const isStreaming = newPresence.activities.some(a => a.type === 1);
if (isStreaming && !member.roles.cache.has(streamingRole.id)) {
await member.roles.add(streamingRole);
console.log(`Added Streaming role to ${member.user.tag}`);
} else if (!isStreaming && member.roles.cache.has(streamingRole.id)) {
await member.roles.remove(streamingRole);
console.log(`Removed Streaming role from ${member.user.tag}`);
}
});
Intent Level Comparison
| Feature | Basic | + Members | + Presence | + Content | All |
|---|
| Slash Commands | โ
| โ
| โ
| โ
| โ
|
| Send Messages | โ
| โ
| โ
| โ
| โ
|
| Manage Roles/Channels | โ
| โ
| โ
| โ
| โ
|
| Voice Channels | โ
| โ
| โ
| โ
| โ
|
| Reactions | โ
| โ
| โ
| โ
| โ
|
| Read Message Content | โ | โ | โ | โ
| โ
|
| Track Member Joins/Leaves | โ | โ
| โ
| โ
| โ
|
| Access Member List | โ | โ
| โ
| โ
| โ
|
| See Member Status | โ | โ | โ
| โ
| โ
|
| Track Activities | โ | โ | โ
| โ
| โ
|
| Content Moderation | โ | โ | โ | โ
| โ
|
| Welcome Messages | โ | โ
| โ
| โ
| โ
|
| Activity-Based Roles | โ | โ | โ
| โ
| โ
|
| Verification (75+) | โ | โ ๏ธ | โ ๏ธ | โ ๏ธ | โ ๏ธ |
Legend:
- โ
= Available
- โ = Not available
- โ ๏ธ = Requires Discord verification
Troubleshooting
Error: "Invalid token"
Cause: Incorrect DISCORD_BOT_TOKEN
Solution:
- Verify token in .env matches Developer Portal
- Reset token in Developer Portal if needed
- Ensure no extra spaces or quotes in .env
- Check token wasn't committed to git (security!)
Error: "Intents not available"
Cause: Intent enabled in .env but not in Developer Portal
Solution:
- Go to Developer Portal โ Bot tab
- Enable intent under "Privileged Gateway Intents"
- Click "Save Changes"
- Restart bot
Error: "Privileged intent blocked" (75+ servers)
Cause: Bot reached 75 servers, verification required
Solution:
- Review verification requirements:
npm run discord setup
- Prepare privacy policy and ToS
- Submit verification in Developer Portal
- Wait for approval (1-2 weeks)
- Respond promptly to Discord's follow-ups
Slash commands not appearing
Cause: Commands not registered or Discord caching
Solution:
npm run discord register-commands
npm run discord register-commands -- --guild YOUR_GUILD_ID
Bot can see message events but not content
Cause: Missing MESSAGE_CONTENT intent
This is expected! Without MESSAGE_CONTENT intent:
- Bot receives message events
- But cannot read message.content
- Slash commands still work
Solution: Enable MESSAGE_CONTENT intent (see Workflow 3)
Welcome messages not working
Cause: Missing GUILD_MEMBERS intent or permissions
Solution:
- Enable GUILD_MEMBERS intent (see Workflow 9)
- Verify bot has "View Channels" and "Send Messages" permissions
- Check systemChannel exists
Resources
version: 1.0.0
updated: 2026-01-30
reviewed: 2026-01-30
score: 4.7