const Discord = require('discord.
js-selfbot-v13');
const fs = require('fs');
const readline = require('readline');
// ⚠️ WARNING: Self-bots violate Discord's Terms of Service
// This is for educational purposes only - use at your own risk
const config = {
token: 'token', // Your Discord user token
newUsername: 'ayushzxcvv',//replce it
newId: '@ayushzxcvv',//replce it
message: `Hey! i am ayush and i changed my id becuse i got spammer flaged so my
new id is user is ayushzxcvv so please dm me fast i am waitting for you dm me and
get rewads`,
// Safety settings
delayBetweenMessages: 0, // 8 seconds between messages
maxMessagesPerSession: 999999, // Unlimited messages per session for DMs
skipOnlineUsers: false, // Skip users who are currently online
confirmBeforeSending: true, // Ask for confirmation before sending
// Chat history settings - DM ONLY
onlyDMs: true, // Only process DM users, skip server interactions
saveChatHistory: true, // Save found users to a file
};
// Initialize Discord client
const client = new Discord.Client({
checkUpdate: false,
readyStatus: false
});
// Delay function
const delay = (ms) => new Promise(resolve => setTimeout(resolve, ms));
// Create readline interface for user input
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
// Utility function to ask user questions
function askQuestion(question) {
return new Promise((resolve) => {
rl.question(question, (answer) => {
resolve(answer.toLowerCase().trim());
});
});
}
// Save users to file
function saveUsersToFile(users, filename = 'chat_history_users.txt') {
try {
const content = [
'// Users found from your chat history',
'// Generated on: ' + new Date().toLocaleString(),
'// Format: UserID - Username#Tag',
''
];
users.forEach(user => {
content.push(`${user.id} // ${user.tag}`);
});
fs.writeFileSync(filename, content.join('\n'));
console.log(`💾 Saved ${users.length} users to ${filename}`);
} catch (error) {
console.error('❌ Error saving to file:', error.message);
}
}
// Get all users from DM channels
async function getUsersFromDMs() {
console.log('🔍 Scanning DM channels...');
const dmUsers = new Map();
try {
const dmChannels = client.channels.cache.filter(channel =>
channel.type === 'DM' || channel.type === 'GROUP_DM'
);
console.log(`📨 Found ${dmChannels.size} DM channels`);
for (const [channelId, channel] of dmChannels) {
try {
if (channel.type === 'DM' && channel.recipient) {
// Regular DM
const user = channel.recipient;
if (user.id !== client.user.id) {
dmUsers.set(user.id, {
id: user.id,
tag: user.tag,
username: user.username,
source: 'DM'
});
}
} else if (channel.type === 'GROUP_DM' && channel.recipients) {
// Group DM
channel.recipients.forEach(user => {
if (user.id !== client.user.id) {
dmUsers.set(user.id, {
id: user.id,
tag: user.tag,
username: user.username,
source: 'Group DM'
});
}
});
}
} catch (error) {
console.log(`⚠️ Couldn't access channel ${channelId}`);
}
}
console.log(`👥 Found ${dmUsers.size} users from DM channels`);
return Array.from(dmUsers.values());
} catch (error) {
console.error('❌ Error scanning DMs:', error.message);
return [];
}
}
// Get users from server message history - DISABLED
async function getUsersFromServerHistory() {
// Server interactions disabled - only DMs allowed
console.log('🚫 Server interactions disabled (DM only mode)');
return [];
}
// Get all friends
async function getAllFriends() {
console.log('🔍 Getting friends list...');
const friends = [];
try {
const relationships = client.relationships.cache;
const friendRelationships = relationships.filter(r => r.type === 'FRIEND');
friendRelationships.forEach((relationship, userId) => {
const user = client.users.cache.get(userId);
if (user) {
friends.push({
id: user.id,
tag: user.tag,
username: user.username,
source: 'Friend'
});
}
});
console.log(`👥 Found ${friends.length} friends`);
return friends;
} catch (error) {
console.error('❌ Error getting friends:', error.message);
return [];
}
}
// Combine all DM users and friends only (no server users)
async function getAllChatHistoryUsers() {
console.log('🔍 Collecting users from DMs and Friends only...\n');
const allUsers = new Map();
// Get friends
const friends = await getAllFriends();
friends.forEach(user => allUsers.set(user.id, user));
// Get DM users only
const dmUsers = await getUsersFromDMs();
dmUsers.forEach(user => allUsers.set(user.id, user));
// Skip server users (DM only mode)
console.log('🚫 Skipping server interactions (DM only mode enabled)');
const uniqueUsers = Array.from(allUsers.values());
console.log(`\n📊 Summary (DM Only Mode):`);
console.log(`👥 Friends: ${friends.length}`);
console.log(`📨 DM Users: ${dmUsers.length}`);
console.log(`🎯 Total Unique Users: ${uniqueUsers.length}`);
console.log(`🚫 Server users: Skipped (DM only mode)`);
if (config.saveChatHistory) {
saveUsersToFile(uniqueUsers, 'dm_users_only.txt');
}
return uniqueUsers;
}
// Send DM to a specific user
async function sendDMToUser(userInfo, message) {
try {
console.log(`\n📤 Sending to: ${userInfo.tag} (from: ${userInfo.source})`);
// Fetch user to make sure they still exist
const user = await client.users.fetch(userInfo.id).catch(() => null);
if (!user) {
console.log(`❌ User not found: ${userInfo.tag}`);
return { success: false, reason: 'User not found' };
}
// Check if user is online (optional safety feature)
if (config.skipOnlineUsers) {
const isOnline = client.guilds.cache.some(guild => {
const member = guild.members.cache.get(userInfo.id);
return member && member.presence?.status === 'online';
});
if (isOnline) {
console.log(` Skipping ${user.tag} (currently online)`);
return { success: false, reason: 'User is online' };
}
}
// Create DM channel and send message
const dmChannel = await user.createDM();
await dmChannel.send(message);
console.log(`✅ Message sent successfully to: ${user.tag}`);
return { success: true, user: user.tag };
} catch (error) {
let reason = 'Unknown error';
if (error.code === 50007) {
reason = 'Cannot send DMs (blocked or privacy settings)';
} else if (error.code === 10013) {
reason = 'Unknown user';
} else if (error.code === 40003) {
reason = 'Rate limited';
} else if (error.message.includes('Missing Access')) {
reason = 'No permission to DM this user';
} else {
reason = error.message;
}
console.log(`❌ Failed to send to ${userInfo.tag}: ${reason}`);
return { success: false, reason };
}
}
// Message all DM users (unlimited session)
async function messageAllChatHistoryUsers() {
const allUsers = await getAllChatHistoryUsers();
if (allUsers.length === 0) {
console.log('❌ No DM users found.');
return;
}
// Show preview of users
console.log('\n📋 Preview of DM users to message:');
allUsers.slice(0, 10).forEach((user, index) => {
console.log(` ${index + 1}. ${user.tag} (${user.source})`);
});
if (allUsers.length > 10) {
console.log(` ... and ${allUsers.length - 10} more users`);
}
console.log(`\n💥 UNLIMITED SESSION MODE - Will message ALL ${allUsers.length}
users!`);
console.log(` Estimated time: ${Math.round((allUsers.length *
config.delayBetweenMessages) / 1000 / 60)} minutes`);
if (config.confirmBeforeSending) {
const confirm = await askQuestion(`\n❓ Send message to ALL $
{allUsers.length} DM users? This will take a while! (y/n): `);
if (confirm !== 'y' && confirm !== 'yes') {
console.log('❌ Cancelled by user.');
return;
}
}
let successCount = 0;
let failCount = 0;
let processedCount = 0;
console.log(`\n🚀 Starting unlimited DM session...`);
console.log(`⚡ No session limits - will process all ${allUsers.length} users!
`);
const startTime = Date.now();
for (const userInfo of allUsers) {
processedCount++;
console.log(`\n📨 Progress: ${processedCount}/${allUsers.length} ($
{Math.round((processedCount/allUsers.length)*100)}%)`);
const result = await sendDMToUser(userInfo, config.message);
if (result.success) {
successCount++;
} else {
failCount++;
}
// Show progress every 10 messages
if (processedCount % 10 === 0) {
const elapsed = (Date.now() - startTime) / 1000 / 60;
const remaining = allUsers.length - processedCount;
const estimatedRemaining = (remaining * config.delayBetweenMessages) /
1000 / 60;
console.log(`\n📊 Progress Update:`);
console.log(` Sent: ${successCount} | ❌ Failed: ${failCount} | ⏱️
Elapsed: ${elapsed.toFixed(1)}min`);
console.log(`📝 Remaining: ${remaining} users | 🕐 Est. time left: $
{estimatedRemaining.toFixed(1)}min`);
}
// Delay between messages for safety
if (processedCount < allUsers.length) {
console.log(`⏳ Waiting ${config.delayBetweenMessages / 1000}
seconds...`);
await delay(config.delayBetweenMessages);
}
}
const totalTime = (Date.now() - startTime) / 1000 / 60;
console.log(`\n🎉 UNLIMITED SESSION COMPLETED!`);
console.log(`📊 Final Summary:`);
console.log(`✅ Successfully sent: ${successCount}`);
console.log(`❌ Failed to send: ${failCount}`);
console.log(`📝 Total processed: ${processedCount}`);
console.log(` Total time: ${totalTime.toFixed(1)} minutes`);
console.log(`📊 Success rate: ${Math.round((successCount/processedCount)*100)}
%`);
if (config.saveChatHistory) {
console.log(`💾 All DM users saved to: dm_users_only.txt`);
}
}
// Show main menu
async function showMenu() {
console.log('\n🎯 Discord DM-Only ID Change Notifier - What would you like to
do?');
console.log('1. Auto-message ALL DM users (UNLIMITED session)');
console.log('2. Just scan and save DM users (no messages)');
console.log('3. Show my Discord info');
console.log('4. Exit');
const choice = await askQuestion('Choose an option (1-4): ');
switch (choice) {
case '1':
await messageAllChatHistoryUsers();
break;
case '2':
await getAllChatHistoryUsers();
console.log('✅ DM users scanned and saved to dm_users_only.txt');
break;
case '3':
console.log(`\n👤 Logged in as: ${client.user.tag}`);
console.log(`👥 Friends: ${client.relationships.cache.filter(r => r.type
=== 'FRIEND').size}`);
console.log(`🏠 Servers: ${client.guilds.cache.size}`);
console.log(`📨 DM Channels: ${client.channels.cache.filter(c => c.type
=== 'DM').size}`);
console.log(`👥 Group DMs: ${client.channels.cache.filter(c => c.type
=== 'GROUP_DM').size}`);
break;
case '4':
console.log('👋 Goodbye!');
process.exit(0);
break;
default:
console.log('❌ Invalid choice. Please try again.');
}
// Show menu again
await showMenu();
}
// Main function
async function main() {
console.log('🚀 Discord DM-Only Auto Messenger');
console.log('⚠️ WARNING: Self-bots violate Discord ToS - use at your own
risk!');
console.log('📨 DM ONLY MODE - No server interactions');
console.log('♾️ UNLIMITED SESSION - Will message ALL DM users');
console.log(`📝 New ID: ${config.newId}`);
console.log(`📨 Message: "${config.message}"`);
console.log(`⚙️ Settings: ${config.delayBetweenMessages/1000}s delay, UNLIMITED
messages\n`);
if (config.token === 'YOUR_USER_TOKEN_HERE') {
console.log('❌ Please set your Discord user token in the config section!');
console.log('💡 To get your token:');
console.log(' 1. Open Discord in browser');
console.log(' 2. Press F12 → Network tab');
console.log(' 3. Send any message');
console.log(' 4. Look for /messages request');
console.log(' 5. Find "authorization" header');
process.exit(1);
}
try {
console.log('🔐 Logging in to Discord...');
await client.login(config.token);
console.log(`✅ Successfully logged in as: ${client.user.tag}`);
console.log(`📊 Connected to ${client.guilds.cache.size} servers (DM only
mode)`);
// Wait for everything to load
console.log('⏳ Loading Discord data...');
await delay(5000);
// Show interactive menu
await showMenu();
} catch (error) {
console.error('❌ Login failed:', error.message);
if (error.message.includes('TOKEN_INVALID') ||
error.message.includes('Unauthorized')) {
console.log('🔑 Your token is invalid or expired. Please get a new
one.');
} else if (error.message.includes('RATE_LIMITED')) {
console.log('🚫 You are being rate limited. Please wait and try again
later.');
}
process.exit(1);
}
}
// Handle errors and cleanup
process.on('unhandledRejection', (error) => {
console.error('❌ Unhandled error:', error.message);
});
process.on('SIGINT', () => {
console.log('\n👋 Shutting down...');
rl.close();
client.destroy();
process.exit(0);
});
// Start the application
main().catch(console.error);