blacktwin / JBOPS

Just a Bunch Of Plex Scripts
1.71k stars 304 forks source link

[Request] Killstream message enhancements #136

Closed drizuid closed 5 years ago

drizuid commented 5 years ago

Can we get the option to send {player} and {platform} in the richmedia stream to discord/slack? I have my plex users in a discord channel so they can see this info, but for some of them, they have to ask me which device was being used. Currently, i have a script that sends that info to me via pushover so I can yell at them on discord but im looking to automate. Eventually i'll need to look at matching their plex friendly name with their discord name so I can use mentions.. but that's future (unless you guys are already looking at it!)

blacktwin commented 5 years ago

Can we get the option to send {player} and {platform} in the richmedia stream to discord/slack?

You can do this now. A simple edit to the script. This block. Mainly this part:

                    "fields": [
                        {
                            "inline": True,
                            "name": "User",
                            "value": self.stream.friendly_name
                        },

Create another dictionary with inline, name, and value.

Use this picture for reference.

You'd want:

{"inline": True,
 "name": "Player",
"value": self.stream.player},
{"inline": True,
 "name": "Platform",
"value": self.stream.platform},

To find what the other possible self.stream.* names are, check here. It's up to you what you want to see in the message.

Eventually i'll need to look at matching their plex friendly name with their discord name so I can use mentions

Again that is up to you. To tag someone in discord from a bot or script you need to use their ID. So in Discord right click on the user and Copy ID. Then wrap it in <> and prefix an @: <@1234567890>. You can add some kind of dictionary of your users and their IDs into the script.

discord_users = {'steve': '<@1234567890>',
                 'mike': '<@0987654321>'}

Then check against it to grab the ID to add into the message.

blacktwin commented 5 years ago

👍