/Discord-Channel-JSON-export-importer

Import Discord Channel JSON Exports created by `DiscordChatExporter` at: https://github.com/Tyrrrz/DiscordChatExporter

Primary LanguagePython

Discord Channel JSON export importer

Import Discord Channel JSON Exports created by DiscordChatExporter at: https://github.com/Tyrrrz/DiscordChatExporter

A Script/Bot to send messages (exported as json) to a Discord server channel.

See 'send_messages.py' for script.

Steps for DiscordChatExporter

  1. Download DiscordChatExporter
  2. You need an authorisation token to access what your Discord account can access.
  3. Head over to:
  https://discord.com/

on your browser and log in to your Discord account.

  1. Press Ctrl+Shift+I
  2. Navigate to the Network tab and then click on the XHR button.
  3. In the table look at the File column and look for and click on either the line named "library" OR the line named "country-code". Refresh if you don't see anything.
  4. In the right section, under headers, look for the authorisation line.
  5. Copy the text next to authorisation.
  6. If you struggle with step 2>8 try the following:

dc auth token

  1. Open DiscordChatExporter and paste your authorisation token at the top to access the servers and channels your account has access to.
  2. Choose a channel you want to export
  3. Click the download icon bottom right
  4. Choose an output path (ideally this should be in the same directory as the script 'send_messages.py' from this repo)
  5. Choose JSON as the export format
  6. Make sure the following settings are on:

2024-05-05 14 32 23 DiscordChatExporter v2 43 0

  1. Choose an Assets directory path (ideally this should be in a folder in the same directory as the script 'send_messages.py' from this repo)
  2. Click export and wait for the process to finish

DiscordChatExporter exported messsages (JSON) importer.

  1. Download the send_messages.py script in the repo above.
  2. Create a folder to put the send_messages.py script in.
  3. Open a terminal in that folder location.
  4. In that terminal run the following:
  pip install discord.py
  1. Now edit the send_messages.py script and add the needed values being YOUR_BOT_TOKEN, guild_id, channel_id, exported-channel.json and messages_sent_log.txt.

See the following:

OR:

dc bot token

  1. Navigate to https://discord.com/developers/applications and click on your application.
  2. Click on the Bot option in the left navbar and make sure to enable the following: Presence Intent, Server Members Intent and Message Content Intent.
  3. Now click on the OAuth2 option in the left navbar and copy the Client ID.
  4. Now open https://discordapi.com/permissions.html in a new browser tab.
  5. Tick the boxes next to: Administrator, Manage Messages, Manage Channels, Manage Events, Send Messages, Embed Links, Attach Files, Read Message History, Manage Server, View Channels and Manage Server.
  6. Now paste your Client ID that you copied in the Client ID: field at the bottom of the page.
  7. Now click on the link provided at the way bottom of the page.
  8. Add your bot/application to your chosen server.
  9. Click Continue
  10. Now in the terminal that's in the directory which has your send_messages.py script run the following to excecute the script/bot:
  python send_messages.py
  1. Wait a min for bot to start up and connect.
  2. Now your script/bot should run smoothly and send all the exported messages in the JSON export you provided.
  3. If the script encounters an error and doesn't move on to the next message to send, just stop the script and run it again and it will continue on the last message sent

PS:

YOUR_BOT_TOKEN, guild_id, exported-channel.json and messages_sent_log.txt should all be enclosed in single qoutations while:

channel_id should not be enclosed in qoutations at all.