const { Client, GatewayIntentBits } = require('discord.js'); const { Rcon } = require('rcon-client'); const client = new Client({ intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages, GatewayIntentBits.MessageContent] }); const TOKEN = 'YOUR_BOT_TOKEN'; // Discord bot token'ı const RCON_HOST = 'localhost'; // Minecraft sunucunun IP adresi const RCON_PORT = 25575; // Rcon port numarası const RCON_PASSWORD = 'YOUR_PASSWORD'; // Rcon şifren client.once('ready', () => { console.log(`Bot ${client.user.tag} olarak giriş yaptı.`); }); client.on('messageCreate', async message => { if (message.author.bot) return; if (message.content.startsWith('!minecraft ')) { const command = message.content.slice(11).trim(); try { console.log('Connecting to RCON...'); const rcon = await Rcon.connect({ host: RCON_HOST, port: RCON_PORT, password: RCON_PASSWORD }); console.log('Sending command...'); const response = await rcon.send(command); message.channel.send(`Komut çalıştırıldı: ${response}`); await rcon.end(); } catch (error) { console.error('RCON error:', error); message.channel.send(`RCON bağlantı hatası: ${error.message}`); } } }); client.login(TOKEN);