Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import xchat
- # Variables
- __module_name__ = "Echo plugin"
- __module_version__ = "1.0"
- __module_description__ = "Works with !echo derp"
- # Timer
- def command_timer(userdata):
- if userdata is not None:
- xchat.command(userdata)
- # Main hook control
- def printhook_test(word, word_eol, userdata):
- if xchat.get_info("channel") == "#powder-bots" or xchat.get_info("channel") == "#powder":
- text = word[1].split() # On print hooks, word = ["username", "all the text"]
- # print (text, word)
- if text[0].lower() == "!echo" and len(text) > 1: # If starts with my command and it's longer than 1
- echotext = ""
- stripped = False
- for i in text[1:]: ## Join them with spaces!
- if not stripped:
- i = i.lstrip(";+!$")
- if i.lower() == "alot":
- echotext = echotext + "a lot "
- elif len(i) >= 1 and not "stewiegriffin".lower() in i.lower() and not "nigger" in i.lower() and not "fag" in i.lower():
- echotext = echotext + i + " "
- stripped = True
- xchat.hook_timer(400, command_timer, "msg " + xchat.get_info("channel") + " " + echotext)
- # Timer2 til I learn more python ...
- def command_timer2(userdata):
- if userdata is not None:
- thechannel = xchat.find_context(channel=userdata)
- if thechannel:
- thechannel.command('gui color 0')
- # Nick change ignore
- def color_ignore(word, word_eol, userdata):
- if xchat.get_info("channel") != "#powder":
- xchat.hook_timer(10, command_timer2, xchat.get_info("channel"))
- # Hooks
- xchat.hook_print("Channel Message", printhook_test)
- xchat.hook_print("Channel Msg Hilight", printhook_test)
- xchat.hook_print("Your Message", printhook_test)
- xchat.hook_print("Change Nick", color_ignore)
- xchat.hook_print("Your Nick Changing", color_ignore)
- print ("*** Loaded echo plugin.")
Advertisement
Add Comment
Please, Sign In to add comment