From upstream https://github.com/get-got/discord-downloader-go.git
Modified for arm64
https://github.com/get-got/discord-downloader-go.git
|
4 年之前 | |
---|---|---|
.gitattributes | 4 年之前 | |
.gitignore | 4 年之前 | |
.travis.yml | 4 年之前 | |
LICENSE | 4 年之前 | |
README.md | 4 年之前 | |
common.go | 4 年之前 | |
config.go | 4 年之前 | |
database.go | 4 年之前 | |
discord.go | 4 年之前 | |
downloads.go | 4 年之前 | |
go.mod | 4 年之前 | |
go.sum | 4 年之前 | |
handlers.go | 4 年之前 | |
main.go | 4 年之前 | |
parse.go | 4 年之前 | |
regex.go | 4 年之前 | |
vars.go | 4 年之前 |
Discord Downloader 💾
<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://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://travis-ci.com/get-got/discord-downloader-go" alt="Build Status">
<img src="https://travis-ci.com/get-got/discord-downloader-go.svg?branch=master" />
</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://discord.gg/6Z6FJZVaDV">
<img src="https://img.shields.io/discord/780985109608005703?logo=discord"alt="Join the Discord">
</a>
<a href="https://github.com/get-got/discord-downloader-go/releases/latest">
<b>DOWNLOAD LATEST RELEASE BUILDS</b>
</a>
This is a Discord bot program to download files posted in specified Discord channels to local folders. It can fetch highest possible quality files from various sources (listed below), aside from downloading any file directly linked or attached. See Features below for full list.
Need help? Have suggestions? Join the support & discussion Discord server for this project!
Read more in Discord Trust & Safety Team's Official Statement...
NOTE: This only applies to real User Accounts, not Bot users. This program currently works for either.
Obviously, download the bot program (or compile yourself with Go) and put it in a folder of your choice.
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). Ensure you follow proper JSON syntax to avoid any unexpected errors.
"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)."username"
and "password"
settings. Remove the line for "token"
or leave blank (""
)."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"
.Read Message
permissions in the server(s) of your designated channel(s).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.Read Message History
permissions in the server(s) of your designated channel(s).Developer Mode
in Discord settings under Appearance
.Copy ID
.Copy ID
.Copy ID
.xurls
that required people to edit the project, regarding xurls.Strict.FindAllString
. The issue was due to some people having xurls v2 installed while the projects go.mod required v1.1; changing go.mod to require v2 specifically seems to be the correct fix.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.
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.
You will need the Channel ID (see bottom of Setup) if attempting to catalog history from a specific channel or group of channels, within an admin channel.
<prefix>history
to catalog the current channel the command is sent in (must be registered in channels
in settings).<prefix>history cancel
to stop cataloging the current channel the command is sent in (must be registered in channels
in settings).<prefix>history <Channel ID(s)>
to catalog specified channels from within a designated Admin Channel (must be registered in adminChannels
in settings). You can do multiple channels per command if desired, separated by commas.<prefix>history cancel <Channel ID(s)>
to stop cataloging specified channels from within a designated Admin Channel (must be registered in adminChannels
in settings). You can do multiple channels per command if desired, separated by commas.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.
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.
When initially launching the bot it will create a default settings file if you do not create your own settings.json
beforehand.
Example - Barebones settings.json:
{
"credentials": {
"token": "YOUR_TOKEN"
},
"channels": [
{
"channel": "DISCORD_CHANNEL_ID_TO_DOWNLOAD_FROM",
"destination": "FOLDER_LOCATION_TO_DOWNLOAD_TO"
}
]
}
Example - Selfbot settings.json:
{
"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
}
]
}
Example - Advanced settings.json:
{
"credentials": {
"token": "YOUR_TOKEN",
"twitterAccessToken": "",
"twitterAccessTokenSecret": "",
"twitterConsumerKey": "",
"twitterConsumerSecret": ""
},
"admins": [ "YOUR_DISCORD_USER_ID", "YOUR_FRIENDS_DISCORD_USER_ID" ],
"adminChannels": [
{
"channel": "CHANNEL_ID_FOR_ADMIN_CONTROL"
}
],
"debugOutput": true,
"commandPrefix": "downloader_",
"allowSkipping": true,
"filterDuplicates": true,
"filterDuplicatesThreshold": 75,
"downloadRetryMax": 5,
"downloadTimeout": 120,
"githubUpdateChecking": true,
"presenceStatus": "dnd",
"presenceType": 3,
"presenceOverwrite": "{{count}} files",
"filenameDateFormat": "2006.01.02-15.04.05_",
"embedColor": "#29BEB0",
"inflateCount": 123456,
"channels": [
{
"channel": "THIS_CHANNEL_DOWNLOADS_EVERYTHING",
"destination": "EVERYTHING",
"overwriteEmbedColor": "#FF0000",
"userBlacklist": [ "USER_ID_FOR_PERSON_I_DONT_LIKE" ],
"divideFoldersByType": false,
"saveImages": true,
"saveVideos": true,
"saveAudioFiles": true,
"saveTextFiles": true,
"saveOtherFiles": true,
"savePossibleDuplicates": true,
"extensionBlacklist": [
".htm",
".html",
".php"
]
},
{
"channel": "THIS_CHANNEL_ONLY_DOWNLOADS_MEDIA",
"destination": "media",
"overwriteAllowSkipping": false,
"saveImages": true,
"saveVideos": true,
"saveAudioFiles": true,
"saveTextFiles": false,
"saveOtherFiles": false
},
{
"channel": "THIS_CHANNEL_ONLY_DOWNLOADS_MEDIA_FROM_ME_EXCEPT_DISCORD_FILES",
"destination": "media2",
"usersAllWhitelisted": false,
"userWhitelist": [ "MY_USER_ID" ],
"saveImages": true,
"saveVideos": true,
"saveAudioFiles": true,
"saveTextFiles": false,
"saveOtherFiles": false,
"domainBlacklist": [ "cdn.discordapp.com" ]
},
{
"channel": "THIS_CHANNEL_IS_STEALTHY",
"destination": "stealthy files",
"allowCommands": false,
"errorMessages": false,
"updatePresence": false,
"reactWhenDownloaded": false
},
{
"channels": [ "CHANNEL_1", "CHANNEL_2", "CHANNEL_3", "CHANNEL_4", "CHANNEL_5" ],
"destination": "lots of stuff",
"allowCommands": false,
"errorMessages": false,
"updatePresence": false
}
]
}
All JSON settings follow camelCase format.
[key/value object]
[string]
[string]
[string]
[OPTIONAL]
twitterAccessToken [string]
[OPTIONAL]
twitterAccessTokenSecret [string]
[OPTIONAL]
twitterConsumerKey [string]
[OPTIONAL]
twitterConsumerSecret [string]
[OPTIONAL]
flickrApiKey [string]
[OPTIONAL]
googleDriveCredentialsJSON [string]
[OPTIONAL]
admins [array of strings]
[OPTIONAL]
adminChannels [array of key/value objects]
[string]
[DEFAULTS]
debugOutput [bool]
false
[DEFAULTS]
commandPrefix [string]
"ddg "
[DEFAULTS]
allowSkipping [bool]
true
"skip", "ignore", "don't save", "no save"
[DEFAULTS]
scanOwnMessages [bool]
false
[DEFAULTS]
filterDuplicateImages [bool]
false
[DEFAULTS]
filterDuplicateImagesThreshold [float64]
100.0
[DEFAULTS]
downloadRetryMax [int]
3
[DEFAULTS]
downloadTimeout [int]
60
[DEFAULTS]
githubUpdateChecking [bool]
true
[DEFAULTS]
presenceEnabled [bool]
true
[DEFAULTS]
presenceStatus [string]
"idle"
"online"
, "idle"
, "dnd"
, "invisible"
, "offline"
[DEFAULTS]
presenceType [int]
0
Game = 0, Streaming = 1, Listening = 2, Watching = 3, Custom = 4
[OPTIONAL]
presenceOverwrite [string]
{{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{{numGuilds}}
: Number of guilds bot is a member of{{numChannels}}
: 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 1, 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 - 1 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 1, 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 - 1 January, 2006
{{uptime}}
: Shortened duration of bot uptime[OPTIONAL]
presenceOverwriteDetails [string]
presenceOverwrite
above...[OPTIONAL]
presenceOverwriteState [string]
presenceOverwrite
above...[DEFAULTS]
filenameDateFormat [string]
"2006-01-02_15-04-05 "
[OPTIONAL]
embedColor [string]
random
/rand
, role
/user
, or RGB in hex or int format (ex: #FF0000 or 16711680).[OPTIONAL]
inflateCount [int]
[array of key/value objects]
[THIS OR BELOW]
channel [string]
[THIS OR ABOVE]
channels [array of strings]
[string]
[DEFAULTS]
enabled [bool]
true
[DEFAULTS]
allowCommands [bool]
true
[DEFAULTS]
errorMessages [bool]
true
[DEFAULTS]
scanEdits [bool]
true
[DEFAULTS]
updatePresence [bool]
true
[DEFAULTS]
reactWhenDownloaded [bool]
true
[OPTIONAL]
reactWhenDownloadedEmoji [string]
[OPTIONAL]
overwriteFilenameDateFormat [string]
filenameDateFormat
(see above)[OPTIONAL]
overwriteAllowSkipping [bool]
"skip", "ignore", "don't save", "no save"
[OPTIONAL]
overwriteEmbedColor [string]
random
/rand
, role
/user
, or RGB in hex or int format (ex: #FF0000 or 16711680).[DEFAULTS]
usersAllWhitelisted [bool]
true
false
if you wish to use userWhitelist
to only permit specific users messages to be handled.[OPTIONAL]
userWhitelist [array of strings]
usersAllWhitelisted
as false
to only permit specific users to have their messages handled by the bot. Only accepts User ID's in the array.[OPTIONAL]
userBlacklist [array of strings]
usersAllWhitelisted
as the default true
to block certain users messages from being handled by the bot. Only accepts User ID's in the array.[DEFAULTS]
divideFoldersByServer [bool]
false
[DEFAULTS]
divideFoldersByChannel [bool]
false
[DEFAULTS]
divideFoldersByUser [bool]
false
[DEFAULTS]
divideFoldersByType [bool]
true
[DEFAULTS]
saveImages [bool]
true
[DEFAULTS]
saveVideos [bool]
true
[DEFAULTS]
saveAudioFiles [bool]
false
[DEFAULTS]
saveTextFiles [bool]
false
[DEFAULTS]
saveOtherFiles [bool]
false
[DEFAULTS]
savePossibleDuplicates [bool]
true
[DEFAULTS]
extensionBlacklist [array of strings]
[ ".htm", ".html", ".php", ".exe", ".dll", ".bin", ".cmd", ".sh", ".py", ".jar" ]
[OPTIONAL]
domainBlacklist [array of strings]
[OPTIONAL]
saveAllLinksToFile [string]
[MAJOR].[MINOR].[PATCH]