Files
BattleBot/src/scripts/generateInvite.js
VinceC a8e836fd5b Add help system, deployment docs, and improve setup
Introduces a new interactive help command with button navigation, adds a detailed DEPLOYMENT.md guide, and improves server setup validation and error handling. Updates command registration to include all 9 games, adds version reporting, enhances Docker deployment with a multi-platform script, and removes local .env files from the repo. Also refactors bot startup for better diagnostics and graceful shutdown.
2025-07-13 04:00:39 -05:00

123 lines
5.6 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
require('dotenv').config();
const { Client, GatewayIntentBits, PermissionsBitField } = require('discord.js');
async function generateInvite() {
const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent,
],
});
try {
await client.login(process.env.BOT_TOKEN);
const invite = client.generateInvite({
scopes: ['bot', 'applications.commands'],
permissions: [
// Basic Discord permissions
PermissionsBitField.Flags.ViewChannel,
PermissionsBitField.Flags.SendMessages,
PermissionsBitField.Flags.SendMessagesInThreads,
PermissionsBitField.Flags.EmbedLinks,
PermissionsBitField.Flags.AttachFiles,
PermissionsBitField.Flags.ReadMessageHistory,
PermissionsBitField.Flags.UseExternalEmojis,
PermissionsBitField.Flags.AddReactions,
// Application commands (slash commands)
PermissionsBitField.Flags.UseApplicationCommands,
// Message management for bot maintenance
PermissionsBitField.Flags.ManageMessages,
// Channel management for notifications setup
PermissionsBitField.Flags.ViewChannel,
PermissionsBitField.Flags.ManageChannels,
// Advanced features
PermissionsBitField.Flags.CreatePublicThreads,
PermissionsBitField.Flags.CreatePrivateThreads,
PermissionsBitField.Flags.UseExternalStickers,
// Voice permissions (if needed for future features)
PermissionsBitField.Flags.Connect,
PermissionsBitField.Flags.Speak,
]
});
console.log('\n🤖 ===== VRBattles Discord Bot Invite Generator ===== 🤖');
console.log('\n📊 Current Bot Status:');
console.log(`Name: ${client.user.tag}`);
console.log(`ID: ${client.user.id}`);
console.log(`Created: ${client.user.createdAt.toDateString()}`);
console.log('\n🏠 Current Servers:');
if (client.guilds.cache.size === 0) {
console.log('❌ Bot is not in any servers yet');
} else {
console.log(`✅ Bot is active in ${client.guilds.cache.size} server(s):`);
client.guilds.cache.forEach(guild => {
console.log(` 🎮 ${guild.name} (${guild.memberCount} members) - ID: ${guild.id}`);
});
}
console.log('\n🔗 ===== Bot Invite Link ===== 🔗');
console.log('Copy and share this link to invite VRBattles Bot to any Discord server:');
console.log('\n' + invite + '\n');
console.log('🎯 ===== Bot Features ===== 🎯');
console.log('✅ Interactive Help System (/help)');
console.log('✅ Player Search (/finduser)');
console.log('✅ Team Search (/findteam) with pagination');
console.log('✅ Match History (/matchhistory)');
console.log('✅ Game Subscriptions (/subscribe, /unsubscribe)');
console.log('✅ Server Registration (/register_server)');
console.log('✅ Real-time Match Notifications');
console.log('✅ Dynamic Autocomplete');
console.log('\n⚙ ===== Permissions Included ===== ⚙️');
console.log('✅ View Channels & Send Messages');
console.log('✅ Slash Commands Support');
console.log('✅ Embed Links & File Attachments');
console.log('✅ Message & Channel Management');
console.log('✅ Emoji & Reaction Support');
console.log('✅ Thread Management');
console.log('✅ Voice Channel Access (future features)');
console.log('\n🚀 ===== Setup Instructions ===== 🚀');
console.log('1. 🔗 Click the invite link above');
console.log('2. 🏠 Select your Discord server from the dropdown');
console.log('3. ✅ Keep ALL permissions checked (required for full functionality)');
console.log('4. 🎉 Click "Authorize" to add the bot');
console.log('\n📝 ===== After Adding the Bot ===== 📝');
console.log('1. 💬 Run /help to see all available commands');
console.log('2. 🔧 Run /register_server to connect your server');
console.log('3. 🎮 Run /subscribe to set up game notifications');
console.log('4. 🔍 Try /finduser to search for players!');
console.log('\n🔧 ===== Admin Setup (Channel IDs) ===== 🔧');
console.log('To get Discord Channel IDs for notifications:');
console.log('1. Enable Developer Mode: User Settings > App Settings > Advanced > Developer Mode');
console.log('2. Right-click any text channel > Copy ID');
console.log('3. Use the ID in /subscribe command');
console.log('\n📚 ===== Documentation ===== 📚');
console.log('Full documentation: https://help.vrbattles.gg');
console.log('VRBattles website: https://www.vrbattles.gg');
console.log('\n✨ VRBattles Discord Bot is ready to enhance your VR gaming community! ✨\n');
} catch (error) {
console.error('❌ Error generating invite:', error);
if (error.code === 'TOKEN_INVALID') {
console.error('\n🔑 Invalid bot token. Please check your .env file and ensure BOT_TOKEN is set correctly.');
}
} finally {
client.destroy();
}
}
generateInvite().catch(console.error);