# 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"]
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]
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 = [