Hexchat Python Script for Fullscreen Gaming Streaming on Twitch reddit / irc ---------------------------------------------------------------------- Mysterious_Loner · 2019-04-03 21:40 Here is my tutorial for setting up twitch messages as system notifications while your games are in fullscreen for streaming to twitch. First you will want to install Hexchat to your system. If you don't have this already, you will need to install this along with python to run my script; fortunately for me, I run linux so both of these are part of the default installation for my distro(linuxmint), but ubuntu users should already have this as well. Once you've done that you'll want to connect Hexchat to your streaming channel for twitch. To do this go to the Hexchat Network list, from there you'll *add* a new network, you can name this whatever you wish, I simply named mine Twitch. For the network, use the address: irc.chat.twitch.tv/6667. You can also set this to autojoin your channel, that's simply #(your twitch screenname possibly all lowercase). Also, you'll need to change the login method to 'Server Password.' For your nick name use your twitch account login; the password is where it gets a bit tricky. Goto https://twitchapps.com/tmi/ and login with your twitch account, generate a token and then copy/paste that as your password. At this point you should be able to connect to your twitch stream chat. Now, you'll want to find create an add-ons subfolder in your hexchat folder, this is where you're going to put your scripts. Here is my python script, which I named Twitch_Notifications: [code] __module_name__ = "Twitch_Notifications" __module_version__ = "1.0" __module_author__ = "Mysterious_Loner" __module_description__ = "Display messages as system notifications" import hexchat import os import sys # Display message as system notification def twitch_notify(word, word_eol, userdata): nick = word[0] message = ' '.join(word[3:]) start ='!' end = '@' os.system('notify-send -t 120000 "' +nick.split(start)[1].split(end)[0].upper() +' ' +message +'"') return hexchat.EAT_NONE # Capture every message for twitch_notify() hexchat.hook_server("PRIVMSG", twitch_notify) You can copy/paste this into a blank text file and save it using a .py extension. Place that file into the add-ons subfolder you created. Now, in hexchat under Window/Plugins and Scripts check to make sure the script is loaded, if it's not simply hit the load button, but it should auto-load anytime you open hexchat in the future now. I arbitrarily set the notification bubbles to stay for 2 minutes, in the script this is the '-t 120000' section of code, if you want to change this simply change that number; 100 is 1 second. 0 is permanent unless the bubble is clicked on. I know this works for me on linux, and as far as I know it should work under Windows and Mac as well. Please let me know if you encounter any issues with these OS's. I hope you found this helpful to your stream. ---------------------------------------------------------------------- NidHammer · 2019-04-03 23:04 This is awesome, I just so happen to be doing something similar with Kiwi IRC. I should mess with this! The main reason I wanted to build something is to get twitch emotes to render in the messages when they get passed to Kiwi IRC. ---------------------------------------------------------------------- Mysterious_Loner · 2019-04-03 23:05 Thanks, I really couldn't believe it hadn't been done already. ---------------------------------------------------------------------- A-UNDERSCORE-D · 2019-04-04 10:31 Rather than using os.system, you can use the builtin method of accessing notify-send within hexchat. this means it both will work on windows, and will not block for a split second like using system() will. See `/help tray` and https://github.com/A-UNDERSCORE-D/Hexchat- Plugins/blob/master/adsnotices.py#L159 ---------------------------------------------------------------------- Mysterious_Loner · 2019-04-04 13:34 I'm not a hardcore coder; I'm more of a tinkerer, so I did what I found through web searchs and whatnot. I do have to thank my brother for his help with the hexchat API. I don't notice a split second, although would you be able to extend the duration of the bubble with the built in method? ---------------------------------------------------------------------- A-UNDERSCORE-D · 2019-04-04 13:59 Sorry, rereading what I said, it did come off a bit dickish--I didn't mean to come off as condecending or critical, though I guess it looked like that. For the split second of lag, I found that notify-send does not return immediately upon call, the script I linked used to do something similar with subprocess, and it ended up locking hexchat for a tiny bit of time each time it was called. And I don't believe the time can be extended, though it should behave the exact same way as highlight notifications, which for me would be that they hang around for at least three seconds. ---------------------------------------------------------------------- Mysterious_Loner · 2019-04-04 21:18 For my purposes... I kinda need the time extended... depending on how long the messages are and what's going on... I might need more time to read them