├── .gitignore ├── .github └── FUNDING.yml ├── config.json ├── package.json ├── README.md └── index.js /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | custom: ['https://paypal.me/eternal404'] 2 | -------------------------------------------------------------------------------- /config.json: -------------------------------------------------------------------------------- 1 | { 2 | "token": "Your token", 3 | "userid": "Your user id", 4 | "agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.127 Safari/537.36" 5 | } -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "open-all-dms", 3 | "version": "1.0.0", 4 | "main": "index.js", 5 | "type": "module", 6 | "license": "MIT", 7 | "dependencies": { 8 | "node-fetch": "^2.6.0" 9 | } 10 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |
2 |

DM Opener

3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | --- 15 | 16 |
17 | Small script to extract private message channels from a discord data package & open them on a certain account. 18 |
19 | 20 | --- 21 | 22 | ### How do i use it? 23 | First, you'll need your data package. You can get this by going to Settings > Privacy & Safety and clicking the Request Data button at the bottom. 24 |

![image](https://user-images.githubusercontent.com/98427312/176322082-57a3d3c3-7034-483e-ac21-baee2b7f3777.png) 25 | 26 | ### I have my data package, now what? 27 | - Make sure you have [NodeJS](https://nodejs.org/en/) installed 28 | - Once you have your data package, extract it and make sure you have the messages folder inside. 29 | - Open a Command Prompt/Terminal in this projects directory. 30 | - Run `npm install` and wait for it to finish. 31 | - Edit the `config.json` file with your token and User ID. 32 | - Run `node . "C:\Users\USERNAME\Downloads\package\messages"`. (Replace the path with the path of your messages folder inside your package) 33 | - Wait for all your DMs to open. 34 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | import { readdirSync, readFileSync, existsSync } from 'fs'; 2 | import fetch from 'node-fetch'; 3 | import { join } from 'path'; 4 | 5 | const config = JSON.parse(readFileSync(new URL('./config.json', import.meta.url))); 6 | const sleep = (time) => new Promise(r => setTimeout(r, time)); 7 | 8 | if (!process.argv[2]) { 9 | console.error('Please provide a file path pointing to the "messages" folder in your data package.'); 10 | process.exit(-1); 11 | } 12 | 13 | if (!existsSync(process.argv[2])) { 14 | console.error('The path you provided is not valid or doesn\'t exist.'); 15 | process.exit(-1); 16 | } 17 | 18 | try { 19 | run(); 20 | } catch (e) { 21 | console.log('Failed to open all your DMs: ', e.message); 22 | } 23 | 24 | async function run() { 25 | const files = readdirSync(process.argv[2]); 26 | for (const file of files) { 27 | if (file === 'index.json') continue; 28 | 29 | try { 30 | const path = join(process.argv[2], file, 'channel.json'); 31 | const contents = readFileSync(path); 32 | const data = JSON.parse(contents); 33 | 34 | const recipients = (data.recipients ?? []).filter(r => r !== config.userid); 35 | if (recipients.length) { 36 | const res = await fetch('https://canary.discordapp.com/api/v6/users/@me/channels', { 37 | method: 'POST', 38 | body: JSON.stringify({ recipients }), 39 | headers: { 40 | 'authorization': config.token, 41 | 'User-Agent': config.agent, 42 | 'Content-Type': 'application/json' 43 | } 44 | }).then(r => r.json()); 45 | 46 | const { username, discriminator } = res.recipients[0]; 47 | console.log(`Opened DM with ${username}#${discriminator}`); 48 | await sleep(250); 49 | } 50 | } catch (e) { 51 | console.error('Failed to open DM', e.message); 52 | continue; 53 | } 54 | } 55 | } --------------------------------------------------------------------------------