You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
DiscordChatExporter/.docs/Token-and-IDs.md

15 KiB

Obtaining Token and Channel IDs

Warning: Do not share your token! A token gives full access to an account. To reset a user token, change your account password. To reset a bot token, click on Regenerate in the bot settings.

How to get a User Token

Caution: Automating user accounts violates Discord's terms of service and may result in account termination. Use at your own risk.

Through your web browser

Prerequisite step: Navigate to discord.com and login.

In Chrome

Using the console
  1. Press Ctrl+Shift+I (++I on macOS). Chrome's DevTools tools will display.


  1. Click the Console tab. The console will open.

  2. Type

    (webpackChunkdiscord_app.push([[''],{},e=>{m=[];for(let c in e.c)m.push(e.c[c])}]),m).find(m=>m?.exports?.default?.getToken!==void 0).exports.default.getToken()
    

    into the console and press Enter. The console will display your user token.

Using the network monitor
  1. Press Ctrl+Shift+I (++I on macOS). Chrome's DevTools tools will display.


  1. Click the Network tab. The network panel will open


  1. Press F5. The page will reload, and the network log (the lower half of the network panel) will display several entries.


  1. Click the text box labelled Filter and type library. The entries will filter down to a single entry named library.


  1. Click the entry named library. A panel will open to the right and display details about the entry. Click the Headers tab if it isn't already active.


  1. Scroll through the contents of the Headers tab until you find an entry beginning with authorization:.


  1. Right-click the entry and click copy value.


Using the storage inspector
  1. Press Ctrl+Shift+I (++I on macOS). Chrome's DevTools will display.


  1. Press Ctrl+Shift+M (+Shift+M). Chrome will enter Device Mode, and the webpage will display as if on a mobile device.


  1. If necessary, click the » at the right end of the tab bar, and click Application. The application panel will display.


  1. In the menu to the right, under Storage, expand Local Storage if necessary, then click https://discord.com. The pane to the right will display a list of key-value pairs.


  1. In the text box marked Filter, type token. The entries will filter down to those containing the string token.


  1. Click the token entry. (Note: if the token doesn't display, try refreshing by pressing F5 or +R on macOS)


  1. Click the text box at the bottom, press Ctrl+A (+A on macOS) then Ctrl+C (+C on macOS) to copy the value to your clipboard.


In Firefox

Using the console
  1. Press Ctrl+Shift+K (++K on macOS). Firefoxs web developer tools will display at the bottom of the window, and the web console will display.


  1. Click the Console tab. The console will open.

  2. Type

    (webpackChunkdiscord_app.push([[''],{},e=>{m=[];for(let c in e.c)m.push(e.c[c])}]),m).find(m=>m?.exports?.default?.getToken!==void 0).exports.default.getToken()
    

    into the console and press Enter. The console will display your user token.

Using the network monitor
  1. Press Ctrl+Shift+E (++E on macOS). Firefoxs web developer tools will display at the bottom of the window, and the network monitor will display.


  1. Press F5. The page will reload, and the network request list will populate with entries.


  1. Type library into the filter. The network request list will filter out any entries not containing the string library.


  1. Click library. The network request details pane will display. The headers tab should be active by default. If it isnt, click it.


  1. Type authorization into the text box labelled Filter Headers.


  1. Scroll down until you see an entry labeled authorization under Request Headers.


  1. Right-click the entry labeled authorization and select copy value.


Using the storage inspector
  1. Press Shift+F9. Firefoxs web developer tools will display at the bottom of the window, and the storage panel will be selected.


  1. Press Ctrl+Shift+M (++M on macOS). Firefox will toggle responsive design mode, and the web page will display as if on a mobile device. (Note: Discord may steal focus and respond to the command by toggling mute. If this happens, return focus to Firefoxs web developer tools by clicking somewhere in it, then try the command again.)


  1. In the storage tree (the list on the left side of the web developer tools panel), click Local Storage. The entry will expand, and the entry https://discord.com will display beneath it.


  1. In the storage tree, click https://discord.com. The table widget to the right of the storage tree will display several key-value pairs.


  1. In the text box labelled Filter items at the top of the table widget, enter token. The table will now only display entries containing the string token.


  1. Click the entry token. The sidebar will display. (Note: If the token doesnt display, try refreshing by pressing F5.)


  1. Right-click the single entry in the sidebar and select copy.


Through the desktop app / enabling web developer tools

By editing the settings file

  1. If Discord is running, exit the application by right-clicking the icon in your taskbar tray and clicking Quit Discord.

  2. Open Discord's settings file in your preferred text editor. See the following table for help finding it:

    OS Stable Canary Public Test Build (PTB)
    Windows %APPDATA%\discord\settings.json %APPDATA%\discordcanary\settings.json %APPDATA%\discordptb\settings.json
    macOS ~/Library/Application Support/discord/settings.json ~/Library/Application Support/discordcanary/settings.json ~/Library/Application Support/discordptb/settings.json
    Linux ~/.config/discord/settings.json ~/.config/discordcanary/settings.json ~/.config/discordptb/settings.json

    If you use BetterDiscord, use the following table instead:

    OS Stable Canary Public Test Build (PTB)
    Windows %APPDATA%\BetterDiscord\data\stable\settings.json %APPDATA%\BetterDiscord\data\canary\settings.json %APPDATA%\BetterDiscord\data\ptb\settings.json
    macOS ~/Library/Application Support/BetterDiscord/data/stable/settings.json ~/Library/Application Support/BetterDiscord/data/canary/settings.json ~/Library/Application Support/BetterDiscord/data/ptb/settings.json
    Linux ~/.config/BetterDiscord/data/stable/settings.json ~/.config/BetterDiscord/data/canary/settings.json ~/.config/BetterDiscord/data/ptb/settings.json
  3. Insert a blank line after the first curly bracket ({), add the text "DANGEROUS_ENABLE_DEVTOOLS_ONLY_ENABLE_IF_YOU_KNOW_WHAT_YOURE_DOING": true, to it, and save the file. Your file should resemble the following:

{
  "DANGEROUS_ENABLE_DEVTOOLS_ONLY_ENABLE_IF_YOU_KNOW_WHAT_YOURE_DOING": true,
  "BACKGROUND_COLOR": "#202225",
  "IS_MAXIMIZED": true
}
  1. Launch Discord.

  2. To find your user token, continue here.

Via settings menu (BetterDiscord only)

  1. Click the User Settings button (the gear icon to the right of your username). Discords settings page will open.


  1. In the sidebar to the left, click Settings under the BetterDiscord group. BetterDiscords settings page will display.


  1. In the main panel to the right, expand the Developer Settings group if necessary, and toggle DevTools to enabled.


  1. Press Esc. The settings page will close.
  2. To find your user token, continue here.

How to get a Bot Token

  1. Go to Discord developer portal
  2. Open your Application's settings
  3. Navigate to the Bot section on the left
  4. Under Token click Copy

Warning: Your bot needs to have Message Content Intent enabled for it to be able to read messages!

https://discord.com/developers/applications/


How to get a Server ID or a Channel ID

  1. Open Discord Settings
  2. Go to the Advanced section
  3. Enable Developer Mode
  4. Right-click on the desired server or channel and click Copy Server ID or Copy Channel ID