Skip to content

Anant-Raj17/discordInviteBot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Discord Premium Invite Bot

A Discord bot that generates single-use invite links for premium users and automatically assigns a role upon joining.

Setup

1. Install Dependencies

npm install

2. Discord Developer Portal

  1. Go to Discord Developer Portal
  2. Create a new application
  3. Go to Bot → Add Bot
  4. Copy the Token (keep it secret!)
  5. Enable Server Members Intent under Privileged Gateway Intents
  6. Go to OAuth2URL Generator
    • Select scopes: bot
    • Select permissions: Manage Server, Manage Roles, Send Messages
    • Copy the URL and invite the bot to your server

3. Get Discord IDs

Right-click in Discord (with Developer Mode enabled in settings):

  • Server ID: Right-click server → Copy Server ID
  • Role ID: Server Settings → Roles → Right-click role → Copy Role ID
  • Channel ID: Right-click channel → Copy Channel ID

4. Configure Environment

cp .env.example .env

Edit .env with your values:

DISCORD_TOKEN=your_bot_token
GUILD_ID=your_server_id
PREMIUM_ROLE_ID=your_premium_role_id
CHANNEL_ID=your_channel_id
API_SECRET=generate_a_random_secret
PORT=3000

5. Run the Bot

Development:

npm run dev

Production:

npm run build
npm start

API Usage

Create Premium Invite

curl -X POST http://localhost:3000/api/create-invite \
  -H "Content-Type: application/json" \
  -d '{"secret": "your_api_secret", "userId": "user@email.com"}'

Response:

{
  "success": true,
  "inviteUrl": "https://discord.gg/AbC123"
}

Health Check

curl http://localhost:3000/health

Website Integration

After payment via RevenueCat succeeds:

const response = await fetch('https://your-bot-host.com/api/create-invite', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    secret: 'your_api_secret',
    userId: userEmail
  })
});

const { inviteUrl } = await response.json();
// Show popup with inviteUrl

Deployment

Pella (Recommended - Free)

  1. Go to pella.app
  2. Create account
  3. Upload your project
  4. Set environment variables
  5. Deploy!

Other Free Options

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors