jacob614

!echo script

Dec 22nd, 2012
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.94 KB | None | 0 0
  1. import xchat
  2.  
  3. # Variables
  4. __module_name__ = "Echo plugin"
  5. __module_version__ = "1.0"
  6. __module_description__ = "Works with !echo derp"
  7. # Timer
  8. def command_timer(userdata):
  9.     if userdata is not None:
  10.         xchat.command(userdata)
  11.        
  12. # Main hook control
  13. def printhook_test(word, word_eol, userdata):
  14.     if xchat.get_info("channel") == "#powder-bots" or xchat.get_info("channel") == "#powder":
  15.         text = word[1].split() # On print hooks, word = ["username", "all the text"]
  16.         # print (text, word)
  17.         if text[0].lower() == "!echo" and len(text) > 1: # If starts with my command and it's longer than 1
  18.             echotext = ""
  19.             stripped = False
  20.             for i in text[1:]: ## Join them with spaces!
  21.                 if not stripped:
  22.                     i = i.lstrip(";+!$")
  23.                 if i.lower() == "alot":
  24.                     echotext = echotext + "a lot "
  25.                 elif len(i) >= 1 and not "stewiegriffin".lower() in i.lower() and not "nigger" in i.lower() and not "fag" in i.lower():
  26.                     echotext = echotext + i + " "
  27.                     stripped = True
  28.             xchat.hook_timer(400, command_timer, "msg  " + xchat.get_info("channel") + " " + echotext)
  29.  
  30. # Timer2 til I learn more python ...
  31. def command_timer2(userdata):
  32.     if userdata is not None:
  33.         thechannel = xchat.find_context(channel=userdata)
  34.         if thechannel:
  35.             thechannel.command('gui color 0')
  36.        
  37. # Nick change ignore
  38. def color_ignore(word, word_eol, userdata):
  39.     if xchat.get_info("channel") != "#powder":
  40.         xchat.hook_timer(10, command_timer2, xchat.get_info("channel"))
  41.  
  42. # Hooks
  43. xchat.hook_print("Channel Message", printhook_test)
  44. xchat.hook_print("Channel Msg Hilight", printhook_test)
  45. xchat.hook_print("Your Message", printhook_test)
  46.  
  47. xchat.hook_print("Change Nick", color_ignore)
  48. xchat.hook_print("Your Nick Changing", color_ignore)
  49. print ("*** Loaded echo plugin.")
Advertisement
Add Comment
Please, Sign In to add comment