# šŸ” Get Supergroup Chat ID & Topic ID Simple script to get supergroup chat IDs and topic IDs for local development. ## šŸ“‹ Quick Script Create `quick-chat-info.js` in your project root: ```javascript #!/usr/bin/env node require('dotenv').config(); const TelegramBot = require('node-telegram-bot-api'); console.log('šŸ” Supergroup Chat ID & Topic ID Getter'); console.log('Add your bot to supergroup and send a message...\n'); const botToken = process.env.TELEGRAM_BOT_TOKEN; if (!botToken || botToken === 'YOUR_BOT_TOKEN_HERE') { console.log('āŒ Set TELEGRAM_BOT_TOKEN in .env file'); process.exit(1); } const bot = new TelegramBot(botToken, { polling: true }); bot.on('message', (msg) => { if (msg.chat.type === 'supergroup') { console.log(`šŸ“‹ Supergroup: ${msg.chat.title}`); console.log(`Chat ID: ${msg.chat.id}`); if (msg.message_thread_id) { console.log(`Topic ID: ${msg.message_thread_id}`); console.log(`\nFor .env: ADMIN_CHAT_IDS=${msg.chat.id}`); console.log(`For .env: MONITORING_TOPIC_ID=${msg.message_thread_id}\n`); } else { console.log(`\nFor .env: ADMIN_CHAT_IDS=${msg.chat.id}\n`); } } }); process.on('SIGINT', () => { console.log('\nšŸ‘‹ Done!'); process.exit(0); }); ``` ## šŸš€ Usage 1. **Set bot token** in `.env` file 2. **Add bot to supergroup** as admin 3. **Run script**: `node quick-chat-info.js` 4. **Send message** in supergroup (or topic) 5. **Copy IDs** to `.env` file 6. **Press Ctrl+C** to stop ## 🪟 Windows Batch File Create `get-chat-info.bat`: ```batch @echo off echo šŸ” Getting Supergroup Chat ID and Topic ID echo Add your bot to supergroup and send a message... echo. node quick-chat-info.js pause ``` ## šŸ“‹ Example Output ``` šŸ” Supergroup Chat ID & Topic ID Getter Add your bot to supergroup and send a message... šŸ“‹ Supergroup: Yaltipia Admin Chat Chat ID: -1001234567890 Topic ID: 5 For .env: ADMIN_CHAT_IDS=-1001234567890 For .env: MONITORING_TOPIC_ID=5 ``` --- **Simple and focused! šŸŽÆ**