get-got / discord-downloader-go

A Discord bot program to download and otherwise handle files sent in Discord channels with extensive configuration. Can be used as a genuine Discord Bot or user account / self-bot
MIT License
279 stars 30 forks source link

Successfully logged in, running but not downloading anything #88

Closed Feriman22 closed 1 year ago

Feriman22 commented 1 year ago

Hi,

I have configured the script in the settings.json file as below, the script runs but doesn't download anything, but at the same time new images are appearing on the specified number of channels.

settings.json

{
        "credentials": {
                "token": "HEREISMYTOKEN",
                "userBot": true
        },
        "admins": [
                "1092234524932536118"
        ],
        "processLimit": 0,
        "debug": false,
        "settingsOutput": false,
        "messageOutput": false,
        "messageOutputHistory": false,
        "githubUpdateChecking": true,
        "commandPrefix": "ddg ",
        "scanOwnMessages": false,
        "save": true,
        "presenceEnabled": false,
        "presenceStatus": "idle",
        "reactWhenDownloaded": false,
        "historyMaxJobs": 0,
        "users": null,
        "servers": null,
        "categories": null,
        "channels": [
                {
                        "channel": "1228571173250000330",
                        "destination": "/tmp/",
                        "enabled": true,
                        "save": true,
                        "allowCommands": false,
                        "scanEdits": false,
                        "ignoreBots": true,
                        "sendErrorMessages": false,
                        "presenceEnabled": false,
                        "reactWhenDownloadedHistory": false,
                        "divideByType": true,
                        "saveImages": true,
                        "saveVideos": true
                }
        ]
}

Output:

pi@RPi4:/mnt/Shared/AdobeProject/1_Downloader_App ./discord-downloader-go_linux_arm64
2023/02/07 17:25:07 main.go:114: ---------------- Welcome to discord-downloader-go v2.0.0-beta.9 ----------------
2023/02/07 17:25:07 main.go:124:        > [Version] linux/arm64 / go1.19.5 / discordgo v0.27.0-gg.1 (API v9)
2023/02/07 17:25:08 main.go:138:        > [Info] ** Need help? Discord: https://discord.gg/6Z6FJZVaDV **
2023/02/07 17:25:08 config.go:416:      > [Settings] Loading from "settings.json"...
2023/02/07 17:25:08 main.go:504:        > [Database] Opening database...        (this can take a second...)
2023/02/07 17:25:08 config.go:546:      > [Settings] Loaded - bound to 1 channel, 0 categories, 0 servers, 0 users
2023/02/07 17:25:08 main.go:534:        > [Database] Database opened, contains 0 entries...
2023/02/07 17:25:08 main.go:668:        > [Discord] Connecting to Discord via Token...
2023/02/07 17:25:08 main.go:583:        > [API | Twitter] API credentials missing, the bot won't use the Twitter API.
2023/02/07 17:25:08 main.go:621:        > [API | Instagram] API credentials missing, the bot won't use the Instagram API.
2023/02/07 17:25:10 main.go:723:        > [Discord] Logged into "XYZ"#4321
2023/02/07 17:25:10 main.go:730:        > [Discord] This is a User Account (Self-Bot)
2023/02/07 17:25:10 main.go:731:        > [Discord] - Discord does not allow Automated User Accounts (Self-Bots), so by using this bot you potentially risk account termination.
2023/02/07 17:25:10 main.go:732:        > [Discord] - See GitHub page for link to Discord's official statement.
2023/02/07 17:25:10 main.go:733:        > [Discord] - If you wish to avoid this, use a Bot Application if possible.
2023/02/07 17:25:10 main.go:734:        > [Discord] - Nothing is wrong, this is just info :)
2023/02/07 17:25:10 main.go:170:        > ---- Discord Downloader GO v2.0.0-beta.9 is online with access to 2 servers ----
2023/02/07 17:25:10 main.go:173:        > CTRL+C to exit...

What might be the problem?

Thanks! Feriman

Feriman22 commented 1 year ago

Based on Discord help, I modified the ""ignoreBots": false" value on global and server side, but nothing changed.

I also tried it with different server.

Feriman22 commented 1 year ago

I found a workaround using cURL requests instead of using this, so I close this issue.

Garyguo2011 commented 1 year ago

@Feriman22 having same problem, what will be the cURL alternatives? could you please help me? thank you.

Feriman22 commented 1 year ago

Hi @Garyguo2011, Sure. This cURL command can download the last 100 messages from a specific channel:

curl -s --location --request GET "https://discord.com/api/v9/channels/$channel_id/messages?limit=100" \
--header 'accept-language: en-US,en;q=0.9,it;q=0.8,de;q=0.7,es;q=0.6,pt;q=0.5' \
--header "authorization: $token" \
--header 'sec-ch-ua-platform: "macOS"' \
--header 'user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36' \
--header 'x-discord-locale: en-US' \
--header 'Cookie: $cookieid' >> "$curloutputfile"

Sorry, but I can't remember where the "$cookie" parameter located, but I guess it's a good start for you.