import { Client } from "discord.js-selfbot-v13"; // Test configuration const TEST_TOKEN = process.env.USER_TOKEN; const TEST_USER_ID = "339753362297847810"; // Replace with your Discord user ID for testing if (!TEST_TOKEN) { console.error("USER_TOKEN environment variable is required for testing"); process.exit(1); } const client = new Client({ checkUpdate: false }); client.on("ready", async () => { console.log(`āœ… Test bot ${client.user.username} is ready!`); console.log("šŸ“‹ Available test scenarios:"); console.log("1. Send a DM to yourself with 'teto' to test DM pickup"); console.log("2. In a server, type 'xbox record that' to test recording command"); console.log("3. Type 'hello teto' to test basic greeting"); console.log("4. Type 'stop recording' or 'xbox stop' to test stop command"); console.log("\nšŸ” Monitoring messages for test responses..."); }); client.on("messageCreate", async (message) => { // Skip bot's own messages if (message.author.id === client.user.id) return; console.log(`šŸ“Ø Message received: "${message.content}" from ${message.author.tag}`); // Test DM pickup if (message.channel.type === "DM" && message.content.toLowerCase().includes("teto")) { console.log("āœ… DM pickup test - Bot should respond"); } // Test recording command if (message.content.toLowerCase() === "xbox record that") { console.log("āœ… Recording command test - Bot should attempt to start recording"); // Check if user is in voice channel const member = message.guild?.members.cache.get(message.author.id); const voiceChannel = member?.voice?.channel; if (voiceChannel) { console.log(`šŸ”Š User is in voice channel: ${voiceChannel.name}`); } else { console.log("āŒ User is not in a voice channel"); } } // Test hello command if (message.content.toLowerCase().includes("hello teto")) { console.log("āœ… Hello command test - Bot should respond with greeting"); } // Test stop command if (message.content.toLowerCase() === "stop recording" || message.content.toLowerCase() === "xbox stop") { console.log("āœ… Stop recording command test - Bot should attempt to stop recording"); } }); client.on("error", (error) => { console.error("āŒ Client error:", error); }); client.on("disconnect", () => { console.log("šŸ”Œ Client disconnected"); }); // Test voice channel capabilities client.on("voiceStateUpdate", (oldState, newState) => { if (newState.member.id === client.user.id) { if (newState.channel) { console.log(`šŸ”Š Bot joined voice channel: ${newState.channel.name}`); } else if (oldState.channel) { console.log(`šŸ”‡ Bot left voice channel: ${oldState.channel.name}`); } } }); // Graceful shutdown process.on("SIGINT", () => { console.log("\nšŸ›‘ Shutting down test bot..."); client.destroy(); process.exit(0); }); // Login and start test console.log("šŸš€ Starting test bot..."); client.login(TEST_TOKEN).catch((error) => { console.error("āŒ Failed to login:", error); process.exit(1); }); // Auto-shutdown after 5 minutes setTimeout(() => { console.log("\nā° Test session timeout - shutting down"); client.destroy(); process.exit(0); }, 300_000);