bonk.py 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. from event import Event
  2. import random
  3. class Bonk:
  4. def __init__(self, events=None, printer_handle=None, bot=None, say=None):
  5. self.events = events
  6. self.printer = printer_handle
  7. self.interests = ['__.bonk__']
  8. self.bot = bot
  9. self.say = say
  10. bonk = Event("__.bonk__")
  11. bonk.define(msg_definition="^\.bonk ")
  12. bonk.subscribe(self)
  13. self.bot.register_event(bonk, self)
  14. self.help = ".bonk <bonkee>"
  15. def get_bonked(self, bonkee=''):
  16. """Randomly selects and returns a string with a bonk action directed toward a given bonkee."""
  17. bonk_actions = ['drops a Titan on %s',
  18. 'hadoukens %s',
  19. 'slaps %s around with a large trout',
  20. 'slaps %s around wiiIIITTTTHHH.....A HERRING!',
  21. 'bitch slaps %s',
  22. 'feeds %s a knuckle sandwich',
  23. 'sucker punches %s',
  24. 'drops an ACME anvil on %s',
  25. 'forces %s to exit the building through the window',
  26. 'forces %s to watch all the TSD Productions',
  27. 'roundhouse kicks %s',
  28. 'bonks %s',
  29. 'gently caresses %s',
  30. 'falcon punches %s',
  31. 'pulls a Mike Tyson on %s\'s ear',
  32. 'charges up his lazer and fries %s',
  33. 'introduces %s to his fist',
  34. 'boinks %s',
  35. 'immolates %s',
  36. 'throws %s into the fires of Mount Doom',
  37. 'ties %s to the railroad tracks, curls his mustache, and grins evilly',
  38. 'shoryukens %s',
  39. 'goes medieval on %s',
  40. 'spoils the endings to popular fiction for %s',
  41. 'beats %s in Halo 1v1',
  42. 'ruins %s',
  43. 'reks %s',
  44. 'tramples %s under foot',
  45. 'unleashes his wrath upon %s',
  46. 'goes all ninja assassin on %s',
  47. 'beats %s down with the flag and teabags the body',
  48. 'takes %s\'s mother out for a nice dinner and then never calls her back',
  49. 'rockets %s from across the map',
  50. 'telefrags %s',
  51. 'throws a Dorito into %s\'s jugular from the shadows',
  52. 'wub-wubs %s'
  53. ]
  54. bonk_action = random.choice(bonk_actions) % bonkee
  55. return "\001ACTION " + bonk_action
  56. def handle(self, event):
  57. _z = event.msg.split(None, 1)
  58. if len(_z) == 1:
  59. self.printer("PRIVMSG " + event.channel + " :You must specify who you want me to bonk!\n")
  60. return
  61. else:
  62. self.printer("PRIVMSG " + event.channel + " :" + self.get_bonked(_z[1]) + "\001\n")