// Discord bot with buttons + multi-embeds + interactive mini-game // Required: Node.js 18+, discord.js v14 const { Client, GatewayIntentBits, EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle } = require('discord.js'); const client = new Client({ intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages, GatewayIntentBits.MessageContent] }); const TOKEN = "PUT_YOUR_TOKEN_HERE"; client.once('ready', () => { console.log(`Logged in as ${client.user.tag}`); }); // --- COMMAND: /panel → sends main panel with social links --- client.on('interactionCreate', async (interaction) => { if (!interaction.isChatInputCommand()) return; if (interaction.commandName === 'panel') { const embed = new EmbedBuilder() .setTitle("حساباتي") .setDescription("اختَر المنصة لفتح الرابط مباشرة.") .setColor('#00ADEF'); const row = new ActionRowBuilder().addComponents( new ButtonBuilder().setLabel('YouTube').setStyle(ButtonStyle.Link).setURL('PUT_YOUTUBE_LINK'), new ButtonBuilder().setLabel('TikTok').setStyle(ButtonStyle.Link).setURL('PUT_TIKTOK_LINK'), new ButtonBuilder().setLabel('Instagram').setStyle(ButtonStyle.Link).setURL('PUT_INSTAGRAM_LINK'), new ButtonBuilder().setLabel('Twitch').setStyle(ButtonStyle.Link).setURL('PUT_TWITCH_LINK'), new ButtonBuilder().setLabel('Discord').setStyle(ButtonStyle.Link).setURL('PUT_DISCORD_LINK') ); await interaction.reply({ embeds: [embed], components: [row] }); } }); // --- MINI GAME: Guess Number --- // /play → bot picks a number from 1-10 → user guesses عبر أزرار client.on('interactionCreate', async (interaction) => { if (!interaction.isChatInputCommand()) return; if (interaction.commandName === 'play') { const secret = Math.floor(Math.random() * 10) + 1; const embed = new EmbedBuilder() .setTitle("لعبة التخمين 🎮") .setDescription("اخمّن رقم من 1 إلى 10.") .setColor('#ffaa00'); const row = new ActionRowBuilder(); for (let i = 1; i <= 5; i++) { row.addComponents( new ButtonBuilder() .setLabel(`${i}`) .setCustomId(`g_${secret}_${i}`) .setStyle(ButtonStyle.Primary) ); } const row2 = new ActionRowBuilder(); for (let i = 6; i <= 10; i++) { row2.addComponents( new ButtonBuilder() .setLabel(`${i}`) .setCustomId(`g_${secret}_${i}`) .setStyle(ButtonStyle.Primary) ); } await interaction.reply({ embeds: [embed], components: [row, row2] }); } }); // Handle button guess client.on('interactionCreate', async (i) => { if (!i.isButton()) return; const [_, secret, guess] = i.customId.split('_'); const correct = Number(secret) === Number(guess); await i.reply({ content: correct ? `صحيح! الرقم هو **${secret}**.` : `خطأ! الرقم كان **${secret}**.`, ephemeral: true }); }); client.login(TOKEN); تم إنشاء الكود من الصفر وإضافة لعبتك التفاعلية (تخمين رقم) داخل ملف واحد جاهز للتعديل. إذا تحتاج إضافة لعبة أخرى، أو تغيير شكل اللوحة، أو إضافة أزرار أكثر — اخبرني وسأعدّل مباشرة على الملف.