ffpb_fun.py 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. # -*- coding: utf-8 -*-
  2. from __future__ import print_function
  3. import willie
  4. import random
  5. COFFEE_RULE = '(make[_-]me[_-](a[_-])?)?coffee'
  6. LEET_REPLACEMENTS = (
  7. ('hacker', 'haxor'), ('elite', '1337'),
  8. ('l', '1'), ('o', '0'), ('e', '3')
  9. )
  10. def setup(bot):
  11. """Called by willie upon loading this plugin."""
  12. pass
  13. def shutdown(bot):
  14. """Called by willie upon unloading this plugin."""
  15. pass
  16. @willie.module.rule(r'(?i)(hi|hallo|moin|morgen|guten morgen|re)[ \t]*$')
  17. def ffpb_greeting(bot, trigger):
  18. stats = bot.memory['ffpb_stats'] if 'ffpb_stats' in bot.memory else None
  19. if stats is None:
  20. print("ffpb_greeting: stats is None -> keine Antwort")
  21. return
  22. greeting = random.choice((
  23. 'Hi {0}, bist du einer der {2} Clients an unseren {1} Knoten?',
  24. 'Hey {0}, schön dich zu sehen. Gerade sind übrigens {1} Knoten mit {2} Clients online.',
  25. '{1} Knoten online, {2} Clients im Netz und {0} gibt uns die Ehre - Herzlich Willkommen :)'))
  26. bot.say(greeting.format(trigger.nick, stats["nodes_active"], stats["clients_unique"]))
  27. @willie.module.rule(r'(?i)(m(o[l1]|0[il1])n)[ \t!.]*$')
  28. def ffpb_greeting_leet(bot, trigger):
  29. greeting = random.choice((
  30. 'm0in {0}',
  31. '{0}, alter Hax0r!'))
  32. user_leetified = trigger.nick
  33. for old, new in LEET_REPLACEMENTS:
  34. user_leetified = user_leetified.replace(old, new)
  35. bot.say(greeting.format(user_leetified))
  36. @willie.module.rule(r'(o/|\\o)$')
  37. def ffpb_greeting2(bot, trigger):
  38. bot.say('o.O')
  39. @willie.module.rule(r'(?i)(alles )?fake[?!]?$')
  40. def ffpb_nofake(bot, trigger):
  41. msg = random.choice((
  42. u'zweifelt {0}s Glaubwürdigkeit an.',
  43. 'glaubt nicht, dass {0} echt ist.',
  44. ))
  45. bot.action(msg.format(trigger.nick))
  46. @willie.module.commands('fake')
  47. def ffpb_fakecmd(bot, trigger):
  48. bot.say('Public Service Announcement: {0} ist ein Fake.'.format(trigger.nick))
  49. @willie.module.rule(r'(?i)!(sudo )?rm -rf (--no-preserve-root )?/')
  50. def ffpb_rmrf(bot, trigger):
  51. bot.action("liest dann mal sehr schnell " + trigger.nick + "s Mails o.O")
  52. @willie.module.rule(r'(?i)!' + COFFEE_RULE)
  53. def ffpb_kaffee(bot, trigger):
  54. bot.say("Kein sudo, kein Kaffee.")
  55. @willie.module.rule(r'(?i)!sudo ' + COFFEE_RULE)
  56. def ffpb_sudokaffee(bot, trigger):
  57. bot.action("reicht " + trigger.nick + " eine dampfende, aromatisch duftende Tasse Kaffee.")
  58. @willie.module.rule(r'(?i).*(teurer|besser|neuer|cooler|geiler|mehr|weniger) wie')
  59. def ffpb_grammarnazi_als(bot, trigger):
  60. bot.say("*als")
  61. @willie.module.rule(r'(?i).*(genauso|genau so) als')
  62. def ffpb_grammarnazi_wie(bot, trigger):
  63. bot.say("*wie")
  64. @willie.module.rule(r'(?i).*als wie')
  65. def ffpb_grammarnazi_alswie(bot, trigger):
  66. bot.action("denkt spontan an seine Deutschlehrerin")
  67. @willie.module.rule(r'(?i)gi(ve |m)me the key to your heart')
  68. @willie.module.rule(r'(?i)(.+\s)?(ssh[- ]?)?(pub(lic)?[- ]?)?key (vom|des) (status[- ]?)?bots?(\s|\.|\?|$)')
  69. def ffpb_botkey(bot, trigger):
  70. bot.reply('ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDJfsG/myO4y9WzJSP+ixluHFmkIMJJRsvRT8t5h4y/5A7QzovOw1GpCmWJWnZ6GKXilTxb8ycqVfDcFPB2NRkdJUjYL+v4IMriPeBigAjc6FoUZXOS3TOZVhaTlNT4XxXKOYF/Rpgscv5f0iu1SG0Tp4mb2TX04pZjbnLNBABbjn592abEuMG5bH/g9odi50S0MoU/qCH9AZvkoc8vGu+flOBrKfFi+7g2GxF/w66mMvCJfK27QFSPOiFV3CT6ZfSZM138OCdC1SOi89X9+oCEQ3LB9A+bJgyYnxqp8eVpRPui6K9sPkax71tMimRJA5Xgdvqt9HpcgtNYxKJ4gYMR ffpb-statusbot')