A specialized bot that monitors tag changes in your Discord server in real-time and automatically assigns roles.
The sole purpose of this bot is to perform automatic role management by monitoring tag changes in your Discord server.
- Real-Time Monitoring: Instantly detects tag changes through
GUILD_MEMBER_UPDATEevents - Automatic Role Assignment: Automatically assigns the designated role when a user gets the server tag
- Automatic Role Removal: Automatically removes the role when a user removes their tag
- Smart Control: Only assigns roles to users with the correct server tag
- Duplicate Prevention: Prevents repeated operations for the same user
- Detailed Logging: Records all role operations to console or specified channel
- Database Integration: Tracks user states
- Error Management: Comprehensive error catching and reporting
- Performance Optimization: Prevents unnecessary API calls
- Secure Operations: Security checks during role assignment/removal operations
- Node.js 18.0.0 or higher
git clone https://github.com/beftlidev/discord-tag-role-bot.git
cd discord-tag-role-botnpm installEdit the config.js file:
module.exports = {
bot: {
id: "BOT_USER_ID",
version: "0.0.1",
owner: "OWNER_USER_ID",
support: "SUPPORT_SERVER_INVITE", // optional
website: "YOUR_WEBSITE", // optional
},
token: {
bot: "YOUR_BOT_TOKEN",
topGG: "TOP_GG_TOKEN" // optional
},
guild: {
id: "YOUR_GUILD_ID",
tag: {
logChannelId: "LOG_CHANNEL_ID", // optional
raw: "YOUR_GUILD_TAG", // optional
roleId: "ROLE_TO_GIVE_ID"
}
},
webhook: { // optional
status: {
id: "WEBHOOK_ID",
token: "WEBHOOK_TOKEN"
},
error: {
id: "ERROR_WEBHOOK_ID",
token: "ERROR_WEBHOOK_TOKEN"
}
}
}node index.jsor for Windows:
start.batbot.id: Bot's user IDbot.owner: Bot owner's user IDtoken.bot: Discord bot tokenguild.id: Server IDguild.tag.roleId: Role ID to assign
guild.tag.logChannelId: Channel where log messages will be sentguild.tag.raw: Server tag (guild ID will be used if not specified)webhook: Webhooks for status and error notificationstoken.topGG: Token for Top.gg statistics
- Event Listening:
GUILD_MEMBER_UPDATEevent is captured - Data Validation: Server ID and user information are verified
- Tag Check: User's tag status is checked
- Role Operation: Role is assigned or removed if necessary
- Logging: Operation result is recorded
- Duplicate operation prevention system
- Error catching and logging
- Invalid data validation
- API rate limit protection
- Database Control: Duplicate operation prevention with
Tag.fetch() - Cache Usage: Fast access with Discord.js cache system
- Minimal API Calls: API usage only when necessary
- Error Tolerance: Bot continues to work even if operations fail
- Event Type:
GUILD_MEMBER_UPDATE - Processing Time: ~100-200ms (average)
- Memory Usage: Minimal (only necessary data)
- Reliability: 99.9%+ uptime
This project is licensed under the MIT License. See the LICENSE file for details.
- Bot not working: Check
config.jssettings - Role not assigned: Verify server ID and role ID
- No logs: Check log channel ID
β€οΈ Built with Discord.js
π Don't forget to star if you like it!