blacktwin / JBOPS

Just a Bunch Of Plex Scripts
1.67k stars 307 forks source link

Discord Notifications Not Embedding #310

Closed mattyteds closed 3 years ago

mattyteds commented 3 years ago

Normally my Discord agent works with Tautulli but when the kill_stream script triggers it the bot's messages are not embedding correctly. This is what the bot posts: tautulli: {"embeds": [{"author": {"icon_url": "https://github.com/Tautulli/Tautulli/raw/master/data/interfaces/default/images/logo-circle.png%22,%22name": "Tautulli","url": "http://REDACTED/tautulli/tautulli%22%7D,%22color": 15048717,"fields": [{"inline": true,"name": "User","value": "REDACTED."},{"inline": true,"name": "Session Key","value": "248"},{"inline": true,"name": "Watching","value": "Dragon Ball Z - Welcome Back Goku"},{"inline": false,"name": "Message Sent","value": "Unauthorized client. Contact the Plex admin for help."}],"footer": {"text": "REDACTED | Kill Stream"},"thumbnail": {"url": "http://REDACTED/tautulli/tautulli/image/REDACTED,%22timestamp": "2021-09-07T15:46:35.618812","title": "Killed REDACTED's stream.","url": "https://app.plex.tv/desktop#!/server/REDACTED/details?key=%2Flibrary%2Fmetadata%2F27228%22%7D]%7D

I have Include Rich Metadata Info, Include Link to Plex Web, and Use Poster Thumbnail all checked in the Discord agent but it does the same thing if I uncheck them. And the Discord agent can normally embed messages.

Also if you enabled Include Subject Line in the Discord agent settings the notification from kill_stream fails to send because there is no subject.

blacktwin commented 3 years ago

Can you please provide the entire log file?

mattyteds commented 3 years ago

The above was a copy and paste of the message in Discord. I assume you mean the Tautulli log file since you didn't specify. Here it is but there is nothing useful logged because everything works as intended, it's just not formatted correctly.

tautulli.log

And here is a screenshot of that notification in discord:

Untitled

Also other Tautulli Discord notifications work and embed fine. image

blacktwin commented 3 years ago

Please add --debug to your arguments and share your entire log.

mattyteds commented 3 years ago

This is the relevant log file. You will not be getting my entire log file because I am competent enough to trim a log file, my log file goes back 3 months and I've had this script a week. Still pretty certain this is a syntax or formatting issue with how the embed is actually being generated and passed to the Discord notification agent, the fact the message in Discord is missing several closed braces ( } ) might be a clue? But anyways.

tautulli.log

blacktwin commented 3 years ago

You need to be using a Webhook agent.

blacktwin commented 3 years ago

@mattyteds did you get it working?

mattyteds commented 3 years ago

I did, it created a Webook Agent rather using the Discord Agent. I'm suppose I'll have to keep both.

I also can't seem to get posters to appear. I'm using:

--notify 6 --richMessage discord --jbop allStreams --userId {user_id} --killMessage 'Unauthorized client. Contact the Plex admin for help.' --serverName {server_name} --plexUrl {plex_url} --posterUrl {poster_url} --richColor '#E5A00D'

blacktwin commented 3 years ago

Yeah. You would have the Discord Agent for say Recently Added or Watched statuses and the Webhook agent for using the kill script or if you wanted to setup a custom notification that is more than what is available in the Discord Agent.

blacktwin commented 3 years ago

Can you share pictures and logs?

mattyteds commented 3 years ago

Untitled tautulli.log

Based on the log it should be working.

blacktwin commented 3 years ago

That poster, errr logo, is correct. You're Killing All Streams ('--jbop', 'allStreams') so to account for when there are multiple sessions being killed it falls back to the Tautulli logo. Instead of attempting to choose a poster from all the sessions it's killing it falls back to the logo.

mattyteds commented 3 years ago

"Limitations

I need to learn to read.

blacktwin commented 3 years ago

LOL it happens. All good now?

mattyteds commented 3 years ago

I think so. I just used: --notify 6 --richMessage discord --jbop stream --username {username} --sessionId {session_id} --killMessage 'Unauthorized client. Contact the Plex admin for help.' --serverName {server_name} --plexUrl {plex_url} --posterUrl {poster_url} --richColor '#E5A00D'

It appears to work. I don't think I need to kill all streams.