Download attachments from a specified Discord chat or channel. Files will be saved in the format (yyyyMMdd_HHmmss_originalFileName). Additionally, pertinent information such as the message text and sender will be stored in a corresponding txt file.
(1. Install Visual Studio Community 2022 or a later version. 2. Install the Python development workload, including the optional Python native development tools, in Visual Studio Community.) not necessary? To be tested.
- Install Python 3.12 or a later version.
No longer needed, as dependencies will be automatically installed.
- Install the 'discord.py' library using:
pip install discord.py
- Open https://discord.com/developers/.
- Navigate to 'Applications' on the left-hand menu and click 'New Application' to add a new application.
- Name your application (e.g., 'attachment_downloader') and click 'Create.'
- Choose 'Bot' from the left-hand menu.
- Click 'Add Bot' and confirm adding a bot to your application by clicking 'Yes, do it!'. Your bot is created now.
- Click 'Copy' next to the bot icon to copy/note down the bot token. If the 'Copy' button is not visible, click 'Regenerate' first to generate a new bot token. Do not share the Token!
To use the bot for channels within your server:
- Navigate to 'OAuth2' and 'URL Generator' via the left-hand menu to generate a permission link.
- On the following screen, select 'bot' under 'SCOPES' and choose 'Administrator' under 'BOT PERMISSIONS.'
- Copy and open the 'GENERATED URL' in a new browser window.
- Choose the server to which the bot should be linked from the drop-down list 'ADD TO SERVER' and click 'Continue.'
- Click 'Authorize' to confirm the bot's permissions.
- Clone or download this repository and place it in any folder of your choice on your computer.
- Run the script by opening either the 'start.py' or 'start.bat' file.
- During the first run, input your Bot Token; it will be permanently stored in the configuration file.
- Enter the Discord Server Channel ID from which you want to download attachments. You can confirm or change the Channel ID in each script run.
- Specify the start and end dates for the attachments. Press 'Enter' to receive all files without date filtering.
- The script will proceed to download all attachments. If an attachment already exists in the output folder, it will be automatically overwritten.
- In the output folder, you will find the attachments and corresponding txt-files with the creator's name and message text.
This project is licensed under the [MIT License] - see the LICENSE file for details.