Browse Source

ffpb_fun: detect deviations of existing rules

leet-speek "moin" and question for bot key
Helge Jung 9 years ago
parent
commit
860a0d00a0
1 changed files with 16 additions and 0 deletions
  1. 16 0
      modules/ffpb_fun.py

+ 16 - 0
modules/ffpb_fun.py

@@ -5,6 +5,10 @@ import willie
 import random
 
 COFFEE_RULE = '(make[_-]me[_-](a[_-])?)?coffee'
+LEET_REPLACEMENTS = (
+    ('hacker', 'haxor'), ('elite', '1337'),
+    ('l', '1'), ('o', '0'), ('e', '3')
+)
 
 
 def setup(bot):
@@ -34,6 +38,17 @@ def ffpb_greeting(bot, trigger):
     bot.say(greeting.format(trigger.nick, stats["nodes_active"], stats["clients_unique"]))
 
 
+@willie.module.rule(r'(?i)(m([o0]|\(\))[il1]n)[ \t!.]*$')
+def ffpb_greeting_leet(bot, trigger):
+    greeting = random.choice((
+        'm0in {0}',
+        '{0}, alter Hax0r!'))
+    user_leetified = trigger.nick
+    for old, new in LEET_REPLACEMENTS:
+        user_leetified = user_leetified.replace(old, new)
+    bot.say(greeting.format(user_leetified))
+
+
 @willie.module.rule(r'(o/|\\o)$')
 def ffpb_greeting2(bot, trigger):
     bot.say('o.O')
@@ -84,5 +99,6 @@ def ffpb_grammarnazi_alswie(bot, trigger):
 
 
 @willie.module.rule(r'(?i)gi(ve |m)me the key to your heart')
+@willie.module.rule(r'(?i)(.+\s)?(ssh[- ]?)?key (vom|des) (status[- ]?)?bot(\s|\.|\?|$)')
 def ffpb_botkey(bot, trigger):
     bot.reply('ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDJfsG/myO4y9WzJSP+ixluHFmkIMJJRsvRT8t5h4y/5A7QzovOw1GpCmWJWnZ6GKXilTxb8ycqVfDcFPB2NRkdJUjYL+v4IMriPeBigAjc6FoUZXOS3TOZVhaTlNT4XxXKOYF/Rpgscv5f0iu1SG0Tp4mb2TX04pZjbnLNBABbjn592abEuMG5bH/g9odi50S0MoU/qCH9AZvkoc8vGu+flOBrKfFi+7g2GxF/w66mMvCJfK27QFSPOiFV3CT6ZfSZM138OCdC1SOi89X9+oCEQ3LB9A+bJgyYnxqp8eVpRPui6K9sPkax71tMimRJA5Xgdvqt9HpcgtNYxKJ4gYMR ffpb-statusbot')