# Locally backing up Private Discord DMs
## Prerequisites
* [Discord Chat Exporter](https://github.com/Tyrrrz/DiscordChatExporter) Download Link to the latest version of writing [here](https://github.com/Tyrrrz/DiscordChatExporter/releases/download/2.32/DiscordChatExporter.CLI.zip), otherwise check GH releases page.
* Powershell (Should be installed)
* .Net v6.0 Runtime for Windows (Should also be installed, but if it's not Download link [here](https://dotnet.microsoft.com/download/dotnet-core/thank-you/runtime-desktop-6.0.0-windows-x64-installer).)
* Your Discord User Token
* The DM Channel ID
## Downloading and installing Discord Chat Exporter
Unzip the Downloaded Package using 7z or an alternative unzipping tool

Once inside the unzipped Directory, you will want to "Open the PowerShell window here"

Once the PowerShell opens, you can execute the program using
```
dotnet .\DiscordChatExporter.Cli.dll
```
though, it won't return much, because we need to give it arguments so it knows what to do.
## Getting Discord Token & IDs
### Log into Discord on your Webbrowser
> Due to morons falling for Free Discord Nitro scams, Discord Devs have decided to block Devtools in the Default Discord client, hence you can use either Discord Canary, Discord PTB, or the Browser, if `Ctrl+Shift+I` doesn't work.
Once Logged into your Browser of choice, the `Console` Panel in the Devtools of your Browser of choice.
This can be done using
* `Ctrl+Shift+J` On Chromium & Firefox based Browsers
### Getting your User Token
**This token effectively acts as your password, do not share it with anyone, a Password reset changes your token**
After you open your Console window it should look something like this: 
It works effectively like a UNIX terminal does, you type in your command at the bottom, and get your output above.
In order to query our User Token, we have to paste in the following codeblock:
```javascript=
webpackChunkdiscord_app.push([[Math.random()],{},(r)=>{console.log(Object.values(r.c).find(m=>m.exports&&m.exports.default&&m.exports.default.getToken!==void 0).exports.default.getToken())}]);
```
Your output should look something like this:

(Don't mind that error message that's just my Discord plugin being dumb)
You copy that to a safe place we will need it later for the powershell command.
### Copying Channel ID
While still having your Console window open, Navigate to the DM conversation you'd like to back up, and enter the following line into your console window
```
window.location.href
```
For our conversation it'd be the following link:
You're interested in the ID number I have circled for you, copy just the number.
## Running the backup
You want to go back to your powershell window, and start executing your backup. For you it will look something like this:
```
dotnet .\DiscordChatExporter.Cli.dll export -t <your-token-here> -c <your-channel-id-here> --media
```
> the `--media` flag sets it to download all images, from the DM conversation and Profile Pictures. For More information on what additional flags you can use, check the [Wiki](https://github.com/Tyrrrz/DiscordChatExporter/wiki/GUI%2C-CLI-and-Formats-explained#using-the-cli) or ask me. Light mode is also possible if that's something you'd prefer.
In my example where I extract our DMs, it'd look like the following: 