From upstream https://github.com/get-got/discord-downloader-go.git
Modified for arm64
https://github.com/get-got/discord-downloader-go.git

Drn 8dd82b0815 filename & behavior default change 2 tahun lalu
.gitattributes f36da52ba8 Initial commit. 4 tahun lalu
.gitignore 3cd8f283a5 history range check fix 2 tahun lalu
.travis.yml 845409f864 reddit fix for travis 2 tahun lalu
Dockerfile 0327fb676a reddit fix for docker 2 tahun lalu
LICENSE f36da52ba8 Initial commit. 4 tahun lalu
README.md 8dd82b0815 filename & behavior default change 2 tahun lalu
commands.go 4f574100ce Update commands.go 2 tahun lalu
common.go 7058c2d58c shorten time durations 2 tahun lalu
config.go 8dd82b0815 filename & behavior default change 2 tahun lalu
database.go b93abc65b9 goification3 2 tahun lalu
discord.go 0b7c73fbaf status colors, status log settings modifications 2 tahun lalu
downloads.go bd97479f7f Update downloads.go 2 tahun lalu
go.mod 57e8697d65 Update go.mod 2 tahun lalu
go.sum 6125fa0d84 go.mod 2 tahun lalu
handlers.go 2a47761067 fix duplicate handlers 2 tahun lalu
history.go a3df40f70d historyMaxJobs, RUNS IN ORDER!!, list works way better 2 tahun lalu
main.go 2a47761067 fix duplicate handlers 2 tahun lalu
parse.go ae2bc9d249 instagram api support 2 tahun lalu
regex.go ae2bc9d249 instagram api support 2 tahun lalu
vars.go 407805f809 vb 2 tahun lalu

README.md

Discord Downloader <i>Go</i>

<a href="https://travis-ci.com/get-got/discord-downloader-go" alt="Travis Build">
    <img src="https://travis-ci.com/get-got/discord-downloader-go.svg?branch=master" />
</a>
<a href="https://hub.docker.com/r/getgot/discord-downloader-go" alt="Docker Build">
    <img src="https://img.shields.io/docker/cloud/build/getgot/discord-downloader-go" />
</a>
<a href="https://goreportcard.com/report/github.com/get-got/discord-downloader-go" alt="Go Report Card">
    <img src="https://goreportcard.com/badge/github.com/get-got/discord-downloader-go" />
</a>
<br>
<a href="https://github.com/get-got/discord-downloader-go/releases" alt="All Releases">
    <img src="https://img.shields.io/github/downloads/get-got/discord-downloader-go/total?label=all-releases&logo=GitHub" />
</a>
<a href="https://hub.docker.com/r/getgot/discord-downloader-go" alt="Docker Pulls">
    <img src="https://img.shields.io/docker/pulls/getgot/discord-downloader-go?label=docker-pulls&logo=Docker" />
</a>
<a href="https://github.com/get-got/discord-downloader-go/releases/latest" alt="Latest Release">
    <img src="https://img.shields.io/github/downloads/get-got/discord-downloader-go/latest/total?label=latest-release&logo=GitHub" />
</a>
<br>
<a href="https://discord.gg/6Z6FJZVaDV">
    <img src="https://img.shields.io/discord/780985109608005703?logo=discord"alt="Join the Discord">
</a>

<a href="https://discord.com/invite/6Z6FJZVaDV">
    <b>Need help? Have suggestions? Join the Discord server!</b>
</a>
<br/><br/>
<a href="https://github.com/get-got/discord-downloader-go/releases/latest">
    <b>DOWNLOAD LATEST RELEASE</b>
</a>

Operating System Architectures ( ? = available but untested )
Windows amd64, arm64 (?), armv7/6/5 (?), 386 (?)
Linux amd64, arm64, armv7/6/5,
risc-v64 (?), mips64/64le (?), s390x (?), 386 (?)
Darwin (Mac) amd64 (?), arm64 (?)
FreeBSD amd64 (?), arm64 (?), armv7/6/5 (?), 386 (?)
OpenBSD amd64 (?), arm64 (?), armv7/6/5 (?), 386 (?)
NetBSD amd64 (?), arm64 (?), armv7/6/5 (?), 386 (?)


This project is a cross-platform cli single-file program to interact with a Discord Bot (genuine bot application or user account, limitations apply to both respectively) to locally download files posted from Discord in real-time as well as a full archive of old messages. It can download any directly sent Discord attachments or linked files and supports fetching highest possible quality files from specific sources (see list below). It also supports very extensive settings configurations and customization, applicable globally or per-server/category/channel/user. Tailor the bot to your exact needs and runtime environment. See the Features list below for the full list. See the List of Settings below for a settings breakdown. See Getting Started or anything else in the table of contents right under this to learn more!

<b>Originally a fork of <a href="https://github.com/Seklfreak/discord-image-downloader-go">Seklfreak's <i>discord-image-downloader-go</i></a></b>

The original project was abandoned, for a list of differences and why I made an independent project, <a href="#differences-from-seklfreaks-discord-image-downloader-go--why-i-made-this"><b>see below</b></a>



⚠️ WARNING! Discord does not allow Automated User Accounts (Self-Bots/User-Bots)

Read more in Discord Trust & Safety Team's Official Statement...

While this project works for user logins, I do not reccomend it as you risk account termination. If you can, use a proper Discord Bot user for this program.

NOTE: This only applies to real User Accounts, not Bot users. This program currently works for either.

Now that that's out of the way...


🤖 Features

Supported Download Sources

  • Direct Links to Files
  • Discord File Attachments
  • Twitter (requires API key, see config section)
  • Instagram (requires account login, see config section)
  • Reddit
  • Imgur
  • Streamable
  • Gfycat
  • Tistory
  • Flickr (requires API key, see config section)
  • I'll always welcome requests but some sources can be tricky to parse...

Commands

Commands are used as ddg <command> <?arguments?> (unless you've changed the prefix) Command | Arguments? | Description --- | --- | --- help, commands | No | Lists all commands. ping, test | No | Pings the bot. info | No | Displays relevant Discord info. status | No | Shows the status of the bot. stats | No | Shows channel stats. history | SEE HISTORY SECTION | (BOT AND SERVER ADMINS ONLY) Processes history for old messages in channel. exit, kill, reload | No | (BOT ADMINS ONLY) Exits the bot (or restarts if using a keep-alive process manager). emojis | Optionally specify server IDs to download emojis from; separate by commas | (BOT ADMINS ONLY) Saves all emojis for channel.


✔️ Getting Started

Confused? Try looking at the step-by-step list.

Depending on your purpose for this program, there are various ways you can run it.

You can either create a settings.json following the examples & variables listed below, or have the program create a default file (if it is missing when you run the program, it will make one, and ask you if you want to enter in basic info for the new file).

Tutorial Video

Getting Started Step-by-Step

  1. Download & put executable within it's own folder.
  2. Configure Main Settings (or run once to have settings generated). (SEE BELOW)
  3. Enter your login credentials in the "credentials" section. (SEE BELOW)
  4. Put your Discord User ID as in the "admins" list of the settings. (SEE BELOW)
  5. Put a Discord Channel ID for a private channel you have access to into the "adminChannels". (SEE BELOW)
  6. Put your desired Discord Channel IDs into th6e "channels" section. (SEE BELOW)
    • I know it can be confusing if you don't have experience with programming or JSON in general, but this was the ideal setup for extensive configuration like this. Just be careful with comma & quote placement and you should be fine. See examples below for help.

Bot Login Credentials

  • If using a Bot Application, enter the token into the "token" setting. Remove the lines for "username" and "password" or leave blank (""). To create a Bot User, go to discord.com/developers/applications and create a New Application. Once created, go to Bot and create. The token can be found on the Bot page. To invite to your server(s), go to OAuth2 and check "bot", copy the url, paste into browser and follow prompts for adding to server(s).
  • If using a User Account (Self-Bot) WITHOUT 2FA (2-Factor Authentication), fill out the "username" and "password" settings. Remove the line for "token" or leave blank ("").
  • If using a User Account (Self-Bot) WITH 2FA (2-Factor Authentication), enter the token into the "token" setting. Remove the lines for "username" and "password" or leave blank (""). Your account token can be found by opening the browser console / dev tools / inspect element > Network tab > filter for "library" and reload the page if nothing appears. Assuming there is an item that looks like the below screenshot, click it and find "Authorization" within the "Request Headers" section of the Headers tab. The random text is your token.

Bot Permissions in Discord

  • In order to perform basic downloading functions, the bot will need Read Message permissions in the server(s) of your designated channel(s).
  • In order to respond to commands, the bot will need Send Message permissions in the server(s) of your designated channel(s). If executing commands via an Admin Channel, the bot will only need Send Message permissions for that channel, and that permission will not be required for the source channel.
  • In order to process history commands, the bot will need Read Message History permissions in the server(s) of your designated channel(s).

NOTE: GENUINE DISCORD BOTS REQUIRE PERMISSIONS ENABLED

  • Go to the Discord Application management page, choose your application, go to the Bot category, and ensure Message Content Intent is enabled.

How to Find Discord IDs

  • Use the info command!
  • Discord Developer Mode: Enable Developer Mode in Discord settings under Appearance.
  • Finding Channel ID: Enable Discord Developer Mode (see above), right click on the channel and Copy ID.
  • Finding User ID: Enable Discord Developer Mode (see above), right click on the user and Copy ID.
  • Finding Emoji ID: Enable Discord Developer Mode (see above), right click on the emoji and Copy ID.
  • Finding DM/PM ID: Inspect Element on the DM icon for the desired user. Look for href="/channels/@me/CHANNEL_ID_HERE". Using this ID in place of a normal channel ID should work perfectly fine.

Differences from Seklfreak's discord-image-downloader-go & Why I made this

  • Better command formatting & support
  • Configuration is JSON-based rather than ini to allow more elaborate settings and better organization. With this came many features such as channel-specific settings.
  • Channel-specific control of downloaded filetypes / content types (considers things like .mov as videos as well, rather than ignore them), Optional dividing of content types into separate folders.
  • (Optional) Reactions upon download success.
  • (Optional) Discord messages upon encountered errors.
  • Extensive bot status/presence customization.
  • Consistent Log Formatting, Color-Coded Logging
  • Somewhat different organization than original project; initially created from scratch then components ported over.
  • Various fixes, improvements, and dependency updates that I also contributed to Seklfreak's original project.

I've been a user of Seklfreak's project since ~2018 and it's been great for my uses, but there were certain aspects I wanted to expand upon, one of those being customization of channel configuration, and other features like message reactions upon success, differently formatted statuses, etc. If some aspects are rudimentary or messy, please make a pull request, as this is my first project using Go and I've learned everything from observation & Stack Overflow.


📚 Guide: Downloading History (Old Messages)

This guide is to show you how to make the bot go through all old messages in a channel and catalog them as though they were being sent right now, in order to download them all.

Command Arguments

If no channel IDs are specified, it will try and use the channel ID for the channel you're using the command in.

Argument / Flag Details
channel ID(s) One or more channel IDs, separated by commas if multiple.
all Use all available registered channels.
cancel or stop Stop downloading history for specified channel(s).
list or status Output running history jobs in Discord & program.
--since=YYYY-MM-DD Will process messages sent after this date.
--since=message_id Will process messages sent after this message.
--before=YYYY-MM-DD Will process messages sent before this date.
--before=message_id Will process messages sent before this message.

Order of arguments does not matter

Examples

  • ddg history
  • ddg history cancel
  • ddg history all
  • ddg history stop all
  • ddg history 000111000111000
  • ddg history 000111000111000, 000222000222000
  • ddg history 000111000111000,000222000222000,000333000333000
  • ddg history 000111000111000, 000333000333000 cancel
  • ddg history 000111000111000 --before=000555000555000
  • ddg history 000111000111000 --since=2020-01-02
  • ddg history 000111000111000 --since=2020-10-12 --before=2021-05-06
  • ddg history 000111000111000 --since=000555000555000 --before=2021-05-06
  • ddg history status
  • ddg history list

🔨 Guide: Settings / Configuration

I tried to make the configuration as user friendly as possible, though you still need to follow proper JSON syntax (watch those commas). Most settings are optional and will use default values or be unused if missing from your settings file.

When initially launching the bot it will create a default settings file if you do not create your own settings.json manually. All JSON settings follow camelCase format.

If you have a config.ini from Seklfreak's discord-image-downloader-go, it will import settings if it's in the same folder as the program.

The bot accepts .json or .jsonc for comment-friendly json.


🛠 List of Settings

TODO: UNDER CONSTRUCTION

THIS IS THE MAIN SETTINGS GROUP, ALL OF THIS WOULD GO INSIDE THE MAIN { } FILE BRACKETS.

  • _constants { "key": "value", "key2": "value2" }
  • credentials
  • admins [ ] of strings
  • adminChannels [ ] of adminChannels
  • processLimit int ; 3
  • debug bool ; false
  • settingsOutput bool ; true
  • messageOutput bool ; true
  • messageOutputHistory bool ; false
  • discordLogLevel int ; 0
  • discordTimeout int ; 180
  • downloadTimeout int ; 60
  • downloadRetryMax int ; 3
  • exitOnBadConnection bool ; false
  • githubUpdateChecking bool ; true
  • commandPrefix string ; "ddg "
  • scanOwnMessages bool ; false
  • allowGeneralCommands bool ; true
  • inflateDownloadCount int
  • europeanNumbers bool ; false
  • checkupRate int ; 30
  • connectionCheckRate int ; 5
  • presenceRefreshRate int ; 3
  • save bool ; true
  • allowCommands bool ; true
  • scanEdits bool ; true
  • ignoreBots bool ; true
  • sendErrorMessages bool ; true
  • sendFileToChannel string
  • sendFileToChannels [ ] of strings
  • sendFileDirectly bool
  • sendFileCaption string
  • filenameDateFormat string ; "2006-01-02_15-04-05"
  • filenameFormat string ; "{{date}} {{file}}"
  • presenceEnabled bool ; true
  • presenceStatus string ; "idle"
  • presenceType int ; 0
  • presenceLabel string
  • presenceDetails string
  • presenceState string
  • reactWhenDownloaded bool ; true
  • reactWhenDownloadedEmoji string
  • reactWhenDownloadedHistory bool ; false
  • historyTyping bool ; true
  • embedColor string
  • historyMaxJobs int ; 3
  • autoHistory bool ; false
  • autoHistoryBefore string
  • autoHistorySince string
  • sendAutoHistoryStatus bool ; false
  • sendHistoryStatus bool ; true
  • divideByYear bool ; false
  • divideByMonth bool ; false
  • divideByServer bool ; false
  • divideByChannel bool ; false
  • divideByUser bool ; false
  • divideByType bool ; true
  • divideFoldersUseID bool ; false
  • saveImages bool ; true
  • saveVideos bool ; true
  • saveAudioFiles bool ; true
  • saveTextFiles bool ; false
  • saveOtherFiles bool ; false
  • savePossibleDuplicates bool ; false
  • filters
    • blockedPhrases [ ] of strings
    • allowedPhrases [ ] of strings
    • blockedUsers [ ] of strings
    • allowedUsers [ ] of strings
    • blockedRoles [ ] of strings
    • allowedRoles [ ] of strings
    • blockedExtensions [ ] of strings ; common misc files by default
    • allowedExtensions [ ] of strings
    • blockedDomains [ ] of strings
    • allowedDomains [ ] of strings
  • all
    • ... follow channels below ...
  • allBlacklistUsers [ ] of strings
  • allBlacklistServers [ ] of strings
  • allBlacklistCategories [ ] of strings
  • allBlacklistChannels [ ] of strings
  • users
    • user string
    • users [ ] of strings
    • ... all other options follow channels below ...
  • servers
    • server string
    • servers [ ] of strings
    • serverBlacklist [ ] of strings
    • ... all other options follow channels below ...
  • categories
    • category string
    • categories [ ] of strings
    • categoryBlacklist [ ] of strings
    • ... all other options follow channels below ...
  • channels
    • channel string
    • channels [ ] of strings
    • destination string
    • enabled bool ; true
    • save bool ; true
    • allowCommands bool ; true
    • scanEdits bool ; true
    • sendErrorMessages bool ; true
    • sendFileToChannel string
    • sendFileToChannels [ ] of strings
    • sendFileDirectly bool ; true
    • sendFileCaption string
    • filenameDateFormat string ; "2006-01-02_15-04-05"
    • filenameFormat string ; "{{date}} {{file}}"
    • presenceEnabled bool ; true
    • reactWhenDownloaded bool ; true
    • reactWhenDownloadedEmoji string
    • reactWhenDownloadedHistory bool ; false
    • blacklistReactEmojis [ ] of strings
    • historyTyping bool ; true
    • embedColor string
    • autoHistory bool ; false
    • autoHistoryBefore string
    • autoHistorySince string
    • sendAutoHistoryStatus bool ; false
    • sendHistoryStatus bool ; true
    • divideByYear bool ; false
    • divideByMonth bool ; false
    • divideByServer bool ; false
    • divideByChannel bool ; false
    • divideByUser bool ; false
    • divideByType bool ; true
    • divideFoldersUseID bool ; false
    • saveImages bool ; true
    • saveVideos bool ; true
    • saveAudioFiles bool ; true
    • saveTextFiles bool ; false
    • saveOtherFiles bool ; false
    • savePossibleDuplicates bool ; false
    • filters
    • blockedPhrases [ ] of strings
    • allowedPhrases [ ] of strings
    • blockedUsers [ ] of strings
    • allowedUsers [ ] of strings
    • blockedRoles [ ] of strings
    • allowedRoles [ ] of strings
    • blockedExtensions [ ] of strings ; common misc files by default
    • allowedExtensions [ ] of strings
    • blockedDomains [ ] of strings
    • allowedDomains [ ] of strings
    • logLinks
    • logMessages
_constants

LOREM IPSUM

credentials

LOREM IPSUM

token

LOREM IPSUM

email

LOREM IPSUM

password

LOREM IPSUM

twitterAccessToken

LOREM IPSUM

twitterAccessTokenSecret

LOREM IPSUM

twitterConsumerKey

LOREM IPSUM

twitterConsumerSecret

LOREM IPSUM

instagramUsername

LOREM IPSUM

instagramPassword

LOREM IPSUM

flickrApiKey

LOREM IPSUM

admins

LOREM IPSUM

adminChannels

LOREM IPSUM

processLimit

LOREM IPSUM

debug

LOREM IPSUM

settingsOutput

LOREM IPSUM

messageOutput

LOREM IPSUM

messageOutputHistory

LOREM IPSUM

discordLogLevel

LOREM IPSUM

discordTimeout

LOREM IPSUM

_constants

LOREM IPSUM

_constants

LOREM IPSUM

_constants

LOREM IPSUM

_constants

LOREM IPSUM

_constants

LOREM IPSUM

_constants

LOREM IPSUM

_constants

LOREM IPSUM

_constants

LOREM IPSUM

_constants

LOREM IPSUM

_constants

LOREM IPSUM

_constants

LOREM IPSUM

_constants

LOREM IPSUM

_constants

LOREM IPSUM

_constants

LOREM IPSUM

_constants

LOREM IPSUM

_constants

LOREM IPSUM

_constants

LOREM IPSUM

_constants

LOREM IPSUM

_constants

LOREM IPSUM

_constants

LOREM IPSUM

_constants

LOREM IPSUM

_constants

LOREM IPSUM

_constants

LOREM IPSUM

_constants

LOREM IPSUM

_constants

LOREM IPSUM

_constants

LOREM IPSUM

_constants

LOREM IPSUM

_constants

LOREM IPSUM

_constants

LOREM IPSUM

_constants

LOREM IPSUM

_constants

LOREM IPSUM

_constants

LOREM IPSUM

_constants

LOREM IPSUM

_constants

LOREM IPSUM

_constants

LOREM IPSUM

_constants

LOREM IPSUM

_constants

LOREM IPSUM

_constants

LOREM IPSUM

_constants

LOREM IPSUM

_constants

LOREM IPSUM

_constants

LOREM IPSUM

_constants

LOREM IPSUM

_constants

LOREM IPSUM

_constants

LOREM IPSUM

_constants

LOREM IPSUM

_constants

LOREM IPSUM

_constants

LOREM IPSUM

_constants

LOREM IPSUM

_constants

LOREM IPSUM

_constants

LOREM IPSUM

_constants

LOREM IPSUM

_constants

LOREM IPSUM

_constants

LOREM IPSUM

_constants

LOREM IPSUM

_constants

LOREM IPSUM

_constants

LOREM IPSUM

_constants

LOREM IPSUM

_constants

LOREM IPSUM

_constants

LOREM IPSUM

_constants

LOREM IPSUM

_constants

LOREM IPSUM

_constants

LOREM IPSUM

_constants

LOREM IPSUM

_constants

LOREM IPSUM

_constants

LOREM IPSUM

_constants

LOREM IPSUM

_constants

LOREM IPSUM

_constants

LOREM IPSUM

_constants

LOREM IPSUM

settings - main

SETTING KEY TYPE DEFAULT DESCRIPTION EXAMPLE
credentials credentials group See credentials group below.
admins array of
strings
None Discord IDs of users
to use admin commands.
"admins": [ "0", "0" ],
adminChannels array of
adminChannel groups
None See adminChannel group below.
discordLogLevel int (whole number) 0 (errors) 0 = Errors,
1 = Warning,
2 = Informational,
3 = Debug
"discordLogLevel": 2,
debug boolean
(true or false)
false Enables extra output for narrowing down problems. "debug": true,
messageOutput boolean
(true or false)
true Enables discord message output. "messageOutput": true,

settings - credentials group

settings - adminChannels group

settings - source group

settings - source / filters group

settings - source / log group


🤖 Settings Examples

TODO: UNDER CONSTRUCTION

example - minimum bot app

example - minimum user account without 2FA

example - minimum user account with 2FA

example - server with friends

example - scraping public servers (user)

example - scraping public server (bot app, as admin)


❔ FAQ


  • Q: How do I convert from Seklfreak's discord-image-downloader-go?
  • A: Place your config.ini from that program in the same directory as this program and delete any settings.json file if present. The program will import your settings from the old project and make a new settings.json. It will still re-download files that DIDG already downloaded, as the database layout is different and the old database is not imported.

⚙️ Development