]> git.aero2k.de Git - urlbot-v3.git/commitdiff
hug people
authorThorsten <mail@aero2k.de>
Fri, 28 Feb 2020 15:55:35 +0000 (16:55 +0100)
committerThorsten <mail@aero2k.de>
Fri, 28 Feb 2020 15:55:35 +0000 (16:55 +0100)
distbot/plugins/fun.py

index fedea95080242ebfbf56543cc62a629ec2a8abe7..75b97ccbb6f28cbd192a7532d1a31127453840b7 100644 (file)
@@ -66,6 +66,19 @@ class Slap(Worker):
         return Action(msg='/me slaps {}'.format(slapped))
 
 
+class Hug(Worker):
+    binding_keys = ["nick.hug.#"]
+    description = "hugs people"
+
+    def parse_body(self, msg):
+        sender = get_nick_from_message(msg)
+        if len(self.used_channel) > 2:
+            slapped = " ".join(self.used_channel[2:])
+        else:
+            slapped = sender
+        return Action(msg='/me hugs {}'.format(slapped))
+
+
 class Consumables(Worker):
     description = "Om nom nom"
     usage = "bot: cake/coffee/kaffee/keks/schnitzel/frühstück [please]"
@@ -171,4 +184,4 @@ class Doctor(Worker):
         return Action(msg="ELIMINATE! ELIMINATE!")
 
 
-ALL = [Klammer, Terminate, Unicode, Slap, Consumables, MentalDeficits, Selfreaction, Doctor]
+ALL = [Klammer, Terminate, Unicode, Hug, Slap, Consumables, MentalDeficits, Selfreaction, Doctor]