]> git.aero2k.de Git - urlbot-v3.git/commitdiff
fix aftermath of ff58ead1bc5037d3114457d1d13e8d09223bada6
authorThorsten <mail@aero2k.de>
Sat, 29 Feb 2020 09:35:21 +0000 (10:35 +0100)
committerThorsten <mail@aero2k.de>
Sat, 29 Feb 2020 09:41:28 +0000 (10:41 +0100)
distbot/bot/bot.py
distbot/plugins/debug.py
distbot/plugins/fun.py

index 7c7af7f130c4a87392dfdeb3c426ef640c441b43..72c95116f1acbe5787b9256d7fac3d5845000d78 100644 (file)
@@ -125,13 +125,20 @@ class Bot(sleekxmpp.ClientXMPP):
 
             # simplify the key significantly
             key = shlex.split(re.sub(r'[^a-z0-9 "\']', '', msg["body"].lower()))
+            if not key:
+                # simple dots, smilies, emoji shit, pass through
+                key = shlex.split(msg["body"].lower())
 
             # cut the nick from the message
             offset = 0
             if self.nick.lower() in key[0].lower():
-                key.pop(0)
-                key.insert(0, "nick")
-                offset = len(self.nick) + 1
+                if message[0] == '>':
+                    key.pop(0)
+                    key.insert(0, "quoted_nick")
+                else:
+                    key.pop(0)
+                    key.insert(0, "nick")
+                offset = message.find(self.nick) + len(self.nick) + 1
 
             if msg["type"] == "groupchat":
                 recipient = msg["mucroom"]
index 3158456265032de8c89b679bed92fae3236bd5a5..c4bb3b3bc669ab954faa27326345221c5e607b34 100644 (file)
@@ -19,4 +19,15 @@ class Echo(Worker):
         return Action(msg=message)
 
 
-ALL = [Echo]
+class Parrot(Worker):
+    binding_keys = Worker.CATCH_ALL + ["nick.repeat"]
+    description = "a most handsome parrot bot"
+    usage = "bot: repeat"
+    uses_history = True
+
+    def parse_body(self, msg):
+        if self.history and 'repeat' in self.used_channel:
+            return Action(msg=self.history[-1]["body"])
+
+
+ALL = [Echo, Parrot]
index 75b97ccbb6f28cbd192a7532d1a31127453840b7..bf6fe87d4948d4d260be37c804f81a3516fc1dc3 100644 (file)
@@ -157,7 +157,7 @@ class MentalDeficits(Worker):
 
 
 class Selfreaction(Worker):
-    binding_keys = ["/me.#.{}.#".format(conf_get("bot_nickname"))]
+    binding_keys = ["me.#.{}.#".format(conf_get("bot_nickname"))]
     description = "reacts to being talked about"
 
     me_replys = [