uncapped1599 / discord_qbittorrent

A simple bash script for creating a styled Discord notification from qBittorrent
GNU General Public License v3.0
15 stars 2 forks source link

Not Receiving Discord Notification #2

Closed yoshi43 closed 1 year ago

yoshi43 commented 1 year ago

I have created the discord_qbit_notification.sh file and added my discord webook details, but I am not receiving any notification in Discord.

If I remove >/dev/null 2>&1 from curl -H "Content-Type: application/json" -X POST -d "$payload" "$discord_webhook_url" >/dev/null 2>&1 and run the script then I get the following output:

{"message": "The request body contains invalid JSON.", "code": 50109}[TestName] Radarr completed. Discord notification sent.

If I replace the curl command with a curl command to test the webook I receive the test notification in Discord. curl -H "Content-Type: application/json" -X POST -d "{\"content\": \"testing\"}" "$discord_webhook_url"

Thank you!

uncapped1599 commented 1 year ago

How are you running the script?

Are you testing via shell or in qbittorrent?

Which OS?

yoshi43 commented 1 year ago

I am running it with the command bash discord_qbit_notification.sh TestName 9999922 12 tracker.com radarr savepath

I am running it in shell with EndeavourOS and am also receiving the same error from a shell within the docker container.

uncapped1599 commented 1 year ago

Funnily enough, this whole time the script has been working fine for me across three different servers. I just ran your command as above again.

Command:

 bash discord_qbit_notification.sh TestName 9999922 12 tracker.com radarr savepath 

Output in discord:

Screenshot 2023-09-15 at 15 08 28

It has never thrown any errors, including right now.

However, it seems if I check in a JSON validator for the payload, I have been overzealous with my quotations around the variables and it is not valid! No idea why this has surfaced for you, the only difference is our OSes, my machines run Ubuntu and Fedora, though I wouldn't know why the implementation of curl would be any different for them.

I have just pushed some changes to the script to remove the extra quotation marks. Please re-download and try this version to see if it works. Hopefully this fixes it!

Thanks for pointing out the issue.

yoshi43 commented 1 year ago

Thank you for the quick reply!

I downloaded the new file, but was still having the issue and it turns out it was an oversight on my part. I never removed the comment from the line "color": 7506394, # You can change the color of the left hand stripe here.

One I removed # You can change the color of the left hand stripe here, it worked without issue!

uncapped1599 commented 1 year ago

Glad to hear it. I have made an edit to the script to make it more obvious for others in the future to remove the comment.