Advertisement
Psyber

unfinished xchat anounce plugin

Mar 23rd, 2015
355
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.76 KB | None | 0 0
  1.  
  2. __module_name__ = "Rhythmbox Irc Announcer Trigger"
  3. __module_description__ = "/me Current song of rhythmbox when !rbox is said in any channel joined."
  4. __module_version__ = "0.1"
  5. import xchat
  6. import subprocess
  7. import time
  8.  
  9. def message_cb(word, word_eol, userdata):
  10.       message=word[1]
  11.       song = subprocess.Popen('rhythmbox-client --print-playing',shell=True,stdout=subprocess.PIPE)
  12.       stdout_value = song.communicate()[0]
  13.       #If channel message is !rbox
  14.       if message == "!rbox":
  15.        #xchat command /say (output of rhythmbox-client --print-playing)
  16.     xchat.command("say Radio is now playing "+str(stdout_value).strip('\n'))
  17.       else:
  18.           True
  19.  
  20. xchat.hook_print("Your Message", message_cb)
  21. xchat.hook_print("Channel Message", message_cb)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement