I need to edit a VERY simple and short script for irc.
It's a page script that will page me when my nick is said (By page, it will play a sound file)
Only problem is, i want it to page me only when !nick is said.
Code:
### Edit the following variables to your likeing.
### filename - change this to the file you wish to play
### app - change this to the application name used to play the file.
### the file name is placed after the command.
### response - change this to 0 to have it off by default.
response = 1
filename = "/home/tech/files/irc/scripts/irc.wav"
app = "esdplay"
### Don't edit past here unless you know what you are doing!
import xchat
import os
import thread
__module_name__ = "Mike's Soundresponse"
__module_version__ = "1.0"
__module_description__ = "A Sound Response script"
print "Pager loaded!"
def soundresponse_cb( word, word_eol, userdata ):
import __main__
if len(word) < 2:
print "You did not supply enough args."
return xchat.EAT_ALL
if word[1] == "on":
__main__.response = 1
print "Turning sound response on."
elif word[1] == "off":
__main__.response = 0
print "Turning sound response off."
elif word[1] == "file":
if len(word) < 3:
print "You did not supply a file name."
else:
__main__.filename = word[2]
elif word[1] == "app":
if len(word) < 3:
print "You did not supply an app name."
else:
__main__.app = word[2]
return xchat.EAT_ALL
def playsound_cb( word, word_eol, userdata ):
import __main__
if __main__.response == 1:
args = (__main__.app + " " + __main__.filename,)
thread.start_new_thread( os.system, args );
return xchat.EAT_NONE
xchat.hook_command( "SOUNDRESPONSE", soundresponse_cb, help="/SOUNDRESPONSE <arg>, turn \"on\" or \"off\"." )
xchat.hook_print("Channel Msg Hilight", playsound_cb)