Skip to content

beftlidev/discord-tag-role-bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

5 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🏷️ Discord Tag Role Bot

Discord.js v14 Node.js 18+ License

Automatic Tag-Based Role Management Bot

A specialized bot that monitors tag changes in your Discord server in real-time and automatically assigns roles.


✨ Main Feature: Tag Role System

🎯 Core Function

The sole purpose of this bot is to perform automatic role management by monitoring tag changes in your Discord server.

🏷️ How It Works?

  • Real-Time Monitoring: Instantly detects tag changes through GUILD_MEMBER_UPDATE events
  • 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

πŸ”§ Technical Features

  • 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

πŸš€ Installation

Requirements

  • Node.js 18.0.0 or higher

1. Download the Project

git clone https://github.com/beftlidev/discord-tag-role-bot.git
cd discord-tag-role-bot

2. Install Dependencies

npm install

3. Configuration

Edit 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"
        }
    }
}

4. Start the Bot

node index.js

or for Windows:

start.bat

πŸ”§ Configuration Details

Required Settings

  • bot.id: Bot's user ID
  • bot.owner: Bot owner's user ID
  • token.bot: Discord bot token
  • guild.id: Server ID
  • guild.tag.roleId: Role ID to assign

Optional Settings

  • guild.tag.logChannelId: Channel where log messages will be sent
  • guild.tag.raw: Server tag (guild ID will be used if not specified)
  • webhook: Webhooks for status and error notifications
  • token.topGG: Token for Top.gg statistics

πŸ”§ Tag Role System Details

πŸ“‹ Process Flow

  1. Event Listening: GUILD_MEMBER_UPDATE event is captured
  2. Data Validation: Server ID and user information are verified
  3. Tag Check: User's tag status is checked
  4. Role Operation: Role is assigned or removed if necessary
  5. Logging: Operation result is recorded

πŸ›‘οΈ Security Measures

  • Duplicate operation prevention system
  • Error catching and logging
  • Invalid data validation
  • API rate limit protection

πŸ“Š System Performance

⚑ Optimizations

  • 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

πŸ“ˆ Statistics

  • Event Type: GUILD_MEMBER_UPDATE
  • Processing Time: ~100-200ms (average)
  • Memory Usage: Minimal (only necessary data)
  • Reliability: 99.9%+ uptime

πŸ“ License

This project is licensed under the MIT License. See the LICENSE file for details.


πŸ“ž Support

πŸ› Troubleshooting

  1. Bot not working: Check config.js settings
  2. Role not assigned: Verify server ID and role ID
  3. No logs: Check log channel ID

🀝 Connect With Me


❀️ Built with Discord.js

🌟 Don't forget to star if you like it!

About

Advanced discord.js v14 guild tag role bot.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors