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.
- Download DiscordChatExporter
- You need an authorisation token to access what your Discord account can access.
- Head over to:
https://discord.com/
on your browser and log in to your Discord account.
- Press
Ctrl+Shift+I
- Navigate to the Network tab and then click on the XHR button.
- 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.
- In the right section, under headers, look for the authorisation line.
- Copy the text next to authorisation.
- If you struggle with step 2>8 try the following:
- Open
DiscordChatExporter
and paste your authorisation token at the top to access the servers and channels your account has access to. - Choose a channel you want to export
- Click the download icon bottom right
- Choose an output path (ideally this should be in the same directory as the script 'send_messages.py' from this repo)
- Choose
JSON
as the export format - Make sure the following settings are on:
- 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) - Click
export
and wait for the process to finish
- Download the send_messages.py script in the repo above.
- Create a folder to put the
send_messages.py
script in. - Open a terminal in that folder location.
- In that terminal run the following:
pip install discord.py
- Now edit the
send_messages.py
script and add the needed values beingYOUR_BOT_TOKEN
,guild_id
,channel_id
,exported-channel.json
andmessages_sent_log.txt
.
See the following:
OR:
- Navigate to https://discord.com/developers/applications and click on your application.
- Click on the
Bot
option in the left navbar and make sure to enable the following:Presence Intent
,Server Members Intent
andMessage Content Intent
. - Now click on the
OAuth2
option in the left navbar and copy theClient ID
. - Now open https://discordapi.com/permissions.html in a new browser tab.
- 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
andManage Server
. - Now paste your
Client ID
that you copied in theClient ID:
field at the bottom of the page. - Now click on the link provided at the way bottom of the page.
- Add your bot/application to your chosen server.
- Click Continue
- 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
- Wait a min for bot to start up and connect.
- Now your script/bot should run smoothly and send all the exported messages in the JSON export you provided.
- 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.