ffpb_fun.py 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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|tag|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. 'Tach {0}, wenn du gerade im Freifunk bist, sind noch {2} andere Clients an {1} Knoten online',
  26. 'Na {0}, du hier? Neben dir sind noch {1} Knoten mit {2} Clients da.',
  27. '{1} Knoten online, {2} Clients im Netz und {0} gibt uns die Ehre - Herzlich Willkommen :)'))
  28. bot.say(greeting.format(trigger.nick, stats["nodes_active"], stats["clients_unique"]))
  29. @willie.module.rule(r'(?i)(m(o[l1]|0[il1])n)[ \t!.]*$')
  30. def ffpb_greeting_leet(bot, trigger):
  31. greeting = random.choice((
  32. 'm0in {0}',
  33. '{0}, alter Hax0r!'))
  34. user_leetified = trigger.nick
  35. for old, new in LEET_REPLACEMENTS:
  36. user_leetified = user_leetified.replace(old, new)
  37. bot.say(greeting.format(user_leetified))
  38. @willie.module.rule(r'(o/|\\o)$')
  39. def ffpb_greeting2(bot, trigger):
  40. bot.say('o.O')
  41. @willie.module.rule(r'(?i)(alles )?fake[?!]?$')
  42. def ffpb_nofake(bot, trigger):
  43. msg = random.choice((
  44. u'zweifelt {0}s Glaubwürdigkeit an.',
  45. 'glaubt nicht, dass {0} echt ist.',
  46. 'fakes ... fakes everywhere, nicht wahr {0}',
  47. ))
  48. bot.action(msg.format(trigger.nick))
  49. @willie.module.commands('fake')
  50. def ffpb_fakecmd(bot, trigger):
  51. bot.say('Public Service Announcement: {0} ist ein Fake.'.format(trigger.nick))
  52. @willie.module.rule(r'(?i)!(sudo )?rm -rf (--no-preserve-root )?/')
  53. def ffpb_rmrf(bot, trigger):
  54. bot.action("liest dann mal sehr schnell " + trigger.nick + "s Mails o.O")
  55. @willie.module.rule(r'(?i)!' + COFFEE_RULE)
  56. def ffpb_kaffee(bot, trigger):
  57. bot.say("Kein sudo, kein Kaffee.")
  58. @willie.module.rule(r'(?i)!sudo ' + COFFEE_RULE)
  59. def ffpb_sudokaffee(bot, trigger):
  60. bot.action("reicht " + trigger.nick + " eine dampfende, aromatisch duftende Tasse Kaffee.")
  61. @willie.module.rule(r'(?i).*(teurer|besser|neuer|cooler|geiler|mehr|weniger) wie')
  62. def ffpb_grammarnazi_als(bot, trigger):
  63. bot.say("*als")
  64. @willie.module.rule(r'(?i).*(genauso|genau so) als')
  65. def ffpb_grammarnazi_wie(bot, trigger):
  66. bot.say("*wie")
  67. @willie.module.rule(r'(?i).*als wie')
  68. def ffpb_grammarnazi_alswie(bot, trigger):
  69. bot.action("denkt spontan an seine Deutschlehrerin")
  70. @willie.module.rule(r'(?i).*(digga|boom|digga boom)')
  71. def ffpb_digga_boom(bot, trigger):
  72. bot.action("feiert nun ganz hart ab auf: https://www.youtube.com/watch?v=3JpNGq8r42Q")
  73. @willie.module.rule(r'(?i)gi(ve |m)me the key to your heart')
  74. @willie.module.rule(r'(?i)(.+\s)?(ssh[- ]?)?(pub(lic)?[- ]?)?key (vom|des) (status[- ]?)?bots?(\s|\.|\?|$)')
  75. def ffpb_botkey(bot, trigger):
  76. bot.reply('ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDJfsG/myO4y9WzJSP+ixluHFmkIMJJRsvRT8t5h4y/5A7QzovOw1GpCmWJWnZ6GKXilTxb8ycqVfDcFPB2NRkdJUjYL+v4IMriPeBigAjc6FoUZXOS3TOZVhaTlNT4XxXKOYF/Rpgscv5f0iu1SG0Tp4mb2TX04pZjbnLNBABbjn592abEuMG5bH/g9odi50S0MoU/qCH9AZvkoc8vGu+flOBrKfFi+7g2GxF/w66mMvCJfK27QFSPOiFV3CT6ZfSZM138OCdC1SOi89X9+oCEQ3LB9A+bJgyYnxqp8eVpRPui6K9sPkax71tMimRJA5Xgdvqt9HpcgtNYxKJ4gYMR ffpb-statusbot')