From: Thorsten Date: Sat, 29 Feb 2020 09:35:21 +0000 (+0100) Subject: fix aftermath of ff58ead1bc5037d3114457d1d13e8d09223bada6 X-Git-Url: https://git.aero2k.de/?a=commitdiff_plain;h=6b992e13b649154da86910f4bc343e7064b37fcf;p=urlbot-v3.git fix aftermath of ff58ead1bc5037d3114457d1d13e8d09223bada6 --- diff --git a/distbot/bot/bot.py b/distbot/bot/bot.py index 7c7af7f..72c9511 100644 --- a/distbot/bot/bot.py +++ b/distbot/bot/bot.py @@ -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"] diff --git a/distbot/plugins/debug.py b/distbot/plugins/debug.py index 3158456..c4bb3b3 100644 --- a/distbot/plugins/debug.py +++ b/distbot/plugins/debug.py @@ -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] diff --git a/distbot/plugins/fun.py b/distbot/plugins/fun.py index 75b97cc..bf6fe87 100644 --- a/distbot/plugins/fun.py +++ b/distbot/plugins/fun.py @@ -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 = [