discord-downloader-go

command module
v1.6.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 26, 2022 License: MIT Imports: 46 Imported by: 0

README ΒΆ

Discord Downloader Go



Join the Discord

DOWNLOAD LATEST RELEASE

Need help? Have suggestions? Join the Discord server!

This is a program that connects to a Discord Bot or User to locally download files posted in Discord channels in real-time as well as old messages. It can download any directly linked files or Discord attachments, as well as the highest possible quality files from specific sources (see list below). It also supports extensive channel-specific configuration and customization. See Features below for full list!

This project is a fork of Seklfreak's discord-image-downloader-go

For list of differences and why I made an independent project, see below


Sections


Features

(COLLAPSABLE SECTION) LIST OF FEATURES & COMMANDS

Supported Download Sources

  • Discord File Attachments
  • Direct Links to Files
  • Twitter (requires API key, see config section)
  • Instagram
  • Reddit
  • Imgur (Single Posts & Albums)
  • Flickr (requires API key, see config section)
  • Google Drive (requires API Credentials, see config section)
  • Mastodon
  • Tistory
  • Streamable
  • Gfycat

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.

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.


Getting Started

(COLLAPSABLE SECTION) GETTING STARTED, HOW-TO, OTHER INFO...

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).

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 the "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), fill out the "username" and "password" settings. Remove the line for "token" or leave blank ("").
  • If using a User Account (Self-Bot) with 2FA (Two-Factor Authentication), enter the token into the "token" setting. Remove the lines for "username" and "password" or leave blank (""). Token can be found from Developer Tools in browser under localStorage.token or in the Discord client Ctrl+Shift+I (Windows)/Cmd+Option+I (Mac) under Application β†’ Local Storage β†’ https://discordapp.com β†’ "token". You must also set userBot within the credentials section of the settings.json to true.

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.
  • Download Support for Reddit & Mastodon.
  • (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)

(COLLAPSABLE SECTION) HISTORY GUIDE

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).
--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

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). All settings specified below labeled [DEFAULTS] will use default values if missing from the settings file, and those labeled [OPTIONAL] will not be used if missing from the 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.

Settings Examples

The following example is for a Bot Application (using a token), bound to 1 channel.

This setup exempts many options so they will use default values (see below). It shows the bare minimum required settings for the bot to function.

(COLLAPSABLE SECTION) SETTINGS EXAMPLE - Barebones:
{
    "credentials": {
        "token": "YOUR_TOKEN"
    },
    "channels": [
        {
            "channel": "DISCORD_CHANNEL_ID_TO_DOWNLOAD_FROM",
            "destination": "FOLDER_LOCATION_TO_DOWNLOAD_TO"
        }
    ]
}
(COLLAPSABLE SECTION) SETTINGS EXAMPLE - Selfbot:
{
    "credentials": {
        "email": "REPLACE_WITH_YOUR_EMAIL",
        "password": "REPLACE_WITH_YOUR_PASSWORD"
    },
    "scanOwnMessages": true,
    "presenceEnabled": false,
    "channels": [
        {
            "channel": "DISCORD_CHANNEL_ID_TO_DOWNLOAD_FROM",
            "destination": "FOLDER_LOCATION_TO_DOWNLOAD_TO",
            "allowCommands": false,
            "errorMessages": false,
            "reactWhenDownloaded": false
        }
    ]
}
(COLLAPSABLE SECTION) SETTINGS EXAMPLE - Advanced:
{
    "credentials": {
        "token": "YOUR_TOKEN",
        "twitterAccessToken": "aaa",
        "twitterAccessTokenSecret": "bbb",
        "twitterConsumerKey": "ccc",
        "twitterConsumerSecret": "ddd"
    },
    "admins": [ "YOUR_DISCORD_USER_ID", "YOUR_FRIENDS_DISCORD_USER_ID" ],
    "adminChannels": [
        {
            "channel": "CHANNEL_ID_FOR_ADMIN_CONTROL"
        }
    ],
    "debugOutput": true,
    "commandPrefix": "downloader_",
    "allowSkipping": true,
    "allowGlobalCommands": true,
    "asyncHistory": false,
    "downloadRetryMax": 5,
    "downloadTimeout": 120,
    "githubUpdateChecking": true,
    "discordLogLevel": 2,
    "filterDuplicateImages": true,
    "filterDuplicateImagesThreshold": 75,
    "presenceEnabled": true,
    "presenceStatus": "dnd",
    "presenceType": 3,
    "presenceOverwrite": "{{count}} files",
    "filenameFormat": "{{date}} {{file}}",
    "filenameDateFormat": "2006.01.02-15.04.05 ",
    "embedColor": "#EE22CC",
    "inflateCount": 12345,
    "channels": [
        {
            "channel": "THIS_CHANNEL_ONLY_DOWNLOADS_MEDIA",
            "destination": "media",
            "overwriteAllowSkipping": false,
            "saveImages": true,
            "saveVideos": true,
            "saveAudioFiles": true,
            "saveTextFiles": false,
            "saveOtherFiles": false
        },
        {
            "channel": "THIS_CHANNEL_IS_STEALTHY",
            "destination": "stealthy",
            "allowCommands": false,
            "errorMessages": false,
            "updatePresence": false,
            "reactWhenDownloaded": false
        },
        {
            "channels": [ "CHANNEL_1", "CHANNEL_2", "CHANNEL_3", "CHANNEL_4", "CHANNEL_5" ],
            "destination": "stuff",
            "allowCommands": false,
            "errorMessages": false,
            "updatePresence": false,
            "reactWhenDownloaded": false
        }
    ]
}
(COLLAPSABLE SECTION) SETTINGS EXAMPLE - Pretty Much Everything:
{
    "_constants": {
        "DOWNLOAD_FOLDER":              "X:/Discord Downloads",
        "MY_TOKEN":                     "aaabbbccc111222333",
        "TWITTER_ACCESS_TOKEN_SECRET":  "aaabbbccc111222333",
        "TWITTER_ACCESS_TOKEN":         "aaabbbccc111222333",
        "TWITTER_CONSUMER_KEY":         "aaabbbccc111222333",
        "TWITTER_CONSUMER_SECRET":      "aaabbbccc111222333",
        "FLICKR_API_KEY":               "aaabbbccc111222333",
        "GOOGLE_DRIVE_CREDS":           "googleDriveCreds.json",

        "MY_USER_ID":       "000111222333444555",
        "BOBS_USER_ID":     "000111222333444555",

        "SERVER_MAIN":               "000111222333444555",
        "CHANNEL_MAIN_GENERAL":      "000111222333444555",
        "CHANNEL_MAIN_MEMES":        "000111222333444555",
        "CHANNEL_MAIN_SPAM":         "000111222333444555",
        "CHANNEL_MAIN_PHOTOS":       "000111222333444555",
        "CHANNEL_MAIN_ARCHIVE":      "000111222333444555",
        "CHANNEL_MAIN_BOT_ADMIN":    "000111222333444555",

        "SERVER_BOBS":              "000111222333444555",
        "CHANNEL_BOBS_GENERAL":     "000111222333444555",
        "CHANNEL_BOBS_MEMES":       "000111222333444555",
        "CHANNEL_BOBS_SPAM":        "000111222333444555",
        "CHANNEL_BOBS_BOT_ADMIN":   "000111222333444555",

        "SERVER_GAMERZ":                "000111222333444555",
        "CHANNEL_GAMERZ_GENERAL":       "000111222333444555",
        "CHANNEL_GAMERZ_MEMES":         "000111222333444555",
        "CHANNEL_GAMERZ_VIDEOS":        "000111222333444555",
        "CHANNEL_GAMERZ_SPAM":          "000111222333444555",
        "CHANNEL_GAMERZ_SCREENSHOTS":   "000111222333444555"
    },
    "credentials": {
        "token": "MY_TOKEN",
        "userBot": true,
        "twitterAccessToken": "TWITTER_ACCESS_TOKEN",
        "twitterAccessTokenSecret": "TWITTER_ACCESS_TOKEN_SECRET",
        "twitterConsumerKey": "TWITTER_CONSUMER_KEY",
        "twitterConsumerSecret": "TWITTER_CONSUMER_SECRET",
        "flickrApiKey": "FLICKR_API_KEY",
        "googleDriveCredentialsJSON": "GOOGLE_DRIVE_CREDS"
    },
    "admins": [ "MY_USER_ID", "BOBS_USER_ID" ],
    "adminChannels": [
        {
            "channel": "CHANNEL_MAIN_BOT_ADMIN"
        },
        {
            "channel": "CHANNEL_BOBS_BOT_ADMIN"
        }
    ],
    "debugOutput": true,
    "commandPrefix": "d_",
    "allowSkipping": true,
    "scanOwnMessages": true,
    "checkPermissions": false,
    "allowGlobalCommands": false,
    "autorunHistory": true,
    "autorunHistoryBefore": "2022-02-05",
    "autorunHistorySince": "2020-02-05",
    "asyncHistory": false,
    "downloadRetryMax": 5,
    "downloadTimeout": 120,
    "discordLogLevel": 3,
    "githubUpdateChecking": false,
    "filterDuplicateImages": true,
    "filterDuplicateImagesThreshold": 50,
    "presenceEnabled": true,
    "presenceStatus": "idle",
    "presenceType": 3,
    "presenceOverwrite": "{{count}} things",
    "presenceOverwriteDetails": "these are my details",
    "presenceOverwriteState": "this is my state",
    "filenameFormat": "{{date}} {{file}}",
    "filenameDateFormat": "2006.01.02_15.04.05_",
    "embedColor": "#FF0000",
    "inflateCount": 69,
    "numberFormatEuropean": true,
    "all": {
        "destination": "DOWNLOAD_FOLDER/Unregistered",
        "allowCommands": false,
        "errorMessages": false,
        "scanEdits": true,
        "ignoreBots": false,
        "overwriteAutorunHistory": false,
        "overwriteAutorunHistoryBefore": "2022-02-05",
        "overwriteAutorunHistorySince": "2020-02-05",
        "updatePresence": false,
        "reactWhenDownloaded": false,
        "typeWhileProcessing": false,
        "divideFoldersByServer": true,
        "divideFoldersByChannel": true,
        "divideFoldersByUser": false,
        "divideFoldersByType": false,
        "saveImages": true,
        "saveVideos": true,
        "saveAudioFiles": true,
        "saveTextFiles": false,
        "saveOtherFiles": true,
        "savePossibleDuplicates": true,
        "filters": {
            "blockedExtensions": [
                ".htm",
                ".html",
                ".php",
                ".bat",
                ".sh",
                ".jar",
                ".exe"
            ]
        },
        "logLinks": {
            "destination": "log_links",
            "destinationIsFolder": true,
            "divideLogsByServer": true,
            "divideLogsByChannel": true,
            "divideLogsByUser": true,
            "userData": true
        },
        "logMessages": {
            "destination": "log_messages",
            "destinationIsFolder": true,
            "divideLogsByServer": true,
            "divideLogsByChannel": true,
            "divideLogsByUser": true,
            "userData": true
        }
    },
    "allBlacklistChannels": [ "CHANNEL_I_DONT_LIKE", "OTHER_CHANNEL_I_DONT_LIKE" ],
    "allBlacklistServers": [ "SERVER_MAIN", "SERVER_BOBS" ],
    "servers": [
        {
            "server": "SERVER_MAIN",
            "destination": "DOWNLOAD_FOLDER/- My Server",
            "divideFoldersByChannel": true
        },
        {
            "servers": [ "SERVER_BOBS", "SERVER_GAMERZ" ],
            "destination": "DOWNLOAD_FOLDER/- Friends Servers",
            "divideFoldersByServer": true,
            "divideFoldersByChannel": true
        }
    ],
    "channels": [
        {
            "channel": "CHANNEL_MAIN_SPAM",
            "destination": "DOWNLOAD_FOLDER/Spam",
            "overwriteAllowSkipping": false,
            "saveImages": true,
            "saveVideos": true,
            "saveAudioFiles": true,
            "saveTextFiles": false,
            "saveOtherFiles": false
        },
        {
            "channel": "CHANNEL_BOBS_SPAM",
            "destination": "DOWNLOAD_FOLDER/Spam - Bob",
            "overwriteAllowSkipping": false,
            "saveImages": true,
            "saveVideos": true,
            "saveAudioFiles": true,
            "saveTextFiles": false,
            "saveOtherFiles": false
        },
        {
            "channels": [ "CHANNEL_MAIN_MEMES", "CHANNEL_BOBS_MEMES", "CHANNEL_GAMERZ_MEMES" ],
            "destination": "DOWNLOAD_FOLDER/Our Memes",
            "allowCommands": true,
            "errorMessages": true,
            "updatePresence": true,
            "reactWhenDownloaded": true,
            "saveImages": true,
            "saveVideos": true,
            "saveAudioFiles": false,
            "saveTextFiles": false,
            "saveOtherFiles": true
        }
    ]
}

List of Settings

πŸ”Ί means the setting (or alternative) is required.

πŸ”Ή means the setting defaults to a prespecified value. List below should say all default values.

πŸ”Έ means the setting is optional and the feature(s) related to the setting will not be implemented if missing.

(COLLAPSABLE SECTION) LIST OF ALL SETTINGS
  • πŸ”Έ "_constants"
    • β€” settings._constants : list of name:value strings
    • Use constants to replace values throughout the rest of the settings.
      • Note: If a constants name is used within another longer constants name, make sure the longer one is higher in order than the shorter one, otherwise the longer one will not be used properly. (i.e. if you have MY_CONSTANT and MY_CONSTANT_TWO, put MY_CONSTANT_TWO above MY_CONSTANT)
    • Basic Example:
    {
        "_constants": {
            "MY_TOKEN": "my token here",
            "ADMIN_CHANNEL": "123456789"
        },
        "credentials": {
            "token": "MY_TOKEN"
        },
        "adminChannels": {
            "channel": "ADMIN_CHANNEL"
        }
    }
    

  • πŸ”Ί "credentials"
    • β€” settings.credentials : setting:value list
    • πŸ”Ί "token"
      • β€” settings.credentials.token : string
      • REQUIRED FOR BOT APPLICATION LOGIN OR USER LOGIN WITH 2FA, don't include if using User Login without 2FA.
    • πŸ”Ί "email"
      • β€” settings.credentials.email : string
      • REQUIRED FOR USER LOGIN WITHOUT 2FA, don't include if using Bot Application Login.
    • πŸ”Ί "password"
      • β€” settings.credentials.password : string
      • REQUIRED FOR USER LOGIN WITHOUT 2FA, don't include if using Bot Application Login.
    • πŸ”Ή "userBot"
      • β€” settings.credentials.userBot : boolean
      • Default: false
      • SET TO true FOR A USER LOGIN WITH 2FA, keep as false if using a Bot Application.

    • πŸ”Έ "twitterAccessToken"
      • β€” settings.credentials.twitterAccessToken : string
      • Won't use Twitter API for fetching media from tweets if credentials are missing.
    • πŸ”Έ "twitterAccessTokenSecret"
      • β€” settings.credentials.twitterAccessTokenSecret : string
      • Won't use Twitter API for fetching media from tweets if credentials are missing.
    • πŸ”Έ "twitterConsumerKey"
      • β€” settings.credentials.twitterConsumerKey : string
      • Won't use Twitter API for fetching media from tweets if credentials are missing.
    • πŸ”Έ "twitterConsumerSecret"
      • β€” settings.credentials.twitterConsumerSecret : string
      • Won't use Twitter API for fetching media from tweets if credentials are missing.
    • πŸ”Έ "flickrApiKey"
      • β€” settings.credentials.flickrApiKey : string
      • Won't use Flickr API for fetching media from posts/albums if credentials are missing.
    • πŸ”Έ "googleDriveCredentialsJSON"
      • β€” settings.credentials.googleDriveCredentialsJSON : string
      • Path for Google Drive API credentials JSON file.
      • Won't use Google Drive API for fetching files if credentials are missing.

  • πŸ”Έ "admins"
    • β€” settings.admins : list of strings
    • List of User ID strings for users allowed to use admin commands
  • πŸ”Έ "adminChannels"
    • β€” settings.adminChannels : list of setting:value groups
    • πŸ”Ί "channel" [USE THIS OR "channels"]
      • β€” settings.adminChannel.channel : string
      • Channel ID for admin commands & logging.
    • πŸ”Ί "channels" [USE THIS OR "channel"]
      • β€” settings.adminChannel.channels : list of strings
      • Channel IDs to monitor, for if you want the same configuration for multiple channels.
    • πŸ”Ή "logStatus"
      • β€” settings.adminChannel.logStatus : boolean
      • Default: true
      • Send status messages to admin channel(s) upon launch.
    • πŸ”Ή "logErrors"
      • β€” settings.adminChannel.logErrors : boolean
      • Default: true
      • Send error messages to admin channel(s) when encountering errors.
    • πŸ”Ή "unlockCommands"
      • β€” settings.adminChannel.unlockCommands : boolean
      • Default: false
      • Unrestrict admin commands so anyone can use within this admin channel.

  • πŸ”Ή "debugOutput"
    • β€” settings.debugOutput : boolean
    • Default: false
    • Output debugging information.
  • πŸ”Ή "messageOutput"
    • β€” settings.messageOutput : boolean
    • Default: true
    • Output handled Discord messages.
  • πŸ”Ή "commandPrefix"
    • β€” settings.commandPrefix : string
    • Default: "ddg "
  • πŸ”Ή "allowSkipping"
    • β€” settings.allowSkipping : boolean
    • Default: true
    • Allow scanning for keywords to skip content downloading.
    • "skip", "ignore", "don't save", "no save"
  • πŸ”Ή "scanOwnMessages"
    • β€” settings.scanOwnMessages : boolean
    • Default: false
    • Scans the bots own messages for content to download, only useful if using as a selfbot.
  • πŸ”Ή "checkPermissions"
    • β€” settings.checkPermissions : boolean
    • Default: true
    • Checks Discord permissions before attempting requests/actions.
  • πŸ”Ή "allowGlobalCommands"
    • β€” settings.allowGlobalCommands : boolean
    • Default: true
    • Allow certain commands to be used even if not registered in channels or adminChannels.
  • πŸ”Έ "autorunHistory"
    • β€” settings.autorunHistory : boolean
    • Autorun history for all registered channels in background upon launch.
    • This can take anywhere between 2 minutes and 2 hours. It depends on how many channels your bot monitors and how many messages it has to go through. It can help to disable it by-channel for channels that don't require it (see overwriteAutorunHistory in channel options).
  • πŸ”Έ "autorunHistoryBefore"
    • β€” settings.autorunHistoryBefore : string
    • Date filter for autorunHistory
  • πŸ”Έ "autorunHistorySince"
    • β€” settings.autorunHistorySince : string
    • Date filter for autorunHistory
  • πŸ”Έ "asyncHistory"
    • β€” settings.asyncHistory : boolean
    • Runs history commands simultaneously rather than one after the other.
      • WARNING!!! May result in Discord API Rate Limiting with many channels, difficulty troubleshooting, exploding CPUs, melted RAM.
  • πŸ”Έ "exitOnBadConnection"
    • β€” settings.exitOnBadConnection : boolean
    • Exits the program upon detecting a connection issue rather than attempting to reconnect.
  • πŸ”Ή "downloadRetryMax"
    • β€” settings.downloadRetryMax : number
    • Default: 3
  • πŸ”Ή "downloadTimeout"
    • β€” settings.downloadTimeout : number
    • Default: 60
  • πŸ”Ή "discordTimeout"
    • β€” settings.discordTimeout : number
    • Default: 180
  • πŸ”Ή "githubUpdateChecking"
    • β€” settings.githubUpdateChecking : boolean
    • Default: true
    • Check for updates from this repo.
  • πŸ”Ή "discordLogLevel"
    • β€” settings.discordLogLevel : number
    • Default: 0
    • 0 = LogError
    • 1 = LogWarning
    • 2 = LogInformational
    • 3 = LogDebug (everything)
  • πŸ”Ή "filterDuplicateImages"
    • β€” settings.filterDuplicateImages : boolean
    • Default: false
    • Experimental feature to filter out images that are too similar to other cached images.
    • Caching of image data is stored via a database file; it will not read all pre-existing images.
  • πŸ”Ή "filterDuplicateImagesThreshold"
    • β€” settings.filterDuplicateImagesThreshold : number with decimals
    • Default: 0
    • Threshold for what the bot considers too similar of an image comparison score. Lower = more similar (lowest is around -109.7), Higher = less similar (does not really have a maximum, would require your own testing).

  • πŸ”Ή "presenceEnabled"
    • β€” settings.presenceEnabled : boolean
    • Default: true
  • πŸ”Ή "presenceStatus"
    • β€” settings.presenceStatus : string
    • Default: "idle"
    • Presence status type.
    • "online", "idle", "dnd", "invisible", "offline"
  • πŸ”Ή "presenceType"
    • β€” settings.presenceType : number
    • Default: 0
    • Presence label type. ("Playing <activity>", "Listening to <activity>", etc)
    • Game = 0, Streaming = 1, Listening = 2, Watching = 3, Custom = 4
      • If Bot User, Streaming & Custom won't work properly.
  • πŸ”Έ "presenceOverwrite"
  • πŸ”Έ "presenceOverwriteDetails"
  • πŸ”Έ "presenceOverwriteState"

* :small_blue_diamond: "reactWhenDownloaded"
    * β€” _settings.reactWhenDownloaded : boolean_
    * _Default:_ `true`
    * Confirmation reaction that file(s) successfully downloaded. Is overwritten by the channel/server equivelant of this setting.
* :small_blue_diamond: "reactWhenDownloadedHistory"
    * β€” _settings.reactWhenDownloaded : boolean_
    * _Default:_ `false`
    * Confirmation reaction that file(s) successfully downloaded when processing history commands. Is overwritten by the channel/server equivelant of this setting.

  • πŸ”Ή "filenameFormat"
    • β€” settings.filenameFormat : string
    • Default: "{{date}} {{file}}"
    • "{{date}}", "{{file}}", "{{messageID}}", "{{userID}}", "{{username}}", "{{channelID}}", "{{serverID}}", "{{message}}", "{{fileType}}", "{{nanoID}}", "{{shortID}}"
    • "{{nanoID}}" is a 21 character unique string, eg: i25_rX9zwDdDn7Sg-ZoaH
    • "{{shortID}}" is a short unique string, eg: NVovc6-QQy
  • πŸ”Ή "filenameDateFormat"
  • πŸ”Έ "embedColor"
    • β€” settings.embedColor : string
    • Unused by Default
    • Supports random/rand, role/user, or RGB in hex or int format (ex: #FF0000 or 16711680).
  • πŸ”Έ "inflateCount"
    • β€” settings.inflateCount : number
    • Unused by Default
    • Inflates the count of total files downloaded by the bot. I only added this for my own personal use to represent an accurate total amount of files downloaded by previous bots I used.
  • πŸ”Ή "numberFormatEuropean"
    • β€” settings.numberFormatEuropean : boolean
    • Default: false
    • Formats numbers as 123.456,78/123.46k rather than 123,456.78/123,46k.

  • πŸ”Έ "all"
    • β€” settings.all : list of setting:value options
    • Follow channels below for variables, except channel & server ID(s) are not used.
    • If a pre-existing config for the channel or server is not found, it will download from any and every channel it has access to using your specified settings.
  • πŸ”Έ "allBlacklistServers"
    • β€” settings.allBlacklistServers : list of strings
    • Unused by Default
    • Blacklists servers (by ID) from all.
  • πŸ”Έ "allBlacklistChannels"
    • β€” settings.allBlacklistChannels : list of strings
    • Unused by Default
    • Blacklists channels (by ID) from all.

  • πŸ”Ί "servers" [USE THIS OR "channels"]
    • β€” settings.servers : list of setting:value groups
    • πŸ”Ί "server" [USE THIS OR "servers"]
      • β€” settings.servers[].server : string
      • Server ID to monitor.
    • πŸ”Ί "servers" [USE THIS OR "server"]
      • β€” settings.servers[].servers : list of strings
      • Server IDs to monitor, for if you want the same configuration for multiple servers.
    • πŸ”Έ "serverBlacklist"
      • β€” settings.servers[].serverBlacklist : list of strings
      • Blacklist specific channels from the encompassing server(s).
    • ALL OTHER VARIABLES ARE SAME AS "channels" BELOW
  • πŸ”Ί "channels" [USE THIS OR "servers"]
    • β€” settings.channels : list of setting:value groups
    • πŸ”Ί "channel" [USE THIS OR "channels"]
      • β€” settings.channels[].channel : string
      • Channel ID to monitor.
    • πŸ”Ί "channels" [USE THIS OR "channel"]
      • β€” settings.channels[].channels : list of strings
      • Channel IDs to monitor, for if you want the same configuration for multiple channels.

    • πŸ”Ί "destination"
      • β€” settings.channels[].destination : string
      • Folder path for saving files, can be full path or local subfolder.
    • πŸ”Ή "enabled"
      • β€” settings.channels[].enabled : boolean
      • Default: true
      • Toggles bot functionality for channel.
    • πŸ”Ή "save"
      • β€” settings.channels[].save : boolean
      • Default: true
      • Toggles whether the files actually get downloaded/saved.
    • πŸ”Ή "allowCommands"
      • β€” settings.channels[].allowCommands : boolean
      • Default: true
      • Allow use of commands like ping, help, etc.
    • πŸ”Ή "scanEdits"
      • β€” settings.channels[].scanEdits : boolean
      • Default: true
      • Check edits for un-downloaded media.
    • πŸ”Ή "ignoreBots"
      • β€” settings.channels[].ignoreBots : boolean
      • Default: false
      • Ignores messages from Bot users.
    • πŸ”Έ overwriteAutorunHistory
      • β€” settings.channels[].overwriteAutorunHistory : boolean
      • Overwrite global setting for autorunning history for all registered channels in background upon launch.
    • πŸ”Έ overwriteAutorunHistoryBefore
      • β€” settings.channels[].overwriteAutorunHistoryBefore : string
      • Date filter for overwriteAutorunHistory
    • πŸ”Έ overwriteAutorunHistorySince
      • β€” settings.channels[].overwriteAutorunHistorySince : string
      • Date filter for overwriteAutorunHistory
    • πŸ”Ή "sendErrorMessages"
      • β€” settings.channels[].sendErrorMessages : boolean
      • Default: true
      • Send response messages when downloads fail or other download-related errors are encountered.
    • πŸ”Έ "sendFileToChannel"
      • β€” settings.channels[].sendFileToChannel : string
      • Forwards/crossposts/logs downloaded files to specified channel (or channels if used as sendFileToChannels below). By default will send as the actual file
    • πŸ”Έ "sendFileToChannels"
      • β€” settings.channels[].sendFileToChannels : list of strings
      • List form of sendFileToChannel above.
    • πŸ”Ή "sendFileDirectly"
      • β€” settings.channels[].sendFileDirectly : boolean
      • Default: true
      • Sends raw file to channel(s) rather than embedded download link.

    • πŸ”Ή "updatePresence"
      • β€” settings.channels[].updatePresence : boolean
      • Default: true
      • Update Discord Presence when download succeeds within this channel.
    • πŸ”Ή "reactWhenDownloaded"
      • β€” settings.channels[].reactWhenDownloaded : boolean
      • Default: true
      • Confirmation reaction that file(s) successfully downloaded.
    • πŸ”Έ "reactWhenDownloadedEmoji"
      • β€” settings.channels[].reactWhenDownloadedEmoji : string
      • Unused by Default
      • Uses specified emoji rather than random server emojis. Simply pasting a standard emoji will work, for custom Discord emojis use "name:ID" format.
    • πŸ”Ή "reactWhenDownloadedHistory"
      • β€” settings.channels[].reactWhenDownloadedHistory : boolean
      • Default: false
      • Reacts to old messages when processing history.
    • πŸ”Ή "blacklistReactEmojis"
      • β€” settings.channels[].blacklistReactEmojis : list of strings
      • Unused by Default
      • Block specific emojis from being used for reacts. Simply pasting a standard emoji will work, for custom Discord emojis use "name:ID" format.
    • πŸ”Ή "typeWhileProcessing"
      • β€” settings.channels[].typeWhileProcessing : boolean
      • Default: false
      • Shows " is typing..." while processing things that aren't processed instantly, like history cataloging.
    • πŸ”Έ "overwriteFilenameDateFormat"
    • πŸ”Έ "overwriteAllowSkipping"
      • β€” settings.channels[].overwriteAllowSkipping : boolean
      • Unused by Default
      • Allow scanning for keywords to skip content downloading.
      • "skip", "ignore", "don't save", "no save"
    • πŸ”Έ "overwriteEmbedColor"
      • β€” settings.channels[].overwriteEmbedColor : string
      • Unused by Default
      • Supports random/rand, role/user, or RGB in hex or int format (ex: #FF0000 or 16711680).

    • πŸ”Ή "divideFoldersByServer"
      • β€” settings.channels[].divideFoldersByServer : boolean
      • Default: false
      • Separate files into subfolders by server of origin (e.g. "My Server", "My Friends Server")
    • πŸ”Ή "divideFoldersByChannel"
      • β€” settings.channels[].divideFoldersByChannel : boolean
      • Default: false
      • Separate files into subfolders by channel of origin (e.g. "my-channel", "my-other-channel")
    • πŸ”Ή "divideFoldersByUser"
      • β€” settings.channels[].divideFoldersByUser : boolean
      • Default: false
      • Separate files into subfolders by user who sent (e.g. "Me#1234", "My Friend#0000")
    • πŸ”Ή "divideFoldersByType"
      • β€” settings.channels[].divideFoldersByType : boolean
      • Default: true
      • Separate files into subfolders by type (e.g. "images", "video", "audio", "text", "other")
    • πŸ”Ή "divideFoldersUseID"
      • β€” settings.channels[].divideFoldersUseID : boolean
      • Default: false
      • Uses ID rather than Name for "divideFoldersByServer", "divideFoldersByChannel", "divideFoldersByUser". I would recommend this if any servers you download from have server/channel/usernames changed frequently.
    • πŸ”Ή "saveImages"
      • β€” settings.channels[].saveImages : boolean
      • Default: true
    • πŸ”Ή "saveVideos"
      • β€” settings.channels[].saveVideos : boolean
      • Default: true
    • πŸ”Ή "saveAudioFiles"
      • β€” settings.channels[].saveAudioFiles : boolean
      • Default: false
    • πŸ”Ή "saveTextFiles"
      • β€” settings.channels[].saveTextFiles : boolean
      • Default: false
    • πŸ”Ή "saveOtherFiles"
      • β€” settings.channels[].saveOtherFiles : boolean
      • Default: false
    • πŸ”Ή "savePossibleDuplicates"
      • β€” settings.channels[].savePossibleDuplicates : boolean
      • Default: false
      • Save file even if exact filename already exists or exact URL is already recorded in database.

    • πŸ”Έ "filters"
      • β€” settings.channels[].filters : setting:value group
      • Filter prioritizes Users before Roles before Phrases.
      • πŸ”Ή "blockedPhrases"
        • β€” settings.channels[].filters.blockedPhrases : list of strings
        • List of phrases to make the bot ignore this message.
        • Will ignore any message containing a blocked phrase UNLESS it also has an allowed phrase. Messages will be processed by default.
        • Default: [ "skip", "ignore", "don't save", "no save" ]
      • πŸ”Έ "allowedPhrases"
        • β€” settings.channels[].filters.allowedPhrases : list of strings
        • List of phrases to allow the bot to process the message.
        • If used without blockedPhrases, no messages will be processed unless they contain an allowed phrase.
      • πŸ”Έ "blockedUsers"
        • β€” settings.channels[].filters.blockedUsers : list of strings
        • Will ignore messages from the following users.
      • πŸ”Έ "allowedUsers"
        • β€” settings.channels[].filters.allowedUsers : list of strings
        • Will ONLY process messages if they were sent from the following users.
      • πŸ”Έ "blockedRoles"
        • β€” settings.channels[].filters.blockedRoles : list of strings
        • Will ignore messages from users with any of the following roles.
      • πŸ”Έ "allowedRoles"
        • β€” settings.channels[].filters.allowedRoles : list of strings
        • Will ONLY process messages if they were sent from users with any of the following roles.
      • πŸ”Ή "blockedExtensions"
        • β€” settings.channels[].filters.blockedExtensions : list of strings
        • List of file extensions for the bot to ignore (include periods).
        • Default: [ ".htm", ".html", ".php", ".exe", ".dll", ".bin", ".cmd", ".sh", ".py", ".jar" ]
      • πŸ”Έ "allowedExtensions"
        • β€” settings.channels[].filters.allowedExtensions : list of strings
        • Will ONLY process files if they have the following extensions (include periods).
      • πŸ”Έ "blockedDomains"
        • β€” settings.channels[].filters.blockedDomains : list of strings
        • List of file source domains (websites) for the bot to ignore.
      • πŸ”Έ "allowedDomains"
        • β€” settings.channels[].filters.allowedDomains : list of strings
        • Will ONLY process files if they were sent from any of the following domains (websites).

    • πŸ”Έ "logLinks"
      • β€” settings.channels[].logLinks : setting:value group
      • πŸ”Ί "destination"
        • β€” settings.channels[].logLinks.destination : string
        • Filepath for single log file to be stored, or directory path for multiple logs to be stored.
      • πŸ”Ή "destinationIsFolder"
        • β€” settings.channels[].logLinks.destinationIsFolder : bool
        • Default: false
        • true if "destination" above is for a directory for multiple logs.
      • πŸ”Ή "divideLogsByServer"
        • β€” settings.channels[].logLinks.divideLogsByServer : bool
        • Default: true
        • ONLY USED IF "destinationIsFolder" ABOVE IS true
        • Separates log files by Server ID.
      • πŸ”Ή "divideLogsByChannel"
        • β€” settings.channels[].logLinks.divideLogsByChannel : bool
        • Default: true
        • ONLY USED IF "destinationIsFolder" ABOVE IS true
        • Separates log files by Channel ID.
      • πŸ”Ή "divideLogsByUser"
        • β€” settings.channels[].logLinks.divideLogsByUser : bool
        • Default: false
        • ONLY USED IF "destinationIsFolder" ABOVE IS true
        • Separates log files by User ID.
      • πŸ”Ή "divideLogsByStatus"
        • β€” settings.channels[].logLinks.divideLogsByStatus : bool
        • Default: false
        • ONLY USED IF "destinationIsFolder" ABOVE IS true
        • Separates log files download status.
        • DOES NOT APPLY TO "logMessages" BELOW
      • πŸ”Ή "logDownloads"
        • β€” settings.channels[].logLinks.logDownloads : bool
        • Default: true
        • Includes successfully downloaded links in logs.
        • DOES NOT APPLY TO "logMessages" BELOW
      • πŸ”Ή "logFailures"
        • β€” settings.channels[].logLinks.logFailures : bool
        • Default: true
        • Includes failed/skipped/ignored links in logs.
        • DOES NOT APPLY TO "logMessages" BELOW
      • πŸ”Ή "filterDuplicates"
        • β€” settings.channels[].logLinks.filterDuplicates : bool
        • Default: false
        • Filters out duplicate links (or messages) from being logged if already present in log file.
      • πŸ”Έ "prefix"
        • β€” settings.channels[].logLinks.prefix : string
        • Prepend log line with string.
      • πŸ”Έ "suffix"
        • β€” settings.channels[].logLinks.suffix : string
        • Append log line with string.
      • πŸ”Ή "userData"
        • β€” settings.channels[].logLinks.userData : bool
        • Default: false
        • Include additional data such as SERVER/CHANNEL/USER ID's for logged files/messages.
    • πŸ”Έ "logMessages"
      • Identical to "logLinks" above unless noted otherwise.

Presence Placeholders for Settings

For presenceOverwrite, presenceOverwriteDetails, presenceOverwriteState

(COLLAPSABLE SECTION)
Key Description
{{dgVersion}} discord-go version
{{ddgVersion}} Project version
{{apiVersion}} Discord API version
{{countNoCommas}} Raw total count of downloads (without comma formatting)
{{count}} Raw total count of downloads
{{countShort}} Shortened total count of downloads
{{numServers}} Number of servers bot is in
{{numBoundServers}} Number of bound servers
{{numBoundChannels}} Number of bound channels
{{numAdminChannels}} Number of admin channels
{{numAdmins}} Number of designated admins
{{timeSavedShort}} Last save time formatted as 3:04pm
{{timeSavedShortTZ}} Last save time formatted as 3:04pm MST
{{timeSavedMid}} Last save time formatted as 3:04pm MST 1/2/2006
{{timeSavedLong}} Last save time formatted as 3:04:05pm MST - January 2, 2006
{{timeSavedShort24}} Last save time formatted as 15:04
{{timeSavedShortTZ24}} Last save time formatted as 15:04 MST
{{timeSavedMid24}} Last save time formatted as 15:04 MST 2/1/2006
{{timeSavedLong24}} Last save time formatted as 15:04:05 MST - 2 January, 2006
{{timeNowShort}} Current time formatted as 3:04pm
{{timeNowShortTZ}} Current time formatted as 3:04pm MST
{{timeNowMid}} Current time formatted as 3:04pm MST 1/2/2006
{{timeNowLong}} Current time formatted as 3:04:05pm MST - January 2, 2006
{{timeNowShort24}} Current time formatted as 15:04
{{timeNowShortTZ24}} Current time formatted as 15:04 MST
{{timeNowMid24}} Current time formatted as 15:04 MST 2/1/2006
{{timeNowLong24}} Current time formatted as 15:04:05 MST - 2 January, 2006
{{uptime}} Shortened duration of bot uptime

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

  • I'm a complete amateur with Golang. If anything's bad please make a pull request.
  • Versioning is [MAJOR].[MINOR].[PATCH]
(COLLAPSABLE SECTION) CREDITS & SOURCES

Credits & Dependencies

Core Dependencies

Other Dependencies

Documentation ΒΆ

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL