# -*- coding: utf-8 -*- from __future__ import print_function 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): """Called by willie upon loading this plugin.""" pass def shutdown(bot): """Called by willie upon unloading this plugin.""" pass @willie.module.rule(r'(?i)(hi|hallo|moin|morgen|guten morgen|tag|re)[ \t]*$') def ffpb_greeting(bot, trigger): stats = bot.memory['ffpb_stats'] if 'ffpb_stats' in bot.memory else None if stats is None: print("ffpb_greeting: stats is None -> keine Antwort") return greeting = random.choice(( 'Hi {0}, bist du einer der {2} Clients an unseren {1} Knoten?', 'Hey {0}, schön dich zu sehen. Gerade sind übrigens {1} Knoten mit {2} Clients online.', 'Tach {0}, wenn du gerade im Freifunk bist, sind noch {2} andere Clients an {1} Knoten online', 'Na {0}, du hier? Neben dir sind noch {1} Knoten mit {2} Clients da.', '{1} Knoten online, {2} Clients im Netz und {0} gibt uns die Ehre - Herzlich Willkommen :)')) bot.say(greeting.format(trigger.nick, stats["nodes_active"], stats["clients_unique"])) @willie.module.rule(r'(?i)(m(o[l1]|0[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') @willie.module.rule(r'(?i)(alles )?fake[?!]?$') def ffpb_nofake(bot, trigger): msg = random.choice(( u'zweifelt {0}s Glaubwürdigkeit an.', 'glaubt nicht, dass {0} echt ist.', 'fakes ... fakes everywhere, nicht wahr {0}', )) bot.action(msg.format(trigger.nick)) @willie.module.commands('fake') def ffpb_fakecmd(bot, trigger): bot.say('Public Service Announcement: {0} ist ein Fake.'.format(trigger.nick)) @willie.module.rule(r'(?i)!(sudo )?rm -rf (--no-preserve-root )?/') def ffpb_rmrf(bot, trigger): bot.action("liest dann mal sehr schnell " + trigger.nick + "s Mails o.O") @willie.module.rule(r'(?i)!' + COFFEE_RULE) def ffpb_kaffee(bot, trigger): bot.say("Kein sudo, kein Kaffee.") @willie.module.rule(r'(?i)!sudo ' + COFFEE_RULE) def ffpb_sudokaffee(bot, trigger): bot.action("reicht " + trigger.nick + " eine dampfende, aromatisch duftende Tasse Kaffee.") @willie.module.rule(r'(?i).*(teurer|besser|neuer|cooler|geiler|mehr|weniger) wie') def ffpb_grammarnazi_als(bot, trigger): bot.say("*als") @willie.module.rule(r'(?i).*(genauso|genau so) als') def ffpb_grammarnazi_wie(bot, trigger): bot.say("*wie") @willie.module.rule(r'(?i).*als wie') def ffpb_grammarnazi_alswie(bot, trigger): bot.action("denkt spontan an seine Deutschlehrerin") @willie.module.rule(r'(?i).*(digga|boom|digga boom)') def ffpb_digga_boom(bot, trigger): bot.action("feiert nun ganz hart ab auf: https://www.youtube.com/watch?v=3JpNGq8r42Q") @willie.module.rule(r'(?i)gi(ve |m)me the key to your heart') @willie.module.rule(r'(?i)(.+\s)?(ssh[- ]?)?(pub(lic)?[- ]?)?key (vom|des) (status[- ]?)?bots?(\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')