ScruffyRules

asd

Jun 21st, 2016
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.28 KB | None | 0 0
  1. #-*- coding:utf-8 -*-
  2. import hexchat, random
  3.  
  4. __module_name__ = "Timebomb"
  5. __module_version__ = "1.0"
  6. __module_description__ = "Timebombs! :D"
  7.  
  8. print("Timebomb LOADED!")
  9.  
  10. def unload_cb(userdata):
  11.     print("Timebomb UNLOADED!")
  12.  
  13. hexchat.hook_unload(unload_cb)
  14.  
  15. # settings = [nick of person being bombed, correct wire to disarm the bomb, hook object]
  16. settings = [None] * 3
  17.  
  18. def kaboom(userdata):
  19.     global settings
  20.    
  21.     hexchat.command("MSG {} \00304\002KABOOM!".format(userdata))
  22.     hexchat.command("MSG {} {}, Should've gone for the {} wire.".format(userdata, settings[0], settings[1]))
  23.     settings = [None] * 3
  24.  
  25. def main_handler(word, word_eol, userdata):
  26.     global settings
  27.  
  28.     colours = ["red", "orange", "yellow", "green", "blue", "indigo", "violet"]
  29.     if word[1].startswith("%timebomb"):
  30.         # %timebomb nick -- Set's timebomb in nick's pants.
  31.         argv = word[1].split()
  32.  
  33.         if len(argv) < 2:
  34.             hexchat.command("MSG {} {}, Too few arguments.".format(hexchat.get_info("channel"), word[0]))
  35.         else:
  36.             if not (settings[0] or settings[1] or settings[2]):
  37.                 if random.randint(0, 3) == 0:
  38.                     hexchat.command("MSG {} {}, There is a 1 in 4 chance that I will NOT do someone a favour with the timebomb. Sorry, this is the 1 in 4 chance I just told you about.".format(hexchat.get_info("channel"), word[0]))
  39.                 else:    
  40.                     time = random.randint(10, 100)
  41.                     settings[0] = argv[1]
  42.                     settings[1] = random.choice(colours)
  43.                     settings[2] = hexchat.hook_timer(time * 1000, kaboom, userdata=hexchat.get_info("channel"))
  44.                     hexchat.command("MSG {} A timebomb is set for {} seconds and shoved into {}'s pants. There are 7 wires: {}.    Use %cut colour to cut a wire.".format(hexchat.get_info("channel"), time, argv[1], colours))
  45.             else:
  46.                 hexchat.command("MSG {} {}, There is already a live timebomb in {}'s pants!".format(hexchat.get_info("channel"), word[0], settings[0]))
  47.  
  48. hexchat.hook_print("Channel Message", main_handler)
  49. hexchat.hook_print("Your Message", main_handler)
  50. hexchat.hook_print("Private Message", main_handler)
  51. hexchat.hook_print("Private Message to Dialog", main_handler)
Advertisement
Add Comment
Please, Sign In to add comment