A script to delete your own messages from a Discord DM channel.
- Open Discord in your browser
- Open the browser's Developer Console (
F12→ Console tab) - Fill in your Token, DM Channel ID, and User ID
- Paste and run the script
⚠️ Warning: Using self-bot tokens violates Discord's Terms of Service. Use at your own risk.
(async () => {
// PASTE YOUR TOKEN BETWEEN THE QUOTES
const token = "PASTE_TOKEN_HERE";
// DM CHANNEL ID (from the URL)
const dmChannelId = "1476759430493376676";
// YOUR USER ID (Right-click your profile and copy the ID)
const myUserId = "YOUR_USER_ID_HERE";
const delay = 1200;
async function clearDM() {
const response = await fetch(`https://discord.com/api/v9/channels/${dmChannelId}/messages?limit=100`, {
headers: { "Authorization": token }
});
const messages = await response.json();
if (!Array.isArray(messages)) {
console.error("Error fetching messages. Check your Token!");
return;
}
const myMessages = messages.filter(m => m.author.id === myUserId);
if (myMessages.length === 0) return console.log("No messages from you found in this batch.");
for (const msg of myMessages) {
await fetch(`https://discord.com/api/v9/channels/${dmChannelId}/messages/${msg.id}`, {
method: "DELETE",
headers: { "Authorization": token }
});
console.log(`Message deleted.`);
await new Promise(res => setTimeout(res, delay));
}
console.log("Batch complete! If there are still messages, run the script again.");
}
clearDM();
})();- The script deletes up to 100 messages per run. If you have more, run it again.
- The
delay(1200ms) helps avoid Discord rate limits. Don't lower it too much. - Never share your token with anyone.